hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ce6d51848f6288ffcb33df08d22282eed002396d | 3,084 | hpp | C++ | src/applications/utilities/postProcessing/dataConversion/caelusToVTK/readFields_vtk.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | src/applications/utilities/postProcessing/dataConversion/caelusToVTK/readFields_vtk.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | src/applications/utilities/postProcessing/dataConversion/caelusToVTK/readFields_vtk.hpp | MrAwesomeRocks/caelus-cml | 55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7 | [
"mpich2"
] | null | null | null | /*---------------------------------------------------------------------------*\
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of CAELUS.
CAELUS is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CAELUS 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 CAELUS. If not, see <http://www.gnu.org/licenses/>.
InClass
CML::readFields
Description
SourceFiles
readFields.cpp
\*---------------------------------------------------------------------------*/
#ifndef readFields_H
#define readFields_H
#include "fvMesh.hpp"
#include "PtrList.hpp"
#include "IOobjectList.hpp"
#include "HashSet.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace CML
{
// Read the fields and optionally subset and put on the pointer list
template<class GeoField>
void readFields
(
const vtkMesh& vMesh,
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const HashSet<word>& selectedFields,
PtrList<GeoField>& fields
);
} // End namespace CML
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "IOobjectList.hpp"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace CML
{
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class GeoField>
void readFields
(
const vtkMesh& vMesh,
const typename GeoField::Mesh& mesh,
const IOobjectList& objects,
const HashSet<word>& selectedFields,
PtrList<GeoField>& fields
)
{
// Search list of objects for volScalarFields
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
// Construct the vol scalar fields
fields.setSize(fieldObjects.size());
label nFields = 0;
forAllIter(IOobjectList, fieldObjects, iter)
{
if (selectedFields.empty() || selectedFields.found(iter()->name()))
{
fields.set
(
nFields,
vMesh.interpolate
(
GeoField
(
*iter(),
mesh
)
)
);
nFields++;
}
}
fields.setSize(nFields);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace CML
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| 26.358974 | 79 | 0.480545 | [
"mesh"
] |
ce7097008cff574ebb8046984b38bfe921a205e9 | 671 | cpp | C++ | ALGORITHMS/Two Pointer/905. SortArrayByParity-1.cpp | compl3xX/ROAD-TO-DSA | 2261c112135a51d9d88c4b57e6f062f6b32550a7 | [
"MIT"
] | null | null | null | ALGORITHMS/Two Pointer/905. SortArrayByParity-1.cpp | compl3xX/ROAD-TO-DSA | 2261c112135a51d9d88c4b57e6f062f6b32550a7 | [
"MIT"
] | null | null | null | ALGORITHMS/Two Pointer/905. SortArrayByParity-1.cpp | compl3xX/ROAD-TO-DSA | 2261c112135a51d9d88c4b57e6f062f6b32550a7 | [
"MIT"
] | null | null | null | class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
vector<int>ans;
sort(nums.begin(),nums.end());
int s=0;
int e=nums.size()-1;
while(s<e)
{
if(nums[s]%2!=0&&nums[e]%2==0)
{
swap(nums[s],nums[e]);
s++;
e--;
}
else if(nums[s]%2!=0&&nums[e]%2!=0)
{
e--;
}
else if(nums[s]%2==0&&nums[e]%2!=0)
{
s++;
}
else
{
s++;
}
}
return nums;
}
};
| 20.96875 | 54 | 0.304024 | [
"vector"
] |
ce7122e64da6c8137a1ab52abd494c47492630c0 | 645 | cxx | C++ | source/SemiSupervisedSegmentationPropagation/SegmentationPropagation-3D.cxx | tschuls/ETH-SegReg-DLL | 34bd10464dc5e8b3c7bf3371ca1e190d692385b7 | [
"BSD-2-Clause-FreeBSD"
] | 15 | 2015-04-15T06:49:06.000Z | 2021-09-01T09:09:50.000Z | source/SemiSupervisedSegmentationPropagation/SegmentationPropagation-3D.cxx | tschuls/ETH-SegReg-DLL | 34bd10464dc5e8b3c7bf3371ca1e190d692385b7 | [
"BSD-2-Clause-FreeBSD"
] | 14 | 2015-03-09T19:09:47.000Z | 2015-09-04T15:31:12.000Z | source/SemiSupervisedSegmentationPropagation/SegmentationPropagation-3D.cxx | tschuls/ETH-SegReg-DLL | 34bd10464dc5e8b3c7bf3371ca1e190d692385b7 | [
"BSD-2-Clause-FreeBSD"
] | 10 | 2015-04-08T09:17:44.000Z | 2017-08-12T17:30:15.000Z | /**
* @file SegmentationPropagation-3D.cxx
* @author Tobias Gass <tobiasgass@gmail.com>
* @date Thu Mar 12 14:30:35 2015
*
* @brief 2D semi-supervised segmentation propagation
*
*
*/
#include <stdio.h>
#include <iostream>
//#include "Segmentation-Propagation.h"
//#include "Segmentation-Propagation-Modular.h"
#include "Segmentation-Propagation-efficient1Hop.h"
using namespace SSSP;
int main(int argc, char ** argv)
{
typedef short int PixelType;
const unsigned int D=3;
typedef itk::Image<PixelType,D> ImageType;
SegmentationPropagationModular<ImageType,33> net;
net.run(argc,argv);
return 1;
}
| 19.545455 | 54 | 0.703876 | [
"3d"
] |
ce7831dbaef6ed561a169c39241fdbb514d7f65c | 1,156 | cpp | C++ | mesh/segment.cpp | ianabel/mfem | d8c0e3a1914719a4e67a9f1b02ae4c6b5d9e7f0b | [
"BSD-3-Clause"
] | null | null | null | mesh/segment.cpp | ianabel/mfem | d8c0e3a1914719a4e67a9f1b02ae4c6b5d9e7f0b | [
"BSD-3-Clause"
] | null | null | null | mesh/segment.cpp | ianabel/mfem | d8c0e3a1914719a4e67a9f1b02ae4c6b5d9e7f0b | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2010-2020, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
#include "mesh_headers.hpp"
namespace mfem
{
Segment::Segment( const int *ind, int attr ) : Element(Geometry::SEGMENT)
{
attribute = attr;
for (int i=0; i<2; i++)
{
indices[i] = ind[i];
}
}
Segment::Segment( int ind1, int ind2, int attr ) : Element(Geometry::SEGMENT)
{
attribute = attr;
indices[0] = ind1;
indices[1] = ind2;
}
void Segment::SetVertices(const int *ind)
{
indices[0] = ind[0];
indices[1] = ind[1];
}
void Segment::GetVertices( Array<int> &v ) const
{
v.SetSize( 2 );
for (int i=0; i<2; i++)
{
v[i] = indices[i];
}
}
Linear1DFiniteElement SegmentFE;
}
| 22.230769 | 80 | 0.668685 | [
"geometry"
] |
ce7880c8922ddb445fb693d861b86b52f854f6e8 | 8,517 | cpp | C++ | src/cascadia/TerminalSettingsModel/IconPathConverter.cpp | UnrealApex/terminal | 3866771b1b66030b71cfa845a6ff4c8dc0dd9397 | [
"MIT"
] | null | null | null | src/cascadia/TerminalSettingsModel/IconPathConverter.cpp | UnrealApex/terminal | 3866771b1b66030b71cfa845a6ff4c8dc0dd9397 | [
"MIT"
] | 1 | 2020-03-27T03:58:55.000Z | 2020-03-27T03:58:55.000Z | src/cascadia/TerminalSettingsModel/IconPathConverter.cpp | UnrealApex/terminal | 3866771b1b66030b71cfa845a6ff4c8dc0dd9397 | [
"MIT"
] | null | null | null | #include "pch.h"
#include "IconPathConverter.h"
#include "IconPathConverter.g.cpp"
#include "Utils.h"
using namespace winrt::Windows;
using namespace winrt::Windows::UI::Xaml;
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
// These are templates that help us figure out which BitmapIconSource/FontIconSource to use for a given IconSource.
// We have to do this because some of our code still wants to use WUX/MUX IconSources.
#pragma region BitmapIconSource
template<typename TIconSource>
struct BitmapIconSource
{
};
template<>
struct BitmapIconSource<winrt::Microsoft::UI::Xaml::Controls::IconSource>
{
using type = winrt::Microsoft::UI::Xaml::Controls::BitmapIconSource;
};
template<>
struct BitmapIconSource<winrt::Windows::UI::Xaml::Controls::IconSource>
{
using type = winrt::Windows::UI::Xaml::Controls::BitmapIconSource;
};
#pragma endregion
#pragma region FontIconSource
template<typename TIconSource>
struct FontIconSource
{
};
template<>
struct FontIconSource<winrt::Microsoft::UI::Xaml::Controls::IconSource>
{
using type = winrt::Microsoft::UI::Xaml::Controls::FontIconSource;
};
template<>
struct FontIconSource<winrt::Windows::UI::Xaml::Controls::IconSource>
{
using type = winrt::Windows::UI::Xaml::Controls::FontIconSource;
};
#pragma endregion
// Method Description:
// - Creates an IconSource for the given path. The icon returned is a colored
// icon. If we couldn't create the icon for any reason, we return an empty
// IconElement.
// Template Types:
// - <TIconSource>: The type of IconSource (MUX, WUX) to generate.
// Arguments:
// - path: the full, expanded path to the icon.
// Return Value:
// - An IconElement with its IconSource set, if possible.
template<typename TIconSource>
TIconSource _getColoredBitmapIcon(const winrt::hstring& path)
{
if (!path.empty())
{
try
{
winrt::Windows::Foundation::Uri iconUri{ path };
BitmapIconSource<TIconSource>::type iconSource;
// Make sure to set this to false, so we keep the RGB data of the
// image. Otherwise, the icon will be white for all the
// non-transparent pixels in the image.
iconSource.ShowAsMonochrome(false);
iconSource.UriSource(iconUri);
return iconSource;
}
CATCH_LOG();
}
return nullptr;
}
// Method Description:
// - Creates an IconSource for the given path.
// * If the icon is a path to an image, we'll use that.
// * If it isn't, then we'll try and use the text as a FontIcon. If the
// character is in the range of symbols reserved for the Segoe MDL2
// Asserts, well treat it as such. Otherwise, we'll default to a Sego
// UI icon, so things like emoji will work.
// * If we couldn't create the icon for any reason, we return an empty
// IconElement.
// Template Types:
// - <TIconSource>: The type of IconSource (MUX, WUX) to generate.
// Arguments:
// - path: the unprocessed path to the icon.
// Return Value:
// - An IconElement with its IconSource set, if possible.
template<typename TIconSource>
TIconSource _getIconSource(const winrt::hstring& iconPath)
{
TIconSource iconSource{ nullptr };
if (iconPath.size() != 0)
{
const auto expandedIconPath{ _expandIconPath(iconPath) };
iconSource = _getColoredBitmapIcon<TIconSource>(expandedIconPath);
// If we fail to set the icon source using the "icon" as a path,
// let's try it as a symbol/emoji.
//
// Anything longer than 2 wchar_t's _isn't_ an emoji or symbol, so
// don't do this if it's just an invalid path.
if (!iconSource && iconPath.size() <= 2)
{
try
{
FontIconSource<TIconSource>::type icon;
const wchar_t ch = iconPath[0];
// The range of MDL2 Icons isn't explicitly defined, but
// we're using this based off the table on:
// https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font
const bool isMDL2Icon = ch >= L'\uE700' && ch <= L'\uF8FF';
if (isMDL2Icon)
{
icon.FontFamily(winrt::Windows::UI::Xaml::Media::FontFamily{ L"Segoe MDL2 Assets" });
}
else
{
// Note: you _do_ need to manually set the font here.
icon.FontFamily(winrt::Windows::UI::Xaml::Media::FontFamily{ L"Segoe UI" });
}
icon.Glyph(iconPath);
iconSource = icon;
}
CATCH_LOG();
}
}
if (!iconSource)
{
// Set the default IconSource to a BitmapIconSource with a null source
// (instead of just nullptr) because there's a really weird crash when swapping
// data bound IconSourceElements in a ListViewTemplate (i.e. CommandPalette).
// Swapping between nullptr IconSources and non-null IconSources causes a crash
// to occur, but swapping between IconSources with a null source and non-null IconSources
// work perfectly fine :shrug:.
BitmapIconSource<TIconSource>::type icon;
icon.UriSource(nullptr);
iconSource = icon;
}
return iconSource;
}
static winrt::hstring _expandIconPath(hstring iconPath)
{
if (iconPath.empty())
{
return iconPath;
}
winrt::hstring envExpandedPath{ wil::ExpandEnvironmentStringsW<std::wstring>(iconPath.c_str()) };
return envExpandedPath;
}
// Method Description:
// - Attempt to convert something into another type. For the
// IconPathConverter, we support a variety of icons:
// * If the icon is a path to an image, we'll use that.
// * If it isn't, then we'll try and use the text as a FontIcon. If the
// character is in the range of symbols reserved for the Segoe MDL2
// Asserts, well treat it as such. Otherwise, we'll default to a Sego
// UI icon, so things like emoji will work.
// - MUST BE CALLED ON THE UI THREAD.
// Arguments:
// - value: the input object to attempt to convert into an IconSource.
// Return Value:
// - Visible if the object was a string and wasn't the empty string.
Foundation::IInspectable IconPathConverter::Convert(Foundation::IInspectable const& value,
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
Foundation::IInspectable const& /* parameter */,
hstring const& /* language */)
{
const auto& iconPath = winrt::unbox_value_or<winrt::hstring>(value, L"");
return _getIconSource<Controls::IconSource>(iconPath);
}
// unused for one-way bindings
Foundation::IInspectable IconPathConverter::ConvertBack(Foundation::IInspectable const& /* value */,
Windows::UI::Xaml::Interop::TypeName const& /* targetType */,
Foundation::IInspectable const& /* parameter */,
hstring const& /* language */)
{
throw hresult_not_implemented();
}
Windows::UI::Xaml::Controls::IconSource IconPathConverter::IconSourceWUX(hstring path)
{
return _getIconSource<Windows::UI::Xaml::Controls::IconSource>(path);
}
Microsoft::UI::Xaml::Controls::IconSource IconPathConverter::IconSourceMUX(hstring path)
{
return _getIconSource<Microsoft::UI::Xaml::Controls::IconSource>(path);
}
}
| 41.144928 | 122 | 0.571093 | [
"object",
"model"
] |
706ac51fd69470aaf9214a302c21401f5cb72ebc | 5,001 | cpp | C++ | build-qgetic-Desktop-Debug/moc_geticmainwnd.cpp | circinusX1/qgetic | 112e20af4e940eae44af9cbf51362f362a743329 | [
"BSD-4-Clause"
] | null | null | null | build-qgetic-Desktop-Debug/moc_geticmainwnd.cpp | circinusX1/qgetic | 112e20af4e940eae44af9cbf51362f362a743329 | [
"BSD-4-Clause"
] | null | null | null | build-qgetic-Desktop-Debug/moc_geticmainwnd.cpp | circinusX1/qgetic | 112e20af4e940eae44af9cbf51362f362a743329 | [
"BSD-4-Clause"
] | null | null | null | /****************************************************************************
** Meta object code from reading C++ file 'geticmainwnd.h'
**
** Created by: The Qt Meta Object Compiler version 63 (Qt 4.8.6)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../getic/geticmainwnd.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'geticmainwnd.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 63
#error "This file was generated using the moc from 4.8.6. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_GeticMainWnd[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
16, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: signature, parameters, type, tag, flags
18, 14, 13, 13, 0x0a,
48, 13, 13, 13, 0x08,
82, 13, 13, 13, 0x08,
116, 13, 13, 13, 0x08,
150, 13, 13, 13, 0x08,
186, 13, 13, 13, 0x08,
222, 13, 13, 13, 0x08,
255, 13, 13, 13, 0x08,
289, 13, 13, 13, 0x08,
324, 13, 13, 13, 0x08,
359, 13, 13, 13, 0x08,
386, 13, 13, 13, 0x08,
419, 13, 13, 13, 0x08,
456, 13, 13, 13, 0x08,
488, 13, 13, 13, 0x08,
522, 13, 13, 13, 0x08,
0 // eod
};
static const char qt_meta_stringdata_GeticMainWnd[] = {
"GeticMainWnd\0\0m,,\0onUpdate(int32_t,void*,void*)\0"
"on_action_New_tCtrl_N_triggered()\0"
"on_action_Open_Ctrl_0_triggered()\0"
"on_action_Save_Ctrl_S_triggered()\0"
"on_actionSave_As_Ctrl_A_triggered()\0"
"on_action_Export_Ctrl_E_triggered()\0"
"on_actionMove_Ctrl_M_triggered()\0"
"on_actionScale_Ctrl_L_triggered()\0"
"on_actionVertex_Ctrl_T_triggered()\0"
"on_actionRotate_Ctrl_R_triggered()\0"
"on_actionBRUSH_triggered()\0"
"on_actionCone_Ctrl_N_triggered()\0"
"on_actionCylinder_Ctrl_Y_triggered()\0"
"on_actionBox_Ctrl_O_triggered()\0"
"on_actionBrush_Ctrl_B_triggered()\0"
"on_actionSlide_Ctrl_S_triggered()\0"
};
void GeticMainWnd::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
Q_ASSERT(staticMetaObject.cast(_o));
GeticMainWnd *_t = static_cast<GeticMainWnd *>(_o);
switch (_id) {
case 0: _t->onUpdate((*reinterpret_cast< int32_t(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< void*(*)>(_a[3]))); break;
case 1: _t->on_action_New_tCtrl_N_triggered(); break;
case 2: _t->on_action_Open_Ctrl_0_triggered(); break;
case 3: _t->on_action_Save_Ctrl_S_triggered(); break;
case 4: _t->on_actionSave_As_Ctrl_A_triggered(); break;
case 5: _t->on_action_Export_Ctrl_E_triggered(); break;
case 6: _t->on_actionMove_Ctrl_M_triggered(); break;
case 7: _t->on_actionScale_Ctrl_L_triggered(); break;
case 8: _t->on_actionVertex_Ctrl_T_triggered(); break;
case 9: _t->on_actionRotate_Ctrl_R_triggered(); break;
case 10: _t->on_actionBRUSH_triggered(); break;
case 11: _t->on_actionCone_Ctrl_N_triggered(); break;
case 12: _t->on_actionCylinder_Ctrl_Y_triggered(); break;
case 13: _t->on_actionBox_Ctrl_O_triggered(); break;
case 14: _t->on_actionBrush_Ctrl_B_triggered(); break;
case 15: _t->on_actionSlide_Ctrl_S_triggered(); break;
default: ;
}
}
}
const QMetaObjectExtraData GeticMainWnd::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject GeticMainWnd::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_GeticMainWnd,
qt_meta_data_GeticMainWnd, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &GeticMainWnd::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *GeticMainWnd::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *GeticMainWnd::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_GeticMainWnd))
return static_cast<void*>(const_cast< GeticMainWnd*>(this));
return QMainWindow::qt_metacast(_clname);
}
int GeticMainWnd::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 16)
qt_static_metacall(this, _c, _id, _a);
_id -= 16;
}
return _id;
}
QT_END_MOC_NAMESPACE
| 36.23913 | 153 | 0.629874 | [
"object"
] |
7074076a1adb9a06fc5f70d7c8ea411be2b3a2c8 | 12,871 | hpp | C++ | src/mods/mod_message_base_editor.hpp | BadOPCode/Oblivion2-XRM | d65d9aa4b8021fc3b50b2c09edd0b19eb7baa1b9 | [
"Zlib"
] | 78 | 2015-10-08T07:14:37.000Z | 2022-02-10T04:51:21.000Z | src/mods/mod_message_base_editor.hpp | BadOPCode/Oblivion2-XRM | d65d9aa4b8021fc3b50b2c09edd0b19eb7baa1b9 | [
"Zlib"
] | 117 | 2015-12-14T16:51:42.000Z | 2020-02-16T07:00:36.000Z | src/mods/mod_message_base_editor.hpp | BadOPCode/Oblivion2-XRM | d65d9aa4b8021fc3b50b2c09edd0b19eb7baa1b9 | [
"Zlib"
] | 10 | 2015-12-10T16:54:24.000Z | 2022-02-10T04:51:29.000Z | #ifndef MOD_MESSAGE_BASE_EDITOR_HPP
#define MOD_MESSAGE_BASE_EDITOR_HPP
#include "mod_base.hpp"
#include <string>
#include <memory>
#include <functional>
#include <vector>
class AccessLevel;
typedef std::shared_ptr<AccessLevel> access_level_ptr;
class SessionData;
typedef std::shared_ptr<SessionData> session_data_ptr;
class Directory;
typedef std::shared_ptr<Directory> directory_ptr;
/**
* @class ModLevelEditor
* @author Michael Griffin
* @date 15/08/2018
* @file mod_level_editor.hpp
* @brief Level Editor
*/
class ModMessageBaseEditor
: public ModBase
{
public:
ModMessageBaseEditor(session_data_ptr session_data, config_ptr config, ansi_process_ptr ansi_process)
: ModBase(session_data, config, ansi_process)
, m_session_io(session_data)
, m_filename("mod_message_base_editor.yaml")
, m_text_prompts_dao(new TextPromptsDao(GLOBAL_DATA_PATH, m_filename))
, m_mod_setup_index(MOD_DISPLAY_MENU)
, m_mod_function_index(MOD_MENU_INPUT)
, m_mod_menu_state_index(MENU_ADD)
, m_mod_toggle_view_index(VIEW_DEFAULT)
, m_max_toggled_view_index(VIEW_PULLDOWN)
, m_is_text_prompt_exist(false)
, m_page(0)
, m_rows_per_page(0)
, m_current_menu("")
, m_current_option(0)
, m_current_field(0)
{
// Setup Modules
m_setup_functions.push_back(std::bind(&ModMessageBaseEditor::setupMenuEditor, this));
m_setup_functions.push_back(std::bind(&ModMessageBaseEditor::setupMenuEditFields, this));
// Input or Method Modules that handle incoming input per state.
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorInput, this, std::placeholders::_1));
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorPausedInput, this, std::placeholders::_1));
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorMenuNameInput, this, std::placeholders::_1));
// Menu Field Input Commands
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorMenuFieldInput, this, std::placeholders::_1));
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorMenuFieldHandler, this, std::placeholders::_1));
// Display Pause, waits for a key, then returns (Used in View Generic Menu)
m_mod_functions.push_back(std::bind(&ModMessageBaseEditor::menuEditorDisplayPause, this, std::placeholders::_1));
// Check of the Text Prompts exist.
m_is_text_prompt_exist = m_text_prompts_dao->fileExists();
if (!m_is_text_prompt_exist)
{
createTextPrompts();
}
// Loads all Text Prompts for current module
m_text_prompts_dao->readPrompts();
}
virtual ~ModMessageBaseEditor() override
{
std::vector<std::function< void()> >().swap(m_setup_functions);
std::vector<std::function< void(const std::string &)> >().swap(m_mod_functions);
std::vector<access_level_ptr>().swap(m_loaded_level);
}
virtual bool update(const std::string &character_buffer, const bool &) override;
virtual bool onEnter() override;
virtual bool onExit() override;
// Setup Module Index
enum
{
MOD_DISPLAY_MENU = 0,
MOD_DISPLAY_MENU_EDIT = 1
};
// Input Module Index
enum
{
MOD_MENU_INPUT = 0, // Menu Parser
MOD_PAUSE = 1, // Pauses on display of menus/options
MOD_MENU_NAME = 2, // Menu Name Handler
MOD_MENU_FIELD_INPUT = 3, // Menu Field Parser
MOD_MENU_FIELD = 4 // Menu Field Handler
};
// Input Menu State Index
// Used for both Menus and Options.
enum
{
MENU_ADD = 0,
MENU_CHANGE = 1,
MENU_DELETE = 2
};
// Menu Option Toggled View State
// Lets so switch the views to see other command information.
enum
{
VIEW_DEFAULT = 0,
VIEW_NAMES = 1,
VIEW_STRINGS = 2,
VIEW_PULLDOWN = 3
};
// Create Prompt Constants, these are the keys for key/value lookup
const std::string PROMPT_HEADER = "level_header";
const std::string PROMPT_LEVEL_EDIT_HEADER = "level_field_edit_header";
const std::string PROMPT_PAUSE = "pause_prompt";
const std::string PROMPT_INPUT_TEXT = "level_input_text";
const std::string PROMPT_OPTION_INPUT_TEXT = "option_input_text";
const std::string PROMPT_INVALID = "invalid_input";
const std::string PROMPT_LEVEL_ADD = "level_add";
const std::string PROMPT_LEVEL_DELETE = "level_delete";
const std::string PROMPT_LEVEL_CHANGE = "level_edit";
const std::string PROMPT_INVALID_LEVEL_EXISTS = "invalid_level_exists";
const std::string PROMPT_INVALID_LEVEL_NOT_EXISTS = "invalid_level_doesnt_exist";
// Menu Field Edit Prompts
const std::string PROMPT_LEVEL_FIELD_INPUT_TEXT = "level_field_input_text";
const std::string PROMPT_LEVEL_FIELD_TITLE = "level_field_title";
const std::string PROMPT_LEVEL_FIELD_PASSWORD = "level_field_password";
const std::string PROMPT_LEVEL_FIELD_FALLBACK = "level_field_fallback";
const std::string PROMPT_LEVEL_FIELD_HELP_ID = "level_field_help_id";
const std::string PROMPT_LEVEL_FIELD_NAME = "level_field_name";
const std::string PROMPT_LEVEL_FIELD_PULLDOWN = "level_field_pulldown";
// Menu Field Display for screen
const std::string DISPLAY_LEVEL_FIELDS_VERSION_ID = "display_menu_field_version_id";
const std::string DISPLAY_LEVEL_FIELDS_BORDER_ROW_COLOR = "display_menu_field_row_color";
const std::string DISPLAY_LEVEL_FIELDS_TITLE = "display_menu_field_title";
const std::string DISPLAY_LEVEL_FIELDS_PASSWORD = "display_menu_field_passoword";
const std::string DISPLAY_LEVEL_FIELDS_FALLBACK = "display_menu_field_fallback";
const std::string DISPLAY_LEVEL_FIELDS_HELP_ID = "display_menu_field_help_id";
const std::string DISPLAY_LEVEL_FIELDS_NAME = "display_menu_field_name";
const std::string DISPLAY_LEVEL_FIELDS_PULLDOWN_FILE = "display_menu_field_pulldown_file";
const std::string DISPLAY_LEVEL_FIELDS_VIEW_GENERIC = "display_menu_field_view_generic";
const std::string DISPLAY_LEVEL_FIELDS_EDIT_OPTIONS = "display_menu_field_edit_options";
const std::string DISPLAY_LEVEL_FIELDS_QUIT_SAVE = "display_menu_field_save";
const std::string DISPLAY_LEVEL_FIELDS_QUIT_ABORT = "display_menu_field_abort";
/**
* @brief Create Default Text Prompts for module
* @return
*/
void createTextPrompts();
/**
* @brief Sets an individual input module index.
* @param mod_function_index
*/
void changeInputModule(int mod_function_index);
/**
* @brief Sets an individual setup method module index.
* @param mod_function_index
*/
void changeSetupModule(int mod_function_index);
/**
* @brief Sets an individual Menu Input State Add/Change/Delete
* @param mod_menu_state_index
*/
void changeMenuInputState(int mod_menu_state_index);
/**
* @brief Redisplay's the current module prompt.
* @return
*/
void redisplayModulePrompt();
/**
* @brief Pull and Display Prompts
* @param prompt
*/
void displayPrompt(const std::string &prompt);
/**
* @brief Pull and parse and return Display Prompts for use in interfaces
* @param prompt
*/
std::string getDisplayPrompt(const std::string &prompt);
/**
* @brief Pull and parse and return Display Prompts for use in interfaces
* @param prompt
*/
std::string getDisplayPromptRaw(const std::string &prompt);
/**
* @brief Pull and Display Prompts with MCI Code
* @param prompt
* @param mci_field
*/
void displayPromptMCI(const std::string &prompt, const std::string &mci_field);
/**
* @brief Pull and Display Prompts with following newline
* @param prompt
*/
void displayPromptAndNewLine(const std::string &prompt);
/**
* @brief Validates user Logon
* @return
*/
void setupMenuEditor();
/**
* @brief Setup for the Menu Editor
* @return
*/
void setupMenuEditFields();
/**
* @brief Displays the current page of menu items
* @param input_state
*/
void displayCurrentPage(const std::string &input_state);
/**
* @brief Displays the current page of menu items
* @param input_state
*/
void displayCurrentEditPage(const std::string &input_state);
/**
* @brief Check if the menu exists in the current listing
* @param menu_name
* @return
*/
bool checkMenuExists(std::string menu_name);
/**
* @brief Check if the menu option exists in the current listing
* @param menu_option
*/
bool checkMenuOptionExists(unsigned int option_index);
/**
* @brief Menu Editor Display, Runs through all existing menus
* @return
*/
std::string displayMenuList();
/**
* @brief Menu Editor, for Displaying Menu Fields to Edit
* @return
*/
std::string displayMenuEditScreen();
/**
* Input Methods below here.
*/
/**
* @brief Handles Input (Waiting for Any Key Press)
* @param input
*/
void menuEditorPausedInput(const std::string &input);
/**
* @brief Handles Input (Waiting for Any Key Press) View Generic Menu
* @param input
*/
void menuEditorDisplayPause(const std::string &input);
/**
* @brief Handles Menu Editor Command Selection
* @param input
*/
void menuEditorInput(const std::string &input);
/**
* @brief Handles Menu Field Editor Command Selection
* @param input
*/
void menuEditorMenuFieldInput(const std::string &input);
/**
* @brief Handles Field Updates for Menu Data
* @param input
*/
void menuEditorMenuFieldHandler(const std::string &input);
/**
* @brief Handles Menu Name Input, Parses Strings and checks Valid Menus
* @param input
*/
void menuEditorMenuNameInput(const std::string &input);
/**
* @brief handle each menu separate state and what to do next on input.
* @param does_menu_exist
* @param menu_name
*/
void handleMenuInputState(bool does_menu_exist, const std::string &menu_name);
/**
* @brief Create a new empty Menu
* @param menu_name
*/
void createNewMenu(const std::string &menu_name);
/**
* @brief Create a new empty Menu
* @param option_index
*/
void createNewMenuOption(unsigned int option_index);
/**
* @brief Delete an existing Menu Option
* @param option_index
*/
void deleteExistingMenuOption(unsigned int option_index);
/**
* @brief On Insertion of Menu Options, reorder all after index
* @param option_index
*/
void reorderMenuIndexesInsertion(unsigned int option_index);
/**
* @brief On Deletion of Menu Options, reorder all after index
* @param option_index
*/
void reorderMenuIndexesDeletion(unsigned int option_index);
/**
* @brief Delete an existing Menu
* @param menu_name
*/
void deleteExistingMenu(const std::string &menu_name);
/**
* @brief Create a new empty Menu
* @param menu_name
*/
void copyExistingMenu(const std::string &menu_name);
/**
* @brief Copy an Existing Menu Option
* @param option_index
*/
void copyExistingMenuOption(int option_index);
/**
* @brief Save Menu Changes
* @return
*/
void saveMenuChanges();
private:
// Function Input Vector.
std::vector<std::function< void()> > m_setup_functions;
std::vector<std::function< void(const std::string &)> > m_mod_functions;
std::vector<std::string> m_menu_display_list;
std::vector<access_level_ptr> m_loaded_level;
SessionIO m_session_io;
std::string m_filename;
text_prompts_dao_ptr m_text_prompts_dao;
unsigned int m_mod_setup_index;
unsigned int m_mod_function_index;
unsigned int m_mod_menu_state_index;
unsigned int m_mod_toggle_view_index;
unsigned int m_max_toggled_view_index;
bool m_is_text_prompt_exist;
unsigned int m_page;
unsigned int m_rows_per_page;
std::string m_current_menu;
unsigned int m_current_option;
unsigned int m_current_field;
CommonIO m_common_io;
directory_ptr m_directory;
};
#endif // MOD_MESSAGE_BASE_EDITOR_HPP
| 31.70197 | 125 | 0.665683 | [
"vector"
] |
7076b324d6853fa0adc7430ff21482bccbfe6bb6 | 2,128 | cc | C++ | chrome/renderer/native_handler.cc | Scopetta197/chromium | b7bf8e39baadfd9089de2ebdc0c5d982de4a9820 | [
"BSD-3-Clause"
] | 212 | 2015-01-31T11:55:58.000Z | 2022-02-22T06:35:11.000Z | chrome/renderer/native_handler.cc | 1065672644894730302/Chromium | 239dd49e906be4909e293d8991e998c9816eaa35 | [
"BSD-3-Clause"
] | 5 | 2015-03-27T14:29:23.000Z | 2019-09-25T13:23:12.000Z | chrome/renderer/native_handler.cc | 1065672644894730302/Chromium | 239dd49e906be4909e293d8991e998c9816eaa35 | [
"BSD-3-Clause"
] | 221 | 2015-01-07T06:21:24.000Z | 2022-02-11T02:51:12.000Z | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/renderer/native_handler.h"
#include "base/memory/linked_ptr.h"
#include "base/logging.h"
#include "chrome/renderer/module_system.h"
#include "v8/include/v8.h"
NativeHandler::NativeHandler()
: object_template_(
v8::Persistent<v8::ObjectTemplate>::New(v8::ObjectTemplate::New())) {
}
NativeHandler::~NativeHandler() {
object_template_.Dispose();
}
v8::Handle<v8::Object> NativeHandler::NewInstance() {
return object_template_->NewInstance();
}
// static
v8::Handle<v8::Value> NativeHandler::Router(const v8::Arguments& args) {
// It is possible for JS code to execute after ModuleSystem has been deleted
// in which case the native handlers will also have been deleted, making
// HandlerFunction below point to freed memory.
if (!ModuleSystem::IsPresentInCurrentContext()) {
return v8::ThrowException(v8::Exception::Error(
v8::String::New("ModuleSystem has been deleted")));
}
HandlerFunction* handler_function = static_cast<HandlerFunction*>(
args.Data().As<v8::External>()->Value());
return handler_function->Run(args);
}
void NativeHandler::RouteFunction(const std::string& name,
const HandlerFunction& handler_function) {
linked_ptr<HandlerFunction> function(new HandlerFunction(handler_function));
// TODO(koz): Investigate using v8's MakeWeak() function instead of holding
// on to these pointers here.
handler_functions_.push_back(function);
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(Router,
v8::External::New(function.get()));
object_template_->Set(name.c_str(), function_template);
}
void NativeHandler::RouteStaticFunction(const std::string& name,
const HandlerFunc handler_func) {
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(handler_func, v8::External::New(this));
object_template_->Set(name.c_str(), function_template);
}
| 37.333333 | 78 | 0.724624 | [
"object"
] |
707e5560ae0297e78b306e68b12d533d70d3292b | 11,599 | cc | C++ | lib/replace.cc | smyte-forks/node-re2 | 40845c2497cffffbb3959ccb2e681ddd640684e0 | [
"BSD-3-Clause"
] | 1 | 2020-02-08T07:15:10.000Z | 2020-02-08T07:15:10.000Z | lib/replace.cc | smyte-forks/node-re2 | 40845c2497cffffbb3959ccb2e681ddd640684e0 | [
"BSD-3-Clause"
] | null | null | null | lib/replace.cc | smyte-forks/node-re2 | 40845c2497cffffbb3959ccb2e681ddd640684e0 | [
"BSD-3-Clause"
] | null | null | null | #include "./wrapped_re2.h"
#include "./util.h"
#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include <node_buffer.h>
inline int getMaxSubmatch(const char *data, size_t size, const std::map<std::string, int> &namedGroups)
{
int maxSubmatch = 0, index, index2;
const char *nameBegin;
const char *nameEnd;
for (size_t i = 0; i < size;)
{
char ch = data[i];
if (ch == '$')
{
if (i + 1 < size)
{
ch = data[i + 1];
switch (ch)
{
case '$':
case '&':
case '`':
case '\'':
i += 2;
continue;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
index = ch - '0';
if (i + 2 < size)
{
ch = data[i + 2];
if ('0' <= ch && ch <= '9')
{
index2 = index * 10 + (ch - '0');
if (maxSubmatch < index2)
maxSubmatch = index2;
i += 3;
continue;
}
}
if (maxSubmatch < index)
maxSubmatch = index;
i += 2;
continue;
case '<':
nameBegin = data + i + 2;
nameEnd = (const char *)memchr(nameBegin, '>', size - i - 2);
if (nameEnd)
{
std::string name(nameBegin, nameEnd - nameBegin);
auto group = namedGroups.find(name);
if (group != namedGroups.end())
{
index = group->second;
if (maxSubmatch < index)
maxSubmatch = index;
}
i = nameEnd + 1 - data;
}
else
{
i += 2;
}
continue;
}
}
++i;
continue;
}
i += getUtf8CharSize(ch);
}
return maxSubmatch;
}
inline std::string replace(const char *data, size_t size, const std::vector<re2::StringPiece> &groups, const re2::StringPiece &str, const std::map<std::string, int> &namedGroups)
{
std::string result;
size_t index, index2;
const char *nameBegin;
const char *nameEnd;
for (size_t i = 0; i < size;)
{
char ch = data[i];
if (ch == '$')
{
if (i + 1 < size)
{
ch = data[i + 1];
switch (ch)
{
case '$':
result += ch;
i += 2;
continue;
case '&':
result += groups[0].as_string();
i += 2;
continue;
case '`':
result += std::string(str.data(), groups[0].data() - str.data());
i += 2;
continue;
case '\'':
result += std::string(groups[0].data() + groups[0].size(),
str.data() + str.size() - groups[0].data() - groups[0].size());
i += 2;
continue;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
index = ch - '0';
if (i + 2 < size)
{
ch = data[i + 2];
if ('0' <= ch && ch <= '9')
{
i += 3;
index2 = index * 10 + (ch - '0');
if (index2 && index2 < groups.size())
{
result += groups[index2].as_string();
continue;
}
result += '$';
result += '0' + index;
result += ch;
continue;
}
ch = '0' + index;
}
i += 2;
if (index && index < groups.size())
{
result += groups[index].as_string();
continue;
}
result += '$';
result += ch;
continue;
case '<':
if (!namedGroups.empty())
{
nameBegin = data + i + 2;
nameEnd = (const char *)memchr(nameBegin, '>', size - i - 2);
if (nameEnd)
{
std::string name(nameBegin, nameEnd - nameBegin);
auto group = namedGroups.find(name);
if (group != namedGroups.end())
{
index = group->second;
result += groups[index].as_string();
}
i = nameEnd + 1 - data;
}
else
{
result += "$<";
i += 2;
}
}
else
{
result += "$<";
i += 2;
}
continue;
}
}
result += '$';
++i;
continue;
}
size_t sym_size = getUtf8CharSize(ch);
result.append(data + i, sym_size);
i += sym_size;
}
return result;
}
static Nan::Maybe<std::string> replace(WrappedRE2 *re2, const StrVal &replacee, const char *replacer, size_t replacer_size)
{
const re2::StringPiece str = replacee;
const char *data = str.data();
size_t size = str.size();
const auto &namedGroups = re2->regexp.NamedCapturingGroups();
std::vector<re2::StringPiece> groups(std::min(re2->regexp.NumberOfCapturingGroups(), getMaxSubmatch(replacer, replacer_size, namedGroups)) + 1);
const auto &match = groups[0];
size_t lastIndex = 0;
std::string result;
auto anchor = re2::RE2::UNANCHORED;
if (re2->sticky)
{
if (!re2->global)
{
if (replacee.isBuffer)
{
lastIndex = re2->lastIndex;
}
else
{
for (size_t n = re2->lastIndex; n; --n)
{
lastIndex += getUtf8CharSize(data[lastIndex]);
}
}
}
anchor = re2::RE2::ANCHOR_START;
}
if (lastIndex)
{
result = std::string(data, lastIndex);
}
bool noMatch = true;
while (lastIndex <= size && re2->regexp.Match(str, lastIndex, size, anchor, &groups[0], groups.size()))
{
noMatch = false;
if (!re2->global && re2->sticky)
{
re2->lastIndex += replacee.isBuffer ? match.data() - data + match.size() - lastIndex : getUtf16Length(data + lastIndex, match.data() + match.size());
}
if (match.size())
{
if (match.data() == data || match.data() - data > lastIndex)
{
result += std::string(data + lastIndex, match.data() - data - lastIndex);
}
result += replace(replacer, replacer_size, groups, str, namedGroups);
lastIndex = match.data() - data + match.size();
}
else
{
result += replace(replacer, replacer_size, groups, str, namedGroups);
size_t sym_size = getUtf8CharSize(data[lastIndex]);
if (lastIndex < size)
{
result.append(data + lastIndex, sym_size);
}
lastIndex += sym_size;
}
if (!re2->global)
{
break;
}
}
if (lastIndex < size)
{
result += std::string(data + lastIndex, size - lastIndex);
}
if (re2->global)
{
re2->lastIndex = 0;
}
else if (re2->sticky)
{
if (noMatch)
{
re2->lastIndex = 0;
}
}
return Nan::Just(result);
}
inline Nan::Maybe<std::string> replace(const Nan::Callback *replacer, const std::vector<re2::StringPiece> &groups, const re2::StringPiece &str, const v8::Local<v8::Value> &input, bool useBuffers, const std::map<std::string, int> &namedGroups)
{
std::vector<v8::Local<v8::Value>> argv;
auto context = Nan::GetCurrentContext();
if (useBuffers)
{
for (size_t i = 0, n = groups.size(); i < n; ++i)
{
const auto &item = groups[i];
argv.push_back(Nan::CopyBuffer(item.data(), item.size()).ToLocalChecked());
}
argv.push_back(Nan::New(static_cast<int>(groups[0].data() - str.data())));
}
else
{
for (size_t i = 0, n = groups.size(); i < n; ++i)
{
const auto &item = groups[i];
argv.push_back(Nan::New(item.data(), item.size()).ToLocalChecked());
}
argv.push_back(Nan::New(static_cast<int>(getUtf16Length(str.data(), groups[0].data()))));
}
argv.push_back(input);
if (!namedGroups.empty())
{
auto groups = Nan::New<v8::Object>();
(void)groups->SetPrototype(context, Nan::Null());
for (std::pair<std::string, int> group : namedGroups)
{
Nan::Set(groups, Nan::New(group.first).ToLocalChecked(), argv[group.second]);
}
argv.push_back(groups);
}
auto maybeResult = Nan::CallAsFunction(replacer->GetFunction(), context->Global(), static_cast<int>(argv.size()), &argv[0]);
if (maybeResult.IsEmpty())
{
return Nan::Nothing<std::string>();
}
auto result = maybeResult.ToLocalChecked();
if (node::Buffer::HasInstance(result))
{
return Nan::Just(std::string(node::Buffer::Data(result), node::Buffer::Length(result)));
}
StrVal val = result;
return Nan::Just(std::string(val.data, val.size));
}
static Nan::Maybe<std::string> replace(WrappedRE2 *re2, const StrVal &replacee, const Nan::Callback *replacer, const v8::Local<v8::Value> &input, bool useBuffers)
{
const re2::StringPiece str = replacee;
const char *data = str.data();
size_t size = str.size();
std::vector<re2::StringPiece> groups(re2->regexp.NumberOfCapturingGroups() + 1);
const auto &match = groups[0];
size_t lastIndex = 0;
std::string result;
auto anchor = re2::RE2::UNANCHORED;
if (re2->sticky)
{
if (!re2->global)
{
if (replacee.isBuffer)
{
lastIndex = re2->lastIndex;
}
else
{
for (size_t n = re2->lastIndex; n; --n)
{
lastIndex += getUtf8CharSize(data[lastIndex]);
}
}
}
anchor = RE2::ANCHOR_START;
}
if (lastIndex)
{
result = std::string(data, lastIndex);
}
const auto &namedGroups = re2->regexp.NamedCapturingGroups();
bool noMatch = true;
while (lastIndex <= size && re2->regexp.Match(str, lastIndex, size, anchor, &groups[0], groups.size()))
{
noMatch = false;
if (!re2->global && re2->sticky)
{
re2->lastIndex += replacee.isBuffer ? match.data() - data + match.size() - lastIndex : getUtf16Length(data + lastIndex, match.data() + match.size());
}
if (match.size())
{
if (match.data() == data || match.data() - data > lastIndex)
{
result += std::string(data + lastIndex, match.data() - data - lastIndex);
}
const auto part = replace(replacer, groups, str, input, useBuffers, namedGroups);
if (part.IsNothing())
{
return part;
}
result += part.FromJust();
lastIndex = match.data() - data + match.size();
}
else
{
const auto part = replace(replacer, groups, str, input, useBuffers, namedGroups);
if (part.IsNothing())
{
return part;
}
result += part.FromJust();
size_t sym_size = getUtf8CharSize(data[lastIndex]);
if (lastIndex < size)
{
result.append(data + lastIndex, sym_size);
}
lastIndex += sym_size;
}
if (!re2->global)
{
break;
}
}
if (lastIndex < size)
{
result += std::string(data + lastIndex, size - lastIndex);
}
if (re2->global)
{
re2->lastIndex = 0;
}
else if (re2->sticky)
{
if (noMatch)
{
re2->lastIndex = 0;
}
}
return Nan::Just(result);
}
static bool requiresBuffers(const v8::Local<v8::Function> &f)
{
auto flag(Nan::Get(f, Nan::New("useBuffers").ToLocalChecked()).ToLocalChecked());
if (flag->IsUndefined() || flag->IsNull() || flag->IsFalse())
{
return false;
}
if (flag->IsNumber())
{
return flag->NumberValue(Nan::GetCurrentContext()).FromMaybe(0) != 0;
}
if (flag->IsString())
{
return flag->ToString(Nan::GetCurrentContext()).ToLocalChecked()->Length() > 0;
}
return true;
}
NAN_METHOD(WrappedRE2::Replace)
{
auto re2 = Nan::ObjectWrap::Unwrap<WrappedRE2>(info.This());
if (!re2)
{
info.GetReturnValue().Set(info[0]);
return;
}
StrVal replacee = info[0];
if (!replacee.data)
{
info.GetReturnValue().Set(info[0]);
return;
}
std::string result;
if (info[1]->IsFunction())
{
auto fun = info[1].As<v8::Function>();
const std::unique_ptr<const Nan::Callback> cb(new Nan::Callback(fun));
const auto replaced = replace(re2, replacee, cb.get(), info[0], requiresBuffers(fun));
if (replaced.IsNothing())
{
info.GetReturnValue().Set(info[0]);
return;
}
result = replaced.FromJust();
}
else
{
StrVal replacer = info[1];
if (!replacer.data)
{
info.GetReturnValue().Set(info[0]);
return;
}
const auto replaced = replace(re2, replacee, replacer.data, replacer.size);
if (replaced.IsNothing())
{
info.GetReturnValue().Set(info[0]);
return;
}
result = replaced.FromJust();
}
if (replacee.isBuffer)
{
info.GetReturnValue().Set(Nan::CopyBuffer(result.data(), result.size()).ToLocalChecked());
return;
}
info.GetReturnValue().Set(Nan::New(result).ToLocalChecked());
}
| 22.17782 | 242 | 0.58074 | [
"object",
"vector"
] |
708057f2825afdc649e041b5f217d70ff4b31c50 | 1,584 | hpp | C++ | SOLVER/src/core/element/crd/CoordTransformCartesian.hpp | chaindl/AxiSEM-3D | 0251f301c79c676fb37792209d6e24f107773b3d | [
"MIT"
] | null | null | null | SOLVER/src/core/element/crd/CoordTransformCartesian.hpp | chaindl/AxiSEM-3D | 0251f301c79c676fb37792209d6e24f107773b3d | [
"MIT"
] | null | null | null | SOLVER/src/core/element/crd/CoordTransformCartesian.hpp | chaindl/AxiSEM-3D | 0251f301c79c676fb37792209d6e24f107773b3d | [
"MIT"
] | null | null | null | //
// CoordTransformCartesian.hpp
// AxiSEM3D
//
// Created by Kuangdai Leng on 3/10/19.
// Copyright © 2019 Kuangdai Leng. All rights reserved.
//
// coordinate transform between (s,phi,z) and (R,T,Z)
// for vector and 2nd-order tensor fields
// Nothing for Cartesian meshes.
#ifndef CoordTransformCartesian_hpp
#define CoordTransformCartesian_hpp
#include "CoordTransform.hpp"
class CoordTransformCartesian: public CoordTransform {
public:
// (s,phi,z) -> (R,T,Z)
void transformSPZ_RTZ3(eigen::vec_ar3_CMatPP_RM &ui, int nu_1) const {
// nothing
}
// (R,T,Z) -> (s,phi,z)
void transformRTZ_SPZ3(eigen::vec_ar3_CMatPP_RM &ui, int nu_1) const {
// nothing
}
// (R,T,Z) -> (s,phi,z)
void transformRTZ_SPZ3(eigen::ar3_RMatPP_RM &ui) const {
// nothing
}
// (s,phi,z) -> (R,T,Z) for nabla
void transformSPZ_RTZ9(eigen::vec_ar9_CMatPP_RM &nij, int nu_1) const {
// nothing
}
// (R,T,Z) -> (s,phi,z) for nabla
void transformRTZ_SPZ9(eigen::vec_ar9_CMatPP_RM &nij, int nu_1) const {
// nothing
}
// (R,T,Z) -> (s,phi,z) for nabla
void transformRTZ_SPZ9(eigen::ar9_RMatPP_RM &nij) const {
// nothing
}
// (s,phi,z) -> (R,T,Z) for Voigt
void transformSPZ_RTZ6(eigen::vec_ar6_CMatPP_RM &eij, int nu_1) const {
// nothing
}
// (R,T,Z) -> (s,phi,z) for Voigt
void transformRTZ_SPZ6(eigen::vec_ar6_CMatPP_RM &sij, int nu_1) const {
// nothing
}
};
#endif /* CoordTransformCartesian_hpp */
| 25.548387 | 75 | 0.614268 | [
"vector",
"transform"
] |
70865129891be566b77f701e2527deabde4574f1 | 28,340 | cpp | C++ | tests.cpp | cmpandya29/cracking-the-coding-interview-1 | 8e5980d1c323960be561552b18048096f0e47cc3 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-01-14T05:38:27.000Z | 2019-01-14T05:38:27.000Z | tests.cpp | XLBetlog/cracking-the-coding-interview | 8e5980d1c323960be561552b18048096f0e47cc3 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests.cpp | XLBetlog/cracking-the-coding-interview | 8e5980d1c323960be561552b18048096f0e47cc3 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2019-08-29T05:04:20.000Z | 2021-02-07T11:05:34.000Z | //
// Created by alex on 7/31/17.
//
#include "cpp_solutions/chapter_01_arrays_and_strings/chapter_01_includes.h"
#include "cpp_solutions/chapter_02_linked_lists/chapter_02_includes.h"
#include "cpp_solutions/chapter_03_stacks_and_queues/chapter_03_includes.h"
#include "cpp_solutions/chapter_04_trees_and_graphs/chapter_04_includes.h"
#include "cpp_solutions/chapter_05_bit_manipulation/chapter_05_includes.h"
#include "cpp_solutions/chapter_08_recursion_and_dynamic_programming/chapter_08_includes.h"
#include "cpp_solutions/chapter_10_sorting_and_searching/chapter_10_includes.h"
#include "cpp_solutions/chapter_12_cpp/chapter_12_includes.h"
#include "cpp_solutions/misc_exercises/misc_includes.h"
#define CATCH_CONFIG_MAIN
#include "cpp_solutions/third_party/Catch/include/catch.hpp"
#include <vector>
#include <Eigen/Dense>
TEST_CASE("Chapter 01 - Problem 01 - isUnique()", "test"){
REQUIRE(chapter_01::isUnique("alex"));
REQUIRE(!chapter_01::isUnique("aalex"));
}
TEST_CASE("Chapter 01 - Problem 02 - isPermutation()", "test"){
REQUIRE(!chapter_01::isPermutation("alex", "alexa"));
REQUIRE(chapter_01::isPermutation("aa", "aa"));
REQUIRE(chapter_01::isPermutation("alex", "lexa"));
REQUIRE(chapter_01::isPermutation("alex", "xela"));
REQUIRE(chapter_01::isPermutation("", ""));
REQUIRE(!chapter_01::isPermutation("cat", "ctt"));
REQUIRE(!chapter_01::isPermutation("alexxx", "xxxxxx"));
}
TEST_CASE("Chapter 01 - Problem 03 - URLify()", "test") {
// expect 'Mr. John Smith' -> 'Mr.%20John%20Smith'
std::string input1 = "Mr. John Smith ";
std::string output1 = "Mr.%20John%20Smith%20";
chapter_01::URLify(input1);
REQUIRE(input1 == output1);
std::string input2 = "";
std::string output2 = "";
chapter_01::URLify(input2);
REQUIRE(input2 == output2);
std::string input3 = " ";
std::string output3 = "%20";
chapter_01::URLify(input3);
REQUIRE(input3 == output3);
std::string input4 = "Alex";
std::string output4 = "Alex";
chapter_01::URLify(input4);
REQUIRE(input4 == output4);
}
TEST_CASE("Chapter 01 - Problem 04 - palindromePermutation()", "test") {
REQUIRE(chapter_01::palindromePermutation("tact coa"));
REQUIRE(!chapter_01::palindromePermutation("Tact Coa"));
REQUIRE(!chapter_01::palindromePermutation("xyz"));
REQUIRE(chapter_01::palindromePermutation("AA B AA"));
REQUIRE(!chapter_01::palindromePermutation("aA B AA"));
}
TEST_CASE("Chapter 01 - Problem 05 - oneAway()", "test"){
REQUIRE(chapter_01::oneAway("pale", "ple"));
REQUIRE(chapter_01::oneAway("pale", "pale"));
REQUIRE(chapter_01::oneAway("pale", "bale"));
REQUIRE(!chapter_01::oneAway("pale", "bae"));
REQUIRE(!chapter_01::oneAway("alex", "al"));
REQUIRE(!chapter_01::oneAway("alex", "all"));
REQUIRE(!chapter_01::oneAway("alex", "alll"));
REQUIRE(chapter_01::oneAway("apple", "aple"));
REQUIRE(chapter_01::oneAway("bale", "pale"));
REQUIRE(chapter_01::oneAway("", ""));
}
TEST_CASE("Chapter 01 - Problem 06 - stringCompression()", "test"){
REQUIRE("a2b1c5a3" == chapter_01::stringCompression("aabcccccaaa"));
REQUIRE("alex" == chapter_01::stringCompression("alex"));
REQUIRE("" == chapter_01::stringCompression(""));
REQUIRE("a10" == chapter_01::stringCompression("aaaaaaaaaa"));
}
TEST_CASE("Chapter 01 - Problem 07 - rotateMatrix()", "test"){
Eigen::MatrixXi input4x4(4,4);
input4x4 << 1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4,
1, 2, 3, 4;
Eigen::MatrixXi input5x5(5,5);
input5x5 << 1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 5;
Eigen::MatrixXi output4x4(4,4);
output4x4 << 1, 1, 1, 1,
2, 2, 2, 2,
3, 3, 3, 3,
4, 4, 4, 4;
Eigen::MatrixXi output5x5(5,5);
output5x5 << 1, 1, 1, 1, 1,
2, 2, 2, 2, 2,
3, 3, 3, 3, 3,
4, 4, 4, 4, 4,
5, 5, 5, 5, 5;
chapter_01::rotate(input4x4);
chapter_01::rotate(input5x5);
REQUIRE(input4x4.isApprox(output4x4));
REQUIRE(input5x5.isApprox(output5x5));
}
TEST_CASE("Chapter 01 - Problem 08 - setZero()", "test"){
// assume rotations are clockwise
Eigen::MatrixXi input4x4(4,4);
input4x4 << 1, 2, 3, 4,
1, 2, 0, 4,
1, 2, 3, 4,
0, 2, 3, 4;
Eigen::MatrixXi input5x5(5,5);
input5x5 << 0, 2, 3, 4, 5,
1, 2, 0, 4, 5,
1, 2, 3, 4, 5,
1, 2, 3, 4, 0,
1, 2, 3, 4, 5;
Eigen::MatrixXi output4x4(4,4);
output4x4 << 0, 2, 0, 4,
0, 0, 0, 0,
0, 2, 0, 4,
0, 0, 0, 0;
Eigen::MatrixXi output5x5(5,5);
output5x5 << 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 2, 0, 4, 0,
0, 0, 0, 0, 0,
0, 2, 0, 4, 0;
chapter_01::setZero(input4x4);
chapter_01::setZero(input5x5);
REQUIRE(input4x4.isApprox(output4x4));
REQUIRE(input5x5.isApprox(output5x5));
}
TEST_CASE("Chapter 01 - Problem 09 - stringRotation()", "test"){
REQUIRE(chapter_01::stringRotation("waterbottle", "erbottlewat"));
REQUIRE(!chapter_01::stringRotation("waterbottle", "erbottlewatx"));
REQUIRE(chapter_01::stringRotation("", ""));
}
TEST_CASE("Chapter 02 - Basic LinkedList Functionality", "test"){
std::vector<int> testVector = {1,2,3,4,5,6,7};
REQUIRE(testVector == chapter_02::listToVector(chapter_02::vectorToList(testVector)));
}
TEST_CASE("Chapter 02 - Problem 01 - removeDups()", "test"){
std::vector<int> noDups = {1,7,3,6,5,4,2};
std::vector<int> dups = {2,2,1,5,6,2,5,2,7,7};
std::vector<int> fixedDups = {2,1,5,6,7};
std::vector<int> emptyVec;
// check that remove dups function doesn't affect lists with no dups
chapter_02::SinglyLinkedNode<int>* noDupsHead = chapter_02::vectorToList(noDups);
chapter_02::removeDups(noDupsHead);
REQUIRE(noDups == chapter_02::listToVector(noDupsHead));
// check case with duplicates
chapter_02::SinglyLinkedNode<int>* dupsHead = chapter_02::vectorToList(dups);
chapter_02::removeDups(dupsHead);
REQUIRE(fixedDups == chapter_02::listToVector(dupsHead));
// check case with empty list
chapter_02::SinglyLinkedNode<int>* emptyHead = chapter_02::vectorToList(emptyVec);
chapter_02::removeDups(emptyHead);
REQUIRE(emptyVec == chapter_02::listToVector(emptyHead));
}
TEST_CASE("Chapter 02 - Problem 02 - returnKthToLast()", "test"){
std::vector<int> testVec1 = {1,7,3,6,5,4,2};
std::vector<int> testVec2 = {2,2,1,5,6,2,5,2,7,7};
std::vector<int> testVec3;
chapter_02::SinglyLinkedNode<int>* testVec1Head = chapter_02::vectorToList(testVec1);
chapter_02::SinglyLinkedNode<int>* testVec2Head = chapter_02::vectorToList(testVec2);
chapter_02::SinglyLinkedNode<int>* testVec3Head = chapter_02::vectorToList(testVec3);
REQUIRE(5 == chapter_02::returnKthToLast(testVec1Head, 3)->getValue());
REQUIRE(2 == chapter_02::returnKthToLast(testVec1Head, 1)->getValue());
REQUIRE(1 == chapter_02::returnKthToLast(testVec1Head, testVec1.size())->getValue());
REQUIRE(2 == chapter_02::returnKthToLast(testVec2Head, 3)->getValue());
REQUIRE(7 == chapter_02::returnKthToLast(testVec2Head, 1)->getValue());
REQUIRE(2 == chapter_02::returnKthToLast(testVec2Head, testVec2.size())->getValue());
REQUIRE(nullptr == chapter_02::returnKthToLast(testVec2Head, 0));
REQUIRE(nullptr == chapter_02::returnKthToLast(testVec1Head, 10));
REQUIRE(nullptr == chapter_02::returnKthToLast(testVec3Head, 10));
}
TEST_CASE("Chapter 02 - Problem 03 - deleteMiddleNode()", "test"){
// create test dataset
std::vector<std::string> testVec = {"a", "b", "c", "d", "e", "f"};
std::vector<std::string> expectedVec = {"a", "b", "d", "e", "f"};
chapter_02::SinglyLinkedNode<std::string>* testVecHead = chapter_02::vectorToList(testVec);
chapter_02::SinglyLinkedNode<std::string>* expectedVecHead = chapter_02::vectorToList(expectedVec);
// traverse input to find node with content "c"
chapter_02::SinglyLinkedNode<std::string>* head = testVecHead;
while (head != nullptr && head->getValue() != "c"){
head = head->getNext();
}
// head is not at location "c". call delete function
chapter_02::deleteMiddleNode(head);
// check that vec 1 and vec 2 are the same
while (testVecHead != nullptr && expectedVecHead != nullptr){
REQUIRE(testVecHead->getValue() == expectedVecHead->getValue());
testVecHead = testVecHead->getNext();
expectedVecHead = expectedVecHead->getNext();
}
}
TEST_CASE("Chapter 02 - Problem 04 - partition()", "test"){
// create test dataset
std::vector<int> inputVec = {3, 5, 8, 5, 10, 2, 1};
std::vector<int> expectedVec = {1, 2, 3, 5, 8, 5, 10};
chapter_02::SinglyLinkedNode<int>* inputVecHead = chapter_02::vectorToList(inputVec);
chapter_02::SinglyLinkedNode<int>* expectedVecHead = chapter_02::vectorToList(expectedVec);
// perform partition
inputVecHead = chapter_02::partition(inputVecHead, 5);
// check that vec 1 and vec 2 are the same
while (inputVecHead != nullptr && expectedVecHead != nullptr){
REQUIRE(inputVecHead->getValue() == expectedVecHead->getValue());
inputVecHead = inputVecHead->getNext();
expectedVecHead = expectedVecHead->getNext();
}
}
TEST_CASE("Chapter 02 - Problem 05 - sumLists()", "test"){
// create test dataset
// 9423 + 951 = 10374
std::vector<uint8_t> n1Vec = {3, 2, 4, 9};
std::vector<uint8_t> n2Vec = {1, 5, 9};
std::vector<uint8_t> sumVecExpected = {4, 7, 3, 0, 1};
chapter_02::SinglyLinkedNode<uint8_t>* n1Head = chapter_02::vectorToList(n1Vec);
chapter_02::SinglyLinkedNode<uint8_t>* n2Head = chapter_02::vectorToList(n2Vec);
std::vector<uint8_t> sumVecActual = chapter_02::listToVector(chapter_02::sumLists(n1Head, n2Head));
REQUIRE(sumVecExpected == sumVecActual);
};
TEST_CASE("Chapter 02 - Problem 06 - palindrome()", "test"){
// create test dataset
std::vector<int> list1 = {0, 4, 7, 0, 0, 7, 4, 0};
std::vector<int> list2 = {3, 5, 2, 5, 3};
std::vector<int> list3 = {0, 1, 0, 1, 0, 1};
std::vector<std::string> list4 = {"a", "l", "e", "x"};
std::vector<std::string> list5 = {"A", "B", "B", "A"};
chapter_02::SinglyLinkedNode<int>* head1 = chapter_02::vectorToList(list1);
chapter_02::SinglyLinkedNode<int>* head2 = chapter_02::vectorToList(list2);
chapter_02::SinglyLinkedNode<int>* head3 = chapter_02::vectorToList(list3);
chapter_02::SinglyLinkedNode<std::string>* head4 = chapter_02::vectorToList(list4);
chapter_02::SinglyLinkedNode<std::string>* head5 = chapter_02::vectorToList(list5);
REQUIRE(chapter_02::palindrome(head1));
REQUIRE(chapter_02::palindrome(head2));
REQUIRE(!chapter_02::palindrome(head3));
REQUIRE(!chapter_02::palindrome(head4));
REQUIRE(chapter_02::palindrome(head5));
};
TEST_CASE("Chapter 02 - Problem 07 - intersection()", "test") {
// list 1
chapter_02::SinglyLinkedNode<int>* node1_6 = new chapter_02::SinglyLinkedNode<int>(1, nullptr);
chapter_02::SinglyLinkedNode<int>* node1_5 = new chapter_02::SinglyLinkedNode<int>(2, node1_6);
chapter_02::SinglyLinkedNode<int>* node1_4 = new chapter_02::SinglyLinkedNode<int>(7, node1_5);
chapter_02::SinglyLinkedNode<int>* node1_3 = new chapter_02::SinglyLinkedNode<int>(9, node1_4);
chapter_02::SinglyLinkedNode<int>* node1_2 = new chapter_02::SinglyLinkedNode<int>(5, node1_3);
chapter_02::SinglyLinkedNode<int>* node1_1 = new chapter_02::SinglyLinkedNode<int>(1, node1_2);
chapter_02::SinglyLinkedNode<int>* node1_0 = new chapter_02::SinglyLinkedNode<int>(3, node1_1);
// list 2
chapter_02::SinglyLinkedNode<int>* node2_1 = new chapter_02::SinglyLinkedNode<int>(6, node1_4); // intersection point
chapter_02::SinglyLinkedNode<int>* node2_0 = new chapter_02::SinglyLinkedNode<int>(4, node2_1);
// list 3
chapter_02::SinglyLinkedNode<int>* node3_1 = new chapter_02::SinglyLinkedNode<int>(6, nullptr);
chapter_02::SinglyLinkedNode<int>* node3_0 = new chapter_02::SinglyLinkedNode<int>(4, node3_1);
REQUIRE(node1_4 == chapter_02::intersection(node1_0, node2_0));
REQUIRE(nullptr == chapter_02::intersection(node1_0, node3_0));
REQUIRE(nullptr == chapter_02::intersection(static_cast<chapter_02::SinglyLinkedNode<int>*>(nullptr), static_cast<chapter_02::SinglyLinkedNode<int>*>(nullptr)));
}
TEST_CASE("Chapter 02 - Problem 08 - findLoop()", "test") {
// see problem_2_8_explanation.pdf
// example 1
chapter_02::SinglyLinkedNode<int>* node1_7 = new chapter_02::SinglyLinkedNode<int>(7, nullptr);
chapter_02::SinglyLinkedNode<int>* node1_6 = new chapter_02::SinglyLinkedNode<int>(6, node1_7);
chapter_02::SinglyLinkedNode<int>* node1_5 = new chapter_02::SinglyLinkedNode<int>(5, node1_6);
chapter_02::SinglyLinkedNode<int>* node1_4 = new chapter_02::SinglyLinkedNode<int>(4, node1_5);
chapter_02::SinglyLinkedNode<int>* node1_3 = new chapter_02::SinglyLinkedNode<int>(3, node1_4);
chapter_02::SinglyLinkedNode<int>* node1_2 = new chapter_02::SinglyLinkedNode<int>(2, node1_3);
chapter_02::SinglyLinkedNode<int>* node1_1 = new chapter_02::SinglyLinkedNode<int>(1, node1_2);
chapter_02::SinglyLinkedNode<int>* node1_0 = new chapter_02::SinglyLinkedNode<int>(0, node1_1);
node1_7->setNext(node1_5);
REQUIRE(node1_5 == chapter_02::findLoop(node1_0));
// example 2
chapter_02::SinglyLinkedNode<int>* node2_10 = new chapter_02::SinglyLinkedNode<int>(10, nullptr);
chapter_02::SinglyLinkedNode<int>* node2_9 = new chapter_02::SinglyLinkedNode<int>(9, node2_10);
chapter_02::SinglyLinkedNode<int>* node2_8 = new chapter_02::SinglyLinkedNode<int>(8, node2_9);
chapter_02::SinglyLinkedNode<int>* node2_7 = new chapter_02::SinglyLinkedNode<int>(7, node2_8);
chapter_02::SinglyLinkedNode<int>* node2_6 = new chapter_02::SinglyLinkedNode<int>(6, node2_7);
chapter_02::SinglyLinkedNode<int>* node2_5 = new chapter_02::SinglyLinkedNode<int>(5, node2_6);
chapter_02::SinglyLinkedNode<int>* node2_4 = new chapter_02::SinglyLinkedNode<int>(4, node2_5);
chapter_02::SinglyLinkedNode<int>* node2_3 = new chapter_02::SinglyLinkedNode<int>(3, node2_4);
chapter_02::SinglyLinkedNode<int>* node2_2 = new chapter_02::SinglyLinkedNode<int>(2, node2_3);
chapter_02::SinglyLinkedNode<int>* node2_1 = new chapter_02::SinglyLinkedNode<int>(1, node2_2);
chapter_02::SinglyLinkedNode<int>* node2_0 = new chapter_02::SinglyLinkedNode<int>(0, node2_1);
node2_10->setNext(node2_3);
REQUIRE(node2_3 == chapter_02::findLoop(node2_0));
// example 3
REQUIRE(static_cast<chapter_02::SinglyLinkedNode<int>*>(nullptr) == chapter_02::findLoop(static_cast<chapter_02::SinglyLinkedNode<int>*>(nullptr)));
}
TEST_CASE("Chapter 03 - Stack", "test"){
chapter_03::Stack<int> myStack = chapter_03::Stack<int>();
for (int i = 1; i <= 4; i++){
myStack.push(i);
}
std::vector<int> tooShort = {3,2,1};
std::vector<int> incorrect = {5,3,2,1};
std::vector<int> justRight = {4,3,2,1};
std::vector<int> tooLong = {4,3,2,1,1};
std::vector<int> empty = {};
REQUIRE(myStack!=tooShort);
REQUIRE(myStack!=tooLong);
REQUIRE(myStack!=incorrect);
REQUIRE(myStack==justRight);
REQUIRE(myStack.peek()==4);
REQUIRE(!myStack.isEmpty());
while (!myStack.isEmpty()){
empty.push_back(myStack.pop());
}
REQUIRE(empty==justRight);
REQUIRE(myStack.isEmpty());
REQUIRE(myStack.pop()==0);
REQUIRE(myStack.peek()==0);
}
TEST_CASE("Chapter 03 - Problem 02 - StackMin()", "test"){
chapter_03::StackMin<int> myStack = chapter_03::StackMin<int>();
myStack.push(-8);
myStack.push(-5);
myStack.push(1);
myStack.push(-6);
REQUIRE(myStack.seeMin() == -8);
myStack.push(-9);
REQUIRE(myStack.seeMin() == -9);
myStack.push(-15);
myStack.push(-30);
myStack.pop();
myStack.pop();
REQUIRE(myStack.seeMin() == -9);
}
TEST_CASE("Chapter 03 - Problem 04 - QueueViStacks()", "test"){
chapter_03::QueueViaStacks<int> myQueue = chapter_03::QueueViaStacks<int>();
for (int i = 0; i < 10; i++) myQueue.enqueue(i);
for (int i = 0; i < 5; i++) REQUIRE(myQueue.dequeue() == i);
for (int i = 0; i < 5; i++) myQueue.enqueue(i);
for (int i = 5; i < 10; i++) REQUIRE(myQueue.dequeue() == i);
for (int i = 0; i < 5; i++) REQUIRE(myQueue.dequeue() == i);
}
TEST_CASE("Chapter 04 - Basic Graph Functionality", "test"){
chapter_02::GraphNode<int> node(1);
chapter_02::GraphNode<int>* child0 = new chapter_02::GraphNode<int>(0);
chapter_02::GraphNode<int>* child1 = new chapter_02::GraphNode<int>(1);
chapter_02::GraphNode<int>* child2 = new chapter_02::GraphNode<int>(2);
chapter_02::GraphNode<int>* child3 = new chapter_02::GraphNode<int>(3);
node.addChild(child0, 0);
node.addChild(child1, 1);
node.addChild(child2, 2);
node.addChild(child3, 3);
std::vector<chapter_02::GraphNode<int>*> children;
node.getChildren(children);
REQUIRE(children[0] == child0);
REQUIRE(children[1] == child1);
REQUIRE(children[2] == child2);
REQUIRE(children[3] == child3);
node.removeChild(0);
node.removeChild(1);
node.removeChild(2);
node.removeChild(3);
std::vector<chapter_02::GraphNode<int>*> deletedChildren;
node.getChildren(deletedChildren);
REQUIRE(deletedChildren.size() == 0);
// no need to delete children, because removeChildren does that for us.
}
TEST_CASE("Chapter 04 - Problem 01 - Route Between Nodes", "test"){
/*
Implements this directed graph:
1 -> 2 -> 3
|
v
4 -> 5 -> 6
| ^
v |
7 -> 8
*/
chapter_02::GraphNode<int>* node1 = new chapter_02::GraphNode<int>(1);
chapter_02::GraphNode<int>* node2 = new chapter_02::GraphNode<int>(2);
chapter_02::GraphNode<int>* node3 = new chapter_02::GraphNode<int>(3);
chapter_02::GraphNode<int>* node4 = new chapter_02::GraphNode<int>(4);
chapter_02::GraphNode<int>* node5 = new chapter_02::GraphNode<int>(5);
chapter_02::GraphNode<int>* node6 = new chapter_02::GraphNode<int>(6);
chapter_02::GraphNode<int>* node7 = new chapter_02::GraphNode<int>(7);
chapter_02::GraphNode<int>* node8 = new chapter_02::GraphNode<int>(8);
node1->addChild(node2, 0);
node2->addChild(node3, 0);
node2->addChild(node4, 1);
node4->addChild(node5, 0);
node4->addChild(node7, 1);
node5->addChild(node6, 0);
node7->addChild(node8, 0);
node8->addChild(node5, 0);
REQUIRE(chapter_04::pathExistsDFS(node1, node6) == true);
REQUIRE(chapter_04::pathExistsDFS(node7, node5) == true);
REQUIRE(chapter_04::pathExistsDFS(node3, node8) == false);
REQUIRE(chapter_04::pathExistsDFS(node1, node8) == true);
REQUIRE(chapter_04::pathExistsDFS(static_cast<chapter_02::GraphNode<int>*>(nullptr), static_cast<chapter_02::GraphNode<int>*>(nullptr)) == false);
REQUIRE(chapter_04::pathExistsDFS(node1, static_cast<chapter_02::GraphNode<int>*>(nullptr)) == false);
delete node1;
delete node2;
delete node3;
delete node4;
delete node5;
delete node6;
delete node7;
delete node8;
}
TEST_CASE("Chapter 05 - Problem 01 - insertion()", "test"){
REQUIRE(chapter_05::insertion(0b10000000000, 0b10011, 2, 6) == 0b10001001100);
}
TEST_CASE("Chapter 05 - Problem 02 - binaryToString()", "test") {
std::string binary_string_1 = "";
std::string binary_string_2 = "";
std::string binary_string_3 = "";
std::string binary_string_4 = "";
REQUIRE(chapter_05::binaryToString(0.5, binary_string_1) == 0);
REQUIRE(chapter_05::binaryToString(0.25, binary_string_2) == 0);
REQUIRE(chapter_05::binaryToString(1.5, binary_string_3) == -1);
REQUIRE(chapter_05::binaryToString(0.722, binary_string_4) == 0);
REQUIRE(binary_string_1 == "0.1");
REQUIRE(binary_string_2 == "0.01");
REQUIRE(binary_string_3 == "");
REQUIRE(binary_string_4 == "0.10111000110101001111110111110011"); // needs double precision to work
}
TEST_CASE("Chapter 05 - Problem 06 - conversion()", "test"){
REQUIRE(chapter_05::conversion(0b11001100, 0b11110000) == 4);
REQUIRE(chapter_05::conversion(29, 15) == 2);
}
TEST_CASE("Chapter 05 - Problem 07 - pairwiseSwap()", "test"){
REQUIRE(chapter_05::pairwiseSwap(0b10101010) == 0b01010101);
REQUIRE(chapter_05::pairwiseSwap(0b11110000) == 0b11110000);
REQUIRE(chapter_05::pairwiseSwap(0b110) == 0b1001);
}
TEST_CASE("Chapter 08 - Problem 01 - tripleStep()", "test"){
REQUIRE(chapter_08::tripleStep(3) == 4);
REQUIRE(chapter_08::tripleStep(4) == 7);
REQUIRE(chapter_08::tripleStep(5) == 13);
}
TEST_CASE("Chapter 08 - Problem 02 - robotGrid()", "test"){
Eigen::MatrixXd maze(5, 5);
maze << 1, 1, 1, 0, 1,
0, 0, 1, 1, 1,
0, 1, 1, 0, 0,
0, 1, 1, 0, 1,
1, 1, 1, 1, 1;
std::vector<Eigen::Vector2d> expectedPath = {Eigen::Vector2d(0,0),
Eigen::Vector2d(0,1),
Eigen::Vector2d(0,2),
Eigen::Vector2d(1,2),
Eigen::Vector2d(2,2),
Eigen::Vector2d(3,2),
Eigen::Vector2d(4,2),
Eigen::Vector2d(4,3),
Eigen::Vector2d(4,4)};
std::vector<Eigen::Vector2d> path;
REQUIRE(chapter_08::robotGrid(maze, path));
REQUIRE(path == expectedPath);
}
TEST_CASE("Chapter 08 - Problem 03 - magicIndex()", "test"){
std::vector<int> noMagicIndex = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::vector<int> magicIndex5 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
std::vector<int> magicIndex7 = {-40, -20, -1, 1, 2, 3, 5, 7, 9, 12, 13};
REQUIRE(chapter_08::magicIndex(noMagicIndex) == -1);
REQUIRE(chapter_08::magicIndex(magicIndex5) == 5);
REQUIRE(chapter_08::magicIndex(magicIndex7) == 7);
}
TEST_CASE("Chapter 08 - Problem 04 - powerSet()", "test"){
std::vector<int> set123 = {1, 2, 3};
std::vector<int> set12 = {1, 2};
std::vector<int> set13 = {1, 3};
std::vector<int> set23 = {2, 3};
std::vector<int> set1 = {1};
std::vector<int> set2 = {2};
std::vector<int> set3 = {3};
std::vector<int> emptySet = {};
std::vector<std::vector<int>> powerSet123 = {emptySet, set1, set2, set12, set3, set13, set23, set123};
std::vector<std::vector<int>> powerSet12 = {emptySet, set1, set2, set12};
std::vector<std::vector<int>> powerSet1 = {emptySet, set1};
std::vector<std::vector<int>> testPowerSet = {};
chapter_08::createPowerSet(set123, testPowerSet);
REQUIRE(testPowerSet == powerSet123);
testPowerSet = {};
chapter_08::createPowerSet(set12, testPowerSet);
REQUIRE(testPowerSet == powerSet12);
testPowerSet = {};
chapter_08::createPowerSet(set1, testPowerSet);
REQUIRE(testPowerSet == powerSet1);
};
TEST_CASE("Chapter 08 - Problem 05 - recursiveMultiply()", "test"){
REQUIRE(chapter_08::recursiveMultiply(1, 1) == 1);
REQUIRE(chapter_08::recursiveMultiply(1, 2) == 2);
REQUIRE(chapter_08::recursiveMultiply(0, 1) == 0);
REQUIRE(chapter_08::recursiveMultiply(9, 10) == 90);
REQUIRE(chapter_08::recursiveMultiply(9, 11) == 99);
REQUIRE(chapter_08::recursiveMultiply(12, 12) == 144);
}
TEST_CASE("Chapter 08 - Problem 10 - paintFill()", "test"){
Eigen::MatrixXi image(6, 6);
image << 0, 1, 1, 0, 0, 3,
1, 1, 1, 1, 0, 0,
0, 1, 1, 0, 0, 2,
0, 0, 0, 0, 2, 2,
0, 2, 2, 2, 2, 2,
0, 0, 0, 2, 2, 2;
Eigen::MatrixXi zerosFilled(6, 6);
zerosFilled << 0, 1, 1, 5, 5, 3,
1, 1, 1, 1, 5, 5,
5, 1, 1, 5, 5, 2,
5, 5, 5, 5, 2, 2,
5, 2, 2, 2, 2, 2,
5, 5, 5, 2, 2, 2;
Eigen::MatrixXi onesFilled(6, 6);
onesFilled << 0, 5, 5, 0, 0, 3,
5, 5, 5, 5, 0, 0,
0, 5, 5, 0, 0, 2,
0, 0, 0, 0, 2, 2,
0, 2, 2, 2, 2, 2,
0, 0, 0, 2, 2, 2;
Eigen::MatrixXi twosFilled(6, 6);
twosFilled << 0, 1, 1, 0, 0, 3,
1, 1, 1, 1, 0, 0,
0, 1, 1, 0, 0, 5,
0, 0, 0, 0, 5, 5,
0, 5, 5, 5, 5, 5,
0, 0, 0, 5, 5, 5;
Eigen::MatrixXi threeFilled(6, 6);
threeFilled << 0, 1, 1, 0, 0, 5,
1, 1, 1, 1, 0, 0,
0, 1, 1, 0, 0, 2,
0, 0, 0, 0, 2, 2,
0, 2, 2, 2, 2, 2,
0, 0, 0, 2, 2, 2;
Eigen::MatrixXi expectedZerosFilled = image;
Eigen::MatrixXi expectedOnesFilled = image;
Eigen::MatrixXi expectedTwosFilled = image;
Eigen::MatrixXi expectedThreeFilled = image;
chapter_08::paintFill(expectedZerosFilled, Eigen::Vector2i(2, 0), 5);
chapter_08::paintFill(expectedOnesFilled, Eigen::Vector2i(1, 2), 5);
chapter_08::paintFill(expectedTwosFilled, Eigen::Vector2i(4, 3), 5);
chapter_08::paintFill(expectedThreeFilled, Eigen::Vector2i(0, 5), 5);
REQUIRE(zerosFilled.isApprox(expectedZerosFilled));
REQUIRE(onesFilled.isApprox(expectedOnesFilled));
REQUIRE(twosFilled.isApprox(expectedTwosFilled));
REQUIRE(threeFilled.isApprox(expectedThreeFilled));
}
TEST_CASE("Chapter 10 - Problem 01 - sortedMerge()","test"){
int A[10] = {5, 5, 10, 10, 15}; // remainder of uninitialized values set to zero implicitly
int B[5] = {3, 6, 9, 12, 15};
int lastA = 4; // index of last item placed in A
int lastB = 4; // index of last item placed in B
int C[10] = {3, 5, 5, 6, 9, 10, 10, 12, 15, 15};
chapter_10::sortedMerge(&A[0], lastA, &B[0], lastB);
for (int i = 0; i < 10; i++){
REQUIRE(A[i] == C[i]);
}
int D[10] = {5, 5, 10, 10}; // remainder of uninitialized values set to zero implicitly
int E[6] = {3, 6, 9, 12, 15, 15};
int lastD = 3; // index of last item placed in D
int lastE = 5; // index of last item placed in E
chapter_10::sortedMerge(&D[0], lastD, &E[0], lastE);
for (int i = 0; i < 10; i++){
REQUIRE(D[i] == C[i]);
}
}
TEST_CASE("Chapter 12 - Problem 02 - reverse()", "test"){
char s1[] = "Alex";
char s1Rev[] = "xelA";
char s2[] = "a";
char s2Rev[] = "a";
chapter_12::reverse(&s1[0]);
chapter_12::reverse(&s2[0]);
// strcmp returns 0 if the 2 strings are equal.
REQUIRE(strcmp(&s1[0], &s1Rev[0]) == 0);
REQUIRE(strcmp(&s2[0], &s2Rev[0]) == 0);
}
TEST_CASE("Chapter 12 - Problem 12 - copyNode()", "test"){
std::vector<int> targetVector = {1,2,3,4,5,6,7};
chapter_02::SinglyLinkedNode<int>* head = chapter_02::vectorToList(targetVector);
chapter_02::SinglyLinkedNode<int>* copy = chapter_12::copyNode(head);
REQUIRE(targetVector == chapter_02::listToVector(copy)); // check that the values contained in nodes are identical
// Check that the pointers in the head linked list are *not* the same as the pointers in the copy likned list
// This is to verify a copy was actually made.
while (head != nullptr && copy != nullptr){
REQUIRE(head != copy);
head = head->getNext();
copy = copy->getNext();
}
}
TEST_CASE("Misc Exercises - makeIntegralImage()", "test"){
Eigen::MatrixXd input1(4, 4);
input1 << 1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1;
Eigen::MatrixXd output1(4, 4);
output1 << 1, 2, 3, 4,
2, 4, 6, 8,
3, 6, 9, 12,
4, 8, 12, 16;
REQUIRE(output1.isApprox(misc::makeIntegralImage(input1)));
Eigen::MatrixXd output2(4, 4);
output2 << 1, 3, 6, 10,
3, 9, 18, 30,
6, 18, 36, 60,
10, 30, 60, 100;
REQUIRE(output2.isApprox(misc::makeIntegralImage(output1)));
}
TEST_CASE("Misc Exercises - boxFilter()", "test"){
}
| 43.069909 | 162 | 0.629958 | [
"vector"
] |
7089ffef66dea8719c1e8e7fe2d2e99a6e6ca2d3 | 1,882 | hpp | C++ | module-db/Database/DatabaseInitializer.hpp | bitigchi/MuditaOS | 425d23e454e09fd6ae274b00f8d19c57a577aa94 | [
"BSL-1.0"
] | 369 | 2021-11-10T09:20:29.000Z | 2022-03-30T06:36:58.000Z | module-db/Database/DatabaseInitializer.hpp | bitigchi/MuditaOS | 425d23e454e09fd6ae274b00f8d19c57a577aa94 | [
"BSL-1.0"
] | 149 | 2021-11-10T08:38:35.000Z | 2022-03-31T23:01:52.000Z | module-db/Database/DatabaseInitializer.hpp | bitigchi/MuditaOS | 425d23e454e09fd6ae274b00f8d19c57a577aa94 | [
"BSL-1.0"
] | 41 | 2021-11-10T08:30:37.000Z | 2022-03-29T08:12:46.000Z | // Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include "Database.hpp"
#include <fstream>
#include <filesystem>
namespace
{
template <typename T> inline bool starts_with(const T &str, const T &start)
{
if (start.size() > str.size())
return false;
return str.compare(0, start.size(), start) == 0;
}
template <typename T> inline bool ends_with(const T &str, const T &end)
{
if (end.size() > str.size())
return false;
return std::equal(end.rbegin(), end.rend(), str.rbegin());
}
} // namespace
class DatabaseInitializer
{
class ScopedFile
{
public:
ScopedFile(std::string path, std::string mode)
{
file = std::fopen(path.c_str(), mode.c_str());
}
~ScopedFile()
{
std::fclose(file);
}
[[nodiscard]] std::FILE *get() const
{
return file;
}
private:
std::FILE *file = nullptr;
};
public:
DatabaseInitializer(Database *db);
~DatabaseInitializer() = default;
auto run(std::filesystem::path path, std::string ext = "sql") -> bool;
auto readCommands(std::filesystem::path filePath) -> std::vector<std::string>;
auto listFiles(std::filesystem::path path, std::string prefix, std::string ext)
-> std::vector<std::filesystem::path>;
auto executeOnDb(const std::vector<std::string> statements) -> bool;
private:
/*
* Splits filename in format <prefix>_<num>.ext into array
* [0] - filename
* [1] - prefix
* [2] - num
*/
auto splitFilename(std::string filename) -> std::array<std::string, 3>;
std::string readContent(const char *filename) const noexcept;
Database *db = nullptr;
};
| 25.093333 | 83 | 0.586079 | [
"vector"
] |
708c8194661be2e619d50dcc1cc3e7c769a6f004 | 3,443 | cpp | C++ | automatic_controller.cpp | aclement30/bondi | 17753c80f4f6a69b30a10ec2d7f42c29fb1ee0c6 | [
"Apache-2.0"
] | null | null | null | automatic_controller.cpp | aclement30/bondi | 17753c80f4f6a69b30a10ec2d7f42c29fb1ee0c6 | [
"Apache-2.0"
] | null | null | null | automatic_controller.cpp | aclement30/bondi | 17753c80f4f6a69b30a10ec2d7f42c29fb1ee0c6 | [
"Apache-2.0"
] | null | null | null | #include "config.h"
#include "display_service.h"
#include "keypad_service.h"
#include "location_service.h"
#include "meal_service.h"
#include "navigation_menu.h"
#include "safety_service.h"
#include "state_manager.h"
#include "string.h"
#include "automatic_controller.h"
using namespace std;
AutomaticController::AutomaticController() {}
AutomaticController::~AutomaticController() {
if (mealServicePtr != NULL) {
delete mealServicePtr;
}
}
void AutomaticController::handle() {
// Skip if there is already a meal being distributed
if (hasCurrentMeal()) {
if (!mealServicePtr->isDistributionCompleted()) {
mealServicePtr->distributeMeal();
} else {
mealServicePtr->displayMealCompletionScreen();
delete mealServicePtr;
mealServicePtr = NULL;
}
} else {
displayAutomaticModeScreen();
KeypadService::getInstance().waitForActivity(5000);
// Do nothing until feeder is docked
if (!LocationService::getInstance().isDocked()) {
return;
}
int scheduledMealId = MealService::getScheduledMealId(AppConfig::getInstance().meals);
if (scheduledMealId == 0) {
return;
}
if (mealServicePtr != NULL) {
delete mealServicePtr;
mealServicePtr = NULL;
}
// Display short warning notice before moving
SafetyService::getInstance().displayMovingWarning();
mealServicePtr = new MealService(scheduledMealId);
mealServicePtr->displayMealDistributionScreen();
mealServicePtr->startDistribution();
return;
}
}
void AutomaticController::resume() {
if (hasCurrentMeal()) {
mealServicePtr->displayMealDistributionScreen();
}
handle();
}
void AutomaticController::escape() {
if (!hasCurrentMeal()) {
// Immediately go back to main menu
StateManager::getInstance().changeState(MainMenu);
return;
}
// Pause distribution
mealServicePtr->stopFeeding();
// Ask if distribution should be cancelled
bool cancelDistribution = displayEscapeConfirmationScreen();
if (cancelDistribution) {
StateManager::getInstance().changeState(MainMenu);
}
}
void AutomaticController::safetyStop() {
if (mealServicePtr != NULL) {
mealServicePtr->safetyStop();
}
}
// PRIVATE
bool AutomaticController::hasCurrentMeal() {
return mealServicePtr != NULL;
}
void AutomaticController::displayAutomaticModeScreen() {
const static char title[] PROGMEM = "MODE: AUTO";
const static char waitingMsg[] PROGMEM = "En attente";
DisplayService::getInstance().clearScreen();
DisplayService::getInstance().printTitle(getString(title));
DisplayService::getInstance().addBorder();
DisplayService::getInstance().printCenter(getString(waitingMsg), 2);
}
bool AutomaticController::displayEscapeConfirmationScreen() {
const static char confirmButtonText[] PROGMEM = "Continuer";
const static char errorMsg1[] PROGMEM = "La distribution du";
const static char errorMsg2[] PROGMEM = "repas sera annulee !";
vector<string> errorMessage = {
getString(errorMsg1),
getString(errorMsg2)
};
DisplayService::getInstance().showWarningScreen(errorMessage, getString(confirmButtonText));
return KeypadService::getInstance().waitForConfirmation();
} | 27.99187 | 96 | 0.672669 | [
"vector"
] |
70915e74945431d3358f1072478a4c744a91b7d9 | 2,244 | hpp | C++ | include/moost/murcl/request.hpp | lastfm/libmoost | 895db7cc5468626f520971648741488c373c5cff | [
"MIT"
] | 37 | 2015-02-22T17:15:44.000Z | 2022-02-24T02:24:41.000Z | include/moost/murcl/request.hpp | lastfm/libmoost | 895db7cc5468626f520971648741488c373c5cff | [
"MIT"
] | null | null | null | include/moost/murcl/request.hpp | lastfm/libmoost | 895db7cc5468626f520971648741488c373c5cff | [
"MIT"
] | 11 | 2015-02-12T04:35:06.000Z | 2022-01-19T12:46:32.000Z | /* vim:set ts=3 sw=3 sts=3 et: */
/**
* Copyright © 2008-2013 Last.fm Limited
*
* This file is part of libmoost.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* @file request.hpp
* @brief Represents an abstraction of a LibCurl request
* @author Ricky Cormier
* @version 0.0.0.1
* @date 2011-10-17
*/
#ifndef FM_LAST_MOOST_MURCL_REQUEST_HPP__
#define FM_LAST_MOOST_MURCL_REQUEST_HPP__
#include <stdexcept>
#include <iostream>
#include <boost/bind.hpp>
#include <curl/curl.h>
#include "easy.hpp"
#include "response.hpp"
namespace moost { namespace murcl {
class request
{
public:
/**
* @brief This class represents a LibCurl request
*
* @param peasy
* a pointer to a LibCurl easy interface handle
*/
request(easy::ptr peasy)
: peasy_(peasy)
{
}
/**
* @brief Performs a LibCurl request and generates a response
*
* @param resp
* a reference to a response object
*/
void perform(response & resp)
{
peasy_->set_option<easyopt::writedata>(resp());
peasy_->set_option<easyopt::writecb>(response::callback);
peasy_->perform();
}
private:
easy::ptr peasy_;
};
}}
#endif // FM_LAST_MOOST_MURCL_REQUEST_HPP__
| 26.714286 | 71 | 0.711676 | [
"object"
] |
7094723fc98d8f74c4897891751a811460bb69f0 | 32,655 | cpp | C++ | gdal/ogr/ogrsf_frmts/idb/ogridbtablelayer.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | 3,100 | 2015-01-02T10:33:40.000Z | 2022-03-31T02:06:51.000Z | gdal/ogr/ogrsf_frmts/idb/ogridbtablelayer.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | 3,496 | 2015-01-06T16:53:30.000Z | 2022-03-31T20:18:51.000Z | gdal/ogr/ogrsf_frmts/idb/ogridbtablelayer.cpp | jpapadakis/gdal | f07aa15fd65af36b04291303cc6834c87f662814 | [
"MIT"
] | 2,036 | 2015-01-08T20:22:12.000Z | 2022-03-31T10:24:08.000Z | /******************************************************************************
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Implements OGRIDBTableLayer class, access to an existing table
* (based on ODBC and PG drivers).
* Author: Oleg Semykin, oleg.semykin@gmail.com
*
******************************************************************************
* Copyright (c) 2006, Oleg Semykin
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#include "cpl_conv.h"
#include "cpl_string.h"
#include "ogr_idb.h"
CPL_CVSID("$Id$")
/************************************************************************/
/* OGRIDBTableLayer() */
/************************************************************************/
OGRIDBTableLayer::OGRIDBTableLayer( OGRIDBDataSource *poDSIn )
{
poDS = poDSIn;
pszQuery = nullptr;
bUpdateAccess = TRUE;
bHaveSpatialExtents = FALSE;
iNextShapeId = 0;
poFeatureDefn = nullptr;
}
/************************************************************************/
/* ~OGRIDBTableLayer() */
/************************************************************************/
OGRIDBTableLayer::~OGRIDBTableLayer()
{
CPLFree( pszQuery );
ClearQuery();
}
/************************************************************************/
/* Initialize() */
/************************************************************************/
CPLErr OGRIDBTableLayer::Initialize( const char *pszTableName,
const char *pszGeomCol,
int bUpdate )
{
bUpdateAccess = bUpdate;
ITConnection *poConn = poDS->GetConnection();
if ( pszFIDColumn )
{
CPLFree( pszFIDColumn );
pszFIDColumn = nullptr;
}
/* -------------------------------------------------------------------- */
/* Do we have a simple primary key? */
/* -------------------------------------------------------------------- */
if ( pszFIDColumn== nullptr )
{
ITCursor oGetKey( *poConn );
CPLString osSql =
" select sc.colname"
" from syscolumns sc, sysindexes si, systables st"
" where st.tabid = si.tabid"
" and st.tabid = sc.tabid"
" and si.idxtype = 'U'"
" and sc.colno = si.part1"
" and si.part2 = 0" // only one-column keys
" and st.tabname='";
osSql += pszTableName;
osSql += "'";
if( oGetKey.Prepare( osSql.c_str() ) &&
oGetKey.Open(ITCursor::ReadOnly) )
{
ITValue * poVal = oGetKey.Fetch();
if ( poVal && poVal->IsNull() == false )
{
pszFIDColumn = CPLStrdup(poVal->Printable());
poVal->Release();
}
if( oGetKey.Fetch() ) // more than one field in key!
{
CPLFree( pszFIDColumn );
pszFIDColumn = nullptr;
CPLDebug("OGR_IDB", "Table %s has multiple primary key fields,"
" ignoring them all.", pszTableName );
}
}
}
/* -------------------------------------------------------------------- */
/* Have we been provided a geometry column? */
/* -------------------------------------------------------------------- */
CPLFree( pszGeomColumn );
if( pszGeomCol== nullptr )
pszGeomColumn = nullptr;
else
pszGeomColumn = CPLStrdup( pszGeomCol );
/* -------------------------------------------------------------------- */
/* Get the column definitions for this table. */
/* -------------------------------------------------------------------- */
ITCursor oGetCol( *poConn );
CPLErr eErr;
CPLString sql;
sql.Printf( "select * from %s where 1=0", pszTableName );
if( ! oGetCol.Prepare( sql.c_str() ) ||
! oGetCol.Open(ITCursor::ReadOnly) )
return CE_Failure;
eErr = BuildFeatureDefn( pszTableName, &oGetCol );
if( eErr != CE_None )
return eErr;
if( poFeatureDefn->GetFieldCount() == 0 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"No column definitions found for table '%s', layer not usable.",
pszTableName );
return CE_Failure;
}
/* -------------------------------------------------------------------- */
/* Do we have XMIN, YMIN, XMAX, YMAX extent fields? */
/* -------------------------------------------------------------------- */
if( poFeatureDefn->GetFieldIndex( "XMIN" ) != -1
&& poFeatureDefn->GetFieldIndex( "XMAX" ) != -1
&& poFeatureDefn->GetFieldIndex( "YMIN" ) != -1
&& poFeatureDefn->GetFieldIndex( "YMAX" ) != -1 )
{
bHaveSpatialExtents = TRUE;
CPLDebug( "OGR_IDB", "Table %s has geometry extent fields.",
pszTableName );
}
/* -------------------------------------------------------------------- */
/* If we got a geometry column, does it exist? Is it binary? */
/* -------------------------------------------------------------------- */
if( pszGeomColumn != nullptr )
{
int iColumn = oGetCol.RowType()->ColumnId( pszGeomColumn );
if( iColumn < 0 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Column %s requested for geometry, but it does not exist.",
pszGeomColumn );
CPLFree( pszGeomColumn );
pszGeomColumn = nullptr;
}
bGeomColumnWKB = TRUE;
/*else
{
if( ITCursor::GetTypeMapping(
oGetCol.GetColType( iColumn )) == SQL_C_BINARY )
bGeomColumnWKB = TRUE;
}*/
}
return CE_None;
}
/************************************************************************/
/* ClearQuery() */
/************************************************************************/
void OGRIDBTableLayer::ClearQuery()
{
if( m_poCurr != nullptr )
{
m_poCurr->Close();
delete m_poCurr;
m_poCurr = nullptr;
}
}
/************************************************************************/
/* GetQuery() */
/************************************************************************/
ITCursor *OGRIDBTableLayer::GetQuery()
{
if( m_poCurr== nullptr )
ResetQuery();
return m_poCurr;
}
/************************************************************************/
/* ResetQuery() */
/************************************************************************/
OGRErr OGRIDBTableLayer::ResetQuery()
{
ClearQuery();
iNextShapeId = 0;
m_poCurr = new ITCursor( *poDS->GetConnection() );
// Create list of fields
CPLString osFields;
if ( pszGeomColumn )
{
if ( ! osFields.empty() )
osFields += ",";
osFields += "st_asbinary(";
osFields += pszGeomColumn;
osFields += ") as ";
osFields += pszGeomColumn;
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
if ( ! osFields.empty() )
osFields += ",";
osFields += poFeatureDefn->GetFieldDefn(i)->GetNameRef();
}
CPLString sql;
sql += "SELECT ";
sql += osFields;
sql += " FROM ";
sql += poFeatureDefn->GetName();
/* Append attribute query if we have it */
if( pszQuery != nullptr )
{
sql += " WHERE ";
sql += pszQuery;
}
/* If we have a spatial filter, and per record extents, query on it */
if( m_poFilterGeom != nullptr && bHaveSpatialExtents )
{
if( pszQuery== nullptr )
sql += " WHERE";
else
sql += " AND";
CPLString sqlTmp;
sqlTmp.Printf( "%s XMAX > %.8f AND XMIN < %.8f"
" AND YMAX > %.8f AND YMIN < %.8f",
sql.c_str(),
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MaxX,
m_sFilterEnvelope.MinY, m_sFilterEnvelope.MaxY );
sql = sqlTmp;
}
/* If we have a spatial filter and GeomColumn, query using st_intersects function */
else if( m_poFilterGeom != nullptr && pszGeomColumn )
{
if( pszQuery== nullptr )
sql += " WHERE";
else
sql += " AND";
CPLString sqlTmp;
sqlTmp.Printf(
"%s st_intersects(st_geomfromtext('POLYGON((%.8f %.8f, %.8f %.8f, %.8f %.8f, %.8f %.8f, %.8f %.8f))',0),%s)",
sql.c_str(),
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MinY,
m_sFilterEnvelope.MaxX, m_sFilterEnvelope.MinY,
m_sFilterEnvelope.MaxX, m_sFilterEnvelope.MaxY,
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MaxY,
m_sFilterEnvelope.MinX, m_sFilterEnvelope.MinY, pszGeomColumn );
sql = sqlTmp;
}
CPLDebug( "OGR_IDB", "Exec(%s)", sql.c_str() );
if( m_poCurr->Prepare( sql.c_str() ) &&
m_poCurr->Open(ITCursor::ReadOnly) )
{
return OGRERR_NONE;
}
else
{
delete m_poCurr;
m_poCurr = nullptr;
return OGRERR_FAILURE;
}
}
/************************************************************************/
/* ResetReading() */
/************************************************************************/
void OGRIDBTableLayer::ResetReading()
{
ClearQuery();
OGRIDBLayer::ResetReading();
}
/************************************************************************/
/* GetFeature() */
/************************************************************************/
OGRFeature *OGRIDBTableLayer::GetFeature( GIntBig nFeatureId )
{
if( pszFIDColumn== nullptr )
return OGRIDBLayer::GetFeature( nFeatureId );
ClearQuery();
iNextShapeId = nFeatureId;
m_poCurr = new ITCursor( *poDS->GetConnection() );
// Create list of fields
CPLString osFields;
if ( poFeatureDefn->GetFieldIndex( pszFIDColumn ) == -1 )
osFields += pszFIDColumn;
if ( pszGeomColumn )
{
if ( ! osFields.empty() )
osFields += ",";
osFields += "st_asbinary(";
osFields += pszGeomColumn;
osFields += ") as ";
osFields += pszGeomColumn;
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
if ( ! osFields.empty() )
osFields += ",";
osFields += poFeatureDefn->GetFieldDefn(i)->GetNameRef();
}
CPLString sql;
sql.Printf( "SELECT %s FROM %s WHERE %s = " CPL_FRMT_GIB,
osFields.c_str(), poFeatureDefn->GetName(),
pszFIDColumn, nFeatureId );
CPLDebug( "OGR_IDB", "ExecuteSQL(%s)", sql.c_str() );
if( !m_poCurr->Prepare( sql.c_str() ) ||
!m_poCurr->Open(ITCursor::ReadOnly) )
{
delete m_poCurr;
m_poCurr = nullptr;
return nullptr;
}
return GetNextRawFeature();
}
/************************************************************************/
/* SetAttributeFilter() */
/************************************************************************/
OGRErr OGRIDBTableLayer::SetAttributeFilter( const char *pszQueryIn )
{
CPLFree(m_pszAttrQueryString);
m_pszAttrQueryString = (pszQueryIn) ? CPLStrdup(pszQueryIn) : nullptr;
if( (pszQueryIn== nullptr && this->pszQuery == nullptr)
|| (pszQueryIn != nullptr && this->pszQuery != nullptr
&& EQUAL(pszQueryIn,this->pszQuery)) )
return OGRERR_NONE;
CPLFree( this->pszQuery );
this->pszQuery = CPLStrdup( pszQueryIn );
ClearQuery();
return OGRERR_NONE;
}
/************************************************************************/
/* TestCapability() */
/************************************************************************/
int OGRIDBTableLayer::TestCapability( const char * pszCap )
{
if( EQUAL(pszCap,OLCSequentialWrite) ||
EQUAL(pszCap,OLCRandomWrite) )
return bUpdateAccess;
else if( EQUAL(pszCap,OLCRandomRead) )
return TRUE;
else
return OGRIDBLayer::TestCapability( pszCap );
}
/************************************************************************/
/* GetFeatureCount() */
/* */
/* If a spatial filter is in effect, we turn control over to */
/* the generic counter. Otherwise we return the total count. */
/* Eventually we should consider implementing a more efficient */
/* way of counting features matching a spatial query. */
/************************************************************************/
GIntBig OGRIDBTableLayer::GetFeatureCount( int bForce )
{
return OGRIDBLayer::GetFeatureCount( bForce );
}
/************************************************************************/
/* GetSpatialRef() */
/* */
/* We override this to try and fetch the table SRID from the */
/* geometry_columns table if the srsid is -2 (meaning we */
/* haven't yet even looked for it). */
/************************************************************************/
OGRSpatialReference *OGRIDBTableLayer::GetSpatialRef()
{
if( nSRSId == -2 )
{
nSRSId = -1;
if ( ! pszGeomColumn )
return nullptr;
CPLString osCmd;
osCmd.Printf( " SELECT FIRST 1 srid, trim(srtext)"
" FROM spatial_ref_sys, %s"
" WHERE srid = ST_Srid(%s) ",
poFeatureDefn->GetName(), pszGeomColumn );
ITCursor oSridCur( *poDS->GetConnection() );
if( oSridCur.Prepare( osCmd.c_str() )&&
oSridCur.Open( ITCursor::ReadOnly ) )
{
ITRow * row = static_cast<ITRow *>( oSridCur.NextRow() );
if ( row && ! row->IsNull() )
{
nSRSId = atoi(row->Column(0)->Printable());
const char * wkt = row->Column(1)->Printable();
if ( poSRS )
{
// Hmm ... it should be null
delete poSRS;
}
poSRS = new OGRSpatialReference();
poSRS->SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER);
if ( poSRS->importFromWkt( wkt ) != OGRERR_NONE )
{
CPLError( CE_Warning, CPLE_AppDefined,
"Error parse srs wkt: %s", wkt );
delete poSRS;
poSRS = nullptr;
}
}
}
}
return OGRIDBLayer::GetSpatialRef();
}
#if 0
OGRErr OGRIDBTableLayer::ISetFeature( OGRFeature *poFeature )
{
OGRErr eErr(OGRERR_FAILURE);
if ( ! bUpdateAccess )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error update feature. Layer is read only." );
return eErr;
}
if( nullptr == poFeature )
{
CPLError( CE_Failure, CPLE_AppDefined,
"NULL pointer to OGRFeature passed to SetFeature()." );
return eErr;
}
if( poFeature->GetFID() == OGRNullFID )
{
CPLError( CE_Failure, CPLE_AppDefined,
"FID required on features given to SetFeature()." );
return eErr;
}
ITStatement oQuery( *poDS->GetConnection() );
int bUpdateGeom = TRUE;
OGRwkbGeometryType nGeomType = poFeature->GetGeometryRef()->getGeometryType();
CPLString osGeomFunc;
int nSrid = 0; // FIXME Obtain geometry SRID
switch (nGeomType)
{
case wkbPoint:
osGeomFunc = "ST_PointFromText";
break;
case wkbLineString:
osGeomFunc = "ST_LineFromText";
break;
case wkbPolygon:
osGeomFunc = "ST_PolyFromText";
break;
case wkbMultiPoint:
osGeomFunc = "ST_MPointFromText";
break;
case wkbMultiLineString:
osGeomFunc = "ST_MLineFromText";
break;
case wkbMultiPolygon:
osGeomFunc = "ST_MPolyFromText";
break;
default:
bUpdateGeom = FALSE;
CPLDebug("OGR_IDB", "SetFeature(): Unknown geometry type. Geometry will not be updated.");
}
// Create query
CPLString osSql;
CPLString osFields;
if ( pszGeomColumn && bUpdateGeom )
{
osFields.Printf( "%s = %s( ?, %d )", pszGeomColumn, osGeomFunc.c_str(), nSrid );
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
const char * pszFieldName = poFeatureDefn->GetFieldDefn(i)->GetNameRef();
// skip fid column from update
if ( EQUAL( pszFIDColumn, pszFieldName ) )
continue;
if ( ! osFields.empty() )
{
osFields += ",";
}
osFields += pszFieldName;
osFields += "=?";
}
osSql.Printf( "UPDATE %s SET %s WHERE %s = %d",
poFeatureDefn->GetName(),
osFields.c_str(),
pszFIDColumn,
poFeature->GetFID() );
if ( ! oQuery.Prepare( osSql.c_str() ) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare SQL.\n%s",osSql.c_str() );
return eErr;
}
int iParam = 0;
if ( pszGeomColumn && bUpdateGeom )
{
ITValue * par = oQuery.Param( iParam ); // it should be a geom value
if ( ! par )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare geom param");
return eErr;
}
OGRGeometry * poGeom = poFeature->GetGeometryRef();
char * wkt;
poGeom->exportToWkt( &wkt );
if( ! par->FromPrintable( wkt ) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare geom param");
par->Release();
return eErr;
}
CPLFree( wkt );
par->Release();
iParam++;
}
for ( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
ITValue * par = oQuery.Param( iParam );
if ( ! par )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare param %d", iParam);
return eErr;
}
if ( ! poFeature->IsFieldSetAndNotNull( i ) )
{
if ( ! par->SetNull() )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error set param %d to NULL", iParam);
par->Release();
return eErr;
}
par->Release();
continue;
}
ITConversions * cv = 0;
bool res = FALSE;
if ( par->QueryInterface( ITConversionsIID, (void **) &cv) !=
IT_QUERYINTERFACE_SUCCESS )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare param %d", iParam);
par->Release();
return eErr;
}
switch ( poFeatureDefn->GetFieldDefn( i )->GetType() )
{
case OFTInteger:
res = cv->ConvertFrom( poFeature->GetFieldAsInteger( i ) );
break;
case OFTReal:
res = cv->ConvertFrom( poFeature->GetFieldAsDouble( i ) );
break;
case OFTIntegerList:
case OFTRealList:
case OFTStringList:
// FIXME Prepare array of values field
//cv->ConvertFrom( poFeature->GetFieldAsStringList( i ) );
//break;
case OFTBinary:
// FIXME Prepare binary field
case OFTString:
case OFTDate:
case OFTTime:
case OFTDateTime:
res = cv->ConvertFrom( poFeature->GetFieldAsString( i ) );
break;
default:
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare param %d. Unknown data type.", iParam);
cv->Release();
par->Release();
return eErr;
}
if ( res != TRUE )
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare param.");
cv->Release();
par->Release();
}
CPLDebug( "OGR_IDB", "ExecuteSQL(%s)", oQuery.QueryText().Data() );
if( !oQuery.Exec() )
{
CPLError( CE_Failure, CPLE_AppDefined, "Error update Feature.");
return eErr;
}
return OGRERR_NONE;
}
#endif
OGRErr OGRIDBTableLayer::ISetFeature( OGRFeature *poFeature )
{
OGRErr eErr(OGRERR_FAILURE);
if ( ! bUpdateAccess )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error update feature. Layer is read only." );
return eErr;
}
if( nullptr == poFeature )
{
CPLError( CE_Failure, CPLE_AppDefined,
"NULL pointer to OGRFeature passed to SetFeature()." );
return eErr;
}
if( poFeature->GetFID() == OGRNullFID )
{
CPLError( CE_Failure, CPLE_AppDefined,
"FID required on features given to SetFeature()." );
return eErr;
}
ITStatement oQuery( *poDS->GetConnection() );
int bUpdateGeom = TRUE;
CPLString osGeomFunc;
if ( poFeature->GetGeometryRef() )
{
OGRwkbGeometryType nGeomType = poFeature->GetGeometryRef()->getGeometryType();
switch (nGeomType)
{
case wkbPoint:
osGeomFunc = "ST_PointFromText";
break;
case wkbLineString:
osGeomFunc = "ST_LineFromText";
break;
case wkbPolygon:
osGeomFunc = "ST_PolyFromText";
break;
case wkbMultiPoint:
osGeomFunc = "ST_MPointFromText";
break;
case wkbMultiLineString:
osGeomFunc = "ST_MLineFromText";
break;
case wkbMultiPolygon:
osGeomFunc = "ST_MPolyFromText";
break;
default:
bUpdateGeom = FALSE;
CPLDebug("OGR_IDB", "SetFeature(): Unknown geometry type. Geometry will not be updated.");
}
}
else
{
bUpdateGeom = FALSE;
}
// Create query
CPLString osSql;
CPLString osFields;
if ( pszGeomColumn && bUpdateGeom )
{
OGRGeometry * poGeom = poFeature->GetGeometryRef();
char * wkt;
poGeom->exportToWkt( &wkt );
osFields.Printf( "%s = %s( '%s', %d )", pszGeomColumn, osGeomFunc.c_str(), wkt, nSRSId );
CPLFree( wkt );
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
const char * pszFieldName = poFeatureDefn->GetFieldDefn(i)->GetNameRef();
// skip fid column from update
if ( EQUAL( pszFIDColumn, pszFieldName ) )
continue;
if ( ! osFields.empty() )
{
osFields += ",";
}
osFields += pszFieldName;
osFields += "=";
if ( ! poFeature->IsFieldSetAndNotNull( i ) )
{
osFields += "NULL";
continue;
}
CPLString osVal;
switch ( poFeatureDefn->GetFieldDefn( i )->GetType() )
{
case OFTInteger:
osVal.Printf( "%d", poFeature->GetFieldAsInteger( i ) );
break;
case OFTReal:
if ( poFeatureDefn->GetFieldDefn( i )->GetPrecision() )
{
// have a decimal format width.precision
CPLString osFormatString;
osFormatString.Printf( "%%%d.%df",
poFeatureDefn->GetFieldDefn( i )->GetWidth(),
poFeatureDefn->GetFieldDefn( i )->GetPrecision() );
osVal.Printf( osFormatString.c_str(), poFeature->GetFieldAsDouble( i ) );
}
else
osVal.Printf( "%f", poFeature->GetFieldAsDouble( i ) );
break;
case OFTIntegerList:
case OFTRealList:
case OFTStringList:
// FIXME Prepare array of values field
//cv->ConvertFrom( poFeature->GetFieldAsStringList( i ) );
//break;
case OFTBinary:
// FIXME Prepare binary field
case OFTString:
case OFTDate:
case OFTTime:
case OFTDateTime:
default:
osVal.Printf( "'%s'", poFeature->GetFieldAsString( i ) );
break;
}
osFields += osVal;
}
osSql.Printf( "UPDATE %s SET %s WHERE %s = " CPL_FRMT_GIB,
poFeatureDefn->GetName(),
osFields.c_str(),
pszFIDColumn,
poFeature->GetFID() );
if ( ! oQuery.Prepare( osSql.c_str() ) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare SQL.\n%s",osSql.c_str() );
return eErr;
}
CPLDebug( "OGR_IDB", "Exec(%s)", oQuery.QueryText().Data() );
if( !oQuery.Exec() )
{
CPLError( CE_Failure, CPLE_AppDefined, "Error update Feature.");
return eErr;
}
return OGRERR_NONE;
}
OGRErr OGRIDBTableLayer::ICreateFeature( OGRFeature *poFeature )
{
OGRErr eErr(OGRERR_FAILURE);
if ( ! bUpdateAccess )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error create feature. Layer is read only." );
return eErr;
}
if( nullptr == poFeature )
{
CPLError( CE_Failure, CPLE_AppDefined,
"NULL pointer to OGRFeature passed to CreateFeature()." );
return eErr;
}
if( poFeature->GetFID() != OGRNullFID && pszFIDColumn== nullptr )
{
CPLError( CE_Failure, CPLE_AppDefined,
"FID ignored on feature given to CreateFeature(). Unknown FID column." );
return eErr;
}
int bUpdateGeom = TRUE;
CPLString osGeomFunc;
if ( poFeature->GetGeometryRef() )
{
OGRwkbGeometryType nGeomType = poFeature->GetGeometryRef()->getGeometryType();
switch (nGeomType)
{
case wkbPoint:
osGeomFunc = "ST_PointFromText";
break;
case wkbLineString:
osGeomFunc = "ST_LineFromText";
break;
case wkbPolygon:
osGeomFunc = "ST_PolyFromText";
break;
case wkbMultiPoint:
osGeomFunc = "ST_MPointFromText";
break;
case wkbMultiLineString:
osGeomFunc = "ST_MLineFromText";
break;
case wkbMultiPolygon:
osGeomFunc = "ST_MPolyFromText";
break;
default:
bUpdateGeom = FALSE;
CPLDebug("OGR_IDB", "SetFeature(): Unknown geometry type. Geometry will not be updated.");
}
}
else
bUpdateGeom = FALSE;
// Create query
CPLString osSql;
CPLString osFields;
CPLString osValues;
if ( pszGeomColumn && bUpdateGeom )
{
OGRGeometry * poGeom = poFeature->GetGeometryRef();
char * wkt;
poGeom->exportToWkt( &wkt );
osFields += pszGeomColumn;
osValues.Printf( "%s( '%s', %d )", osGeomFunc.c_str(), wkt, nSRSId );
CPLFree( wkt );
}
for( int i = 0; i < poFeatureDefn->GetFieldCount(); i++ )
{
const char * pszFieldName = poFeatureDefn->GetFieldDefn(i)->GetNameRef();
// Skip NULL fields
if ( ! poFeature->IsFieldSetAndNotNull( i ) )
{
continue;
}
if ( ! osFields.empty() )
{
osFields += ",";
osValues += ",";
}
osFields += pszFieldName;
CPLString osVal;
switch ( poFeatureDefn->GetFieldDefn( i )->GetType() )
{
case OFTInteger:
osVal.Printf( "%d", poFeature->GetFieldAsInteger( i ) );
break;
case OFTReal:
if ( poFeatureDefn->GetFieldDefn( i )->GetPrecision() )
{
// have a decimal format width.precision
CPLString osFormatString;
osFormatString.Printf( "%%%d.%df",
poFeatureDefn->GetFieldDefn( i )->GetWidth(),
poFeatureDefn->GetFieldDefn( i )->GetPrecision() );
osVal.Printf( osFormatString.c_str(), poFeature->GetFieldAsDouble( i ) );
}
else
osVal.Printf( "%f", poFeature->GetFieldAsDouble( i ) );
break;
case OFTIntegerList:
case OFTRealList:
case OFTStringList:
// FIXME Prepare array of values field
//cv->ConvertFrom( poFeature->GetFieldAsStringList( i ) );
//break;
case OFTBinary:
// FIXME Prepare binary field
case OFTString:
case OFTDate:
case OFTTime:
case OFTDateTime:
default:
osVal.Printf( "'%s'", poFeature->GetFieldAsString( i ) );
break;
}
osValues += osVal;
}
osSql.Printf( "INSERT INTO %s (%s) VALUES (%s)",
poFeatureDefn->GetName(),
osFields.c_str(),
osValues.c_str() );
ITStatement oQuery( *poDS->GetConnection() );
if ( ! oQuery.Prepare( osSql.c_str() ) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Error prepare SQL.\n%s",osSql.c_str() );
return eErr;
}
CPLDebug( "OGR_IDB", "Exec(%s)", oQuery.QueryText().Data() );
if( !oQuery.Exec() )
{
CPLError( CE_Failure, CPLE_AppDefined, "Error create Feature.");
return eErr;
}
ITQuery oFidQuery( *poDS->GetConnection() );
osSql.Printf( "SELECT MAX(%s) from %s", pszFIDColumn, poFeatureDefn->GetName() );
CPLDebug( "OGR_IDB", "Exec(%s)", osSql.c_str() );
ITRow * row = oFidQuery.ExecOneRow( osSql.c_str() );
if( ! row || row->NumColumns() < 1 )
{
CPLError( CE_Failure, CPLE_AppDefined, "Error create Feature.");
return eErr;
}
int fid = atoi( row->Column(0)->Printable() );
if ( fid > 0 )
poFeature->SetFID( fid );
else
{
CPLError( CE_Failure, CPLE_AppDefined, "Error create Feature. Unable to get new fid" );
return eErr;
}
return OGRERR_NONE;
}
| 30.54724 | 125 | 0.472454 | [
"geometry"
] |
7098e6a014060611183d1e155cec26fe6c60c02d | 731 | hpp | C++ | include/lea/engine/drawable.hpp | jfalcou/lea | 85c3648af1b67aa70320df1c60fec457f82b5f81 | [
"MIT"
] | 2 | 2019-08-12T22:54:48.000Z | 2020-06-01T22:23:07.000Z | include/lea/engine/drawable.hpp | jfalcou/lea | 85c3648af1b67aa70320df1c60fec457f82b5f81 | [
"MIT"
] | null | null | null | include/lea/engine/drawable.hpp | jfalcou/lea | 85c3648af1b67aa70320df1c60fec457f82b5f81 | [
"MIT"
] | null | null | null | //==================================================================================================
/**
LEA - Little Engine Adventure
Copyright 2020 Joel FALCOU
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
**/
//==================================================================================================
#pragma once
#include <SFML/Graphics/Transform.hpp>
#include <lea/api.hpp>
#include <memory>
namespace sf
{
class RenderTarget;
}
namespace lea
{
struct LEA_API drawable
{
virtual ~drawable();
virtual void draw(sf::RenderTarget& target, sf::Transform const& transform = {}) const =0;
};
using drawable_t = std::unique_ptr<drawable>;
}
| 23.580645 | 100 | 0.51026 | [
"transform"
] |
709c56b2db5b303cab759e8fbc32530597b788c1 | 4,031 | cpp | C++ | src/condor_collector.V6/ad_transforms.cpp | sridish123/htcondor | 481d975fd8602242f6a052aab04e20b0b560db89 | [
"Apache-2.0"
] | 217 | 2015-01-08T04:49:42.000Z | 2022-03-27T10:11:58.000Z | src/condor_collector.V6/ad_transforms.cpp | sridish123/htcondor | 481d975fd8602242f6a052aab04e20b0b560db89 | [
"Apache-2.0"
] | 185 | 2015-05-03T13:26:31.000Z | 2022-03-28T03:08:59.000Z | src/condor_collector.V6/ad_transforms.cpp | sridish123/htcondor | 481d975fd8602242f6a052aab04e20b0b560db89 | [
"Apache-2.0"
] | 133 | 2015-02-11T09:17:45.000Z | 2022-03-31T07:28:54.000Z | /***************************************************************
*
* Copyright (C) 1990-2020, Condor Team, Computer Sciences Department,
* University of Wisconsin-Madison, WI.
*
* 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 "condor_common.h"
#include "condor_debug.h"
#include "condor_config.h"
#include "ad_transforms.h"
#include "condor_attributes.h"
void
AdTransforms::config(const char * param_prefix)
{
int rval;
// Setup xform_utils hashtable, and record a ckpt
m_mset.clear();
m_mset.init();
m_mset_ckpt = m_mset.save_state();
m_transforms_list.clear();
std::string adtransNames;
if( !param( adtransNames, (std::string(param_prefix) + "_TRANSFORM_NAMES").c_str() ) ) {
return;
}
StringList nameList(adtransNames.c_str());
nameList.rewind();
const char *name = nullptr;
while( (name = nameList.next()) ) {
if (!strcasecmp(name, "NAMES") ) { continue; } // prevent recursion!
std::string attributeName = std::string(param_prefix) + "_TRANSFORM_" + name;
// fetch unexpanded param, we will only expand it now for the old (classad) style transforms.
const char * raw_transform_text = param_unexpanded(attributeName.c_str());
if (!raw_transform_text) {
dprintf(D_ALWAYS, (std::string(param_prefix) + "_TRANSFORM_%s not defined, ignoring.\n").c_str(), name);
continue;
}
std::unique_ptr<MacroStreamXFormSource> xfm(new MacroStreamXFormSource(name));
// Always assume that the native xform is used, not the
// new-ClassAd style used by the JobRouter and JOB_TRANSFORM_*
std::string errmsg = "";
int offset = 0;
if ( (rval=xfm->open(raw_transform_text, offset, errmsg)) < 0 ) {
dprintf(D_ALWAYS, (std::string(param_prefix) + "_TRANSFORM_%s macro stream malformed, ignoring. (err=%d) %s\n").c_str(),
name, rval, errmsg.c_str());
continue;
}
// Finally, append the xfm to the end our list (order is important here!)
m_transforms_list.emplace_back(std::move(xfm));
std::string xfm_text;
dprintf(D_ALWAYS,
(std::string(param_prefix) + "_TRANSFORM_%s setup as transform rule #%lu :\n%s\n").c_str(),
name, m_transforms_list.size(), m_transforms_list.back()->getFormattedText(xfm_text, "\t") );
}
}
int
AdTransforms::transform(ClassAd *ad, CondorError *errorStack)
{
if (!shouldTransform()) {return 0;}
int transforms_applied = 0;
int transforms_considered = 0;
StringList attrs_changed;
int rval;
std::string errmsg;
std::string applied_names;
// Revert variables hashtable so it doesn't grow idefinitely
m_mset.rewind_to_state(m_mset_ckpt, false);
// Apply our ordered list of transforms to the ad, changing it in-place.
for (const auto &xfm : m_transforms_list) {
transforms_considered++;
if (!xfm->matches(ad)) {continue;}
rval = TransformClassAd(ad, *xfm, m_mset, errmsg);
if (rval < 0) {
dprintf(D_ALWAYS,
"ad transforms: ERROR applying transform %s (err=-3,rval=%d,msg=%s)\n",
xfm->getName(), rval, errmsg.c_str());
if (errorStack)
errorStack->pushf("TRANSFORM", 3, "ERROR applying transform %s: %s",
xfm->getName(), errmsg.c_str());
return -3;
}
if (IsFulldebug(D_FULLDEBUG)) {
if (transforms_applied) applied_names += ",";
applied_names += xfm->getName();
}
transforms_applied++;
}
dprintf( D_FULLDEBUG,
"ad transform: %d considered, %d applied (%s)\n",
transforms_considered, transforms_applied,
transforms_applied > 0 ? applied_names.c_str() : "<none>" );
return 0;
}
| 31.992063 | 123 | 0.682461 | [
"transform"
] |
70a48a46a935008c9a651f5604581d424a80c3a3 | 879 | cpp | C++ | hackerRank/interview prep kit/hash tables/ransomNote.cpp | mateuslatrova/competitive-programming | 96f24df172e14d2c52c4682aeaad132710a09dc7 | [
"MIT"
] | null | null | null | hackerRank/interview prep kit/hash tables/ransomNote.cpp | mateuslatrova/competitive-programming | 96f24df172e14d2c52c4682aeaad132710a09dc7 | [
"MIT"
] | null | null | null | hackerRank/interview prep kit/hash tables/ransomNote.cpp | mateuslatrova/competitive-programming | 96f24df172e14d2c52c4682aeaad132710a09dc7 | [
"MIT"
] | null | null | null | // Problem: https://www.hackerrank.com/challenges/ctci-ransom-note/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=dictionaries-hashmaps
#include <bits/stdc++.h>
using namespace std;
/*
* Complete the 'checkMagazine' function below.
*
* The function accepts following parameters:
* 1. STRING_ARRAY magazine
* 2. STRING_ARRAY note
*/
void checkMagazine(vector<string> magazine, vector<string> note) {
int m = magazine.size();
int n = note.size();
map<string,int> magazineTable;
for (string word: magazine) magazineTable[word]++;
for (string word: note) {
// If the word is in the magazine:
if (magazineTable.count(word) > 0 && magazineTable[word] > 0) {
magazineTable[word]--;
} else {
cout << "No";
return;
}
}
cout << "Yes";
} | 27.46875 | 178 | 0.640501 | [
"vector"
] |
70a64207d2f11a7fdf43959c31a1d138694ac291 | 5,119 | cpp | C++ | graspitCpp/utils/helper.cpp | awied1404/COPING | 0fe36c1835928db15fb36f752ca83f8d2c2e33d4 | [
"MIT"
] | null | null | null | graspitCpp/utils/helper.cpp | awied1404/COPING | 0fe36c1835928db15fb36f752ca83f8d2c2e33d4 | [
"MIT"
] | null | null | null | graspitCpp/utils/helper.cpp | awied1404/COPING | 0fe36c1835928db15fb36f752ca83f8d2c2e33d4 | [
"MIT"
] | null | null | null | //
// Created by andreas on 05.11.20.
//
#include "helper.h"
/**
* @fn bool eigenGraspToGraspMsg(const GraspIt::EigenGraspResult& eigenGraspResult, own_msg::eigenGraspResult &ownResult, int iSavedGrasps)
* @brief converts a graspit eigenGraspResult to a result that can be published to our interface
* @param eigenGraspResult eigenGraspResult computed by graspit
* @param ownResult result that will be published
* @param iSavedGrasps number of graspit results because we will tell that to the motion planning component
* @return true on success
*/
bool eigenGraspToGraspMsg(const GraspIt::EigenGraspResult& eigenGraspResult, own_msg::eigenGraspResult &ownResult, int iSavedGrasps)
{
/* copy values of object-to-hand transformation matrix */
for(int i = 0; i < 16; i++)
{
ownResult.matrix.data.push_back(eigenGraspResult.getObjectToHandTransform().data()[i]);
}
/* copy values of joints for a closing grasp */
for(int i = 0; i < eigenGraspResult.getGraspJointDOFs().size(); i++)
{
ownResult.jointValues.push_back(eigenGraspResult.getGraspJointDOFs().at(i));
}
ownResult.energy = eigenGraspResult.getEnergy();
ownResult.abort = 0; /* if grasp planning component doesn't find good results we can tell the motion planning component to stop */
ownResult.numberGrasps = iSavedGrasps;
return true;
}
/**
* @fn std::string getWorldFromFilePath(std::string sFilename)
* @brief isolates the world name from the whole filepath. The last string after a slash and before a dot will be
* seen as world file name
* @param sFilename filename with absolute/relative path
* @return name of the world
*/
std::string getWorldFromFilePath(std::string sFilename)
{
std::string sReturnValue;
std::vector<std::string> results;
boost::split(results, sFilename, [](char c){return c == '/';});
/* here we have the filename with file ending */
sReturnValue = results.at(results.size()-1);
results.clear();
/* get world name without filename*/
boost::split(results, sReturnValue, [](char c){return c == '.';});
return results.at(0);
}
/**
* @fn void publishAllGrasps(std::vector<GraspIt::EigenGraspResult> allGrasps, ros::Publisher &publisher)
* @brief publishes all grasps to the ros topic specified for the given publisher
* @param allGrasps graspit results
* @param publisher current ros publisher
*/
void publishAllGrasps(std::vector<GraspIt::EigenGraspResult> allGrasps, ros::Publisher &publisher)
{
ros::Rate rate(10); /* [Hz] */
int iSavedGrasps = allGrasps.size();
for(int n = 0; n < iSavedGrasps; n ++)
{
own_msg::eigenGraspResult eigenGraspResult;
eigenGraspToGraspMsg(allGrasps.at(n), eigenGraspResult, iSavedGrasps);
publisher.publish(eigenGraspResult);
/* as we don't have an async spinner we need to do the spinning by ourself so that message will arrive */
ros::spinOnce();
usleep(2 * 1000);
}
ROS_INFO("Grasps published");
}
/**
* @fn bool checkGraspsForDifferences(std::vector<GraspIt::EigenGraspResult> graspVector)
* @brief checks if in the given vector are grasps that really differ from each other or not
* @param graspVector vector that contains all grasps
* @return true if a certain difference was detected
*/
bool checkGraspsForDifferences(std::vector<GraspIt::EigenGraspResult> graspVector)
{
double dDifferencePosition = 5; /* mm */
double dDifferenceRotation = 0.2; /* rad */
bool bDifferentGraspsDetected = false;
std::vector<geometry_msgs::Pose> poses;
for(int i = 0; i < graspVector.size(); i++)
{
poses.push_back(tf2::toMsg(graspVector.at(i).getObjectToHandTransform()));
}
for(int i = 0; i < graspVector.size(); i++)
{
for(int j = 1; j < graspVector.size(); j++)
{
if(abs(poses.at(i).orientation.x - poses.at(j).orientation.x) > dDifferenceRotation)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).orientation.y - poses.at(j).orientation.y) > dDifferenceRotation)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).orientation.z - poses.at(j).orientation.z) > dDifferenceRotation)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).orientation.w - poses.at(j).orientation.w) > dDifferenceRotation)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).position.x - poses.at(j).position.x) > dDifferencePosition)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).position.y - poses.at(j).position.y) > dDifferencePosition)
{
bDifferentGraspsDetected = true;
}
else if(abs(poses.at(i).position.z - poses.at(j).position.z) > dDifferencePosition)
{
bDifferentGraspsDetected = true;
}
}
}
return bDifferentGraspsDetected;
}
| 38.780303 | 139 | 0.659308 | [
"object",
"vector"
] |
70a8bd91d544056f45df96a9cb6b7d14a01daf78 | 2,205 | cpp | C++ | Samples/HolographicMixedRealityCapture/cpp/Content/ControlBase.cpp | dujianxin/Windows-universal-samples | d4e95ff0ac408c5d4d980bb18d53fb2c6556a273 | [
"MIT"
] | 2,504 | 2019-05-07T06:56:42.000Z | 2022-03-31T19:37:59.000Z | Samples/HolographicMixedRealityCapture/cpp/Content/ControlBase.cpp | dujianxin/Windows-universal-samples | d4e95ff0ac408c5d4d980bb18d53fb2c6556a273 | [
"MIT"
] | 314 | 2019-05-08T16:56:30.000Z | 2022-03-21T07:13:45.000Z | Samples/HolographicMixedRealityCapture/cpp/Content/ControlBase.cpp | dujianxin/Windows-universal-samples | d4e95ff0ac408c5d4d980bb18d53fb2c6556a273 | [
"MIT"
] | 2,219 | 2019-05-07T00:47:26.000Z | 2022-03-30T21:12:31.000Z | #include "pch.h"
#include "ControlBase.h"
#include "Common\DirectXHelper.h"
using namespace HolographicMRCSample;
using namespace Concurrency;
using namespace DirectX;
using namespace Windows::Foundation::Numerics;
using namespace Windows::UI::Input::Spatial;
// Loads vertex and pixel shaders from files and instantiates the cube geometry.
ControlBase::ControlBase()
{
}
void ControlBase::Initialize(const std::shared_ptr<DX::DeviceResources>& deviceResources)
{
m_deviceResources = deviceResources;
CreateDeviceDependentResources();
}
ControlBase::~ControlBase()
{
m_children.clear();
}
void ControlBase::CreateDeviceDependentResources()
{
DoCreateDeviceDependentResources();
for (auto it = m_children.begin(); it != m_children.end(); it++)
{
it->get()->CreateDeviceDependentResources();
}
}
void ControlBase::ReleaseDeviceDependentResources()
{
DoReleaseDeviceDependentResources();
for (auto it = m_children.begin(); it != m_children.end(); it++)
{
it->get()->ReleaseDeviceDependentResources();
}
}
void ControlBase::Update(
const DX::StepTimer& timer,
HolographicFrame^ holographicFrame,
SpatialCoordinateSystem^ currentCoordinateSystem,
SpatialInteractionSourceState^ interactionSource)
{
Update(timer, holographicFrame, currentCoordinateSystem, interactionSource, DirectX::XMMatrixIdentity());
}
void ControlBase::Update(
const DX::StepTimer& timer,
HolographicFrame^ holographicFrame,
SpatialCoordinateSystem^ currentCoordinateSystem,
SpatialInteractionSourceState^ interactionSource,
const DirectX::XMMATRIX &parentTransform)
{
DoUpdate(timer, holographicFrame, currentCoordinateSystem, interactionSource, parentTransform);
for (auto it = m_children.begin(); it != m_children.end(); it++)
{
it->get()->Update(timer, holographicFrame, currentCoordinateSystem, interactionSource, DirectX::XMLoadFloat4x4(&m_transform));
}
}
void ControlBase::Render()
{
DoRender();
for (auto it = m_children.begin(); it != m_children.end(); it++)
{
it->get()->Render();
}
}
| 27.222222 | 135 | 0.702041 | [
"geometry",
"render"
] |
70ab6af24ed54420205d327e58cc90db8c401db7 | 3,778 | hxx | C++ | src/Node.hxx | LittleGreyCells/escheme-oops | 61adf2416e1ffe91f205e074d68d72d4ffbf49b9 | [
"MIT"
] | null | null | null | src/Node.hxx | LittleGreyCells/escheme-oops | 61adf2416e1ffe91f205e074d68d72d4ffbf49b9 | [
"MIT"
] | null | null | null | src/Node.hxx | LittleGreyCells/escheme-oops | 61adf2416e1ffe91f205e074d68d72d4ffbf49b9 | [
"MIT"
] | null | null | null | #ifndef SCHEME_NODE_HXX
#define SCHEME_NODE_HXX
#include <string>
namespace scheme
{
//
// Node Object Heirarchy
//
// Node (abstract)
// Char
// Fixnum
// Flonum
// Str
// Symbol
// List
// Nil
// Vector
// Env (abstract)
// GlobalEnv
// FrameEnv
// AssocEnv
// Prim
// PrimFunc
// EvalFunc
// Closure
// Continuation
// Port (abstract)
// FilePort
// StringPort
// TerminalPort
// Promise
// Dict
//
enum ConfigurationConstants
{
ARGSTACK_SIZE = 500,
REGSTACK_SIZE = 1000,
INTSTACK_SIZE = 1000,
};
using byte = unsigned char;
class Port;
class Node
{
public:
Node() : marked(false), form(0) {}
virtual bool nullp() { return false; }
virtual bool atomp() { return true; }
virtual bool consp() { return false; }
virtual bool listp() { return false; }
virtual bool fixnump() { return false; }
virtual bool flonump() { return false; }
virtual bool numberp() { return false; }
virtual bool charp() { return false; }
virtual bool stringp() { return false; }
virtual bool symbolp() { return false; }
virtual bool vectorp() { return false; }
virtual bool envp() { return false; }
virtual bool primp() { return false; }
virtual bool closurep() { return false; }
virtual bool bvecp() { return false; }
virtual bool contp() { return false; }
virtual bool promisep() { return false; }
virtual bool dictp() { return false; }
virtual bool assocenvp() { return false; }
virtual bool portp() { return false; }
virtual bool inportp() { return false; }
virtual bool outportp() { return false; }
virtual bool stringportp() { return false; }
virtual Node* getcar();
virtual Node* getcdr();
virtual void setcar( Node* );
virtual void setcdr( Node* );
virtual unsigned length();
virtual Node* getvalue();
virtual void setvalue( Node* value );
virtual unsigned vlen();
virtual long getfixnum();
virtual double getflonum();
virtual void mark() = 0;
virtual void print( Port* port, int style ) = 0;
virtual void apply_dispatch();
virtual size_t hash();
std::string id( const std::string& label );
void setform( byte form ) { this->form = form; }
void setmark() { marked = true; }
void unmark() { marked = false; }
bool ismarked() { return marked; }
bool marked;
byte form;
};
Node* guard( Node* n, bool (Node::*pred)() );
class Exception
{
public:
Exception( std::string desc );
std::string description;
};
class FatalException : public Exception
{
public:
FatalException( std::string desc ) : Exception(desc) {}
};
class SevereException : public Exception
{
public:
SevereException( std::string desc, Node* obj = nullptr ) : Exception(desc), object(obj) {}
Node* object;
};
class ParseException : public SevereException
{
public:
ParseException( std::string desc, Node* obj = nullptr ) : SevereException(desc, obj) {}
};
class AccessException : public SevereException
{
public:
AccessException( std::string desc, Node* obj = nullptr ) : SevereException(desc, obj) {}
};
class EvalException : public SevereException
{
public:
EvalException( std::string desc, Node* obj = nullptr ) : SevereException(desc, obj) {}
};
struct Exit {};
template <typename T1,
typename T2>
inline T1 down_cast( T2 x ) { return (T1)(x); }
}
#endif
| 23.761006 | 96 | 0.577819 | [
"object",
"vector"
] |
70aee086fc901ed73431b4e9290dd787daeacb19 | 1,942 | hpp | C++ | include/dependencies/rb_tree_node.hpp | hun756/Data-Sutructures-in-CPlusPlus | 6760f04bfaa2ce6a3afa636faa75a496bf8e900b | [
"MIT"
] | 7 | 2020-10-22T17:46:02.000Z | 2022-03-12T16:59:54.000Z | include/dependencies/rb_tree_node.hpp | hun756/Data-Sutructures-in-CPlusPlus | 6760f04bfaa2ce6a3afa636faa75a496bf8e900b | [
"MIT"
] | 1 | 2020-10-25T18:28:27.000Z | 2020-10-28T00:58:24.000Z | include/dependencies/rb_tree_node.hpp | hun756/Data-Sutructures-in-CPlusPlus | 6760f04bfaa2ce6a3afa636faa75a496bf8e900b | [
"MIT"
] | 1 | 2020-10-25T19:20:46.000Z | 2020-10-25T19:20:46.000Z | /**
* File : x_red_black_tree.hpp
* Explain : Node class for red black tree.
* Author : Mehmet Ekemen
* Nickname : `hun
* Email : ekemenms@hotmail.com
* Date : 05.02.2020 (updated)
* Github : github.com/hun756
* Resource : https://github.com/hun756/Data-Sutructures-in-CPlusPlus/
**/
#ifndef RED_BLACK_TREE_NODE_HPP
#define RED_BLACK_TREE_NODE_HPP
enum class Color
{
Red,
Black
};
template <class _Ty>
class RedBlackTreeNode
{
public:
// members
_Ty data;
RedBlackTreeNode<_Ty>* parent;
RedBlackTreeNode<_Ty>* left;
RedBlackTreeNode<_Ty>* right;
Color color;
/**
* Construct a new Red Black Tree Node object
*
* @param data : _Ty -> value of template parameter.
* @param parent : RBNode* -> pointer from RBNode Class
* @param left : RBNode* -> ""
* @param right : RBNode* -> ""
* @param color : Color -> Object of enumeration color class
**/
RedBlackTreeNode(_Ty data = _Ty(),
RedBlackTreeNode<_Ty>* parent = nullptr,
RedBlackTreeNode<_Ty>* left = nullptr,
RedBlackTreeNode<_Ty>* right = nullptr,
Color color = Color::Red
);
};
template <class _Ty>
RedBlackTreeNode<_Ty>::RedBlackTreeNode(_Ty data,
RedBlackTreeNode<_Ty>* parent,
RedBlackTreeNode<_Ty>* left,
RedBlackTreeNode<_Ty>* right,
Color color
) : data(data), parent(parent), left(left), right(right), color(color)
{
}
#endif /* end of include guard : RED_BLACK_TREE_NODE_HPP */ | 28.985075 | 94 | 0.501545 | [
"object"
] |
70b16821b532aafbd37bf287cdcbcdf780858570 | 47,294 | cpp | C++ | TerrainApps/VTBuilder/Builder.cpp | huidian200803/vterrain-VTP-vterrain.org | 08a8b97cbe64190e26f31ee5efcf31996d9022cb | [
"MIT"
] | 4 | 2019-02-08T13:51:26.000Z | 2021-12-07T13:11:06.000Z | TerrainApps/VTBuilder/Builder.cpp | hryang1/vterrain-VTP-vterrain.org | 08a8b97cbe64190e26f31ee5efcf31996d9022cb | [
"MIT"
] | null | null | null | TerrainApps/VTBuilder/Builder.cpp | hryang1/vterrain-VTP-vterrain.org | 08a8b97cbe64190e26f31ee5efcf31996d9022cb | [
"MIT"
] | 7 | 2017-12-03T10:13:17.000Z | 2022-03-29T09:51:18.000Z | //
// Builder.cpp: The main Builder class of the VTBuilder
//
// Copyright (c) 2001-2012 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/stdpaths.h>
#include "vtdata/vtLog.h"
#include "vtdata/DataPath.h"
#include "vtdata/GDALWrapper.h"
#include "vtdata/MaterialDescriptor.h"
#include <float.h> // for FLT_MIN
#include "Builder.h"
#include "Tin2d.h"
#include "VegGenOptions.h"
#include "vtImage.h"
#include "Options.h"
#include "vtui/Helper.h"
// Layers
#include "ElevLayer.h"
#include "ImageLayer.h"
#include "RawLayer.h"
#include "RoadLayer.h"
#include "StructLayer.h"
#include "UtilityLayer.h"
#include "VegLayer.h"
// Dialogs
#include "OptionsDlg.h"
#include "SampleElevationDlg.h"
#include "SampleImageDlg.h"
#include "vtui/ProjectionDlg.h"
/** This singleton contains all the global options for the whole application. */
vtTagArray g_Options;
/** Global pointer to builder object, of which there is only one */
Builder *g_bld;
// external hook to glue code
void InitMiniConvHook(int iJpegQuality = 95);
//////////////////////////////////////////////////////////////////
// Builder constructor
//
Builder::Builder()
{
VTLOG(" Builder constructor: enter\n");
// init app data
m_pActiveLayer = NULL;
m_bAdoptFirstCRS = true;
m_pParentWindow = NULL;
m_LSOptions.Defaults();
m_pInstanceDlg = NULL;
m_bDrawDisabled = false;
m_tileopts.cols = 4;
m_tileopts.rows = 4;
m_tileopts.numlods = 3;
m_tileopts.lod0size = 512;
m_tileopts.bCreateDerivedImages = false;
m_tileopts.bMaskUnknownAreas = false;
m_tileopts.bImageAlpha = false;
m_tileopts.bUseTextureCompression = true;
m_tileopts.eCompressionType = TC_OPENGL;
g_bld = this;
// Get datapaths from the vtp.xml config file
ReadDataPath();
VTLOG("Using Datapaths:\n");
int i, n = (int)vtGetDataPath().size();
if (n == 0)
VTLOG(" none.\n");
for (i = 0; i < n; i++)
VTLOG(" %s\n", (const char *) vtGetDataPath()[i]);
VTLOG1(" Initializing GDAL.\n");
CheckForGDALAndWarn();
g_GDALWrapper.RequestGDALFormats();
// set up the datum list we will use
SetupEPSGDatums();
// Fill list of layer type names
if (vtLayer::LayerTypeNames.IsEmpty())
{
// These must correspond to the order of the LayerType enum!
vtLayer::LayerTypeNames.Add(_("Raw"));
vtLayer::LayerTypeNames.Add(_("Elevation"));
vtLayer::LayerTypeNames.Add(_("Image"));
vtLayer::LayerTypeNames.Add(_("Road"));
vtLayer::LayerTypeNames.Add(_("Structure"));
vtLayer::LayerTypeNames.Add(_("Water"));
vtLayer::LayerTypeNames.Add(_("Vegetation"));
vtLayer::LayerTypeNames.Add(_("Utility"));
}
// We might need libMini's conversion hook, so set that up
InitMiniConvHook();
VTLOG1(" Builder constructor: exit\n");
}
Builder::~Builder()
{
VTLOG1("Builder destructor\n");
DeleteContents();
FreeGlobalMaterials();
FreeContentFiles();
}
void Builder::DeleteContents()
{
m_Layers.DeleteLayers();
m_pActiveLayer = NULL;
}
////////////////////////////////////////////////////////////////
// Project Methods
void trim_eol(char *buf)
{
int len = (int)strlen(buf);
if (len && buf[len-1] == 10) buf[len-1] = 0;
len = (int)strlen(buf);
if (len && buf[len-1] == 13) buf[len-1] = 0;
}
bool Builder::LoadProject(const vtString &fname, vtScaledView *pView)
{
// Avoid trouble with '.' and ',' in Europe
ScopedLocale normal_numbers(LC_NUMERIC, "C");
VTLOG1("LoadProject()\n");
// read project file
FILE *fp = vtFileOpen(fname, "rb");
if (!fp)
{
DisplayAndLog("Couldn't open project file: '%s'", (const char *) fname);
return false;
}
// even the first layer must match the project's CRS
m_bAdoptFirstCRS = false;
int iNumLayersFailed = 0;
char buf[2000];
while (fgets(buf, 2000, fp) != NULL)
{
if (!strncmp(buf, "Projection ", 11))
{
// read projection info
vtCRS crs;
char *wkt = buf + 11;
OGRErr err = crs.importFromWkt(&wkt);
if (err != OGRERR_NONE)
{
DisplayAndLog("Had trouble parsing the projection information "
"from that file.");
fclose(fp);
return false;
}
SetCRS(crs);
}
if (!strncmp(buf, "PlantList ", 10))
{
trim_eol(buf);
LoadSpeciesFile(buf+10);
}
if (!strncmp(buf, "BioTypes ", 9))
{
trim_eol(buf);
LoadBiotypesFile(buf+9);
}
if (!strncmp(buf, "area ", 5))
{
sscanf(buf+5, "%lf %lf %lf %lf\n", &m_area.left, &m_area.top,
&m_area.right, &m_area.bottom);
VTLOG(" area: %lf %lf %lf %lf\n", m_area.left, m_area.top,
m_area.right, m_area.bottom);
}
if (!strncmp(buf, "view ", 5))
{
DRECT rect;
sscanf(buf+5, "%lf %lf %lf %lf\n", &rect.left, &rect.top,
&rect.right, &rect.bottom);
if (pView)
pView->ZoomToRect(rect, 0.0f);
}
if (!strncmp(buf, "layers", 6))
{
int count = 0;
LayerType ltype;
sscanf(buf+7, "%d\n", &count);
for (int i = 0; i < count; i++)
{
bool bShow = true, bImport = false;
int iType;
char buf2[200], buf3[200];
if (fgets(buf, 200, fp) == NULL)
return false;
int num = sscanf(buf, "type %d, %s %s", &iType, buf2, buf3);
ltype = (LayerType)iType;
if (!strcmp(buf2, "import"))
bImport = true;
if (num > 2 && !strcmp(buf3, "hidden"))
bShow = false;
// next line is the path
if (fgets(buf, 200, fp) == NULL)
return false;
// trim trailing LF character
trim_eol(buf);
vtString path = buf;
// If there is a relative path, allow it to be relative to the
// location of the project file.
if (path.Left(1) == ".")
{
path = ExtractPath(fname, true);
path += buf;
}
wxString layer_fname(path, wxConvUTF8);
// Catch older projects that might not be correct UTF8
if (layer_fname == _T(""))
layer_fname = wxString(path, *wxConvCurrent);
int numlayers = NumLayers();
if (bImport)
{
int num_loaded = ImportDataFromArchive(ltype, layer_fname, false);
if (num_loaded == 0)
iNumLayersFailed++;
}
else
{
vtLayer *lp = vtLayer::CreateNewLayer(ltype);
if (lp && lp->Load(layer_fname))
AddLayer(lp);
else
{
delete lp;
iNumLayersFailed++;
}
}
// Hide any layers created, if desired
int newlayers = NumLayers();
for (int j = numlayers; j < newlayers; j++)
GetLayer(j)->SetVisible(bShow);
}
}
}
fclose(fp);
// reset to default behavior
m_bAdoptFirstCRS = true;
if (iNumLayersFailed > 0)
DisplayAndLog("%d of the project's layers could not be loaded.", iNumLayersFailed);
AddToMRU(m_ProjectFiles, fname);
VTLOG1(" LoadProject done.\n");
return true;
}
////////////////////////////////////////////////////////////////
// Layer Methods
//
// Load a layer from a file without knowing its type
//
Builder::LoadResult Builder::LoadLayer(const wxString &fname_in)
{
// check file extension
wxString fname = fname_in;
wxString ext = fname.AfterLast('.');
bool bNative = false;
vtLayer *pLayer = NULL;
if (ext.CmpNoCase(_T("rmf")) == 0)
{
bNative = true;
vtRoadLayer *pRL = new vtRoadLayer;
if (pRL->Load(fname))
pLayer = pRL;
else
delete pRL;
}
if (ext.CmpNoCase(_T("bt")) == 0 ||
ext.CmpNoCase(_T("tin")) == 0 ||
ext.CmpNoCase(_T("itf")) == 0 ||
fname.Right(6).CmpNoCase(_T(".bt.gz")) == 0)
{
bNative = true;
vtElevLayer *pEL = new vtElevLayer;
if (pEL->Load(fname))
pLayer = pEL;
else
delete pEL;
}
if (ext.CmpNoCase(_T("vtst")) == 0 ||
fname.Right(8).CmpNoCase(_T(".vtst.gz")) == 0)
{
bNative = true;
vtStructureLayer *pSL = new vtStructureLayer;
if (pSL->Load(fname))
pLayer = pSL;
else
delete pSL;
}
if (ext.CmpNoCase(_T("vf")) == 0)
{
bNative = true;
// Make sure we have some species first.
if (GetSpeciesList()->NumSpecies() == 0)
{
vtString species_path = FindFileOnPaths(vtGetDataPath(), "PlantData/species.xml");
wxString msg;
msg += _("You must specify a species file (plant list) to use when working with vegetation files.");
if (species_path == "")
{
wxMessageBox(msg);
return Builder::FAILED;
}
msg += _T("\n");
msg += _("Do you want to load the default species file from:");
msg += _T("\n");
msg += wxString::FromUTF8((const char *) species_path);
int ret = wxMessageBox(msg, _("Plants"), wxYES_NO);
if (ret == wxYES)
{
if (!LoadSpeciesFile(species_path))
return Builder::FAILED;
}
else // No.
return Builder::CANCELLED;
}
vtVegLayer *pVL = new vtVegLayer;
if (pVL->Load(fname))
pLayer = pVL;
else
delete pVL;
}
if (ext.CmpNoCase(_T("shp")) == 0 ||
ext.CmpNoCase(_T("gml")) == 0 ||
ext.CmpNoCase(_T("xml")) == 0 ||
ext.CmpNoCase(_T("igc")) == 0)
{
vtRawLayer *pRL = new vtRawLayer;
if (pRL->Load(fname))
pLayer = pRL;
else
delete pRL;
}
#if 0 // doesn't this belong in import?
if (ext.CmpNoCase(_T("img")) == 0)
{
vtImageLayer *pIL = new vtImageLayer;
if (pIL->Load(fname))
pLayer = pIL;
else
delete pIL;
}
#endif
if (ext.CmpNoCase(_T("tif")) == 0)
{
// If it's a 8-bit or 24-bit TIF, then it's likely to be an image.
// If it's a 16-bit TIF, then it's likely to be elevation.
int depth;
GDALDataType eType = GDT_Unknown;
bool success = GetBitDepthUsingGDAL(fname_in.mb_str(wxConvUTF8), depth, eType);
if (eType == GDT_Float32 || eType == GDT_Int16)
{
// We only support elevation from that kind of TIFF
}
else if (depth == 8 || depth == 24 || depth == 32)
{
bNative = true;
vtImageLayer *pIL = new vtImageLayer;
if (pIL->Load(fname))
pLayer = pIL;
else
delete pIL;
}
}
if (pLayer)
{
bool success = AddLayerWithCheck(pLayer, true);
if (success)
{
AddToMRU(m_LayerFiles, (const char *) fname_in.mb_str(wxConvUTF8));
return Builder::LOADED;
}
else
{
delete pLayer;
return Builder::CANCELLED;
}
}
if (bNative)
return Builder::FAILED;
else
return Builder::NOT_NATIVE;
}
void Builder::AddLayer(vtLayer *lp)
{
m_Layers.push_back(lp);
}
bool Builder::AddLayerWithCheck(vtLayer *pLayer, bool bRefresh)
{
VTLOG("AddLayerWithCheck(%lx)\n", pLayer);
vtCRS crs;
pLayer->GetCRS(crs);
bool bFirst = (m_Layers.size() == 0);
if (bFirst && m_bAdoptFirstCRS)
{
// if this is our first layer, adopt its projection
VTLOG1(" Adopting CRS from this layer.\n");
SetCRS(crs);
}
else
{
// check for CRS conflict
VTLOG1(" Checking CRS compatibility.\n");
if (!(m_crs == crs))
{
int ret;
bool keep = false;
if (IsGUIApp())
{
char *str1, *str2;
m_crs.exportToProj4(&str1);
crs.exportToProj4(&str2);
wxString msg;
msg.Printf(_("The data already loaded is in:\n %hs\n but the layer you are attempting to add:\n %s\n is using:\n %hs\n Would you like to attempt to convert it now to the existing projection?"),
str1, pLayer->GetLayerFilename().c_str(), str2);
OGRFree(str1);
OGRFree(str2);
ret = wxMessageBox(msg, _("Convert Coordinate System?"), wxYES_NO);
if (ret == wxNO)
keep = true;
}
else
{
// If there is no GUI, we must always assume they want to convert
ret = wxYES;
}
if (ret == wxYES)
{
VTLOG1(" Reprojecting..\n");
OpenProgressDialog(_("Reprojecting"), _T(""), false, m_pParentWindow);
bool success = pLayer->TransformCoords(m_crs);
CloseProgressDialog();
if (success)
keep = true;
else
{
if (IsGUIApp())
{
ret = wxMessageBox(_("Couldn't convert projection.\n Proceed anyway?"),
_("Warning"), wxYES_NO);
if (ret == wxYES)
keep = true;
}
}
}
if (!keep)
return false;
}
}
AddLayer(pLayer);
SetActiveLayer(pLayer, false);
return true;
}
void Builder::RemoveLayer(vtLayer *lp)
{
if (!lp)
return;
// check the type of the layer we're deleting
LayerType lt = lp->GetType();
// remove
m_Layers.Remove(lp);
// if it was the active layer, select another layer of the same type
if (GetActiveLayer() == lp)
{
vtLayer *lp_new = FindLayerOfType(lt);
SetActiveLayer(lp_new, true);
}
// then delete
DeleteLayer(lp);
}
void Builder::DeleteLayer(vtLayer *lp)
{
delete lp;
}
void Builder::SetActiveLayer(vtLayer *lp, bool refresh)
{
m_pActiveLayer = lp;
}
//
// Returns the number of layers present of a given type.
//
int Builder::LayersOfType(LayerType lt)
{
int count = 0;
for (uint l = 0; l < m_Layers.size(); l++)
{
if (m_Layers[l]->GetType() == lt)
count++;
}
return count;
}
int Builder::NumModifiedLayers()
{
int count = 0;
for (uint l = 0; l < m_Layers.size(); l++)
{
vtLayer *lp = m_Layers[l];
if (lp->GetModified() && lp->CanBeSaved())
count++;
}
return count;
}
vtLayer *Builder::FindLayerOfType(LayerType lt)
{
for (uint l = 0; l < m_Layers.size(); l++)
{
vtLayer *lp = m_Layers[l];
if (lp->GetType() == lt)
return lp;
}
return NULL;
}
int Builder::LayerNum(vtLayer *lp)
{
for (uint i = 0; i < m_Layers.size(); i++)
if (lp == m_Layers[i])
return i;
return -1;
}
void Builder::SwapLayerOrder(int n0, int n1)
{
vtLayer *lp0 = m_Layers[n0];
vtLayer *lp1 = m_Layers[n1];
m_Layers[n0] = lp1;
m_Layers[n1] = lp0;
}
LayerType Builder::AskLayerType()
{
wxString choices[LAYER_TYPES];
for (int i = 0; i < LAYER_TYPES; i++)
choices[i] = vtLayer::LayerTypeNames[i];
int n = LAYER_TYPES;
static int cur_type = 0; // remember the choice for next time
wxSingleChoiceDialog dialog(m_pParentWindow, _("These are your choices"),
_("Please indicate layer type"), n, (const wxString *)choices);
dialog.SetSelection(cur_type);
if (dialog.ShowModal() == wxID_OK)
{
cur_type = dialog.GetSelection();
return (LayerType) cur_type;
}
else
return LT_UNKNOWN;
}
void Builder::CheckOptionBounds()
{
// Check the preferences, make sure they have acceptable values.
if (g_Options.GetValueInt(TAG_SAMPLING_N) < 1)
g_Options.SetValueInt(TAG_SAMPLING_N, 1);
if (g_Options.GetValueInt(TAG_SAMPLING_N) > 32)
g_Options.SetValueInt(TAG_SAMPLING_N, 32);
int mp;
if (!g_Options.GetValueInt(TAG_MAX_MEGAPIXELS, mp))
mp = 16;
if (mp < 0) mp = 0;
if (mp > 300) mp = 300;
g_Options.SetValueInt(TAG_MAX_MEGAPIXELS, mp);
int ems;
if (!g_Options.GetValueInt(TAG_ELEV_MAX_SIZE, ems))
ems = 4096;
if (ems < 16) ems = 16;
if (ems > 8192) ems = 8192;
g_Options.SetValueInt(TAG_ELEV_MAX_SIZE, ems);
if (!g_Options.FindTag(TAG_TIFF_COMPRESS))
g_Options.SetValueBool(TAG_TIFF_COMPRESS, false, true);
// deal with deprecated tag
if (g_Options.FindTag(TAG_SLOW_FILL_GAPS))
{
bool bSlow = g_Options.GetValueBool(TAG_SLOW_FILL_GAPS);
g_Options.RemoveTag(TAG_SLOW_FILL_GAPS);
if (bSlow)
g_Options.SetValueInt(TAG_GAP_FILL_METHOD, 2, true);
else
g_Options.SetValueInt(TAG_GAP_FILL_METHOD, 1, true);
}
if (!g_Options.FindTag(TAG_GAP_FILL_METHOD))
g_Options.SetValueInt(TAG_GAP_FILL_METHOD, 1, true);
int mmg;
if (!g_Options.GetValueInt(TAG_MAX_MEM_GRID, mmg))
mmg = 128;
if (mmg < 1) mmg = 1;
if (mmg > 8192) mmg = 8192;
g_Options.SetValueInt(TAG_MAX_MEM_GRID, mmg);
}
void Builder::SetOptionDefaults()
{
// These are app options from Options.h
g_Options.SetValueBool(TAG_SHOW_MAP, true, true);
g_Options.SetValueBool(TAG_SHOW_UTM, false, true);
g_Options.SetValueBool(TAG_SHOW_PATHS, false, true);
g_Options.SetValueBool(TAG_ROAD_DRAW_WIDTH, false, true);
g_Options.SetValueBool(TAG_USE_CURRENT_CRS, false, true);
g_Options.SetValueBool(TAG_LOAD_IMAGES_ALWAYS, false, true);
g_Options.SetValueBool(TAG_LOAD_IMAGES_NEVER, false, true);
g_Options.SetValueBool(TAG_REPRO_TO_FLOAT_ALWAYS, false, true);
g_Options.SetValueBool(TAG_REPRO_TO_FLOAT_NEVER, false, true);
g_Options.SetValueInt(TAG_SAMPLING_N, 1, true);
g_Options.SetValueInt(TAG_ELEV_MAX_SIZE, 4096, true);
g_Options.SetValueInt(TAG_MAX_MEGAPIXELS, 16, true);
g_Options.SetValueBool(TAG_BLACK_TRANSP, false, true);
g_Options.SetValueBool(TAG_TIFF_COMPRESS, false, true);
g_Options.SetValueBool(TAG_DEFAULT_GZIP_BT, false, true);
g_Options.SetValueBool(TAG_DELAY_LOAD_GRID, false, true);
g_Options.SetValueInt(TAG_MAX_MEM_GRID, 128, true);
g_Options.SetValueBool(TAG_DRAW_RAW_SIMPLE, false, true);
g_Options.SetValueBool(TAG_DRAW_TIN_SIMPLE, false, true);
g_Options.SetValueInt(TAG_GAP_FILL_METHOD, 1, true); // Fast.
// status bar options
g_Options.SetValueBool(TAG_SHOW_MINUTES, false, true);
g_Options.SetValueInt(TAG_SHOW_VERT_UNITS, (int) LU_METERS, true);
// These are elevation draw options from ElevDrawOptions.h
g_Options.SetValueBool(TAG_SHOW_ELEVATION, true, true);
g_Options.SetValueBool(TAG_SHADING_QUICK, true, true);
g_Options.SetValueBool(TAG_SHADING_DOT, false, true);
g_Options.SetValueBool(TAG_CAST_SHADOWS, false, true);
g_Options.SetValueInt(TAG_CAST_ANGLE, 20, true);
g_Options.SetValueInt(TAG_CAST_DIRECTION, 45, true);
g_Options.SetValueFloat(TAG_AMBIENT, 0.25f, true);
g_Options.SetValueFloat(TAG_GAMMA, 0.8f, true);
g_Options.SetValueString(TAG_COLOR_MAP_FILE, "VTBuilder.cmt", true);
}
void Builder::AddToMRU(vtStringArray &arr, const vtString &fname)
{
// if it's already in the list, remove it
int idx = vtFindString(arr, fname);
if (idx != -1)
arr.erase(arr.begin() + idx);
// push it on the front
arr.insert(arr.begin(), fname);
// crop at 10 items
if (arr.size() > 10)
arr.resize(10);
// Store all changes to global options
g_Options.SetValueString("ProjectMRU", vtConcatArray(m_ProjectFiles, '|'));
g_Options.SetValueString("LayerMRU", vtConcatArray(m_LayerFiles, '|'));
g_Options.SetValueString("ImportMRU", vtConcatArray(m_ImportFiles, '|'));
}
DRECT Builder::GetExtents()
{
// Acculumate the extents of all the layers
DRECT rect;
rect.SetInsideOut();
bool has_bounds = false;
DRECT layer_rect;
for (uint i = 0; i < m_Layers.size(); i++)
{
if (m_Layers[i]->GetExtent(layer_rect))
{
rect.GrowToContainRect(layer_rect);
has_bounds = true;
}
}
if (has_bounds)
return rect;
else if (m_crs.IsDymaxion())
return DRECT(0, 1.5*sqrt(3.0), 5.5, 0); // extents of Dymaxion map
else
return DRECT(-180, 90, 180, -90); // degree extents of whole planet
}
//
// Pick a point, in geographic coords, which is roughly in the middle
// of the data that the user is working with.
//
DPoint2 Builder::EstimateGeoDataCenter()
{
DRECT rect = GetExtents();
DPoint2 pos = rect.GetCenter();
if (!m_crs.IsGeographic())
{
vtCRS geo;
CreateSimilarGeographicCRS(m_crs, geo);
ScopedOCTransform trans(CreateTransformIgnoringDatum(&m_crs, &geo));
if (trans)
trans->Transform(1, &pos.x, &pos.y);
}
return pos;
}
void Builder::LookForContentFiles()
{
VTLOG1("Searching data paths for content files (.vtco)\n");
for (uint i = 0; i < vtGetDataPath().size(); i++)
{
vtStringArray fnames;
AddFilenamesToStringArray(fnames, vtGetDataPath()[i], "*.vtco");
for (uint j = 0; j < fnames.size(); j++)
{
vtString path = vtGetDataPath()[i];
path += fnames[j];
bool success = true;
vtContentManager *mng = new vtContentManager;
try
{
mng->ReadXML(path);
}
catch (xh_io_exception &ex)
{
// display (or at least log) error message here
VTLOG("XML error:");
VTLOG(ex.getFormattedMessage().c_str());
success = false;
delete mng;
}
if (success)
m_contents.push_back(mng);
}
}
VTLOG(" found %d files on %d paths\n", m_contents.size(), vtGetDataPath().size());
}
void Builder::FreeContentFiles()
{
for (uint i = 0; i < m_contents.size(); i++)
delete m_contents[i];
m_contents.clear();
}
void Builder::ResolveInstanceItem(vtStructInstance *inst)
{
vtString name;
if (!inst->GetValueString("itemname", name))
return;
for (uint j = 0; j < m_contents.size(); j++)
{
vtItem *item = m_contents[j]->FindItemByName(name);
if (item)
{
inst->SetItem(item);
break;
}
}
}
/**
* Sample all elevation layers into a target layer.
*/
bool Builder::SampleCurrentTerrains(vtElevLayer *pTarget)
{
VTLOG1(" SampleCurrentTerrains\n");
// measure time
clock_t tm1 = clock();
DRECT area;
pTarget->GetExtent(area);
const DPoint2 &step = pTarget->GetGrid()->GetSpacing();
const int layers = m_Layers.size();
float fData = 0, fBestData;
const IPoint2 Size = pTarget->GetGrid()->GetDimensions();
// Create progress dialog for the slow part
OpenProgressDialog(_("Sampling Elevation Layers"), _T(""), true);
// Determine which source elevation layers overlap our desired area
std::vector<vtElevLayer*> elevs;
std::vector<vtElevLayer*> relevant_elevs;
uint elev_layers = ElevLayerArray(elevs);
for (uint e = 0; e < elev_layers; e++)
{
DRECT layer_extent;
elevs[e]->GetExtent(layer_extent);
if (area.OverlapsRect(layer_extent))
relevant_elevs.push_back(elevs[e]);
}
// Setup TINs for speedy picking
for (size_t lay = 0; lay < relevant_elevs.size(); lay++)
relevant_elevs[lay]->SetupTinTriangleBins(50); // target 50 tris per bin
// iterate through the heixels of the new terrain
DPoint2 p;
wxString str;
for (int i = 0; i < Size.x; i++)
{
if ((i % 10) == 0)
{
str.Printf(_T("%d / %d"), i, Size.x);
if (UpdateProgressDialog(i*100/Size.x, str))
{
CloseProgressDialog();
return false;
}
}
p.x = area.left + (i * step.x);
for (int j = 0; j < Size.y; j++)
{
p.y = area.bottom + (j * step.y);
// find some data for this point
fBestData = ElevLayerArrayValue(relevant_elevs, p);
pTarget->GetGrid()->SetFValue(i, j, fBestData);
}
}
CloseProgressDialog();
clock_t tm2 = clock();
float time = ((float)tm2 - tm1)/CLOCKS_PER_SEC;
VTLOG(" SampleCurrentTerrains: %.3f seconds.\n", time);
return true;
}
float Builder::GetHeightFromTerrain(const DPoint2 &p)
{
float height = INVALID_ELEVATION;
int layers = m_Layers.size();
for (int i = 0; i < layers; i++)
{
vtLayer *lay = m_Layers[i];
if (lay->GetType() != LT_ELEVATION || !lay->GetVisible()) continue;
vtElevLayer *pEL = (vtElevLayer *) lay;
float val = pEL->GetElevation(p);
if (val != INVALID_ELEVATION)
height = val;
}
return height;
}
uint Builder::ElevLayerArray(std::vector<vtElevLayer*> &elevs)
{
for (uint l = 0; l < NumLayers(); l++)
{
vtLayer *lp = m_Layers[l];
if (lp->GetType() == LT_ELEVATION && lp->GetVisible())
elevs.push_back((vtElevLayer *)lp);
}
return (uint)elevs.size();
}
/**
* Fill the gaps (NODATA heixels) in an elevation layer, by interpolating
* from the surrounding values.
*
* \param el The elevation layer to fill the gaps on.
* \param area Optionally, restrict the operation to a given area.
*/
bool Builder::FillElevGaps(vtElevLayer *el, DRECT *area, int iMethod)
{
// Create progress dialog for the slow part
OpenProgressDialog(_("Filling Gaps"), _T(""), true);
bool bGood;
if (iMethod == -1)
iMethod = g_Options.GetValueInt(TAG_GAP_FILL_METHOD);
VTLOG("FillElevGaps, method %d\n", iMethod);
if (iMethod == 1)
// fast
bGood = el->GetGrid()->FillGaps(area, progress_callback);
else if (iMethod == 2)
// slow and smooth
bGood = el->GetGrid()->FillGapsSmooth(area, progress_callback);
else if (iMethod == 3)
{
int result = el->GetGrid()->FillGapsByRegionGrowing(2, 5, progress_callback);
bGood = (result != -1);
}
CloseProgressDialog();
return bGood;
}
void Builder::FlagStickyLayers(const std::vector<vtElevLayer*> &elevs)
{
// Clear sticky flag for all layers
for (uint i = 0; i < m_Layers.size(); i++)
m_Layers[i]->SetSticky(false);
// Set sticky flag for the desired layers
for (size_t e = 0; e < elevs.size(); e++)
elevs[e]->SetSticky(true);
}
/*
Given two elevation layer, add or subtract them to produce a new grid layer.
Both layers are sampled at the given spacing.
This is useful for comparing two elevations A and B. E.g. the resulting grid
will be positive where the height of A is greater than B, and negative where
A is less than B.
*/
vtElevLayer *Builder::ElevationMath(vtElevLayer *pElev1, vtElevLayer *pElev2,
const DRECT &extent, const DPoint2 &spacing, bool plus)
{
// Consider sampling.
IPoint2 grid_size;
grid_size.x = extent.Width() / spacing.x;
grid_size.y = extent.Height() / spacing.y;
vtElevationGrid *grid = new vtElevationGrid;
vtElevError err;
grid->Create(extent, grid_size, true, m_crs, &err);
OpenProgressDialog(_("Comparing Elevation Layers"), _T(""), false);
DPoint2 p;
for (int j = 0; j < grid_size.y; j++)
{
UpdateProgressDialog(j * 100 / grid_size.y);
for (int i = 0; i < grid_size.x; i++)
{
p.Set(extent.left + i * spacing.x, extent.bottom + j * spacing.y);
const float val1 = pElev1->GetElevation(p);
const float val2 = pElev2->GetElevation(p);
float val;
if (val1 == INVALID_ELEVATION || val2 == INVALID_ELEVATION)
val = INVALID_ELEVATION;
else
{
if (plus)
val = val1 + val2;
else
val = val1 - val2;
}
grid->SetFValue(i, j, val);
}
}
CloseProgressDialog();
vtElevLayer *pNewLayer = new vtElevLayer(grid);
if (plus)
pNewLayer->SetLayerFilename(_("sum"));
else
pNewLayer->SetLayerFilename(_("difference"));
AddLayer(pNewLayer);
return pNewLayer;
}
/**
For a give elevation layer (grid), look at all the other road layers and
carve the terrain up/down to match them.
*/
void Builder::CarveWithCulture(vtElevLayer *pElev, float margin)
{
vtElevationGrid *grid = pElev->GetGrid();
if (!pElev || !grid)
return;
// Must have at least some culture we can carve in
vtRoadLayer *pR = (vtRoadLayer *) FindLayerOfType(LT_ROAD);
vtStructureLayer *pS = (vtStructureLayer *) FindLayerOfType(LT_STRUCTURE);
if (!pR && !pS)
return;
// how many units to flatten on either side of the roadway, past the
// physical edge of the link surface
float shoulder = margin / 2;
float fade = margin;
OpenProgressDialog(_("Scanning Grid against Roads"), _T(""));
if (pR)
{
// Prepare the road layer
LinkEdit *pLink;
for (pLink = pR->GetFirstLink(); pLink; pLink = pLink->GetNext())
{
const float half = pLink->m_fLeftWidth + shoulder + fade;
pLink->m_extent.Grow(half, half);
}
}
std::vector<float> building_heights;
std::vector<DRECT> building_extents;
if (pS)
{
// Prepare the structure layer: precompute a centroid of each building
// and the elevation of the existing surface at that point.
building_heights.resize(pS->size());
building_extents.resize(pS->size());
float elev;
for (uint i = 0; i < pS->size(); i++)
{
vtStructure *str = pS->at(i);
vtBuilding *bld = str->GetBuilding();
building_heights[i] = INVALID_ELEVATION;
if (bld && bld->GetLevel(0))
{
bld->GetExtents(building_extents[i]);
building_extents[i].Grow(margin, margin);
const DPolygon2 &dpoly = bld->GetLevel(0)->GetFootprint();
const DPoint2 center = dpoly[0].Centroid();
if (grid->FindAltitudeOnEarth(center, elev, true))
building_heights[i] = elev;
}
}
}
int altered_heixels = 0;
int linkpoint;
float fractional;
double a, b, total;
DPoint3 loc;
int i, j;
int xsize, ysize;
grid->GetDimensions(xsize, ysize);
for (i = 0; i < xsize; i++)
{
if ((i % 5) == 0)
UpdateProgressDialog(i*100/xsize);
for (j = 0; j < ysize; j++)
{
grid->GetEarthLocation(i, j, loc);
DPoint2 p2(loc.x, loc.y);
float sum_elev = 0.0f;
float sum_weight = 0.0f;
const float existing = grid->GetFValue(i, j);
if (pR)
{
for (LinkEdit *pLink = pR->GetFirstLink(); pLink; pLink = pLink->GetNext())
{
if (!pLink->WithinExtent(p2))
continue;
// Find position in link coordinates.
// These factors (a,b) are similar to what Pete Willemsen calls
// Curvilinear Coordinates: distance and offset.
DPoint2 closest;
total = pLink->GetLinearCoordinates(p2, a, b, closest,
linkpoint, fractional, false);
const float left_half = pLink->m_fLeftWidth + shoulder;
const float right_half = pLink->m_fRightWidth + shoulder;
// Check if the point is actually on the link
if (a < 0 || a > total ||
b < -(left_half + fade) ||
b > (right_half + fade))
continue;
// Don't use the height of the ground at the middle of the link.
// That assumes the link is draped perfectly. In reality,
// it's draped based only on the height at each vertex of
// the link. Just use those.
// Also, if the road isn't entirely on elevation, skip it.
float alt1, alt2;
if (!grid->FindAltitudeOnEarth(pLink->GetAt(linkpoint), alt1))
continue;
if (!grid->FindAltitudeOnEarth(pLink->GetAt(linkpoint+1), alt2))
continue;
const float road_height = alt1 + (alt2 - alt1) * fractional;
// If in the road proper, use road height.
if (b > -left_half && b < right_half)
{
sum_elev += road_height;
sum_weight += 1.0f;
}
else
{
// If the point falls in the 'fade' region, interpolate
// the offset from 1 to 0 across the region.
float amount;
if (b < -left_half)
amount = (b + (fade + left_half)) / fade;
if (b > right_half)
amount = ((right_half + fade) - b) / fade;
if (amount > 0.01) // Avoid precision issues
{
const float diff = road_height - existing;
sum_elev += (existing + diff * amount) * amount;
sum_weight += amount;
}
}
}
}
// Also compare to buildings
if (pS)
{
for (uint i = 0; i < pS->size(); i++)
{
vtStructure *str = pS->at(i);
// a building
vtBuilding *bld = str->GetBuilding();
if (!bld)
continue;
if (!building_extents[i].ContainsPoint(p2))
continue;
if (building_heights[i] == INVALID_ELEVATION)
continue;
const float dist = bld->GetDistanceToInterior(p2);
if (dist > margin)
continue;
if (dist == 0)
{
sum_elev += building_heights[i];
sum_weight += 1.0f;
}
else
{
const float amount = 1.0f - (dist / margin);
if (amount > 0.01) // Avoid precision issues
{
const float diff = building_heights[i] - existing;
sum_elev += (existing + diff * amount) * amount;
sum_weight += amount;
}
}
}
}
if (sum_weight != 0.0f)
{
grid->SetFValue(i, j, sum_elev / sum_weight);
altered_heixels++;
}
}
}
if (altered_heixels)
{
grid->ComputeHeightExtents();
pElev->SetModified(true);
pElev->ReRender();
}
CloseProgressDialog();
}
//
// sample all image data into this one
//
bool Builder::SampleCurrentImages(vtImageLayer *pTargetLayer)
{
vtImage *pTarget = pTargetLayer->GetImage();
DRECT area;
pTarget->GetExtent(area);
const DPoint2 &step = pTarget->GetSpacing();
int i, j, l, layers = m_Layers.size();
const IPoint2 Size = pTarget->GetDimensions();
// Create progress dialog for the slow part
OpenProgressDialog(_("Sampling Image Layers"), _T(""), true);
vtImage **images = new vtImage *[LayersOfType(LT_IMAGE)];
int g, num_image = 0;
for (l = 0; l < layers; l++)
{
vtLayer *lp = m_Layers[l];
if (lp->GetType() == LT_IMAGE)
images[num_image++] = ((vtImageLayer *)lp)->GetImage();
}
double dRes = step.x;
// Get ready to multisample
DLine2 offsets;
int iNSampling = g_Options.GetValueInt(TAG_SAMPLING_N);
MakeSampleOffsets(step, iNSampling, offsets);
dRes /= iNSampling;
// iterate through the pixels of the new image
DPoint2 p;
RGBAi rgba, sampled;
int count;
for (j = 0; j < Size.y; j++)
{
if (UpdateProgressDialog(j*100/Size.y))
{
// Cancel
CloseProgressDialog();
return false;
}
// Sample at the pixel centers, which are 1/2 pixel in from extents
p.y = area.bottom + (step.y/2) + (j * step.y);
for (i = 0; i < Size.x; i++)
{
p.x = area.left + (step.x/2) + (i * step.x);
// find some data for this point
count = 0;
for (g = 0; g < num_image; g++)
{
// take image that's on top (last in list)
if (images[g]->GetMultiSample(p, offsets, sampled, dRes))
{
rgba = sampled;
count++;
}
}
if (count)
pTarget->SetRGBA(i, Size.y-1-j, rgba);
else
// write NODATA (black, with no alpha, for now)
pTarget->SetRGBA(i, Size.y-1-j, RGBAi(0, 0, 0, 0));
}
}
CloseProgressDialog();
delete images;
return true;
}
bool Builder::GetRGBUnderCursor(const DPoint2 &p, RGBi &rgb)
{
bool success = false;
RGBAi value;
for (uint i = 0; i < m_Layers.size(); i++)
{
vtLayer *lay = m_Layers[i];
if (lay->GetType() != LT_IMAGE || !lay->GetVisible())
continue;
vtImageLayer *pIL = (vtImageLayer *) lay;
// Safety check
if (!pIL->GetImage())
continue;
if (pIL->GetImage()->GetColorSolid(p, value))
{
rgb = value;
success = true;
}
}
return success;
}
void Builder::SetCRS(const vtCRS &crs)
{
char type[7], value[4000];
crs.GetTextDescription(type, value);
VTLOG("Setting main CRS to: %s, %s\n", type, value);
m_crs = crs;
}
////////////////////////////////////////////////////////////////
// Project operations
bool Builder::LoadSpeciesFile(const char *fname)
{
if (!GetSpeciesList()->ReadXML(fname))
{
DisplayAndLog("Couldn't read plant list from file '%s'.", fname);
return false;
}
m_strSpeciesFilename = fname;
return true;
}
bool Builder::LoadBiotypesFile(const char *fname)
{
if (!m_BioRegion.Read(fname, m_SpeciesList))
{
DisplayAndLog("Couldn't read bioregion list from file '%s'.", fname);
return false;
}
m_strBiotypesFilename = fname;
return true;
}
//////////////////////////
// Elevation ops
void Builder::ScanElevationLayers(int &count, int &floating, int &tins, DPoint2 &spacing)
{
count = floating = tins = 0;
spacing.Set(0,0);
for (uint i = 0; i < m_Layers.size(); i++)
{
vtLayer *lay = m_Layers[i];
if (lay->GetType() != LT_ELEVATION)
continue;
count++;
vtElevLayer *el = (vtElevLayer *) lay;
if (el->IsGrid())
{
vtElevationGrid *grid = el->GetGrid();
if (grid->IsFloatMode() || grid->GetScale() != 1.0f)
floating++;
spacing = grid->GetSpacing();
}
else
{
tins++;
// All TINs have floating-point precision
floating++;
}
}
}
void Builder::AreaSampleElevation(BuilderView *pView)
{
VTLOG1("AreaSampleElevation\n");
// If any of the input terrain are floats, then recommend to the user
// that the output should be float as well.
bool floatmode = false;
// sample spacing in meters/heixel or degrees/heixel
DPoint2 spacing(0, 0);
int count = 0, floating = 0, tins = 0;
ScanElevationLayers(count, floating, tins, spacing);
VTLOG(" Layers: %d, Elevation layers: %d, %d are floating point\n",
NumLayers(), count, floating);
if (count == 0)
{
DisplayAndLog("Sorry, you must have some elevation grid layers\n"
"to perform a sampling operation on them.");
return;
}
if (floating > 0)
floatmode = true;
// Always recommend sub-meter precision when sampling TINs
if (tins > 0)
floatmode = true;
if (spacing == DPoint2(0, 0))
{
// There were no elevation grids to estimate spacing, so just give
// a default value.
spacing.Set(1,1);
}
// Open the Sample dialog
SampleElevationDlg dlg(m_pParentWindow, -1, _("Sample Elevation"));
dlg.m_fEstX = spacing.x;
dlg.m_fEstY = spacing.y;
dlg.m_area = m_area;
dlg.m_bFloats = floatmode;
dlg.SetView(pView);
int ret = dlg.ShowModal();
if (pView)
pView->HideGridMarks();
if (ret == wxID_CANCEL)
return;
// Make new terrain
vtElevLayer *pOutput = new vtElevLayer(dlg.m_area, dlg.m_Size,
dlg.m_bFloats, dlg.m_fVUnits, m_crs);
if (!pOutput->GetGrid()->HasData())
{
wxString str;
str.Printf(_("Failed to initialize %d x %d elevation grid"),
dlg.m_Size.x, dlg.m_Size.y);
wxMessageBox(str);
return;
}
// fill in the value for pOutput by merging samples from all other terrain
if (!SampleCurrentTerrains(pOutput))
{
delete pOutput;
return;
}
pOutput->GetGrid()->ComputeHeightExtents();
if (dlg.m_bFillGaps)
{
if (!FillElevGaps(pOutput))
{
delete pOutput;
return;
}
}
if (dlg.m_bNewLayer)
AddLayerWithCheck(pOutput);
else if (dlg.m_bToFile)
{
OpenProgressDialog(_("Writing file"), dlg.m_strToFile, true);
wxString fname = dlg.m_strToFile;
bool gzip = (fname.Right(3).CmpNoCase(_T(".gz")) == 0);
vtString fname_utf8 = (const char *) fname.mb_str(wxConvUTF8);
bool success = pOutput->GetGrid()->SaveToBT(fname_utf8, progress_callback, gzip);
delete pOutput;
CloseProgressDialog();
if (success)
DisplayAndLog("Successfully wrote to '%s'", (const char *) fname_utf8);
else
DisplayAndLog("Did not successfully write to '%s'", (const char *) fname_utf8);
}
}
//////////////////////////////////////////////////////////
// Image ops
void Builder::AreaSampleImages(BuilderView *pView)
{
// sample spacing in meters/heixel or degrees/heixel
DPoint2 spacing(0, 0);
int iBitDepth = 0;
for (uint i = 0; i < m_Layers.size(); i++)
{
vtLayer *lay = m_Layers[i];
if (lay->GetType() == LT_IMAGE)
{
vtImageLayer *im = (vtImageLayer *) lay;
spacing = im->GetSpacing();
// Adopt bit depth from first layer. It would be better to ask the user, but
// this should do what they expect almost always.
iBitDepth = im->GetImage()->GetBitDepth();
}
}
if (spacing == DPoint2(0, 0))
{
DisplayAndLog(_("Sorry, you must have some image layers to\n perform a sampling operation on them."));
return;
}
// Open the Sample dialog
SampleImageDlg dlg(m_pParentWindow, -1, _("Sample Imagery"));
dlg.m_fEstX = spacing.x;
dlg.m_fEstY = spacing.y;
dlg.m_area = m_area;
dlg.SetView(pView);
int ret = dlg.ShowModal();
if (pView)
pView->HideGridMarks();
if (ret == wxID_CANCEL)
return;
// Make new image
vtImageLayer *pOutputLayer = new vtImageLayer(dlg.m_area, dlg.m_Size, m_crs, iBitDepth);
vtImage *pOutput = pOutputLayer->GetImage();
if (!pOutput->GetBitmap())
{
DisplayAndLog(_("Sorry, could not allocate an image of that size."));
delete pOutputLayer;
return;
}
// fill in the value for pBig by merging samples from all other terrain
bool success = SampleCurrentImages(pOutputLayer);
if (!success)
{
delete pOutputLayer;
return;
}
if (dlg.m_bNewLayer)
AddLayerWithCheck(pOutputLayer);
else if (dlg.m_bToFile)
{
OpenProgressDialog(_("Writing file"), dlg.m_strToFile, true);
vtString fname = (const char *) dlg.m_strToFile.mb_str(wxConvUTF8);
success = pOutput->SaveToFile(fname);
delete pOutput;
CloseProgressDialog();
if (success)
DisplayAndLog("Successfully wrote to '%s'", (const char *) fname);
else
DisplayAndLog(("Did not successfully write to '%s'."), (const char *) fname);
}
}
//////////////////////////
// Vegetation ops
/**
* Generate vegetation in a given area, and writes it to a VF file.
* All options are given in the VegGenOptions object passed in.
*
*/
void Builder::GenerateVegetation(const char *vf_file, DRECT area,
VegGenOptions &opt)
{
OpenProgressDialog(_("Generating Vegetation"), wxString::FromUTF8(vf_file), true);
clock_t time1 = clock();
vtBioType SingleBiotype;
if (opt.m_iSingleSpecies != -1)
{
// simply use a single species
vtPlantSpecies *ps = m_SpeciesList.GetSpecies(opt.m_iSingleSpecies);
SingleBiotype.AddPlant(ps, opt.m_fFixedDensity);
opt.m_iSingleBiotype = m_BioRegion.AddType(&SingleBiotype);
}
// Create some optimization indices to speed it up
if (opt.m_pBiotypeLayer)
opt.m_pBiotypeLayer->CreateIndex(10);
if (opt.m_pDensityLayer)
opt.m_pDensityLayer->CreateIndex(10);
GenerateVegetationPhase2(vf_file, area, opt);
// Clean up the optimization indices
if (opt.m_pBiotypeLayer)
opt.m_pBiotypeLayer->FreeIndex();
if (opt.m_pDensityLayer)
opt.m_pDensityLayer->FreeIndex();
// clean up temporary biotype
if (opt.m_iSingleSpecies != -1)
{
m_BioRegion.m_Types.RemoveAt(opt.m_iSingleBiotype);
}
clock_t time2 = clock();
float time = ((float)time2 - time1)/CLOCKS_PER_SEC;
VTLOG("GenerateVegetation: %.3f seconds.\n", time);
}
void Builder::GenerateVegetationPhase2(const char *vf_file, DRECT area,
VegGenOptions &opt)
{
// Avoid trouble with '.' and ',' in Europe
ScopedLocale normal_numbers(LC_NUMERIC, "C");
uint i, j, k;
DPoint2 p, p2;
uint x_trees = (uint)(area.Width() / opt.m_fSampling);
uint y_trees = (uint)(area.Height() / opt.m_fSampling);
int bio_type=0;
float density_scale;
vtPlantInstanceArray pia;
vtPlantDensity *pd;
vtBioType *bio;
vtPlantSpecies *ps;
// inherit CRS from the main frame
vtCRS crs;
GetCRS(crs);
pia.SetCRS(crs);
m_BioRegion.ResetAmounts();
pia.SetSpeciesList(&m_SpeciesList);
// Iterate over the whole area, creating plant instances
for (i = 0; i < x_trees; i ++)
{
wxString str;
str.Printf(_("column %d/%d, plants: %d"), i, x_trees, pia.NumEntities());
if (UpdateProgressDialog(i * 100 / x_trees, str))
{
// user cancel
CloseProgressDialog();
return;
}
p.x = area.left + (i * opt.m_fSampling);
for (j = 0; j < y_trees; j ++)
{
p.y = area.bottom + (j * opt.m_fSampling);
// randomize the position slightly
p2.x = p.x + random_offset(opt.m_fSampling * 0.5f);
p2.y = p.y + random_offset(opt.m_fSampling * 0.5f);
// Density
if (opt.m_pDensityLayer)
{
density_scale = opt.m_pDensityLayer->FindDensity(p2);
if (density_scale <= 0.0f)
continue;
}
else
density_scale = 1.0f;
// Species
if (opt.m_iSingleSpecies != -1)
{
// use our single species biotype
bio_type = opt.m_iSingleBiotype;
}
else
{
if (opt.m_iSingleBiotype != -1)
{
bio_type = opt.m_iSingleBiotype;
}
else if (opt.m_pBiotypeLayer != NULL)
{
bio_type = opt.m_pBiotypeLayer->FindBiotype(p2);
if (bio_type == -1)
continue;
}
}
// look at veg_type to decide which BioType to use
bio = m_BioRegion.m_Types[bio_type];
float square_meters = opt.m_fSampling * opt.m_fSampling;
float factor = density_scale * square_meters * opt.m_fScarcity;
// the amount of each species present accumulates until it
// exceeds 1, at which time we produce a plant instance
for (k = 0; k < bio->m_Densities.GetSize(); k++)
{
pd = bio->m_Densities[k];
pd->m_amount += (pd->m_plant_per_m2 * factor);
}
ps = NULL;
for (k = 0; k < bio->m_Densities.GetSize(); k++)
{
pd = bio->m_Densities[k];
if (pd->m_amount > 1.0f) // time to plant
{
pd->m_amount -= 1.0f;
pd->m_iNumPlanted++;
ps = pd->m_pSpecies;
break;
}
}
if (ps == NULL)
continue;
// Now determine size
float size;
if (opt.m_fFixedSize != -1.0f)
{
size = opt.m_fFixedSize;
}
else
{
float range = opt.m_fRandomTo - opt.m_fRandomFrom;
size = (opt.m_fRandomFrom + random(range)) * ps->GetMaxHeight();
}
// Finally, add the plant
pia.AddPlant(p2, size, ps);
}
}
pia.WriteVF(vf_file);
CloseProgressDialog();
// display a useful message informing the user what was planted
int unplanted = 0;
wxString msg, str;
msg = _("Vegetation distribution results:\n");
for (i = 0; i < m_BioRegion.m_Types.GetSize(); i++)
{
bio = m_BioRegion.m_Types[i];
int total_this_type = 0;
for (k = 0; k < bio->m_Densities.GetSize(); k++)
{
pd = bio->m_Densities[k];
total_this_type += pd->m_iNumPlanted;
unplanted += (int) (pd->m_amount);
}
str.Printf(_(" BioType %d"), i);
msg += str;
if (total_this_type != 0)
{
msg += _T("\n");
for (k = 0; k < bio->m_Densities.GetSize(); k++)
{
pd = bio->m_Densities[k];
str.Printf(_(" Plant %d: %hs: %d generated.\n"), k,
(const char *) pd->m_pSpecies->GetCommonName().m_strName, pd->m_iNumPlanted);
msg += str;
}
}
else
msg += _(": None.\n");
}
str.Printf(_(" Total: %d\n"), pia.NumEntities());
msg += str;
DisplayAndLog(msg);
if (unplanted > 0)
{
msg.Printf(_T("%d plants were generated that could not be placed.\n"), unplanted);
msg += _T("Try to decrease your spacing or scarcity, so that\n");
msg += _T("there are enough places to plant.");
wxMessageBox(msg, _("Warning"));
}
}
//////////////////////////////
using namespace std;
void Builder::ReadDataPath()
{
wxString cwd1 = wxGetCwd();
vtString cwd = (const char *) cwd1.mb_str(wxConvUTF8);
VTLOG(" Current directory: '%s'\n", (const char *) cwd);
VTLOG("Looking for data path info.\n");
// Look these up, we might need them
wxString Dir1 = wxStandardPaths::Get().GetUserConfigDir();
wxString Dir2 = wxStandardPaths::Get().GetConfigDir();
vtString AppDataUser = (const char *) Dir1.mb_str(wxConvUTF8);
vtString AppDataCommon = (const char *) Dir2.mb_str(wxConvUTF8);
// Read the vt datapaths
bool bLoadedDataPaths = vtLoadDataPath(AppDataUser, AppDataCommon);
if (!bLoadedDataPaths || vtGetDataPath().size() == 0)
{
VTLOG1(" Not found or no paths, using default of '../Data/'.\n");
vtGetDataPath().push_back(vtString("../Data/"));
vtGetDataPath().push_back(vtString("../../../Data/"));
}
}
bool Builder::ConfirmValidCRS(vtCRS *pCRS)
{
if (!pCRS->GetRoot())
{
// No CRS at all.
int res;
if (g_Options.GetValueBool(TAG_USE_CURRENT_CRS))
res = wxNO; // Don't ask user, just use current CRS
else
{
wxString msg = _("File lacks a projection.\n Would you like to specify one?\n Yes - specify projection\n No - use current projection\n");
res = wxMessageBox(msg, _("Coordinate Reference System"), wxYES_NO | wxCANCEL);
}
if (res == wxYES)
{
ProjectionDlg dlg(NULL, -1, _("Please indicate projection"));
dlg.SetCRS(m_crs);
if (dlg.ShowModal() == wxID_CANCEL)
return false;
dlg.GetCRS(*pCRS);
}
else if (res == wxNO)
*pCRS = m_crs;
else if (res == wxCANCEL)
return false;
}
return true;
}
/**
* From a set of elevation layers, pick the valid elevation that occurs latest
* in the set.
*/
float ElevLayerArrayValue(std::vector<vtElevLayer*> &elevs, const DPoint2 &p)
{
float fData, fBestData = INVALID_ELEVATION;
for (uint g = 0; g < elevs.size(); g++)
{
vtElevLayer *elev = elevs[g];
// The bounds-test would occur later, but we need to exclude this
// grid early to avoid paging it in unnecessarily.
DRECT ext;
elev->GetExtent(ext);
if (!ext.ContainsPoint(p, true))
continue;
// Check if elevation data is in memory
if (!elev->HasData())
{
bool success = ElevCacheLoadData(elev);
// Safety check; we should never fail to read a BT or ITF, but just in
// case anything goes wrong, don't crash.
if (!success)
return INVALID_ELEVATION;
// If it's a TIN, set it up for speedy picking
elev->SetupTinTriangleBins(50); // target 50 tris per bin
}
vtElevationGrid *grid = elev->GetGrid();
vtTin2d *tin = elev->GetTin();
if (grid)
{
fData = grid->GetFilteredValue(p);
if (fData != INVALID_ELEVATION)
fBestData = fData;
}
else if (tin)
{
if (tin->FindAltitudeOnEarth(p, fData))
fBestData = fData;
}
}
return fBestData;
}
void ElevLayerArrayRange(std::vector<vtElevLayer*> &elevs,
float &minval, float &maxval)
{
float fMin = 1E9;
float fMax = -1E9;
for (uint g = 0; g < elevs.size(); g++)
{
float LayerMin, LayerMax;
elevs[g]->GetHeightField()->GetHeightExtents(LayerMin, LayerMax);
if (LayerMin != INVALID_ELEVATION && LayerMin < fMin)
fMin = LayerMin;
if (LayerMax != INVALID_ELEVATION && LayerMax > fMax)
fMax = LayerMax;
}
minval = fMin;
maxval = fMax;
}
| 24.568312 | 203 | 0.654036 | [
"object",
"vector",
"transform"
] |
70b2f2714e5350492344fcf5b11e9a278ee9b4a2 | 11,817 | cpp | C++ | modules/imgcodecs/test/test_grfmt.cpp | VladKarpushin/opencv | 9787ab598b6609a6ca6652a12441d741cb15f695 | [
"BSD-3-Clause"
] | 13 | 2018-06-04T09:01:49.000Z | 2022-03-29T07:09:33.000Z | modules/imgcodecs/test/test_grfmt.cpp | VladKarpushin/opencv | 9787ab598b6609a6ca6652a12441d741cb15f695 | [
"BSD-3-Clause"
] | 3 | 2019-07-30T08:38:58.000Z | 2019-11-21T06:49:31.000Z | modules/imgcodecs/test/test_grfmt.cpp | VladKarpushin/opencv | 9787ab598b6609a6ca6652a12441d741cb15f695 | [
"BSD-3-Clause"
] | 11 | 2018-06-07T06:31:21.000Z | 2022-01-24T22:29:29.000Z | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "test_precomp.hpp"
namespace opencv_test { namespace {
typedef tuple<string, int> File_Mode;
typedef testing::TestWithParam<File_Mode> Imgcodecs_FileMode;
TEST_P(Imgcodecs_FileMode, regression)
{
const string root = cvtest::TS::ptr()->get_data_path();
const string filename = root + get<0>(GetParam());
const int mode = get<1>(GetParam());
const Mat single = imread(filename, mode);
ASSERT_FALSE(single.empty());
vector<Mat> pages;
ASSERT_TRUE(imreadmulti(filename, pages, mode));
ASSERT_FALSE(pages.empty());
const Mat page = pages[0];
ASSERT_FALSE(page.empty());
EXPECT_EQ(page.channels(), single.channels());
EXPECT_EQ(page.depth(), single.depth());
EXPECT_EQ(page.size().height, single.size().height);
EXPECT_EQ(page.size().width, single.size().width);
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), page, single);
}
const string all_images[] =
{
#ifdef HAVE_JASPER
"readwrite/Rome.jp2",
"readwrite/Bretagne2.jp2",
"readwrite/Bretagne2.jp2",
"readwrite/Grey.jp2",
"readwrite/Grey.jp2",
#endif
#ifdef HAVE_GDCM
"readwrite/int16-mono1.dcm",
"readwrite/uint8-mono2.dcm",
"readwrite/uint16-mono2.dcm",
"readwrite/uint8-rgb.dcm",
#endif
"readwrite/color_palette_alpha.png",
"readwrite/multipage.tif",
"readwrite/ordinary.bmp",
"readwrite/rle8.bmp",
"readwrite/test_1_c1.jpg",
#ifdef HAVE_IMGCODEC_HDR
"readwrite/rle.hdr"
#endif
};
const int basic_modes[] =
{
IMREAD_UNCHANGED,
IMREAD_GRAYSCALE,
IMREAD_COLOR,
IMREAD_ANYDEPTH,
IMREAD_ANYCOLOR
};
INSTANTIATE_TEST_CASE_P(All, Imgcodecs_FileMode,
testing::Combine(
testing::ValuesIn(all_images),
testing::ValuesIn(basic_modes)));
// GDAL does not support "hdr", "dcm" and have problems with "jp2"
struct notForGDAL {
bool operator()(const string &name) const {
const string &ext = name.substr(name.size() - 3, 3);
return ext == "hdr" || ext == "dcm" || ext == "jp2" ||
name.find("rle8.bmp") != std::string::npos;
}
};
inline vector<string> gdal_images()
{
vector<string> res;
std::back_insert_iterator< vector<string> > it(res);
std::remove_copy_if(all_images, all_images + sizeof(all_images)/sizeof(all_images[0]), it, notForGDAL());
return res;
}
INSTANTIATE_TEST_CASE_P(GDAL, Imgcodecs_FileMode,
testing::Combine(
testing::ValuesIn(gdal_images()),
testing::Values(IMREAD_LOAD_GDAL)));
//==================================================================================================
typedef tuple<string, Size> Ext_Size;
typedef testing::TestWithParam<Ext_Size> Imgcodecs_ExtSize;
TEST_P(Imgcodecs_ExtSize, write_imageseq)
{
const string ext = get<0>(GetParam());
const Size size = get<1>(GetParam());
const Point2i center = Point2i(size.width / 2, size.height / 2);
const int radius = std::min(size.height, size.width / 4);
for (int cn = 1; cn <= 4; cn++)
{
SCOPED_TRACE(format("channels %d", cn));
std::vector<int> parameters;
if (cn == 2)
continue;
if (cn == 4 && ext != ".tiff")
continue;
if (cn > 1 && (ext == ".pbm" || ext == ".pgm"))
continue;
if (cn != 3 && ext == ".ppm")
continue;
string filename = cv::tempfile(format("%d%s", cn, ext.c_str()).c_str());
Mat img_gt(size, CV_MAKETYPE(CV_8U, cn), Scalar::all(0));
circle(img_gt, center, radius, Scalar::all(255));
#if 1
if (ext == ".pbm" || ext == ".pgm" || ext == ".ppm")
{
parameters.push_back(IMWRITE_PXM_BINARY);
parameters.push_back(0);
}
#endif
ASSERT_TRUE(imwrite(filename, img_gt, parameters));
Mat img = imread(filename, IMREAD_UNCHANGED);
ASSERT_FALSE(img.empty());
EXPECT_EQ(img.size(), img.size());
EXPECT_EQ(img.type(), img.type());
EXPECT_EQ(cn, img.channels());
if (ext == ".jpg")
{
// JPEG format does not provide 100% accuracy
// using fuzzy image comparison
double n = cvtest::norm(img, img_gt, NORM_L1);
double expected = 0.07 * img.size().area();
EXPECT_LT(n, expected);
EXPECT_PRED_FORMAT2(cvtest::MatComparator(10, 0), img, img_gt);
}
else
{
double n = cvtest::norm(img, img_gt, NORM_L2);
EXPECT_LT(n, 1.);
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), img, img_gt);
}
#if 0
std::cout << filename << std::endl;
imshow("loaded", img);
waitKey(0);
#else
EXPECT_EQ(0, remove(filename.c_str()));
#endif
}
}
const string all_exts[] =
{
#ifdef HAVE_PNG
".png",
#endif
#ifdef HAVE_TIFF
".tiff",
#endif
#ifdef HAVE_JPEG
".jpg",
#endif
".bmp",
#ifdef HAVE_IMGCODEC_PXM
".pam",
".ppm",
".pgm",
".pbm",
".pnm"
#endif
};
vector<Size> all_sizes()
{
vector<Size> res;
for (int k = 1; k <= 5; ++k)
res.push_back(Size(640 * k, 480 * k));
return res;
}
INSTANTIATE_TEST_CASE_P(All, Imgcodecs_ExtSize,
testing::Combine(
testing::ValuesIn(all_exts),
testing::ValuesIn(all_sizes())));
#ifdef HAVE_IMGCODEC_PXM
typedef testing::TestWithParam<bool> Imgcodecs_pbm;
TEST_P(Imgcodecs_pbm, write_read)
{
bool binary = GetParam();
const String ext = "pbm";
const string full_name = cv::tempfile(ext.c_str());
Size size(640, 480);
const Point2i center = Point2i(size.width / 2, size.height / 2);
const int radius = std::min(size.height, size.width / 4);
Mat image(size, CV_8UC1, Scalar::all(0));
circle(image, center, radius, Scalar::all(255));
vector<int> pbm_params;
pbm_params.push_back(IMWRITE_PXM_BINARY);
pbm_params.push_back(binary);
imwrite( full_name, image, pbm_params );
Mat loaded = imread(full_name, IMREAD_UNCHANGED);
ASSERT_FALSE(loaded.empty());
EXPECT_EQ(0, cvtest::norm(loaded, image, NORM_INF));
FILE *f = fopen(full_name.c_str(), "rb");
ASSERT_TRUE(f != NULL);
ASSERT_EQ('P', getc(f));
ASSERT_EQ('1' + (binary ? 3 : 0), getc(f));
fclose(f);
EXPECT_EQ(0, remove(full_name.c_str()));
}
INSTANTIATE_TEST_CASE_P(All, Imgcodecs_pbm, testing::Bool());
#endif
//==================================================================================================
TEST(Imgcodecs_Bmp, read_rle8)
{
const string root = cvtest::TS::ptr()->get_data_path();
Mat rle = imread(root + "readwrite/rle8.bmp");
ASSERT_FALSE(rle.empty());
Mat ord = imread(root + "readwrite/ordinary.bmp");
ASSERT_FALSE(ord.empty());
EXPECT_LE(cvtest::norm(rle, ord, NORM_L2), 1.e-10);
EXPECT_PRED_FORMAT2(cvtest::MatComparator(0, 0), rle, ord);
}
#ifdef HAVE_IMGCODEC_HDR
TEST(Imgcodecs_Hdr, regression)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "/readwrite/";
string name_rle = folder + "rle.hdr";
string name_no_rle = folder + "no_rle.hdr";
Mat img_rle = imread(name_rle, -1);
ASSERT_FALSE(img_rle.empty()) << "Could not open " << name_rle;
Mat img_no_rle = imread(name_no_rle, -1);
ASSERT_FALSE(img_no_rle.empty()) << "Could not open " << name_no_rle;
double min = 0.0, max = 1.0;
minMaxLoc(abs(img_rle - img_no_rle), &min, &max);
ASSERT_FALSE(max > DBL_EPSILON);
string tmp_file_name = tempfile(".hdr");
vector<int>param(1);
for(int i = 0; i < 2; i++) {
param[0] = i;
imwrite(tmp_file_name, img_rle, param);
Mat written_img = imread(tmp_file_name, -1);
ASSERT_FALSE(written_img.empty()) << "Could not open " << tmp_file_name;
minMaxLoc(abs(img_rle - written_img), &min, &max);
ASSERT_FALSE(max > DBL_EPSILON);
}
remove(tmp_file_name.c_str());
}
#endif
#ifdef HAVE_IMGCODEC_PXM
TEST(Imgcodecs_Pam, read_write)
{
string folder = string(cvtest::TS::ptr()->get_data_path()) + "readwrite/";
string filepath = folder + "lena.pam";
cv::Mat img = cv::imread(filepath);
ASSERT_FALSE(img.empty());
std::vector<int> params;
params.push_back(IMWRITE_PAM_TUPLETYPE);
params.push_back(IMWRITE_PAM_FORMAT_RGB);
string writefile = cv::tempfile(".pam");
EXPECT_NO_THROW(cv::imwrite(writefile, img, params));
cv::Mat reread = cv::imread(writefile);
string writefile_no_param = cv::tempfile(".pam");
EXPECT_NO_THROW(cv::imwrite(writefile_no_param, img));
cv::Mat reread_no_param = cv::imread(writefile_no_param);
EXPECT_EQ(0, cvtest::norm(reread, reread_no_param, NORM_INF));
EXPECT_EQ(0, cvtest::norm(img, reread, NORM_INF));
remove(writefile.c_str());
remove(writefile_no_param.c_str());
}
#endif
TEST(Imgcodecs, write_parameter_type)
{
cv::Mat m(10, 10, CV_8UC1, cv::Scalar::all(0));
cv::Mat1b m_type = cv::Mat1b::zeros(10, 10);
string tmp_file = cv::tempfile(".bmp");
EXPECT_NO_THROW(cv::imwrite(tmp_file, cv::Mat(m * 2))) << "* Failed with cv::Mat";
EXPECT_NO_THROW(cv::imwrite(tmp_file, m * 2)) << "* Failed with cv::MatExpr";
EXPECT_NO_THROW(cv::imwrite(tmp_file, m_type)) << "* Failed with cv::Mat_";
EXPECT_NO_THROW(cv::imwrite(tmp_file, m_type * 2)) << "* Failed with cv::MatExpr(Mat_)";
cv::Matx<uchar, 10, 10> matx;
EXPECT_NO_THROW(cv::imwrite(tmp_file, matx)) << "* Failed with cv::Matx";
EXPECT_EQ(0, remove(tmp_file.c_str()));
}
}} // namespace
| 33.287324 | 109 | 0.625286 | [
"vector"
] |
70b43e05d11b13588057ad22e7706c6bd6eadf13 | 4,371 | cc | C++ | src/fgmmbin/fgmm-global-init-from-accs.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 805 | 2018-05-28T02:32:04.000Z | 2022-03-26T09:13:12.000Z | src/fgmmbin/fgmm-global-init-from-accs.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 49 | 2015-10-24T22:06:28.000Z | 2019-12-24T11:13:34.000Z | src/fgmmbin/fgmm-global-init-from-accs.cc | shuipi100/kaldi | 8e30fddb300a87e7c79ef2c0b9c731a8a9fd23f0 | [
"Apache-2.0"
] | 267 | 2018-06-07T08:33:28.000Z | 2022-03-30T12:18:33.000Z | // fgmmbin/fgmm-global-init-from-accs.cc
// Copyright 2015-2017 David Snyder
// 2015 Johns Hopkins University (Author: Daniel Povey)
// 2015 Johns Hopkins University (Author: Daniel Garcia-Romero)
// See ../../COPYING for clarification regarding multiple authors
//
// 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
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing permissions and
// limitations under the License.
#include "base/kaldi-common.h"
#include "util/common-utils.h"
#include "gmm/full-gmm.h"
#include "gmm/mle-full-gmm.h"
int main(int argc, char *argv[]) {
try {
using namespace kaldi;
typedef int32 int32;
MleFullGmmOptions gmm_opts;
const char *usage =
"Initialize a full-covariance GMM from the accumulated stats.\n"
"This binary is similar to fgmm-global-est, but does not use "
"a preexisting model. See also fgmm-global-est.\n"
"Usage: fgmm-global-init-from-accs [options] <stats-in> "
"<number-of-components> <model-out>\n";
bool binary_write = true;
ParseOptions po(usage);
po.Register("binary", &binary_write, "Write output in binary mode");
gmm_opts.Register(&po);
po.Read(argc, argv);
if (po.NumArgs() != 3) {
po.PrintUsage();
exit(1);
}
std::string stats_filename = po.GetArg(1),
model_out_filename = po.GetArg(3);
int32 num_components = atoi(po.GetArg(2).c_str());
AccumFullGmm gmm_accs;
{
bool binary;
Input ki(stats_filename, &binary);
gmm_accs.Read(ki.Stream(), binary, true /* add accs. */);
}
int32 num_gauss = gmm_accs.NumGauss(), dim = gmm_accs.Dim(),
tot_floored = 0, gauss_floored = 0, tot_low_occ = 0;
FullGmm fgmm(num_components, dim);
Vector<BaseFloat> weights(num_gauss);
Matrix<BaseFloat> means(num_gauss, dim);
std::vector<SpMatrix<BaseFloat> > invcovars;
for (int32 i = 0; i < num_components; i++) {
BaseFloat occ = gmm_accs.occupancy()(i);
weights(i) = occ;
Vector<BaseFloat> mean(dim, kSetZero);
SpMatrix<BaseFloat> covar(dim, kSetZero);
// If the occupancy for a Gaussian is very low, set it to a small value.
if (occ < 1e-10) {
weights(i) = 1e-10;
mean.SetRandn();
Vector<BaseFloat> diag(mean.Dim());
diag.Set(1.0);
covar.AddDiagVec(1.0, diag);
tot_low_occ++;
// This is the typical case.
} else {
mean.CopyRowFromMat(gmm_accs.mean_accumulator(), i);
mean.Scale(1.0 / occ);
covar.CopyFromSp(gmm_accs.covariance_accumulator()[i]);
covar.Scale(1.0 / occ);
covar.AddVec2(-1.0, mean); // subtract squared means.
}
means.CopyRowFromVec(mean, i);
// Floor variance Eigenvalues.
BaseFloat floor = std::max(
static_cast<BaseFloat>(gmm_opts.variance_floor),
static_cast<BaseFloat>(covar.MaxAbsEig() / gmm_opts.max_condition));
int32 floored = covar.ApplyFloor(floor);
if (floored) {
tot_floored += floored;
gauss_floored++;
}
covar.InvertDouble();
invcovars.push_back(covar);
}
weights.Scale(1.0 / weights.Sum());
fgmm.SetWeights(weights);
fgmm.SetInvCovarsAndMeans(invcovars, means);
int32 num_bad = fgmm.ComputeGconsts();
KALDI_LOG << "FullGmm has " << num_bad << " bad GConsts";
if (tot_floored > 0) {
KALDI_WARN << tot_floored << " variances floored in " << gauss_floored
<< " Gaussians.";
}
if (tot_low_occ > 0) {
KALDI_WARN << tot_low_occ << " out of " << num_gauss
<< " Gaussians had very low occupancy.";
}
WriteKaldiObject(fgmm, model_out_filename, binary_write);
KALDI_LOG << "Written model to " << model_out_filename;
} catch(const std::exception &e) {
std::cerr << e.what() << '\n';
return -1;
}
}
| 33.366412 | 79 | 0.636468 | [
"vector",
"model"
] |
70bd15d5ad068297c1ae6f99889e1516f7024912 | 1,937 | hh | C++ | node_modules/@parcel/watcher/src/Event.hh | hamsall/hamsall.github.io | dc21c8037c9cd13641c61628ef1ed04c306c7701 | [
"MIT"
] | 2 | 2021-11-06T12:55:05.000Z | 2021-11-30T06:53:27.000Z | node_modules/@parcel/watcher/src/Event.hh | hamsall/hamsall.github.io | dc21c8037c9cd13641c61628ef1ed04c306c7701 | [
"MIT"
] | 6 | 2021-01-16T17:08:41.000Z | 2022-02-13T15:22:51.000Z | node_modules/@parcel/watcher/src/Event.hh | hamsall/hamsall.github.io | dc21c8037c9cd13641c61628ef1ed04c306c7701 | [
"MIT"
] | 3 | 2021-06-14T21:12:19.000Z | 2021-09-20T01:34:43.000Z | #ifndef EVENT_H
#define EVENT_H
#include <string>
#include <napi.h>
#include <mutex>
#include <map>
using namespace Napi;
struct Event {
std::string path;
bool isCreated;
bool isDeleted;
Event(std::string path) : path(path), isCreated(false), isDeleted(false) {}
Value toJS(const Env& env) {
EscapableHandleScope scope(env);
Object res = Object::New(env);
std::string type = isCreated ? "create" : isDeleted ? "delete" : "update";
res.Set(String::New(env, "path"), String::New(env, path.c_str()));
res.Set(String::New(env, "type"), String::New(env, type.c_str()));
return scope.Escape(res);
}
};
class EventList {
public:
void create(std::string path) {
std::lock_guard<std::mutex> l(mMutex);
Event *event = internalUpdate(path);
event->isCreated = true;
}
Event *update(std::string path) {
std::lock_guard<std::mutex> l(mMutex);
return internalUpdate(path);
}
void remove(std::string path) {
std::lock_guard<std::mutex> l(mMutex);
Event *event = internalUpdate(path);
if (event->isCreated) {
mEvents.erase(path);
} else {
event->isDeleted = true;
}
}
size_t size() {
std::lock_guard<std::mutex> l(mMutex);
return mEvents.size();
}
std::vector<Event> getEvents() {
std::lock_guard<std::mutex> l(mMutex);
std::vector<Event> eventsCloneVector;
for(auto it = mEvents.begin(); it != mEvents.end(); ++it) {
eventsCloneVector.push_back(it->second);
}
return eventsCloneVector;
}
void clear() {
std::lock_guard<std::mutex> l(mMutex);
mEvents.clear();
}
private:
mutable std::mutex mMutex;
std::map<std::string, Event> mEvents;
Event *internalUpdate(std::string path) {
auto found = mEvents.find(path);
if (found == mEvents.end()) {
auto it = mEvents.emplace(path, Event(path));
return &it.first->second;
}
return &found->second;
}
};
#endif
| 23.059524 | 78 | 0.632421 | [
"object",
"vector"
] |
70bf35dbd07d39dee21066609ddfe99e2206f4fe | 792,981 | cpp | C++ | src/main_4000.cpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | src/main_4000.cpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | src/main_4000.cpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayerLobbyPoseGeneratorMirror
#include "GlobalNamespace/MockPlayerLobbyPoseGeneratorMirror.hpp"
// Including type: MockPlayerLobbyPoseGeneratorMirror/<SendPoses>d__2
#include "GlobalNamespace/MockPlayerLobbyPoseGeneratorMirror_-SendPoses-d__2.hpp"
// Including type: NodePoseSyncStateManager
#include "GlobalNamespace/NodePoseSyncStateManager.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: System.Threading.CancellationToken
#include "System/Threading/CancellationToken.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly NodePoseSyncStateManager _nodePoseSyncStateManager
::GlobalNamespace::NodePoseSyncStateManager*& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::dyn__nodePoseSyncStateManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::dyn__nodePoseSyncStateManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nodePoseSyncStateManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::NodePoseSyncStateManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MockPlayerLobbyPoseGeneratorMirror.SendPoses
void GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::SendPoses(::System::Threading::CancellationToken cancellationToken) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::SendPoses");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SendPoses", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(cancellationToken)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, cancellationToken);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayerLobbyPoseGeneratorMirror/<SendPoses>d__2
#include "GlobalNamespace/MockPlayerLobbyPoseGeneratorMirror_-SendPoses-d__2.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Int32 <>1__state
int& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$1__state");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Runtime.CompilerServices.AsyncVoidMethodBuilder <>t__builder
::System::Runtime::CompilerServices::AsyncVoidMethodBuilder& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$t__builder() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$t__builder");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>t__builder"))->offset;
return *reinterpret_cast<::System::Runtime::CompilerServices::AsyncVoidMethodBuilder*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Threading.CancellationToken cancellationToken
::System::Threading::CancellationToken& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_cancellationToken() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_cancellationToken");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cancellationToken"))->offset;
return *reinterpret_cast<::System::Threading::CancellationToken*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MockPlayerLobbyPoseGeneratorMirror <>4__this
::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror*& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$4__this");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Runtime.CompilerServices.TaskAwaiter <>u__1
::System::Runtime::CompilerServices::TaskAwaiter& GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$u__1() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::dyn_$$u__1");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>u__1"))->offset;
return *reinterpret_cast<::System::Runtime::CompilerServices::TaskAwaiter*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MockPlayerLobbyPoseGeneratorMirror/<SendPoses>d__2.MoveNext
void GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerLobbyPoseGeneratorMirror/<SendPoses>d__2.SetStateMachine
void GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::SetStateMachine(::System::Runtime::CompilerServices::IAsyncStateMachine* stateMachine) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorMirror::$SendPoses$d__2::SetStateMachine");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(*this, "SetStateMachine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(stateMachine)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, stateMachine);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayerLobbyPoseGeneratorRecording
#include "GlobalNamespace/MockPlayerLobbyPoseGeneratorRecording.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: System.Threading.CancellationToken
#include "System/Threading/CancellationToken.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: MockPlayerLobbyPoseGeneratorRecording.SendPoses
void GlobalNamespace::MockPlayerLobbyPoseGeneratorRecording::SendPoses(::System::Threading::CancellationToken cancellationToken) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerLobbyPoseGeneratorRecording::SendPoses");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SendPoses", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(cancellationToken)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, cancellationToken);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayerMovementType
#include "GlobalNamespace/MockPlayerMovementType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MockPlayerMovementType AI
::GlobalNamespace::MockPlayerMovementType GlobalNamespace::MockPlayerMovementType::_get_AI() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_get_AI");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MockPlayerMovementType>("", "MockPlayerMovementType", "AI"));
}
// Autogenerated static field setter
// Set static field: static public MockPlayerMovementType AI
void GlobalNamespace::MockPlayerMovementType::_set_AI(::GlobalNamespace::MockPlayerMovementType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_set_AI");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MockPlayerMovementType", "AI", value));
}
// Autogenerated static field getter
// Get static field: static public MockPlayerMovementType MirrorPlayer
::GlobalNamespace::MockPlayerMovementType GlobalNamespace::MockPlayerMovementType::_get_MirrorPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_get_MirrorPlayer");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MockPlayerMovementType>("", "MockPlayerMovementType", "MirrorPlayer"));
}
// Autogenerated static field setter
// Set static field: static public MockPlayerMovementType MirrorPlayer
void GlobalNamespace::MockPlayerMovementType::_set_MirrorPlayer(::GlobalNamespace::MockPlayerMovementType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_set_MirrorPlayer");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MockPlayerMovementType", "MirrorPlayer", value));
}
// Autogenerated static field getter
// Get static field: static public MockPlayerMovementType Recording
::GlobalNamespace::MockPlayerMovementType GlobalNamespace::MockPlayerMovementType::_get_Recording() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_get_Recording");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MockPlayerMovementType>("", "MockPlayerMovementType", "Recording"));
}
// Autogenerated static field setter
// Set static field: static public MockPlayerMovementType Recording
void GlobalNamespace::MockPlayerMovementType::_set_Recording(::GlobalNamespace::MockPlayerMovementType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::_set_Recording");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MockPlayerMovementType", "Recording", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MockPlayerMovementType::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerMovementType::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayerSettings
#include "GlobalNamespace/MockPlayerSettings.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.String _userName
::StringW& GlobalNamespace::MockPlayerSettings::dyn__userName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__userName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_userName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _userId
::StringW& GlobalNamespace::MockPlayerSettings::dyn__userId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__userId");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_userId"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _sortIndex
int& GlobalNamespace::MockPlayerSettings::dyn__sortIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__sortIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sortIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _latency
float& GlobalNamespace::MockPlayerSettings::dyn__latency() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__latency");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_latency"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _autoConnect
bool& GlobalNamespace::MockPlayerSettings::dyn__autoConnect() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__autoConnect");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_autoConnect"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _inactiveByDefault
bool& GlobalNamespace::MockPlayerSettings::dyn__inactiveByDefault() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__inactiveByDefault");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inactiveByDefault"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MockPlayerMovementType _movementType
::GlobalNamespace::MockPlayerMovementType& GlobalNamespace::MockPlayerSettings::dyn__movementType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__movementType");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_movementType"))->offset;
return *reinterpret_cast<::GlobalNamespace::MockPlayerMovementType*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _recodingFile
::StringW& GlobalNamespace::MockPlayerSettings::dyn__recodingFile() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__recodingFile");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_recodingFile"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _aiCubeHitChance
float& GlobalNamespace::MockPlayerSettings::dyn__aiCubeHitChance() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__aiCubeHitChance");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_aiCubeHitChance"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _leftHanded
bool& GlobalNamespace::MockPlayerSettings::dyn__leftHanded() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__leftHanded");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leftHanded"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _saberAColor
::UnityEngine::Color& GlobalNamespace::MockPlayerSettings::dyn__saberAColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__saberAColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberAColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _saberBColor
::UnityEngine::Color& GlobalNamespace::MockPlayerSettings::dyn__saberBColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__saberBColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _obstaclesColor
::UnityEngine::Color& GlobalNamespace::MockPlayerSettings::dyn__obstaclesColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::dyn__obstaclesColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_obstaclesColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MockPlayerSettings.get_userName
::StringW GlobalNamespace::MockPlayerSettings::get_userName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_userName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_userName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_userName
void GlobalNamespace::MockPlayerSettings::set_userName(::StringW value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_userName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_userName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_userId
::StringW GlobalNamespace::MockPlayerSettings::get_userId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_userId");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_userId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_userId
void GlobalNamespace::MockPlayerSettings::set_userId(::StringW value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_userId");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_userId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_sortIndex
int GlobalNamespace::MockPlayerSettings::get_sortIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_sortIndex");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_sortIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_sortIndex
void GlobalNamespace::MockPlayerSettings::set_sortIndex(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_sortIndex");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_sortIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_latency
float GlobalNamespace::MockPlayerSettings::get_latency() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_latency");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_latency", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_latency
void GlobalNamespace::MockPlayerSettings::set_latency(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_latency");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_latency", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_autoConnect
bool GlobalNamespace::MockPlayerSettings::get_autoConnect() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_autoConnect");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_autoConnect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_autoConnect
void GlobalNamespace::MockPlayerSettings::set_autoConnect(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_autoConnect");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_autoConnect", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_inactiveByDefault
bool GlobalNamespace::MockPlayerSettings::get_inactiveByDefault() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_inactiveByDefault");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_inactiveByDefault", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_inactiveByDefault
void GlobalNamespace::MockPlayerSettings::set_inactiveByDefault(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_inactiveByDefault");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_inactiveByDefault", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_movementType
::GlobalNamespace::MockPlayerMovementType GlobalNamespace::MockPlayerSettings::get_movementType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_movementType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_movementType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MockPlayerMovementType, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_movementType
void GlobalNamespace::MockPlayerSettings::set_movementType(::GlobalNamespace::MockPlayerMovementType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_movementType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_movementType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_recodingFile
::StringW GlobalNamespace::MockPlayerSettings::get_recodingFile() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_recodingFile");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_recodingFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_recodingFile
void GlobalNamespace::MockPlayerSettings::set_recodingFile(::StringW value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_recodingFile");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_recodingFile", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_aiCubeHitChance
float GlobalNamespace::MockPlayerSettings::get_aiCubeHitChance() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_aiCubeHitChance");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_aiCubeHitChance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_aiCubeHitChance
void GlobalNamespace::MockPlayerSettings::set_aiCubeHitChance(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_aiCubeHitChance");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_aiCubeHitChance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_leftHanded
bool GlobalNamespace::MockPlayerSettings::get_leftHanded() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_leftHanded");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_leftHanded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_leftHanded
void GlobalNamespace::MockPlayerSettings::set_leftHanded(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_leftHanded");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_leftHanded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_saberAColor
::UnityEngine::Color GlobalNamespace::MockPlayerSettings::get_saberAColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_saberAColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberAColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_saberAColor
void GlobalNamespace::MockPlayerSettings::set_saberAColor(::UnityEngine::Color value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_saberAColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_saberAColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_saberBColor
::UnityEngine::Color GlobalNamespace::MockPlayerSettings::get_saberBColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_saberBColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberBColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_saberBColor
void GlobalNamespace::MockPlayerSettings::set_saberBColor(::UnityEngine::Color value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_saberBColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_saberBColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MockPlayerSettings.get_obstaclesColor
::UnityEngine::Color GlobalNamespace::MockPlayerSettings::get_obstaclesColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::get_obstaclesColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_obstaclesColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method);
}
// Autogenerated method: MockPlayerSettings.set_obstaclesColor
void GlobalNamespace::MockPlayerSettings::set_obstaclesColor(::UnityEngine::Color value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockPlayerSettings::set_obstaclesColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_obstaclesColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockPlayersModel
#include "GlobalNamespace/MockPlayersModel.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockQuickPlaySetupModel
#include "GlobalNamespace/MockQuickPlaySetupModel.hpp"
// Including type: QuickPlaySetupData
#include "GlobalNamespace/QuickPlaySetupData.hpp"
// Including type: System.Threading.Tasks.Task`1
#include "System/Threading/Tasks/Task_1.hpp"
// Including type: System.Threading.CancellationToken
#include "System/Threading/CancellationToken.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly QuickPlaySetupData _quickPlaySetupData
::GlobalNamespace::QuickPlaySetupData*& GlobalNamespace::MockQuickPlaySetupModel::dyn__quickPlaySetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockQuickPlaySetupModel::dyn__quickPlaySetupData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_quickPlaySetupData"))->offset;
return *reinterpret_cast<::GlobalNamespace::QuickPlaySetupData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MockQuickPlaySetupModel.GetQuickPlaySetupAsync
::System::Threading::Tasks::Task_1<::GlobalNamespace::QuickPlaySetupData*>* GlobalNamespace::MockQuickPlaySetupModel::GetQuickPlaySetupAsync(::System::Threading::CancellationToken cancellationToken) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MockQuickPlaySetupModel::GetQuickPlaySetupAsync");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetQuickPlaySetupAsync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(cancellationToken)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Threading::Tasks::Task_1<::GlobalNamespace::QuickPlaySetupData*>*, false>(this, ___internal__method, cancellationToken);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MockServerSettings
#include "GlobalNamespace/MockServerSettings.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerMockSettings
#include "GlobalNamespace/MultiplayerMockSettings.hpp"
// Including type: MockPlayerSettings
#include "GlobalNamespace/MockPlayerSettings.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: MockServerSettings
#include "GlobalNamespace/MockServerSettings.hpp"
// Including type: MultiplayerStatusData
#include "GlobalNamespace/MultiplayerStatusData.hpp"
// Including type: QuickPlaySetupData
#include "GlobalNamespace/QuickPlaySetupData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isEnabled
bool& GlobalNamespace::MultiplayerMockSettings::dyn__isEnabled() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__isEnabled");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isEnabled"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MockPlayerSettings _localPlayer
::GlobalNamespace::MockPlayerSettings*& GlobalNamespace::MultiplayerMockSettings::dyn__localPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__localPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::MockPlayerSettings**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.List`1<MockPlayerSettings> _otherPlayers
::System::Collections::Generic::List_1<::GlobalNamespace::MockPlayerSettings*>*& GlobalNamespace::MultiplayerMockSettings::dyn__otherPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__otherPlayers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_otherPlayers"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::MockPlayerSettings*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MockServerSettings _quickplayServer
::GlobalNamespace::MockServerSettings*& GlobalNamespace::MultiplayerMockSettings::dyn__quickplayServer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__quickplayServer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_quickplayServer"))->offset;
return *reinterpret_cast<::GlobalNamespace::MockServerSettings**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerStatusData _multiplayerStatusData
::GlobalNamespace::MultiplayerStatusData*& GlobalNamespace::MultiplayerMockSettings::dyn__multiplayerStatusData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__multiplayerStatusData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerStatusData"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerStatusData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private QuickPlaySetupData _quickPlaySetupData
::GlobalNamespace::QuickPlaySetupData*& GlobalNamespace::MultiplayerMockSettings::dyn__quickPlaySetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::dyn__quickPlaySetupData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_quickPlaySetupData"))->offset;
return *reinterpret_cast<::GlobalNamespace::QuickPlaySetupData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerMockSettings.get_quickplayServer
::GlobalNamespace::MockServerSettings* GlobalNamespace::MultiplayerMockSettings::get_quickplayServer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_quickplayServer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_quickplayServer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MockServerSettings*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.get_localPlayer
::GlobalNamespace::MockPlayerSettings* GlobalNamespace::MultiplayerMockSettings::get_localPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_localPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_localPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MockPlayerSettings*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.get_quickPlaySetupData
::GlobalNamespace::QuickPlaySetupData* GlobalNamespace::MultiplayerMockSettings::get_quickPlaySetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_quickPlaySetupData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_quickPlaySetupData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::QuickPlaySetupData*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.set_quickPlaySetupData
void GlobalNamespace::MultiplayerMockSettings::set_quickPlaySetupData(::GlobalNamespace::QuickPlaySetupData* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::set_quickPlaySetupData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_quickPlaySetupData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerMockSettings.get_multiplayerStatusData
::GlobalNamespace::MultiplayerStatusData* GlobalNamespace::MultiplayerMockSettings::get_multiplayerStatusData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_multiplayerStatusData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_multiplayerStatusData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerStatusData*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.set_multiplayerStatusData
void GlobalNamespace::MultiplayerMockSettings::set_multiplayerStatusData(::GlobalNamespace::MultiplayerStatusData* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::set_multiplayerStatusData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_multiplayerStatusData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerMockSettings.get_otherPlayers
::System::Collections::Generic::List_1<::GlobalNamespace::MockPlayerSettings*>* GlobalNamespace::MultiplayerMockSettings::get_otherPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_otherPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_otherPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::List_1<::GlobalNamespace::MockPlayerSettings*>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.get_isEnabled
bool GlobalNamespace::MultiplayerMockSettings::get_isEnabled() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::get_isEnabled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isEnabled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerMockSettings.set_isEnabled
void GlobalNamespace::MultiplayerMockSettings::set_isEnabled(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::set_isEnabled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_isEnabled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerMockSettings.SharedSettings
::GlobalNamespace::MultiplayerMockSettings* GlobalNamespace::MultiplayerMockSettings::SharedSettings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerMockSettings::SharedSettings");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerMockSettings", "SharedSettings", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerMockSettings*, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerActivePlayersTimeOffsetAverage
#include "GlobalNamespace/MultiplayerActivePlayersTimeOffsetAverage.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _lastReturnedOffsetSyncTime
float& GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__lastReturnedOffsetSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__lastReturnedOffsetSyncTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastReturnedOffsetSyncTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _timeOfLastValidReturnedTime
float& GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__timeOfLastValidReturnedTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::dyn__timeOfLastValidReturnedTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeOfLastValidReturnedTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerActivePlayersTimeOffsetAverage.get_offsetSyncTime
float GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::get_offsetSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::get_offsetSyncTime");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_offsetSyncTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerActivePlayersTimeOffsetAverage.get_isFailed
bool GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::get_isFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage::get_isFailed");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerBigAvatarAnimator
#include "GlobalNamespace/MultiplayerBigAvatarAnimator.hpp"
// Including type: HologramRays
#include "GlobalNamespace/HologramRays.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: Tweening.Tween`1
#include "Tweening/Tween_1.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: EaseType
#include "GlobalNamespace/EaseType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _displayedScale
float& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__displayedScale() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__displayedScale");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_displayedScale"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private HologramRays _hologramRays
::GlobalNamespace::HologramRays*& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__hologramRays() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__hologramRays");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_hologramRays"))->offset;
return *reinterpret_cast<::GlobalNamespace::HologramRays**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _avatarTransform
::UnityEngine::Transform*& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__avatarTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__avatarTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_avatarTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Tweening.TimeTweeningManager _tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _scaleUpTween
::Tweening::Tween_1<float>*& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__scaleUpTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__scaleUpTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scaleUpTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _scaleDownTween
::Tweening::Tween_1<float>*& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__scaleDownTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__scaleDownTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scaleDownTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _initialized
bool& GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__initialized() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::dyn__initialized");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_initialized"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.OnDestroy
void GlobalNamespace::MultiplayerBigAvatarAnimator::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.InitIfNeeded
void GlobalNamespace::MultiplayerBigAvatarAnimator::InitIfNeeded() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::InitIfNeeded");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitIfNeeded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.SetPositionAndRotation
void GlobalNamespace::MultiplayerBigAvatarAnimator::SetPositionAndRotation(::UnityEngine::Vector3 position, ::UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::SetPositionAndRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetPositionAndRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(rotation)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, position, rotation);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.HideInstant
void GlobalNamespace::MultiplayerBigAvatarAnimator::HideInstant() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::HideInstant");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HideInstant", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.Animate
void GlobalNamespace::MultiplayerBigAvatarAnimator::Animate(bool show, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::Animate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Animate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(show), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, show, duration, easeType);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.<InitIfNeeded>b__8_0
void GlobalNamespace::MultiplayerBigAvatarAnimator::$InitIfNeeded$b__8_0(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::<InitIfNeeded>b__8_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__8_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.<InitIfNeeded>b__8_1
void GlobalNamespace::MultiplayerBigAvatarAnimator::$InitIfNeeded$b__8_1(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::<InitIfNeeded>b__8_1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__8_1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerBigAvatarAnimator.<InitIfNeeded>b__8_2
void GlobalNamespace::MultiplayerBigAvatarAnimator::$InitIfNeeded$b__8_2() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarAnimator::<InitIfNeeded>b__8_2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__8_2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerBigAvatarInstaller
#include "GlobalNamespace/MultiplayerBigAvatarInstaller.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: PlayersSpecificSettingsAtGameStartModel
#include "GlobalNamespace/PlayersSpecificSettingsAtGameStartModel.hpp"
// Including type: SaberManager/InitData
#include "GlobalNamespace/SaberManager_InitData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SaberManager/InitData _saberManagerInitData
::GlobalNamespace::SaberManager::InitData*& GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__saberManagerInitData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__saberManagerInitData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberManagerInitData"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberManager::InitData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly PlayersSpecificSettingsAtGameStartModel _playerSpecificSettings
::GlobalNamespace::PlayersSpecificSettingsAtGameStartModel*& GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__playerSpecificSettings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarInstaller::dyn__playerSpecificSettings");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerSpecificSettings"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayersSpecificSettingsAtGameStartModel**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerBigAvatarInstaller.InstallBindings
void GlobalNamespace::MultiplayerBigAvatarInstaller::InstallBindings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerBigAvatarInstaller::InstallBindings");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InstallBindings", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerCenterResizeController
#include "GlobalNamespace/MultiplayerCenterResizeController.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: MultiplayerPlayerLayout
#include "GlobalNamespace/MultiplayerPlayerLayout.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _platformWidth
float& GlobalNamespace::MultiplayerCenterResizeController::dyn__platformWidth() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::dyn__platformWidth");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_platformWidth"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerCenterResizeController::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<System.Single> edgeDistanceFromCenterWasCalculatedEvent
::System::Action_1<float>*& GlobalNamespace::MultiplayerCenterResizeController::dyn_edgeDistanceFromCenterWasCalculatedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::dyn_edgeDistanceFromCenterWasCalculatedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "edgeDistanceFromCenterWasCalculatedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <isEdgeDistanceFromCenterCalculated>k__BackingField
bool& GlobalNamespace::MultiplayerCenterResizeController::dyn_$isEdgeDistanceFromCenterCalculated$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::dyn_$isEdgeDistanceFromCenterCalculated$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<isEdgeDistanceFromCenterCalculated>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single <edgeDistanceFromCenter>k__BackingField
float& GlobalNamespace::MultiplayerCenterResizeController::dyn_$edgeDistanceFromCenter$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::dyn_$edgeDistanceFromCenter$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<edgeDistanceFromCenter>k__BackingField"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerCenterResizeController.get_isEdgeDistanceFromCenterCalculated
bool GlobalNamespace::MultiplayerCenterResizeController::get_isEdgeDistanceFromCenterCalculated() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::get_isEdgeDistanceFromCenterCalculated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isEdgeDistanceFromCenterCalculated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterResizeController.set_isEdgeDistanceFromCenterCalculated
void GlobalNamespace::MultiplayerCenterResizeController::set_isEdgeDistanceFromCenterCalculated(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::set_isEdgeDistanceFromCenterCalculated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_isEdgeDistanceFromCenterCalculated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerCenterResizeController.get_edgeDistanceFromCenter
float GlobalNamespace::MultiplayerCenterResizeController::get_edgeDistanceFromCenter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::get_edgeDistanceFromCenter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_edgeDistanceFromCenter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterResizeController.set_edgeDistanceFromCenter
void GlobalNamespace::MultiplayerCenterResizeController::set_edgeDistanceFromCenter(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::set_edgeDistanceFromCenter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_edgeDistanceFromCenter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerCenterResizeController.add_edgeDistanceFromCenterWasCalculatedEvent
void GlobalNamespace::MultiplayerCenterResizeController::add_edgeDistanceFromCenterWasCalculatedEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::add_edgeDistanceFromCenterWasCalculatedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_edgeDistanceFromCenterWasCalculatedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerCenterResizeController.remove_edgeDistanceFromCenterWasCalculatedEvent
void GlobalNamespace::MultiplayerCenterResizeController::remove_edgeDistanceFromCenterWasCalculatedEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::remove_edgeDistanceFromCenterWasCalculatedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_edgeDistanceFromCenterWasCalculatedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerCenterResizeController.Start
void GlobalNamespace::MultiplayerCenterResizeController::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterResizeController.OnDestroy
void GlobalNamespace::MultiplayerCenterResizeController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterResizeController.HandlePlayersLayoutWasCalculated
void GlobalNamespace::MultiplayerCenterResizeController::HandlePlayersLayoutWasCalculated(::GlobalNamespace::MultiplayerPlayerLayout layout, int numberOfPlayers) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterResizeController::HandlePlayersLayoutWasCalculated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayersLayoutWasCalculated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layout), ::il2cpp_utils::ExtractType(numberOfPlayers)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, layout, numberOfPlayers);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerCenterTextAnimator
#include "GlobalNamespace/MultiplayerCenterTextAnimator.hpp"
// Including type: TMPro.TextMeshPro
#include "TMPro/TextMeshPro.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: Tweening.Tween`1
#include "Tweening/Tween_1.hpp"
// Including type: EaseType
#include "GlobalNamespace/EaseType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshPro _text
::TMPro::TextMeshPro*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__text() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_text"))->offset;
return *reinterpret_cast<::TMPro::TextMeshPro**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _scalingTarget
::UnityEngine::Transform*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__scalingTarget() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__scalingTarget");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scalingTarget"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Tweening.TimeTweeningManager _tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _fadeInTween
::Tweening::Tween_1<float>*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fadeInTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fadeInTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _fadeOutTween
::Tweening::Tween_1<float>*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fadeOutTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fadeOutTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeOutTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _fontSizeTween
::Tweening::Tween_1<float>*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fontSizeTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__fontSizeTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fontSizeTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<UnityEngine.Color> _colorTween
::Tweening::Tween_1<::UnityEngine::Color>*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__colorTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__colorTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<::UnityEngine::Color>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<UnityEngine.Vector3> _offsetTween
::Tweening::Tween_1<::UnityEngine::Vector3>*& GlobalNamespace::MultiplayerCenterTextAnimator::dyn__offsetTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::dyn__offsetTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_offsetTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<::UnityEngine::Vector3>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerCenterTextAnimator.Awake
void GlobalNamespace::MultiplayerCenterTextAnimator::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterTextAnimator.OnDestroy
void GlobalNamespace::MultiplayerCenterTextAnimator::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterTextAnimator.AnimateTextColor
void GlobalNamespace::MultiplayerCenterTextAnimator::AnimateTextColor(::UnityEngine::Color color, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::AnimateTextColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateTextColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(color), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, color, duration, easeType);
}
// Autogenerated method: MultiplayerCenterTextAnimator.AnimateFontSize
void GlobalNamespace::MultiplayerCenterTextAnimator::AnimateFontSize(float fontSize, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::AnimateFontSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateFontSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fontSize), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, fontSize, duration, easeType);
}
// Autogenerated method: MultiplayerCenterTextAnimator.AnimatePositionOffsetSize
void GlobalNamespace::MultiplayerCenterTextAnimator::AnimatePositionOffsetSize(::UnityEngine::Vector3 offset, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::AnimatePositionOffsetSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimatePositionOffsetSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(offset), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, offset, duration, easeType);
}
// Autogenerated method: MultiplayerCenterTextAnimator.AnimateEnabled
void GlobalNamespace::MultiplayerCenterTextAnimator::AnimateEnabled(bool isEnabled, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::AnimateEnabled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateEnabled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isEnabled), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isEnabled, duration, easeType);
}
// Autogenerated method: MultiplayerCenterTextAnimator.SetText
void GlobalNamespace::MultiplayerCenterTextAnimator::SetText(::StringW text) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::SetText");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetText", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, text);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_0
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_0(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_1
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_1(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_5
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_5() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_5");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_5", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_2
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_2(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_3
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_3(::UnityEngine::Color val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_3");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerCenterTextAnimator.<Awake>b__8_4
void GlobalNamespace::MultiplayerCenterTextAnimator::$Awake$b__8_4(::UnityEngine::Vector3 val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerCenterTextAnimator::<Awake>b__8_4");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__8_4", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerConditionalActiveByLayout
#include "GlobalNamespace/MultiplayerConditionalActiveByLayout.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerConditionalActiveByLayout/Condition _condition
::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition& GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__condition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__condition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_condition"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerPlayerLayout _layout
::GlobalNamespace::MultiplayerPlayerLayout& GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__layout() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__layout");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layout"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayerLayout*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerConditionalActiveByLayout.Start
void GlobalNamespace::MultiplayerConditionalActiveByLayout::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConditionalActiveByLayout.HandlePlayersLayoutWasCalculated
void GlobalNamespace::MultiplayerConditionalActiveByLayout::HandlePlayersLayoutWasCalculated(::GlobalNamespace::MultiplayerPlayerLayout layout, int playersCount) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::HandlePlayersLayoutWasCalculated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayersLayoutWasCalculated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layout), ::il2cpp_utils::ExtractType(playersCount)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, layout, playersCount);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerConditionalActiveByLayout/Condition
#include "GlobalNamespace/MultiplayerConditionalActiveByLayout.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerConditionalActiveByLayout/Condition ShowIf
::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_get_ShowIf() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_get_ShowIf");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition>("", "MultiplayerConditionalActiveByLayout/Condition", "ShowIf"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerConditionalActiveByLayout/Condition ShowIf
void GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_set_ShowIf(::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_set_ShowIf");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerConditionalActiveByLayout/Condition", "ShowIf", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerConditionalActiveByLayout/Condition HideIf
::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_get_HideIf() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_get_HideIf");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition>("", "MultiplayerConditionalActiveByLayout/Condition", "HideIf"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerConditionalActiveByLayout/Condition HideIf
void GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_set_HideIf(::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::_set_HideIf");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerConditionalActiveByLayout/Condition", "HideIf", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConditionalActiveByLayout::Condition::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerConnectedPlayerObservable
#include "GlobalNamespace/MultiplayerConnectedPlayerObservable.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerConnectedPlayerObservable::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerObservable::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerConnectedPlayerObservable.get_offsetSyncTime
float GlobalNamespace::MultiplayerConnectedPlayerObservable::get_offsetSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerObservable::get_offsetSyncTime");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_offsetSyncTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerObservable.get_isFailed
bool GlobalNamespace::MultiplayerConnectedPlayerObservable::get_isFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerObservable::get_isFailed");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerController
#include "GlobalNamespace/MultiplayerController.hpp"
// Including type: MultiplayerResultsData
#include "GlobalNamespace/MultiplayerResultsData.hpp"
// Including type: MultiplayerController/<PerformSongStartSync>d__37
#include "GlobalNamespace/MultiplayerController_-PerformSongStartSync-d__37.hpp"
// Including type: MultiplayerController/<>c__DisplayClass42_0
#include "GlobalNamespace/MultiplayerController_--c__DisplayClass42_0.hpp"
// Including type: MultiplayerController/<>c
#include "GlobalNamespace/MultiplayerController_--c.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: MultiplayerLevelScenesTransitionSetupDataSO
#include "GlobalNamespace/MultiplayerLevelScenesTransitionSetupDataSO.hpp"
// Including type: GameScenesManager
#include "GlobalNamespace/GameScenesManager.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: SceneStartSyncController
#include "GlobalNamespace/SceneStartSyncController.hpp"
// Including type: SongStartSyncController
#include "GlobalNamespace/SongStartSyncController.hpp"
// Including type: MultiplayerLevelFinishedController
#include "GlobalNamespace/MultiplayerLevelFinishedController.hpp"
// Including type: FadeInOutController
#include "GlobalNamespace/FadeInOutController.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: MultiplayerIntroAnimationController
#include "GlobalNamespace/MultiplayerIntroAnimationController.hpp"
// Including type: MultiplayerOutroAnimationController
#include "GlobalNamespace/MultiplayerOutroAnimationController.hpp"
// Including type: IMenuRpcManager
#include "GlobalNamespace/IMenuRpcManager.hpp"
// Including type: IGameplayRpcManager
#include "GlobalNamespace/IGameplayRpcManager.hpp"
// Including type: GameplayCoreSceneSetupData
#include "GlobalNamespace/GameplayCoreSceneSetupData.hpp"
// Including type: Zenject.DiContainer
#include "Zenject/DiContainer.hpp"
// Including type: MultiplayerBadgesProvider
#include "GlobalNamespace/MultiplayerBadgesProvider.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: PlayersSpecificSettingsAtGameStartModel
#include "GlobalNamespace/PlayersSpecificSettingsAtGameStartModel.hpp"
// Including type: UnityEngine.Coroutine
#include "UnityEngine/Coroutine.hpp"
// Including type: MultiplayerGameState
#include "GlobalNamespace/MultiplayerGameState.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
// Including type: MultiplayerLevelCompletionResults
#include "GlobalNamespace/MultiplayerLevelCompletionResults.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: DisconnectedReason
#include "GlobalNamespace/DisconnectedReason.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private System.Single kSongTimeToSongStartSyncTimeOffset
float GlobalNamespace::MultiplayerController::_get_kSongTimeToSongStartSyncTimeOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_get_kSongTimeToSongStartSyncTimeOffset");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "MultiplayerController", "kSongTimeToSongStartSyncTimeOffset"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kSongTimeToSongStartSyncTimeOffset
void GlobalNamespace::MultiplayerController::_set_kSongTimeToSongStartSyncTimeOffset(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_set_kSongTimeToSongStartSyncTimeOffset");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController", "kSongTimeToSongStartSyncTimeOffset", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kMinAnimationDurationPercentage
float GlobalNamespace::MultiplayerController::_get_kMinAnimationDurationPercentage() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_get_kMinAnimationDurationPercentage");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "MultiplayerController", "kMinAnimationDurationPercentage"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kMinAnimationDurationPercentage
void GlobalNamespace::MultiplayerController::_set_kMinAnimationDurationPercentage(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_set_kMinAnimationDurationPercentage");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController", "kMinAnimationDurationPercentage", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kGetMultiplayerGameStateTimeout
float GlobalNamespace::MultiplayerController::_get_kGetMultiplayerGameStateTimeout() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_get_kGetMultiplayerGameStateTimeout");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "MultiplayerController", "kGetMultiplayerGameStateTimeout"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kGetMultiplayerGameStateTimeout
void GlobalNamespace::MultiplayerController::_set_kGetMultiplayerGameStateTimeout(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::_set_kGetMultiplayerGameStateTimeout");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController", "kGetMultiplayerGameStateTimeout", value));
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.GameObject _loadingEnvironment
::UnityEngine::GameObject*& GlobalNamespace::MultiplayerController::dyn__loadingEnvironment() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__loadingEnvironment");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_loadingEnvironment"))->offset;
return *reinterpret_cast<::UnityEngine::GameObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLevelScenesTransitionSetupDataSO _multiplayerLevelSceneSetupData
::GlobalNamespace::MultiplayerLevelScenesTransitionSetupDataSO*& GlobalNamespace::MultiplayerController::dyn__multiplayerLevelSceneSetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__multiplayerLevelSceneSetupData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerLevelSceneSetupData"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLevelScenesTransitionSetupDataSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameScenesManager _gameScenesManager
::GlobalNamespace::GameScenesManager*& GlobalNamespace::MultiplayerController::dyn__gameScenesManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__gameScenesManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameScenesManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameScenesManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _playersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerController::dyn__playersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__playersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SceneStartSyncController _sceneStartSyncController
::GlobalNamespace::SceneStartSyncController*& GlobalNamespace::MultiplayerController::dyn__sceneStartSyncController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__sceneStartSyncController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sceneStartSyncController"))->offset;
return *reinterpret_cast<::GlobalNamespace::SceneStartSyncController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SongStartSyncController _songStartSyncController
::GlobalNamespace::SongStartSyncController*& GlobalNamespace::MultiplayerController::dyn__songStartSyncController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__songStartSyncController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_songStartSyncController"))->offset;
return *reinterpret_cast<::GlobalNamespace::SongStartSyncController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLevelFinishedController _multiplayerLevelFinishedController
::GlobalNamespace::MultiplayerLevelFinishedController*& GlobalNamespace::MultiplayerController::dyn__multiplayerLevelFinishedController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__multiplayerLevelFinishedController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerLevelFinishedController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLevelFinishedController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly FadeInOutController _fadeInOutController
::GlobalNamespace::FadeInOutController*& GlobalNamespace::MultiplayerController::dyn__fadeInOutController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__fadeInOutController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInOutController"))->offset;
return *reinterpret_cast<::GlobalNamespace::FadeInOutController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerController::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerIntroAnimationController _introAnimationController
::GlobalNamespace::MultiplayerIntroAnimationController*& GlobalNamespace::MultiplayerController::dyn__introAnimationController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__introAnimationController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_introAnimationController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroAnimationController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerOutroAnimationController _outroAnimationController
::GlobalNamespace::MultiplayerOutroAnimationController*& GlobalNamespace::MultiplayerController::dyn__outroAnimationController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__outroAnimationController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_outroAnimationController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerOutroAnimationController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMenuRpcManager _menuRpcManager
::GlobalNamespace::IMenuRpcManager*& GlobalNamespace::MultiplayerController::dyn__menuRpcManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__menuRpcManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_menuRpcManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMenuRpcManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IGameplayRpcManager _gameplayRpcManager
::GlobalNamespace::IGameplayRpcManager*& GlobalNamespace::MultiplayerController::dyn__gameplayRpcManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__gameplayRpcManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameplayRpcManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IGameplayRpcManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameplayCoreSceneSetupData _sceneSetupData
::GlobalNamespace::GameplayCoreSceneSetupData*& GlobalNamespace::MultiplayerController::dyn__sceneSetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__sceneSetupData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sceneSetupData"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayCoreSceneSetupData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Zenject.DiContainer _diContainer
::Zenject::DiContainer*& GlobalNamespace::MultiplayerController::dyn__diContainer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__diContainer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_diContainer"))->offset;
return *reinterpret_cast<::Zenject::DiContainer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerBadgesProvider _badgesProvider
::GlobalNamespace::MultiplayerBadgesProvider*& GlobalNamespace::MultiplayerController::dyn__badgesProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__badgesProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgesProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerBadgesProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<MultiplayerController/State> stateChangedEvent
::System::Action_1<::GlobalNamespace::MultiplayerController::State>*& GlobalNamespace::MultiplayerController::dyn_stateChangedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn_stateChangedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "stateChangedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::MultiplayerController::State>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _startTime
float& GlobalNamespace::MultiplayerController::dyn__startTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__startTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_startTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerPlayerStartState _localPlayerSyncStartState
::GlobalNamespace::MultiplayerPlayerStartState& GlobalNamespace::MultiplayerController::dyn__localPlayerSyncStartState() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__localPlayerSyncStartState");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerSyncStartState"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayerStartState*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerController/State _state
::GlobalNamespace::MultiplayerController::State& GlobalNamespace::MultiplayerController::dyn__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_state"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController::State*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _sessionGameId
::StringW& GlobalNamespace::MultiplayerController::dyn__sessionGameId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__sessionGameId");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sessionGameId"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerResultsData _resultsData
::GlobalNamespace::MultiplayerResultsData*& GlobalNamespace::MultiplayerController::dyn__resultsData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__resultsData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resultsData"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerResultsData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private PlayersSpecificSettingsAtGameStartModel _playersSpecificSettingsAtGameStartModel
::GlobalNamespace::PlayersSpecificSettingsAtGameStartModel*& GlobalNamespace::MultiplayerController::dyn__playersSpecificSettingsAtGameStartModel() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__playersSpecificSettingsAtGameStartModel");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playersSpecificSettingsAtGameStartModel"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayersSpecificSettingsAtGameStartModel**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Coroutine _timeoutGetGameStateCoroutine
::UnityEngine::Coroutine*& GlobalNamespace::MultiplayerController::dyn__timeoutGetGameStateCoroutine() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::dyn__timeoutGetGameStateCoroutine");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeoutGetGameStateCoroutine"))->offset;
return *reinterpret_cast<::UnityEngine::Coroutine**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerController.get_state
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::get_state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::get_state");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_state", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerController::State, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.add_stateChangedEvent
void GlobalNamespace::MultiplayerController::add_stateChangedEvent(::System::Action_1<::GlobalNamespace::MultiplayerController::State>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::add_stateChangedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_stateChangedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerController.remove_stateChangedEvent
void GlobalNamespace::MultiplayerController::remove_stateChangedEvent(::System::Action_1<::GlobalNamespace::MultiplayerController::State>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::remove_stateChangedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_stateChangedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerController.Start
void GlobalNamespace::MultiplayerController::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.OnDestroy
void GlobalNamespace::MultiplayerController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.HandleSetMultiplayerGameState
void GlobalNamespace::MultiplayerController::HandleSetMultiplayerGameState(::StringW userId, ::GlobalNamespace::MultiplayerGameState gameState) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSetMultiplayerGameState");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSetMultiplayerGameState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId), ::il2cpp_utils::ExtractType(gameState)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, userId, gameState);
}
// Autogenerated method: MultiplayerController.CreateAndBindPlayersSpecificSettingsAtGameStartModel
void GlobalNamespace::MultiplayerController::CreateAndBindPlayersSpecificSettingsAtGameStartModel() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::CreateAndBindPlayersSpecificSettingsAtGameStartModel");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateAndBindPlayersSpecificSettingsAtGameStartModel", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.StartSceneLoadSync
void GlobalNamespace::MultiplayerController::StartSceneLoadSync() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::StartSceneLoadSync");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartSceneLoadSync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.PerformSongStartSync
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerController::PerformSongStartSync(::GlobalNamespace::MultiplayerPlayerStartState localPlayerSyncState) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::PerformSongStartSync");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PerformSongStartSync", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(localPlayerSyncState)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method, localPlayerSyncState);
}
// Autogenerated method: MultiplayerController.HandleDidSwitchPlayerToInactive
void GlobalNamespace::MultiplayerController::HandleDidSwitchPlayerToInactive() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleDidSwitchPlayerToInactive");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleDidSwitchPlayerToInactive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.HandleSceneStartSyncControllerSyncStartDidSuccess
void GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidSuccess(::StringW sessionGameId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidSuccess");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSceneStartSyncControllerSyncStartDidSuccess", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sessionGameId)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, sessionGameId);
}
// Autogenerated method: MultiplayerController.HandleSceneStartSyncControllerSyncStartDidReceiveTooLate
void GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidReceiveTooLate(::StringW sessionGameId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidReceiveTooLate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSceneStartSyncControllerSyncStartDidReceiveTooLate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sessionGameId)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, sessionGameId);
}
// Autogenerated method: MultiplayerController.HandleSceneStartSyncControllerSyncStartDidFail
void GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSceneStartSyncControllerSyncStartDidFail");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSceneStartSyncControllerSyncStartDidFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.HandleSongStartSyncControllerSyncStartSuccess
void GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncStartSuccess(float introAnimationStartSyncTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncStartSuccess");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSongStartSyncControllerSyncStartSuccess", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(introAnimationStartSyncTime)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, introAnimationStartSyncTime);
}
// Autogenerated method: MultiplayerController.HandleSongStartSyncControllerSyncResume
void GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncResume(float introAnimationStartSyncTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncResume");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSongStartSyncControllerSyncResume", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(introAnimationStartSyncTime)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, introAnimationStartSyncTime);
}
// Autogenerated method: MultiplayerController.HandleSongStartSyncControllerSyncStartFailed
void GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncStartFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleSongStartSyncControllerSyncStartFailed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSongStartSyncControllerSyncStartFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.StartGameplay
void GlobalNamespace::MultiplayerController::StartGameplay(float introAnimationStartSyncTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::StartGameplay");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartGameplay", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(introAnimationStartSyncTime)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, introAnimationStartSyncTime);
}
// Autogenerated method: MultiplayerController.HandleAllResultsCollected
void GlobalNamespace::MultiplayerController::HandleAllResultsCollected(::GlobalNamespace::MultiplayerLevelCompletionResults* localPlayerResults, ::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerLevelCompletionResults*>* otherPlayerResults) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleAllResultsCollected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleAllResultsCollected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(localPlayerResults), ::il2cpp_utils::ExtractType(otherPlayerResults)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, localPlayerResults, otherPlayerResults);
}
// Autogenerated method: MultiplayerController.EndGameplay
void GlobalNamespace::MultiplayerController::EndGameplay(::GlobalNamespace::MultiplayerLevelCompletionResults* localPlayerResults, ::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerLevelCompletionResults*>* otherPlayerResults) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::EndGameplay");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "EndGameplay", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(localPlayerResults), ::il2cpp_utils::ExtractType(otherPlayerResults)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, localPlayerResults, otherPlayerResults);
}
// Autogenerated method: MultiplayerController.HandleOutroAnimationDidFinish
void GlobalNamespace::MultiplayerController::HandleOutroAnimationDidFinish() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleOutroAnimationDidFinish");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleOutroAnimationDidFinish", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController.HandleRpcReturnToMenu
void GlobalNamespace::MultiplayerController::HandleRpcReturnToMenu(::StringW userId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleRpcReturnToMenu");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleRpcReturnToMenu", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, userId);
}
// Autogenerated method: MultiplayerController.HandleDisconnected
void GlobalNamespace::MultiplayerController::HandleDisconnected(::GlobalNamespace::DisconnectedReason disconnectedReason) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::HandleDisconnected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleDisconnected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(disconnectedReason)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, disconnectedReason);
}
// Autogenerated method: MultiplayerController.ChangeState
void GlobalNamespace::MultiplayerController::ChangeState(::GlobalNamespace::MultiplayerController::State newState) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::ChangeState");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ChangeState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(newState)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, newState);
}
// Autogenerated method: MultiplayerController.GetCurrentSongTime
float GlobalNamespace::MultiplayerController::GetCurrentSongTime(float songStartSyncTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::GetCurrentSongTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCurrentSongTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(songStartSyncTime)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, songStartSyncTime);
}
// Autogenerated method: MultiplayerController.GetSongStartSyncTime
float GlobalNamespace::MultiplayerController::GetSongStartSyncTime(float introAnimationStartSyncTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::GetSongStartSyncTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetSongStartSyncTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(introAnimationStartSyncTime)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, introAnimationStartSyncTime);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerController/State
#include "GlobalNamespace/MultiplayerController.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State CheckingLobbyState
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_CheckingLobbyState() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_CheckingLobbyState");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "CheckingLobbyState"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State CheckingLobbyState
void GlobalNamespace::MultiplayerController::State::_set_CheckingLobbyState(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_CheckingLobbyState");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "CheckingLobbyState", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State WaitingForPlayers
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_WaitingForPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_WaitingForPlayers");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "WaitingForPlayers"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State WaitingForPlayers
void GlobalNamespace::MultiplayerController::State::_set_WaitingForPlayers(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_WaitingForPlayers");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "WaitingForPlayers", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State SongStartSync
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_SongStartSync() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_SongStartSync");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "SongStartSync"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State SongStartSync
void GlobalNamespace::MultiplayerController::State::_set_SongStartSync(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_SongStartSync");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "SongStartSync", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State Intro
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_Intro() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_Intro");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "Intro"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State Intro
void GlobalNamespace::MultiplayerController::State::_set_Intro(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_Intro");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "Intro", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State Gameplay
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_Gameplay() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_Gameplay");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "Gameplay"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State Gameplay
void GlobalNamespace::MultiplayerController::State::_set_Gameplay(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_Gameplay");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "Gameplay", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State Outro
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_Outro() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_Outro");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "Outro"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State Outro
void GlobalNamespace::MultiplayerController::State::_set_Outro(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_Outro");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "Outro", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerController/State Finished
::GlobalNamespace::MultiplayerController::State GlobalNamespace::MultiplayerController::State::_get_Finished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_get_Finished");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::State>("", "MultiplayerController/State", "Finished"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerController/State Finished
void GlobalNamespace::MultiplayerController::State::_set_Finished(::GlobalNamespace::MultiplayerController::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::_set_Finished");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerController/State", "Finished", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerController::State::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::State::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerController/<PerformSongStartSync>d__37
#include "GlobalNamespace/MultiplayerController_-PerformSongStartSync-d__37.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerController <>4__this
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerPlayerStartState localPlayerSyncState
::GlobalNamespace::MultiplayerPlayerStartState& GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_localPlayerSyncState() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::dyn_localPlayerSyncState");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "localPlayerSyncState"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayerStartState*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerController/<PerformSongStartSync>d__37.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController/<PerformSongStartSync>d__37.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController/<PerformSongStartSync>d__37.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController/<PerformSongStartSync>d__37.MoveNext
bool GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerController/<PerformSongStartSync>d__37.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$PerformSongStartSync$d__37::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerController/<>c__DisplayClass42_0
#include "GlobalNamespace/MultiplayerController_--c__DisplayClass42_0.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public MultiplayerController <>4__this
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single introAnimationStartSyncTime
float& GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::dyn_introAnimationStartSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::dyn_introAnimationStartSyncTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "introAnimationStartSyncTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerController/<>c__DisplayClass42_0.<HandleSongStartSyncControllerSyncStartSuccess>b__0
void GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::$HandleSongStartSyncControllerSyncStartSuccess$b__0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c__DisplayClass42_0::<HandleSongStartSyncControllerSyncStartSuccess>b__0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<HandleSongStartSyncControllerSyncStartSuccess>b__0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerController/<>c
#include "GlobalNamespace/MultiplayerController_--c.hpp"
// Including type: System.Func`2
#include "System/Func_2.hpp"
// Including type: MultiplayerLevelCompletionResults
#include "GlobalNamespace/MultiplayerLevelCompletionResults.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly MultiplayerController/<>c <>9
::GlobalNamespace::MultiplayerController::$$c* GlobalNamespace::MultiplayerController::$$c::_get_$$9() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::_get_$$9");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerController::$$c*>("", "MultiplayerController/<>c", "<>9")));
}
// Autogenerated static field setter
// Set static field: static public readonly MultiplayerController/<>c <>9
void GlobalNamespace::MultiplayerController::$$c::_set_$$9(::GlobalNamespace::MultiplayerController::$$c* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::_set_$$9");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerController/<>c", "<>9", value)));
}
// Autogenerated static field getter
// Get static field: static public System.Func`2<MultiplayerLevelCompletionResults,System.Boolean> <>9__47_0
::System::Func_2<::GlobalNamespace::MultiplayerLevelCompletionResults*, bool>* GlobalNamespace::MultiplayerController::$$c::_get_$$9__47_0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::_get_$$9__47_0");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Func_2<::GlobalNamespace::MultiplayerLevelCompletionResults*, bool>*>("", "MultiplayerController/<>c", "<>9__47_0")));
}
// Autogenerated static field setter
// Set static field: static public System.Func`2<MultiplayerLevelCompletionResults,System.Boolean> <>9__47_0
void GlobalNamespace::MultiplayerController::$$c::_set_$$9__47_0(::System::Func_2<::GlobalNamespace::MultiplayerLevelCompletionResults*, bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::_set_$$9__47_0");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerController/<>c", "<>9__47_0", value)));
}
// Autogenerated method: MultiplayerController/<>c..cctor
void GlobalNamespace::MultiplayerController::$$c::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerController/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated method: MultiplayerController/<>c.<EndGameplay>b__47_0
bool GlobalNamespace::MultiplayerController::$$c::$EndGameplay$b__47_0(::GlobalNamespace::MultiplayerLevelCompletionResults* result) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerController::$$c::<EndGameplay>b__47_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<EndGameplay>b__47_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, result);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerEnvironmentResizeController
#include "GlobalNamespace/MultiplayerEnvironmentResizeController.hpp"
// Including type: MultiplayerEnvironmentResizeController/ResizeType
#include "GlobalNamespace/MultiplayerEnvironmentResizeController_ResizeType.hpp"
// Including type: MultiplayerEnvironmentResizeController/ResizeData
#include "GlobalNamespace/MultiplayerEnvironmentResizeController_ResizeData.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: MultiplayerCenterResizeController
#include "GlobalNamespace/MultiplayerCenterResizeController.hpp"
// Including type: BeatmapObjectSpawnCenter
#include "GlobalNamespace/BeatmapObjectSpawnCenter.hpp"
// Including type: System.Action
#include "System/Action.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _platformEnd
::UnityEngine::Transform*& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__platformEnd() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__platformEnd");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_platformEnd"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerEnvironmentResizeController/ResizeData[] _resizeData
::ArrayW<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData*>& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__resizeData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__resizeData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resizeData"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerCenterResizeController _centerResizeController
::GlobalNamespace::MultiplayerCenterResizeController*& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__centerResizeController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__centerResizeController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_centerResizeController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerCenterResizeController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectSpawnCenter _beatmapObjectSpawnCenter
::GlobalNamespace::BeatmapObjectSpawnCenter*& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__beatmapObjectSpawnCenter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__beatmapObjectSpawnCenter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectSpawnCenter"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectSpawnCenter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action resizingDidFinishEvent
::System::Action*& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn_resizingDidFinishEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn_resizingDidFinishEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "resizingDidFinishEvent"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isResizingFinished
bool& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__isResizingFinished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__isResizingFinished");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isResizingFinished"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _edgeDistanceFromCenterFound
bool& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__edgeDistanceFromCenterFound() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__edgeDistanceFromCenterFound");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_edgeDistanceFromCenterFound"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _spawnCenterDistanceFound
bool& GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__spawnCenterDistanceFound() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::dyn__spawnCenterDistanceFound");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnCenterDistanceFound"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.get_isResizingFinished
bool GlobalNamespace::MultiplayerEnvironmentResizeController::get_isResizingFinished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::get_isResizingFinished");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isResizingFinished", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.add_resizingDidFinishEvent
void GlobalNamespace::MultiplayerEnvironmentResizeController::add_resizingDidFinishEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::add_resizingDidFinishEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_resizingDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.remove_resizingDidFinishEvent
void GlobalNamespace::MultiplayerEnvironmentResizeController::remove_resizingDidFinishEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::remove_resizingDidFinishEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_resizingDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.Start
void GlobalNamespace::MultiplayerEnvironmentResizeController::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.OnDestroy
void GlobalNamespace::MultiplayerEnvironmentResizeController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.HandleEdgeDistanceFromCenterWasCalculated
void GlobalNamespace::MultiplayerEnvironmentResizeController::HandleEdgeDistanceFromCenterWasCalculated(float edgeDistanceFromCenter) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::HandleEdgeDistanceFromCenterWasCalculated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleEdgeDistanceFromCenterWasCalculated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(edgeDistanceFromCenter)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, edgeDistanceFromCenter);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.HandleSpawnCenterDistanceWasFound
void GlobalNamespace::MultiplayerEnvironmentResizeController::HandleSpawnCenterDistanceWasFound(float distance) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::HandleSpawnCenterDistanceWasFound");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSpawnCenterDistanceWasFound", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(distance)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, distance);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.TryResize
void GlobalNamespace::MultiplayerEnvironmentResizeController::TryResize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::TryResize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryResize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController.Resize
void GlobalNamespace::MultiplayerEnvironmentResizeController::Resize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::Resize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Resize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerEnvironmentResizeController/ResizeType
#include "GlobalNamespace/MultiplayerEnvironmentResizeController_ResizeType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerEnvironmentResizeController/ResizeType None
::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_None() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_None");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType>("", "MultiplayerEnvironmentResizeController/ResizeType", "None"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerEnvironmentResizeController/ResizeType None
void GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_None(::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_None");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerEnvironmentResizeController/ResizeType", "None", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerEnvironmentResizeController/ResizeType Position
::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_Position() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_Position");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType>("", "MultiplayerEnvironmentResizeController/ResizeType", "Position"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerEnvironmentResizeController/ResizeType Position
void GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_Position(::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_Position");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerEnvironmentResizeController/ResizeType", "Position", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerEnvironmentResizeController/ResizeType Length
::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_Length() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_get_Length");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType>("", "MultiplayerEnvironmentResizeController/ResizeType", "Length"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerEnvironmentResizeController/ResizeType Length
void GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_Length(::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::_set_Length");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerEnvironmentResizeController/ResizeType", "Length", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerEnvironmentResizeController/ResizeData
#include "GlobalNamespace/MultiplayerEnvironmentResizeController_ResizeData.hpp"
// Including type: TubeBloomPrePassLight
#include "GlobalNamespace/TubeBloomPrePassLight.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerEnvironmentResizeController/ResizeType _resizeType
::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType& GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__resizeType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__resizeType");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resizeType"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _offset
float& GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__offset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__offset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_offset"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TubeBloomPrePassLight[] _lights
::ArrayW<::GlobalNamespace::TubeBloomPrePassLight*>& GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__lights() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__lights");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lights"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::TubeBloomPrePassLight*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform[] _otherTransforms
::ArrayW<::UnityEngine::Transform*>& GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__otherTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::dyn__otherTransforms");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_otherTransforms"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Transform*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerEnvironmentResizeController/ResizeData.get_resizeType
::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_resizeType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_resizeType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_resizeType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeType, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController/ResizeData.get_offset
float GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_offset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_offset");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_offset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController/ResizeData.get_lights
::ArrayW<::GlobalNamespace::TubeBloomPrePassLight*> GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_lights() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_lights");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_lights", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::ArrayW<::GlobalNamespace::TubeBloomPrePassLight*>, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentResizeController/ResizeData.get_otherTransforms
::ArrayW<::UnityEngine::Transform*> GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_otherTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentResizeController::ResizeData::get_otherTransforms");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_otherTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::ArrayW<::UnityEngine::Transform*>, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerGameplayAnimator
#include "GlobalNamespace/MultiplayerGameplayAnimator.hpp"
// Including type: ColorSO
#include "GlobalNamespace/ColorSO.hpp"
// Including type: LightsAnimator
#include "GlobalNamespace/LightsAnimator.hpp"
// Including type: MultiplayerLeadPlayerProvider
#include "GlobalNamespace/MultiplayerLeadPlayerProvider.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: protected ColorSO _activeLightsColor
::GlobalNamespace::ColorSO*& GlobalNamespace::MultiplayerGameplayAnimator::dyn__activeLightsColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__activeLightsColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activeLightsColor"))->offset;
return *reinterpret_cast<::GlobalNamespace::ColorSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected ColorSO _leadingLightsColor
::GlobalNamespace::ColorSO*& GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadingLightsColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadingLightsColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leadingLightsColor"))->offset;
return *reinterpret_cast<::GlobalNamespace::ColorSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected ColorSO _failedLightsColor
::GlobalNamespace::ColorSO*& GlobalNamespace::MultiplayerGameplayAnimator::dyn__failedLightsColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__failedLightsColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_failedLightsColor"))->offset;
return *reinterpret_cast<::GlobalNamespace::ColorSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected System.Single _leadingSwitchCrossFadeDuration
float& GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadingSwitchCrossFadeDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadingSwitchCrossFadeDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leadingSwitchCrossFadeDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected LightsAnimator[] _gameplayLightsAnimators
::ArrayW<::GlobalNamespace::LightsAnimator*>& GlobalNamespace::MultiplayerGameplayAnimator::dyn__gameplayLightsAnimators() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__gameplayLightsAnimators");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameplayLightsAnimators"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::LightsAnimator*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected LightsAnimator[] _allLightsAnimators
::ArrayW<::GlobalNamespace::LightsAnimator*>& GlobalNamespace::MultiplayerGameplayAnimator::dyn__allLightsAnimators() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__allLightsAnimators");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allLightsAnimators"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::LightsAnimator*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLeadPlayerProvider _leadPlayerProvider
::GlobalNamespace::MultiplayerLeadPlayerProvider*& GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadPlayerProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__leadPlayerProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leadPlayerProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLeadPlayerProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerGameplayAnimator::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected readonly Tweening.TimeTweeningManager tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::MultiplayerGameplayAnimator::dyn_tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn_tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected readonly IConnectedPlayer connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerGameplayAnimator::dyn_connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::dyn_connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerGameplayAnimator.Start
void GlobalNamespace::MultiplayerGameplayAnimator::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::Start");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerGameplayAnimator.OnDestroy
void GlobalNamespace::MultiplayerGameplayAnimator::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::OnDestroy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerGameplayAnimator.AnimateNewLeaderSelected
void GlobalNamespace::MultiplayerGameplayAnimator::AnimateNewLeaderSelected(bool isLeading) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::AnimateNewLeaderSelected");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateNewLeaderSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isLeading)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isLeading);
}
// Autogenerated method: MultiplayerGameplayAnimator.HandleStateChanged
void GlobalNamespace::MultiplayerGameplayAnimator::HandleStateChanged(::GlobalNamespace::MultiplayerController::State state) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::HandleStateChanged");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(state)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, state);
}
// Autogenerated method: MultiplayerGameplayAnimator.HandleNewLeaderWasSelected
void GlobalNamespace::MultiplayerGameplayAnimator::HandleNewLeaderWasSelected(::StringW userId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerGameplayAnimator::HandleNewLeaderWasSelected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleNewLeaderWasSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, userId);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerIntroAnimationController
#include "GlobalNamespace/MultiplayerIntroAnimationController.hpp"
// Including type: UnityEngine.Playables.PlayableDirector
#include "UnityEngine/Playables/PlayableDirector.hpp"
// Including type: MultiplayerScoreRingManager
#include "GlobalNamespace/MultiplayerScoreRingManager.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: System.Collections.Generic.Queue`1
#include "System/Collections/Generic/Queue_1.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: MultiplayerTimelineMock
#include "GlobalNamespace/MultiplayerTimelineMock.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Playables.PlayableDirector _introPlayableDirector
::UnityEngine::Playables::PlayableDirector*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__introPlayableDirector() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__introPlayableDirector");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_introPlayableDirector"))->offset;
return *reinterpret_cast<::UnityEngine::Playables::PlayableDirector**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _playerTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerIntroAnimationController::dyn__playerTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__playerTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _ringTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerIntroAnimationController::dyn__ringTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__ringTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ringTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName[] _playerTimelinePropertyNames
::ArrayW<::UnityEngine::PropertyName>& GlobalNamespace::MultiplayerIntroAnimationController::dyn__playerTimelinePropertyNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__playerTimelinePropertyNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTimelinePropertyNames"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::PropertyName>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _localPlayerTrackName
::StringW& GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _localPlayerRingTrackName
::StringW& GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerRingTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerRingTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerRingTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName _localPlayerTimelinePropertyName
::UnityEngine::PropertyName& GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerTimelinePropertyName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__localPlayerTimelinePropertyName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerTimelinePropertyName"))->offset;
return *reinterpret_cast<::UnityEngine::PropertyName*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _firstConnectedPlayerStart
float& GlobalNamespace::MultiplayerIntroAnimationController::dyn__firstConnectedPlayerStart() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__firstConnectedPlayerStart");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_firstConnectedPlayerStart"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _spawnDuration
float& GlobalNamespace::MultiplayerIntroAnimationController::dyn__spawnDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__spawnDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _endMarkerName
::StringW& GlobalNamespace::MultiplayerIntroAnimationController::dyn__endMarkerName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__endMarkerName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_endMarkerName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreRingManager _scoreRingManager
::GlobalNamespace::MultiplayerScoreRingManager*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__scoreRingManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__scoreRingManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreRingManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreRingManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _multiplayerPlayersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__multiplayerPlayersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__multiplayerPlayersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerPlayersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action _onCompleted
::System::Action*& GlobalNamespace::MultiplayerIntroAnimationController::dyn__onCompleted() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__onCompleted");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_onCompleted"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _introDuration
float& GlobalNamespace::MultiplayerIntroAnimationController::dyn__introDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__introDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_introDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _bindingFinished
bool& GlobalNamespace::MultiplayerIntroAnimationController::dyn__bindingFinished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::dyn__bindingFinished");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_bindingFinished"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroAnimationController.OnValidate
void GlobalNamespace::MultiplayerIntroAnimationController::OnValidate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::OnValidate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnValidate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroAnimationController.SetBeforeIntroValue
void GlobalNamespace::MultiplayerIntroAnimationController::SetBeforeIntroValue() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::SetBeforeIntroValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetBeforeIntroValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroAnimationController.PlayIntroAnimation
void GlobalNamespace::MultiplayerIntroAnimationController::PlayIntroAnimation(float maxDesiredIntroAnimationDuration, ::System::Action* onCompleted) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::PlayIntroAnimation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PlayIntroAnimation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(maxDesiredIntroAnimationDuration), ::il2cpp_utils::ExtractType(onCompleted)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, maxDesiredIntroAnimationDuration, onCompleted);
}
// Autogenerated method: MultiplayerIntroAnimationController.GetFullIntroAnimationTime
float GlobalNamespace::MultiplayerIntroAnimationController::GetFullIntroAnimationTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::GetFullIntroAnimationTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetFullIntroAnimationTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroAnimationController.BindTimeline
void GlobalNamespace::MultiplayerIntroAnimationController::BindTimeline() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::BindTimeline");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BindTimeline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroAnimationController.BindRingsAndSetTiming
void GlobalNamespace::MultiplayerIntroAnimationController::BindRingsAndSetTiming(int connectedPlayersCount, ::ArrayW<::UnityEngine::GameObject*> connectedRings, ::UnityEngine::GameObject* localRing) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::BindRingsAndSetTiming");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BindRingsAndSetTiming", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(connectedPlayersCount), ::il2cpp_utils::ExtractType(connectedRings), ::il2cpp_utils::ExtractType(localRing)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, connectedPlayersCount, connectedRings, localRing);
}
// Autogenerated method: MultiplayerIntroAnimationController.TransitionToAfterIntroAnimationState
void GlobalNamespace::MultiplayerIntroAnimationController::TransitionToAfterIntroAnimationState() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::TransitionToAfterIntroAnimationState");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TransitionToAfterIntroAnimationState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroAnimationController.CalculatePlayerIndexSequence
::System::Collections::Generic::Queue_1<int>* GlobalNamespace::MultiplayerIntroAnimationController::CalculatePlayerIndexSequence(::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>* allActivePlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::CalculatePlayerIndexSequence");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CalculatePlayerIndexSequence", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(allActivePlayer)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::Queue_1<int>*, false>(this, ___internal__method, allActivePlayer);
}
// Autogenerated method: MultiplayerIntroAnimationController.SetTimelineMock
void GlobalNamespace::MultiplayerIntroAnimationController::SetTimelineMock(::GlobalNamespace::MultiplayerTimelineMock* multiplayerIntroTimelineMock, bool isDuel) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::SetTimelineMock");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTimelineMock", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(multiplayerIntroTimelineMock), ::il2cpp_utils::ExtractType(isDuel)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, multiplayerIntroTimelineMock, isDuel);
}
// Autogenerated method: MultiplayerIntroAnimationController.Completed
void GlobalNamespace::MultiplayerIntroAnimationController::Completed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroAnimationController::Completed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Completed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerIntroCountdown
#include "GlobalNamespace/MultiplayerIntroCountdown.hpp"
// Including type: MultiplayerIntroCountdown/<CountdownRoutine>d__23
#include "GlobalNamespace/MultiplayerIntroCountdown_-CountdownRoutine-d__23.hpp"
// Including type: MultiplayerIntroCountdown/<PlayDelayed>d__24
#include "GlobalNamespace/MultiplayerIntroCountdown_-PlayDelayed-d__24.hpp"
// Including type: MultiplayerIntroCountdown/<>c__DisplayClass25_0
#include "GlobalNamespace/MultiplayerIntroCountdown_--c__DisplayClass25_0.hpp"
// Including type: MultiplayerIntroCountdown/<PhaseRoutine>d__25
#include "GlobalNamespace/MultiplayerIntroCountdown_-PhaseRoutine-d__25.hpp"
// Including type: UnityEngine.AudioClip
#include "UnityEngine/AudioClip.hpp"
// Including type: MultiplayerIntroCountdownTextController
#include "GlobalNamespace/MultiplayerIntroCountdownTextController.hpp"
// Including type: UnityEngine.AudioSource
#include "UnityEngine/AudioSource.hpp"
// Including type: MultiplayerOffsetPositionByLocalPlayerPosition
#include "GlobalNamespace/MultiplayerOffsetPositionByLocalPlayerPosition.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _textAppearDuration
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__textAppearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__textAppearDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textAppearDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _textDisappearDuration
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__textDisappearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__textDisappearDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textDisappearDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _goDisappearDuration
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__goDisappearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__goDisappearDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_goDisappearDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _partsDistance
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__partsDistance() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__partsDistance");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_partsDistance"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _startLocalPosition
::UnityEngine::Vector3& GlobalNamespace::MultiplayerIntroCountdown::dyn__startLocalPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__startLocalPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_startLocalPosition"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _targetLocalPosition
::UnityEngine::Vector3& GlobalNamespace::MultiplayerIntroCountdown::dyn__targetLocalPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__targetLocalPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_targetLocalPosition"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AudioClip _readyClip
::UnityEngine::AudioClip*& GlobalNamespace::MultiplayerIntroCountdown::dyn__readyClip() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__readyClip");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_readyClip"))->offset;
return *reinterpret_cast<::UnityEngine::AudioClip**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AudioClip _setClip
::UnityEngine::AudioClip*& GlobalNamespace::MultiplayerIntroCountdown::dyn__setClip() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__setClip");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_setClip"))->offset;
return *reinterpret_cast<::UnityEngine::AudioClip**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AudioClip _goClip
::UnityEngine::AudioClip*& GlobalNamespace::MultiplayerIntroCountdown::dyn__goClip() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__goClip");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_goClip"))->offset;
return *reinterpret_cast<::UnityEngine::AudioClip**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AudioClip _buildUpClip
::UnityEngine::AudioClip*& GlobalNamespace::MultiplayerIntroCountdown::dyn__buildUpClip() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__buildUpClip");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_buildUpClip"))->offset;
return *reinterpret_cast<::UnityEngine::AudioClip**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerIntroCountdownTextController _textController0
::GlobalNamespace::MultiplayerIntroCountdownTextController*& GlobalNamespace::MultiplayerIntroCountdown::dyn__textController0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__textController0");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textController0"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdownTextController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerIntroCountdownTextController _textController1
::GlobalNamespace::MultiplayerIntroCountdownTextController*& GlobalNamespace::MultiplayerIntroCountdown::dyn__textController1() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__textController1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textController1"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdownTextController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AudioSource _audioSource
::UnityEngine::AudioSource*& GlobalNamespace::MultiplayerIntroCountdown::dyn__audioSource() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__audioSource");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_audioSource"))->offset;
return *reinterpret_cast<::UnityEngine::AudioSource**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerOffsetPositionByLocalPlayerPosition _multiplayerOffsetByLocalPlayerPosition
::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition*& GlobalNamespace::MultiplayerIntroCountdown::dyn__multiplayerOffsetByLocalPlayerPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__multiplayerOffsetByLocalPlayerPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerOffsetByLocalPlayerPosition"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Tweening.TimeTweeningManager _tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::MultiplayerIntroCountdown::dyn__tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerIntroCountdownTextController _currentTextController
::GlobalNamespace::MultiplayerIntroCountdownTextController*& GlobalNamespace::MultiplayerIntroCountdown::dyn__currentTextController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__currentTextController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentTextController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdownTextController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _fontSize
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__fontSize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__fontSize");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fontSize"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _alpha
float& GlobalNamespace::MultiplayerIntroCountdown::dyn__alpha() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::dyn__alpha");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_alpha"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdown.get_textAppearDuration
float GlobalNamespace::MultiplayerIntroCountdown::get_textAppearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::get_textAppearDuration");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_textAppearDuration", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown.Awake
void GlobalNamespace::MultiplayerIntroCountdown::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown.OnDestroy
void GlobalNamespace::MultiplayerIntroCountdown::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::OnDestroy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown.StartCountdown
void GlobalNamespace::MultiplayerIntroCountdown::StartCountdown(float seconds, float delay, float durationMultiplier) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::StartCountdown");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartCountdown", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(seconds), ::il2cpp_utils::ExtractType(delay), ::il2cpp_utils::ExtractType(durationMultiplier)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, seconds, delay, durationMultiplier);
}
// Autogenerated method: MultiplayerIntroCountdown.CountdownRoutine
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerIntroCountdown::CountdownRoutine(float seconds, float delay, float durationMultiplier) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::CountdownRoutine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CountdownRoutine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(seconds), ::il2cpp_utils::ExtractType(delay), ::il2cpp_utils::ExtractType(durationMultiplier)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method, seconds, delay, durationMultiplier);
}
// Autogenerated method: MultiplayerIntroCountdown.PlayDelayed
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerIntroCountdown::PlayDelayed(::UnityEngine::AudioClip* audioClip, float delay) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::PlayDelayed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PlayDelayed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(audioClip), ::il2cpp_utils::ExtractType(delay)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method, audioClip, delay);
}
// Autogenerated method: MultiplayerIntroCountdown.PhaseRoutine
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerIntroCountdown::PhaseRoutine(::StringW text, float appearDuration, float disappearDuration) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::PhaseRoutine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PhaseRoutine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text), ::il2cpp_utils::ExtractType(appearDuration), ::il2cpp_utils::ExtractType(disappearDuration)})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method, text, appearDuration, disappearDuration);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerIntroCountdown/<CountdownRoutine>d__23
#include "GlobalNamespace/MultiplayerIntroCountdown_-CountdownRoutine-d__23.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerIntroCountdown <>4__this
::GlobalNamespace::MultiplayerIntroCountdown*& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdown**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single delay
float& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_delay() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_delay");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "delay"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single seconds
float& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_seconds() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_seconds");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "seconds"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single durationMultiplier
float& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_durationMultiplier() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_durationMultiplier");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "durationMultiplier"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single <soundDelayAfterText>5__2
float& GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$soundDelayAfterText$5__2() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::dyn_$soundDelayAfterText$5__2");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<soundDelayAfterText>5__2"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdown/<CountdownRoutine>d__23.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<CountdownRoutine>d__23.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<CountdownRoutine>d__23.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<CountdownRoutine>d__23.MoveNext
bool GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<CountdownRoutine>d__23.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$CountdownRoutine$d__23::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerIntroCountdown/<PlayDelayed>d__24
#include "GlobalNamespace/MultiplayerIntroCountdown_-PlayDelayed-d__24.hpp"
// Including type: UnityEngine.AudioClip
#include "UnityEngine/AudioClip.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single delay
float& GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_delay() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_delay");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "delay"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerIntroCountdown <>4__this
::GlobalNamespace::MultiplayerIntroCountdown*& GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdown**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AudioClip audioClip
::UnityEngine::AudioClip*& GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_audioClip() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::dyn_audioClip");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "audioClip"))->offset;
return *reinterpret_cast<::UnityEngine::AudioClip**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdown/<PlayDelayed>d__24.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PlayDelayed>d__24.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PlayDelayed>d__24.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PlayDelayed>d__24.MoveNext
bool GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PlayDelayed>d__24.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PlayDelayed$d__24::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerIntroCountdown/<>c__DisplayClass25_0
#include "GlobalNamespace/MultiplayerIntroCountdown_--c__DisplayClass25_0.hpp"
// Including type: MultiplayerIntroCountdownTextController
#include "GlobalNamespace/MultiplayerIntroCountdownTextController.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public MultiplayerIntroCountdownTextController textController
::GlobalNamespace::MultiplayerIntroCountdownTextController*& GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::dyn_textController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::dyn_textController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "textController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdownTextController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerIntroCountdown <>4__this
::GlobalNamespace::MultiplayerIntroCountdown*& GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdown**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdown/<>c__DisplayClass25_0.<PhaseRoutine>b__0
void GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::$PhaseRoutine$b__0(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::<PhaseRoutine>b__0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<PhaseRoutine>b__0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerIntroCountdown/<>c__DisplayClass25_0.<PhaseRoutine>b__1
void GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::$PhaseRoutine$b__1(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::<PhaseRoutine>b__1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<PhaseRoutine>b__1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerIntroCountdown/<>c__DisplayClass25_0.<PhaseRoutine>b__2
void GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::$PhaseRoutine$b__2(::UnityEngine::Vector3 pos) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::<PhaseRoutine>b__2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<PhaseRoutine>b__2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pos)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, pos);
}
// Autogenerated method: MultiplayerIntroCountdown/<>c__DisplayClass25_0.<PhaseRoutine>b__3
void GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::$PhaseRoutine$b__3(float f) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::<PhaseRoutine>b__3");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<PhaseRoutine>b__3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(f)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, f);
}
// Autogenerated method: MultiplayerIntroCountdown/<>c__DisplayClass25_0.<PhaseRoutine>b__4
void GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::$PhaseRoutine$b__4(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0::<PhaseRoutine>b__4");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<PhaseRoutine>b__4", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerIntroCountdown/<PhaseRoutine>d__25
#include "GlobalNamespace/MultiplayerIntroCountdown_-PhaseRoutine-d__25.hpp"
// Including type: MultiplayerIntroCountdown/<>c__DisplayClass25_0
#include "GlobalNamespace/MultiplayerIntroCountdown_--c__DisplayClass25_0.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerIntroCountdown <>4__this
::GlobalNamespace::MultiplayerIntroCountdown*& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdown**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String text
::StringW& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_text() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "text"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single appearDuration
float& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_appearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_appearDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "appearDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single disappearDuration
float& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_disappearDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_disappearDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "disappearDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerIntroCountdown/<>c__DisplayClass25_0 <>8__1
::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0*& GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$8__1() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::dyn_$$8__1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>8__1"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerIntroCountdown::$$c__DisplayClass25_0**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdown/<PhaseRoutine>d__25.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PhaseRoutine>d__25.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PhaseRoutine>d__25.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PhaseRoutine>d__25.MoveNext
bool GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdown/<PhaseRoutine>d__25.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdown::$PhaseRoutine$d__25::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerIntroCountdownTextController
#include "GlobalNamespace/MultiplayerIntroCountdownTextController.hpp"
// Including type: TMPro.TextMeshPro
#include "TMPro/TextMeshPro.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshPro[] _texts
::ArrayW<::TMPro::TextMeshPro*>& GlobalNamespace::MultiplayerIntroCountdownTextController::dyn__texts() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::dyn__texts");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_texts"))->offset;
return *reinterpret_cast<::ArrayW<::TMPro::TextMeshPro*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.set_hide
void GlobalNamespace::MultiplayerIntroCountdownTextController::set_hide(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::set_hide");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_hide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.get_fontSize
float GlobalNamespace::MultiplayerIntroCountdownTextController::get_fontSize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::get_fontSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_fontSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.set_fontSize
void GlobalNamespace::MultiplayerIntroCountdownTextController::set_fontSize(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::set_fontSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_fontSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.get_alpha
float GlobalNamespace::MultiplayerIntroCountdownTextController::get_alpha() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::get_alpha");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_alpha", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.set_alpha
void GlobalNamespace::MultiplayerIntroCountdownTextController::set_alpha(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::set_alpha");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_alpha", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.SetText
void GlobalNamespace::MultiplayerIntroCountdownTextController::SetText(::StringW text) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::SetText");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetText", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, text);
}
// Autogenerated method: MultiplayerIntroCountdownTextController.SetDistances
void GlobalNamespace::MultiplayerIntroCountdownTextController::SetDistances(float distance) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerIntroCountdownTextController::SetDistances");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetDistances", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(distance)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, distance);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: System.Action`2
#include "System/Action_2.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerPlayerLayout <layout>k__BackingField
::GlobalNamespace::MultiplayerPlayerLayout& GlobalNamespace::MultiplayerLayoutProvider::dyn_$layout$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::dyn_$layout$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<layout>k__BackingField"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayerLayout*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 <activePlayerSpotsCount>k__BackingField
int& GlobalNamespace::MultiplayerLayoutProvider::dyn_$activePlayerSpotsCount$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::dyn_$activePlayerSpotsCount$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<activePlayerSpotsCount>k__BackingField"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`2<MultiplayerPlayerLayout,System.Int32> playersLayoutWasCalculatedEvent
::System::Action_2<::GlobalNamespace::MultiplayerPlayerLayout, int>*& GlobalNamespace::MultiplayerLayoutProvider::dyn_playersLayoutWasCalculatedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::dyn_playersLayoutWasCalculatedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "playersLayoutWasCalculatedEvent"))->offset;
return *reinterpret_cast<::System::Action_2<::GlobalNamespace::MultiplayerPlayerLayout, int>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerLayoutProvider.get_layout
::GlobalNamespace::MultiplayerPlayerLayout GlobalNamespace::MultiplayerLayoutProvider::get_layout() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::get_layout");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_layout", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerPlayerLayout, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLayoutProvider.set_layout
void GlobalNamespace::MultiplayerLayoutProvider::set_layout(::GlobalNamespace::MultiplayerPlayerLayout value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::set_layout");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_layout", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLayoutProvider.get_activePlayerSpotsCount
int GlobalNamespace::MultiplayerLayoutProvider::get_activePlayerSpotsCount() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::get_activePlayerSpotsCount");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_activePlayerSpotsCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLayoutProvider.set_activePlayerSpotsCount
void GlobalNamespace::MultiplayerLayoutProvider::set_activePlayerSpotsCount(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::set_activePlayerSpotsCount");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_activePlayerSpotsCount", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLayoutProvider.add_playersLayoutWasCalculatedEvent
void GlobalNamespace::MultiplayerLayoutProvider::add_playersLayoutWasCalculatedEvent(::System::Action_2<::GlobalNamespace::MultiplayerPlayerLayout, int>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::add_playersLayoutWasCalculatedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_playersLayoutWasCalculatedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLayoutProvider.remove_playersLayoutWasCalculatedEvent
void GlobalNamespace::MultiplayerLayoutProvider::remove_playersLayoutWasCalculatedEvent(::System::Action_2<::GlobalNamespace::MultiplayerPlayerLayout, int>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::remove_playersLayoutWasCalculatedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_playersLayoutWasCalculatedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLayoutProvider.CalculateLayout
::GlobalNamespace::MultiplayerPlayerLayout GlobalNamespace::MultiplayerLayoutProvider::CalculateLayout(int activePlayersCount) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLayoutProvider::CalculateLayout");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CalculateLayout", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(activePlayersCount)})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerPlayerLayout, false>(this, ___internal__method, activePlayersCount);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerLeadPlayerProvider
#include "GlobalNamespace/MultiplayerLeadPlayerProvider.hpp"
// Including type: MultiplayerController/State
#include "GlobalNamespace/MultiplayerController.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _timeToGainFirstLead
float& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__timeToGainFirstLead() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__timeToGainFirstLead");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeToGainFirstLead"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _timeToLooseLead
float& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__timeToLooseLead() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__timeToLooseLead");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeToLooseLead"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreProvider
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__scoreProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__scoreProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<System.String> newLeaderWasSelectedEvent
::System::Action_1<::StringW>*& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn_newLeaderWasSelectedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn_newLeaderWasSelectedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "newLeaderWasSelectedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::StringW>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _currentLeadingPlayerStartTime
float& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentLeadingPlayerStartTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentLeadingPlayerStartTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentLeadingPlayerStartTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreProvider/RankedPlayer _currentlyDisplayedUser
::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentlyDisplayedUser() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentlyDisplayedUser");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentlyDisplayedUser"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreProvider/RankedPlayer _currentlyLeadingUser
::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*& GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentlyLeadingUser() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::dyn__currentlyLeadingUser");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentlyLeadingUser"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.add_newLeaderWasSelectedEvent
void GlobalNamespace::MultiplayerLeadPlayerProvider::add_newLeaderWasSelectedEvent(::System::Action_1<::StringW>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::add_newLeaderWasSelectedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_newLeaderWasSelectedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.remove_newLeaderWasSelectedEvent
void GlobalNamespace::MultiplayerLeadPlayerProvider::remove_newLeaderWasSelectedEvent(::System::Action_1<::StringW>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::remove_newLeaderWasSelectedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_newLeaderWasSelectedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.Start
void GlobalNamespace::MultiplayerLeadPlayerProvider::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.OnDestroy
void GlobalNamespace::MultiplayerLeadPlayerProvider::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.Update
void GlobalNamespace::MultiplayerLeadPlayerProvider::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.StopProviding
void GlobalNamespace::MultiplayerLeadPlayerProvider::StopProviding() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::StopProviding");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StopProviding", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.StartProviding
void GlobalNamespace::MultiplayerLeadPlayerProvider::StartProviding() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::StartProviding");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartProviding", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.HandleStateChanged
void GlobalNamespace::MultiplayerLeadPlayerProvider::HandleStateChanged(::GlobalNamespace::MultiplayerController::State state) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::HandleStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(state)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, state);
}
// Autogenerated method: MultiplayerLeadPlayerProvider.HandleFirstPlayerDidChange
void GlobalNamespace::MultiplayerLeadPlayerProvider::HandleFirstPlayerDidChange(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* firstPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerLeadPlayerProvider::HandleFirstPlayerDidChange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleFirstPlayerDidChange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(firstPlayer)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, firstPlayer);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerObjectInstaller
#include "GlobalNamespace/MultiplayerObjectInstaller.hpp"
// Including type: MultiplayerScoreRingItem
#include "GlobalNamespace/MultiplayerScoreRingItem.hpp"
// Including type: FireworkItemController
#include "GlobalNamespace/FireworkItemController.hpp"
// Including type: MultiplayerResultsPyramidViewAvatar
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatar.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreRingItem _inEnvironmentTextsPrefab
::GlobalNamespace::MultiplayerScoreRingItem*& GlobalNamespace::MultiplayerObjectInstaller::dyn__inEnvironmentTextsPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerObjectInstaller::dyn__inEnvironmentTextsPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inEnvironmentTextsPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreRingItem**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private FireworkItemController _fireworkItemControllerPrefab
::GlobalNamespace::FireworkItemController*& GlobalNamespace::MultiplayerObjectInstaller::dyn__fireworkItemControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerObjectInstaller::dyn__fireworkItemControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fireworkItemControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::FireworkItemController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerResultsPyramidViewAvatar _multiplayerResultsPyramidViewAvatarPrefab
::GlobalNamespace::MultiplayerResultsPyramidViewAvatar*& GlobalNamespace::MultiplayerObjectInstaller::dyn__multiplayerResultsPyramidViewAvatarPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerObjectInstaller::dyn__multiplayerResultsPyramidViewAvatarPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerResultsPyramidViewAvatarPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerResultsPyramidViewAvatar**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerObjectInstaller.InstallBindings
void GlobalNamespace::MultiplayerObjectInstaller::InstallBindings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerObjectInstaller::InstallBindings");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InstallBindings", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerOffsetPositionByLocalPlayerPosition
#include "GlobalNamespace/MultiplayerOffsetPositionByLocalPlayerPosition.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _multiplayerPlayersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__multiplayerPlayersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__multiplayerPlayersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerPlayersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _positionOffset
::UnityEngine::Vector3& GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__positionOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__positionOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_positionOffset"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _rotationOffset
::UnityEngine::Quaternion& GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__rotationOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__rotationOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rotationOffset"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _lastParentPosition
::UnityEngine::Vector3& GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__lastParentPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__lastParentPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastParentPosition"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _lastParentRotation
::UnityEngine::Quaternion& GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__lastParentRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::dyn__lastParentRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastParentRotation"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerOffsetPositionByLocalPlayerPosition.Awake
void GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOffsetPositionByLocalPlayerPosition.Update
void GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOffsetPositionByLocalPlayerPosition.SetEnabled
void GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::SetEnabled(bool isEnabled) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::SetEnabled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetEnabled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isEnabled)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isEnabled);
}
// Autogenerated method: MultiplayerOffsetPositionByLocalPlayerPosition.UpdatePositionAndRotationIfNeeded
void GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::UpdatePositionAndRotationIfNeeded() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition::UpdatePositionAndRotationIfNeeded");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdatePositionAndRotationIfNeeded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerOtherPlayersScoreDiffTextManager
#include "GlobalNamespace/MultiplayerOtherPlayersScoreDiffTextManager.hpp"
// Including type: MultiplayerOtherPlayersScoreDiffTextManager/<>c
#include "GlobalNamespace/MultiplayerOtherPlayersScoreDiffTextManager_--c.hpp"
// Including type: CoreGameHUDController/InitData
#include "GlobalNamespace/CoreGameHUDController_InitData.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: MultiplayerScoreProvider
#include "GlobalNamespace/MultiplayerScoreProvider.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private System.Single kUpdateInterval
float GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::_get_kUpdateInterval() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::_get_kUpdateInterval");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "MultiplayerOtherPlayersScoreDiffTextManager", "kUpdateInterval"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kUpdateInterval
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::_set_kUpdateInterval(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::_set_kUpdateInterval");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerOtherPlayersScoreDiffTextManager", "kUpdateInterval", value));
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _playersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__playersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__playersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreProvider
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__scoreProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__scoreProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly CoreGameHUDController/InitData _initData
::GlobalNamespace::CoreGameHUDController::InitData*& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__initData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__initData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_initData"))->offset;
return *reinterpret_cast<::GlobalNamespace::CoreGameHUDController::InitData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _timeToNextUpdate
float& GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__timeToNextUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::dyn__timeToNextUpdate");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeToNextUpdate"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.Start
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.OnDestroy
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.Update
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.InitLeftRightPositions
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::InitLeftRightPositions() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::InitLeftRightPositions");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitLeftRightPositions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.HideAll
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::HideAll() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::HideAll");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HideAll", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager.HandleStateChanged
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::HandleStateChanged(::GlobalNamespace::MultiplayerController::State newState) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::HandleStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(newState)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, newState);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerOtherPlayersScoreDiffTextManager/<>c
#include "GlobalNamespace/MultiplayerOtherPlayersScoreDiffTextManager_--c.hpp"
// Including type: System.Func`2
#include "System/Func_2.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly MultiplayerOtherPlayersScoreDiffTextManager/<>c <>9
::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c* GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_get_$$9() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_get_$$9");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c*>("", "MultiplayerOtherPlayersScoreDiffTextManager/<>c", "<>9")));
}
// Autogenerated static field setter
// Set static field: static public readonly MultiplayerOtherPlayersScoreDiffTextManager/<>c <>9
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_set_$$9(::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_set_$$9");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerOtherPlayersScoreDiffTextManager/<>c", "<>9", value)));
}
// Autogenerated static field getter
// Get static field: static public System.Func`2<MultiplayerScoreProvider/RankedPlayer,System.Boolean> <>9__10_0
::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>* GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_get_$$9__10_0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_get_$$9__10_0");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>*>("", "MultiplayerOtherPlayersScoreDiffTextManager/<>c", "<>9__10_0")));
}
// Autogenerated static field setter
// Set static field: static public System.Func`2<MultiplayerScoreProvider/RankedPlayer,System.Boolean> <>9__10_0
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_set_$$9__10_0(::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_set_$$9__10_0");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerOtherPlayersScoreDiffTextManager/<>c", "<>9__10_0", value)));
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager/<>c..cctor
void GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerOtherPlayersScoreDiffTextManager/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated method: MultiplayerOtherPlayersScoreDiffTextManager/<>c.<Update>b__10_0
bool GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::$Update$b__10_0(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* p) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOtherPlayersScoreDiffTextManager::$$c::<Update>b__10_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Update>b__10_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p)})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, p);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerOutroAnimationController
#include "GlobalNamespace/MultiplayerOutroAnimationController.hpp"
// Including type: UnityEngine.Playables.PlayableDirector
#include "UnityEngine/Playables/PlayableDirector.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: MultiplayerScoreRingManager
#include "GlobalNamespace/MultiplayerScoreRingManager.hpp"
// Including type: MultiplayerResultsPyramidView
#include "GlobalNamespace/MultiplayerResultsPyramidView.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: GameplayCoreSceneSetupData
#include "GlobalNamespace/GameplayCoreSceneSetupData.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: MultiplayerResultsData
#include "GlobalNamespace/MultiplayerResultsData.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: MultiplayerTimelineMock
#include "GlobalNamespace/MultiplayerTimelineMock.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Playables.PlayableDirector _outroPlayableDirector
::UnityEngine::Playables::PlayableDirector*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__outroPlayableDirector() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__outroPlayableDirector");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_outroPlayableDirector"))->offset;
return *reinterpret_cast<::UnityEngine::Playables::PlayableDirector**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _playerTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__playerTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__playerTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _ringTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__ringTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__ringTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ringTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _resultsTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resultsTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName[] _playerTimelinePropertyNames
::ArrayW<::UnityEngine::PropertyName>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__playerTimelinePropertyNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__playerTimelinePropertyNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTimelinePropertyNames"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::PropertyName>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName[] _resultsTimelinePropertyNames
::ArrayW<::UnityEngine::PropertyName>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsTimelinePropertyNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsTimelinePropertyNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resultsTimelinePropertyNames"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::PropertyName>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _localPlayerTrackName
::StringW& GlobalNamespace::MultiplayerOutroAnimationController::dyn__localPlayerTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__localPlayerTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName _localPlayerTimelinePropertyName
::UnityEngine::PropertyName& GlobalNamespace::MultiplayerOutroAnimationController::dyn__localPlayerTimelinePropertyName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__localPlayerTimelinePropertyName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerTimelinePropertyName"))->offset;
return *reinterpret_cast<::UnityEngine::PropertyName*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String[] _badgeTimelineTrackNames
::ArrayW<::StringW>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeTimelineTrackNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeTimelineTrackNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeTimelineTrackNames"))->offset;
return *reinterpret_cast<::ArrayW<::StringW>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.PropertyName[] _badgeTimelinePropertyNames
::ArrayW<::UnityEngine::PropertyName>& GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeTimelinePropertyNames() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeTimelinePropertyNames");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeTimelinePropertyNames"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::PropertyName>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _badgeStartTransform
::UnityEngine::Transform*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeStartTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeStartTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeStartTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _badgeMidTransform
::UnityEngine::Transform*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeMidTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__badgeMidTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeMidTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _songPreviewTrackName
::StringW& GlobalNamespace::MultiplayerOutroAnimationController::dyn__songPreviewTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__songPreviewTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_songPreviewTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _resultsMocksActivationTrack
::StringW& GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsMocksActivationTrack() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__resultsMocksActivationTrack");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resultsMocksActivationTrack"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreRingManager _multiplayerScoreRingManager
::GlobalNamespace::MultiplayerScoreRingManager*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerScoreRingManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerScoreRingManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerScoreRingManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreRingManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerResultsPyramidView _multiplayerResultsPyramidView
::GlobalNamespace::MultiplayerResultsPyramidView*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerResultsPyramidView() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerResultsPyramidView");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerResultsPyramidView"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerResultsPyramidView**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _multiplayerPlayersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerPlayersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerPlayersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerPlayersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameplayCoreSceneSetupData _sceneSetupData
::GlobalNamespace::GameplayCoreSceneSetupData*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__sceneSetupData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__sceneSetupData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sceneSetupData"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayCoreSceneSetupData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action _onCompleted
::System::Action*& GlobalNamespace::MultiplayerOutroAnimationController::dyn__onCompleted() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::dyn__onCompleted");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_onCompleted"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerOutroAnimationController.Start
void GlobalNamespace::MultiplayerOutroAnimationController::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOutroAnimationController.OnValidate
void GlobalNamespace::MultiplayerOutroAnimationController::OnValidate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::OnValidate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnValidate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOutroAnimationController.OnDestroy
void GlobalNamespace::MultiplayerOutroAnimationController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOutroAnimationController.AnimateOutro
void GlobalNamespace::MultiplayerOutroAnimationController::AnimateOutro(::GlobalNamespace::MultiplayerResultsData* multiplayerResultsData, ::System::Action* onCompleted) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::AnimateOutro");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateOutro", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(multiplayerResultsData), ::il2cpp_utils::ExtractType(onCompleted)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, multiplayerResultsData, onCompleted);
}
// Autogenerated method: MultiplayerOutroAnimationController.BindOutroTimeline
void GlobalNamespace::MultiplayerOutroAnimationController::BindOutroTimeline() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::BindOutroTimeline");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BindOutroTimeline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOutroAnimationController.BindRingsAndAudio
void GlobalNamespace::MultiplayerOutroAnimationController::BindRingsAndAudio(::ArrayW<::UnityEngine::GameObject*> rings, bool isMock, bool isDuel, ::GlobalNamespace::MultiplayerTimelineMock* timelineMock) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::BindRingsAndAudio");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BindRingsAndAudio", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rings), ::il2cpp_utils::ExtractType(isMock), ::il2cpp_utils::ExtractType(isDuel), ::il2cpp_utils::ExtractType(timelineMock)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, rings, isMock, isDuel, timelineMock);
}
// Autogenerated method: MultiplayerOutroAnimationController.SetTimelineMock
void GlobalNamespace::MultiplayerOutroAnimationController::SetTimelineMock(::GlobalNamespace::MultiplayerTimelineMock* multiplayerIntroTimelineMock, bool isDuel) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::SetTimelineMock");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetTimelineMock", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(multiplayerIntroTimelineMock), ::il2cpp_utils::ExtractType(isDuel)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, multiplayerIntroTimelineMock, isDuel);
}
// Autogenerated method: MultiplayerOutroAnimationController.Completed
void GlobalNamespace::MultiplayerOutroAnimationController::Completed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::Completed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Completed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerOutroAnimationController.HandlePlayerSpawningDidFinish
void GlobalNamespace::MultiplayerOutroAnimationController::HandlePlayerSpawningDidFinish() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerOutroAnimationController::HandlePlayerSpawningDidFinish");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerSpawningDidFinish", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPlayerLayout
#include "GlobalNamespace/MultiplayerPlayerLayout.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerPlayerLayout NotDetermined
::GlobalNamespace::MultiplayerPlayerLayout GlobalNamespace::MultiplayerPlayerLayout::_get_NotDetermined() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_get_NotDetermined");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerLayout>("", "MultiplayerPlayerLayout", "NotDetermined"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerPlayerLayout NotDetermined
void GlobalNamespace::MultiplayerPlayerLayout::_set_NotDetermined(::GlobalNamespace::MultiplayerPlayerLayout value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_set_NotDetermined");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerPlayerLayout", "NotDetermined", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerPlayerLayout Circle
::GlobalNamespace::MultiplayerPlayerLayout GlobalNamespace::MultiplayerPlayerLayout::_get_Circle() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_get_Circle");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerLayout>("", "MultiplayerPlayerLayout", "Circle"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerPlayerLayout Circle
void GlobalNamespace::MultiplayerPlayerLayout::_set_Circle(::GlobalNamespace::MultiplayerPlayerLayout value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_set_Circle");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerPlayerLayout", "Circle", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerPlayerLayout Duel
::GlobalNamespace::MultiplayerPlayerLayout GlobalNamespace::MultiplayerPlayerLayout::_get_Duel() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_get_Duel");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerLayout>("", "MultiplayerPlayerLayout", "Duel"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerPlayerLayout Duel
void GlobalNamespace::MultiplayerPlayerLayout::_set_Duel(::GlobalNamespace::MultiplayerPlayerLayout value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::_set_Duel");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerPlayerLayout", "Duel", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerPlayerLayout::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerLayout::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPlayerPlacement
#include "GlobalNamespace/MultiplayerPlayerPlacement.hpp"
// Including type: MultiplayerPlayerPlacement/<>c
#include "GlobalNamespace/MultiplayerPlayerPlacement_--c.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: MultiplayerPlayerLayout
#include "GlobalNamespace/MultiplayerPlayerLayout.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: System.Collections.Generic.IList`1
#include "System/Collections/Generic/IList_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: MultiplayerPlayerPlacement.GetPlayerWorldPosition
::UnityEngine::Vector3 GlobalNamespace::MultiplayerPlayerPlacement::GetPlayerWorldPosition(float outerCircleRadius, float outerCirclePositionAngle, ::GlobalNamespace::MultiplayerPlayerLayout layout) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::GetPlayerWorldPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "GetPlayerWorldPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(outerCircleRadius), ::il2cpp_utils::ExtractType(outerCirclePositionAngle), ::il2cpp_utils::ExtractType(layout)})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, outerCircleRadius, outerCirclePositionAngle, layout);
}
// Autogenerated method: MultiplayerPlayerPlacement.GetOuterCirclePositionAngleForPlayer
float GlobalNamespace::MultiplayerPlayerPlacement::GetOuterCirclePositionAngleForPlayer(int playerIndex, int localPlayerIndex, float angleBetweenPlayers) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::GetOuterCirclePositionAngleForPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "GetOuterCirclePositionAngleForPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(playerIndex), ::il2cpp_utils::ExtractType(localPlayerIndex), ::il2cpp_utils::ExtractType(angleBetweenPlayers)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, playerIndex, localPlayerIndex, angleBetweenPlayers);
}
// Autogenerated method: MultiplayerPlayerPlacement.GetOuterCircleRadius
float GlobalNamespace::MultiplayerPlayerPlacement::GetOuterCircleRadius(float angleBetweenPlayers, float innerCircleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::GetOuterCircleRadius");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "GetOuterCircleRadius", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(angleBetweenPlayers), ::il2cpp_utils::ExtractType(innerCircleRadius)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, angleBetweenPlayers, innerCircleRadius);
}
// Autogenerated method: MultiplayerPlayerPlacement.GetAngleBetweenPlayersWithEvenAdjustment
float GlobalNamespace::MultiplayerPlayerPlacement::GetAngleBetweenPlayersWithEvenAdjustment(int numberOfPlayers, ::GlobalNamespace::MultiplayerPlayerLayout layout) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::GetAngleBetweenPlayersWithEvenAdjustment");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "GetAngleBetweenPlayersWithEvenAdjustment", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(numberOfPlayers), ::il2cpp_utils::ExtractType(layout)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, numberOfPlayers, layout);
}
// Autogenerated method: MultiplayerPlayerPlacement.SortPlayers
void GlobalNamespace::MultiplayerPlayerPlacement::SortPlayers(::System::Collections::Generic::List_1<::GlobalNamespace::IConnectedPlayer*>* players) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::SortPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "SortPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(players)})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, players);
}
// Autogenerated method: MultiplayerPlayerPlacement.GetLocalPlayerIndex
int GlobalNamespace::MultiplayerPlayerPlacement::GetLocalPlayerIndex(::System::Collections::Generic::IList_1<::GlobalNamespace::IConnectedPlayer*>* otherPlayers, ::GlobalNamespace::IConnectedPlayer* localPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::GetLocalPlayerIndex");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement", "GetLocalPlayerIndex", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(otherPlayers), ::il2cpp_utils::ExtractType(localPlayer)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, otherPlayers, localPlayer);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPlayerPlacement/<>c
#include "GlobalNamespace/MultiplayerPlayerPlacement_--c.hpp"
// Including type: System.Comparison`1
#include "System/Comparison_1.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly MultiplayerPlayerPlacement/<>c <>9
::GlobalNamespace::MultiplayerPlayerPlacement::$$c* GlobalNamespace::MultiplayerPlayerPlacement::$$c::_get_$$9() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::_get_$$9");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerPlacement::$$c*>("", "MultiplayerPlayerPlacement/<>c", "<>9")));
}
// Autogenerated static field setter
// Set static field: static public readonly MultiplayerPlayerPlacement/<>c <>9
void GlobalNamespace::MultiplayerPlayerPlacement::$$c::_set_$$9(::GlobalNamespace::MultiplayerPlayerPlacement::$$c* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::_set_$$9");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerPlayerPlacement/<>c", "<>9", value)));
}
// Autogenerated static field getter
// Get static field: static public System.Comparison`1<IConnectedPlayer> <>9__4_0
::System::Comparison_1<::GlobalNamespace::IConnectedPlayer*>* GlobalNamespace::MultiplayerPlayerPlacement::$$c::_get_$$9__4_0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::_get_$$9__4_0");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Comparison_1<::GlobalNamespace::IConnectedPlayer*>*>("", "MultiplayerPlayerPlacement/<>c", "<>9__4_0")));
}
// Autogenerated static field setter
// Set static field: static public System.Comparison`1<IConnectedPlayer> <>9__4_0
void GlobalNamespace::MultiplayerPlayerPlacement::$$c::_set_$$9__4_0(::System::Comparison_1<::GlobalNamespace::IConnectedPlayer*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::_set_$$9__4_0");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerPlayerPlacement/<>c", "<>9__4_0", value)));
}
// Autogenerated method: MultiplayerPlayerPlacement/<>c..cctor
void GlobalNamespace::MultiplayerPlayerPlacement::$$c::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerPlayerPlacement/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated method: MultiplayerPlayerPlacement/<>c.<SortPlayers>b__4_0
int GlobalNamespace::MultiplayerPlayerPlacement::$$c::$SortPlayers$b__4_0(::GlobalNamespace::IConnectedPlayer* p1, ::GlobalNamespace::IConnectedPlayer* p2) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerPlacement::$$c::<SortPlayers>b__4_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<SortPlayers>b__4_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p1), ::il2cpp_utils::ExtractType(p2)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, p1, p2);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerPlayerResultsData
#include "GlobalNamespace/MultiplayerPlayerResultsData.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: MultiplayerLevelCompletionResults
#include "GlobalNamespace/MultiplayerLevelCompletionResults.hpp"
// Including type: MultiplayerBadgeAwardData
#include "GlobalNamespace/MultiplayerBadgeAwardData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public readonly IConnectedPlayer connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerPlayerResultsData::dyn_connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerResultsData::dyn_connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly MultiplayerLevelCompletionResults multiplayerLevelCompletionResults
::GlobalNamespace::MultiplayerLevelCompletionResults*& GlobalNamespace::MultiplayerPlayerResultsData::dyn_multiplayerLevelCompletionResults() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerResultsData::dyn_multiplayerLevelCompletionResults");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "multiplayerLevelCompletionResults"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLevelCompletionResults**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerBadgeAwardData badge
::GlobalNamespace::MultiplayerBadgeAwardData*& GlobalNamespace::MultiplayerPlayerResultsData::dyn_badge() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerResultsData::dyn_badge");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "badge"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerBadgeAwardData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerPlayerResultsData.CompareTo
int GlobalNamespace::MultiplayerPlayerResultsData::CompareTo(::Il2CppObject* obj) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerResultsData::CompareTo");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CompareTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, obj);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPlayerStartState
#include "GlobalNamespace/MultiplayerPlayerStartState.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerPlayerStartState InSync
::GlobalNamespace::MultiplayerPlayerStartState GlobalNamespace::MultiplayerPlayerStartState::_get_InSync() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerStartState::_get_InSync");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerStartState>("", "MultiplayerPlayerStartState", "InSync"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerPlayerStartState InSync
void GlobalNamespace::MultiplayerPlayerStartState::_set_InSync(::GlobalNamespace::MultiplayerPlayerStartState value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerStartState::_set_InSync");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerPlayerStartState", "InSync", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerPlayerStartState Late
::GlobalNamespace::MultiplayerPlayerStartState GlobalNamespace::MultiplayerPlayerStartState::_get_Late() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerStartState::_get_Late");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerPlayerStartState>("", "MultiplayerPlayerStartState", "Late"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerPlayerStartState Late
void GlobalNamespace::MultiplayerPlayerStartState::_set_Late(::GlobalNamespace::MultiplayerPlayerStartState value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerStartState::_set_Late");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerPlayerStartState", "Late", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerPlayerStartState::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayerStartState::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51
#include "GlobalNamespace/MultiplayerPlayersManager_-SwitchLocalPlayerToInactiveCoroutine-d__51.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: BeatmapObjectSpawnCenter
#include "GlobalNamespace/BeatmapObjectSpawnCenter.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: FadeInOutController
#include "GlobalNamespace/FadeInOutController.hpp"
// Including type: Zenject.DiContainer
#include "Zenject/DiContainer.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: MultiplayerLevelCompletionResults
#include "GlobalNamespace/MultiplayerLevelCompletionResults.hpp"
// Including type: IStartSeekSongControllerProvider
#include "GlobalNamespace/IStartSeekSongControllerProvider.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: MultiplayerPlayerStartState
#include "GlobalNamespace/MultiplayerPlayerStartState.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
// Including type: MultiplayerPlayerLayout
#include "GlobalNamespace/MultiplayerPlayerLayout.hpp"
// Including type: MultiplayerLocalActivePlayerFacade/Factory
#include "GlobalNamespace/MultiplayerLocalActivePlayerFacade_Factory.hpp"
// Including type: MultiplayerLocalInactivePlayerFacade/Factory
#include "GlobalNamespace/MultiplayerLocalInactivePlayerFacade_Factory.hpp"
// Including type: MultiplayerConnectedPlayerFacade/Factory
#include "GlobalNamespace/MultiplayerConnectedPlayerFacade_Factory.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalActivePlayerFacade _activeLocalPlayerControllerPrefab
::GlobalNamespace::MultiplayerLocalActivePlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activeLocalPlayerControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalActivePlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalActivePlayerFacade _activeLocalPlayerDuelControllerPrefab
::GlobalNamespace::MultiplayerLocalActivePlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerDuelControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerDuelControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activeLocalPlayerDuelControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalActivePlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalInactivePlayerFacade _inactiveLocalPlayerControllerPrefab
::GlobalNamespace::MultiplayerLocalInactivePlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inactiveLocalPlayerControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalInactivePlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerConnectedPlayerFacade _connectedPlayerControllerPrefab
::GlobalNamespace::MultiplayerConnectedPlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayerControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerConnectedPlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerConnectedPlayerFacade _connectedPlayerDuelControllerPrefab
::GlobalNamespace::MultiplayerConnectedPlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerDuelControllerPrefab() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerDuelControllerPrefab");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayerDuelControllerPrefab"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerConnectedPlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerPlayersManager::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectSpawnCenter _beatmapObjectSpawnCenter
::GlobalNamespace::BeatmapObjectSpawnCenter*& GlobalNamespace::MultiplayerPlayersManager::dyn__beatmapObjectSpawnCenter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__beatmapObjectSpawnCenter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectSpawnCenter"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectSpawnCenter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerPlayersManager::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly FadeInOutController _fadeInOutController
::GlobalNamespace::FadeInOutController*& GlobalNamespace::MultiplayerPlayersManager::dyn__fadeInOutController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__fadeInOutController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInOutController"))->offset;
return *reinterpret_cast<::GlobalNamespace::FadeInOutController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Zenject.DiContainer _container
::Zenject::DiContainer*& GlobalNamespace::MultiplayerPlayersManager::dyn__container() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__container");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_container"))->offset;
return *reinterpret_cast<::Zenject::DiContainer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <playerSpawningFinished>k__BackingField
bool& GlobalNamespace::MultiplayerPlayersManager::dyn_$playerSpawningFinished$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn_$playerSpawningFinished$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<playerSpawningFinished>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action playerSpawningDidFinishEvent
::System::Action*& GlobalNamespace::MultiplayerPlayersManager::dyn_playerSpawningDidFinishEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn_playerSpawningDidFinishEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "playerSpawningDidFinishEvent"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action didSwitchPlayerToInactiveEvent
::System::Action*& GlobalNamespace::MultiplayerPlayersManager::dyn_didSwitchPlayerToInactiveEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn_didSwitchPlayerToInactiveEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "didSwitchPlayerToInactiveEvent"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<MultiplayerLevelCompletionResults> playerDidFinishEvent
::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>*& GlobalNamespace::MultiplayerPlayersManager::dyn_playerDidFinishEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn_playerDidFinishEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "playerDidFinishEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<MultiplayerLevelCompletionResults> playerNetworkDidFailedEvent
::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>*& GlobalNamespace::MultiplayerPlayersManager::dyn_playerNetworkDidFailedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn_playerNetworkDidFailedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "playerNetworkDidFailedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalActivePlayerFacade _activeLocalPlayerFacade
::GlobalNamespace::MultiplayerLocalActivePlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerFacade() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerFacade");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activeLocalPlayerFacade"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalActivePlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalInactivePlayerFacade _inactiveLocalPlayerFacade
::GlobalNamespace::MultiplayerLocalInactivePlayerFacade*& GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerFacade() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerFacade");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inactiveLocalPlayerFacade"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalInactivePlayerFacade**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private IMultiplayerLevelEndActionsPublisher _currentEventsPublisher
::GlobalNamespace::IMultiplayerLevelEndActionsPublisher*& GlobalNamespace::MultiplayerPlayersManager::dyn__currentEventsPublisher() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__currentEventsPublisher");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentEventsPublisher"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerLevelEndActionsPublisher**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private IStartSeekSongControllerProvider _currentStartSeekSongControllerProvider
::GlobalNamespace::IStartSeekSongControllerProvider*& GlobalNamespace::MultiplayerPlayersManager::dyn__currentStartSeekSongControllerProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__currentStartSeekSongControllerProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentStartSeekSongControllerProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::IStartSeekSongControllerProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalActivePlayerFacade/Factory _activeLocalPlayerFactory
::GlobalNamespace::MultiplayerLocalActivePlayerFacade::Factory*& GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerFactory() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__activeLocalPlayerFactory");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activeLocalPlayerFactory"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalActivePlayerFacade::Factory**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerLocalInactivePlayerFacade/Factory _inactiveLocalPlayerFactory
::GlobalNamespace::MultiplayerLocalInactivePlayerFacade::Factory*& GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerFactory() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__inactiveLocalPlayerFactory");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_inactiveLocalPlayerFactory"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalInactivePlayerFacade::Factory**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerConnectedPlayerFacade/Factory _connectedPlayerFactory
::GlobalNamespace::MultiplayerConnectedPlayerFacade::Factory*& GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerFactory() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerFactory");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayerFactory"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerConnectedPlayerFacade::Factory**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<System.String,MultiplayerConnectedPlayerFacade> _connectedPlayerControllersMap
::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerConnectedPlayerFacade*>*& GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerControllersMap() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerControllersMap");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayerControllersMap"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerConnectedPlayerFacade*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<System.String,System.Single> _connectedPlayerCenterFacingRotationsMap
::System::Collections::Generic::Dictionary_2<::StringW, float>*& GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerCenterFacingRotationsMap() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__connectedPlayerCenterFacingRotationsMap");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayerCenterFacingRotationsMap"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::StringW, float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.IReadOnlyList`1<IConnectedPlayer> _allActiveAtGameStartPlayers
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>*& GlobalNamespace::MultiplayerPlayersManager::dyn__allActiveAtGameStartPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::dyn__allActiveAtGameStartPlayers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allActiveAtGameStartPlayers"))->offset;
return *reinterpret_cast<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerPlayersManager.get_playerSpawningFinished
bool GlobalNamespace::MultiplayerPlayersManager::get_playerSpawningFinished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_playerSpawningFinished");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_playerSpawningFinished", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.set_playerSpawningFinished
void GlobalNamespace::MultiplayerPlayersManager::set_playerSpawningFinished(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::set_playerSpawningFinished");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_playerSpawningFinished", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.get_allActiveAtGameStartPlayers
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>* GlobalNamespace::MultiplayerPlayersManager::get_allActiveAtGameStartPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_allActiveAtGameStartPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_allActiveAtGameStartPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.get_localPlayerStartSeekSongController
::GlobalNamespace::IStartSeekSongControllerProvider* GlobalNamespace::MultiplayerPlayersManager::get_localPlayerStartSeekSongController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_localPlayerStartSeekSongController");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_localPlayerStartSeekSongController", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IStartSeekSongControllerProvider*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.get_activeLocalPlayerFacade
::GlobalNamespace::MultiplayerLocalActivePlayerFacade* GlobalNamespace::MultiplayerPlayersManager::get_activeLocalPlayerFacade() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_activeLocalPlayerFacade");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_activeLocalPlayerFacade", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerLocalActivePlayerFacade*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.get_inactivePlayerFacade
::GlobalNamespace::MultiplayerLocalInactivePlayerFacade* GlobalNamespace::MultiplayerPlayersManager::get_inactivePlayerFacade() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_inactivePlayerFacade");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_inactivePlayerFacade", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerLocalInactivePlayerFacade*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.get_localPlayerTransform
::UnityEngine::Transform* GlobalNamespace::MultiplayerPlayersManager::get_localPlayerTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::get_localPlayerTransform");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_localPlayerTransform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Transform*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.add_playerSpawningDidFinishEvent
void GlobalNamespace::MultiplayerPlayersManager::add_playerSpawningDidFinishEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::add_playerSpawningDidFinishEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_playerSpawningDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.remove_playerSpawningDidFinishEvent
void GlobalNamespace::MultiplayerPlayersManager::remove_playerSpawningDidFinishEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::remove_playerSpawningDidFinishEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_playerSpawningDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.add_didSwitchPlayerToInactiveEvent
void GlobalNamespace::MultiplayerPlayersManager::add_didSwitchPlayerToInactiveEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::add_didSwitchPlayerToInactiveEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_didSwitchPlayerToInactiveEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.remove_didSwitchPlayerToInactiveEvent
void GlobalNamespace::MultiplayerPlayersManager::remove_didSwitchPlayerToInactiveEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::remove_didSwitchPlayerToInactiveEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_didSwitchPlayerToInactiveEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.add_playerDidFinishEvent
void GlobalNamespace::MultiplayerPlayersManager::add_playerDidFinishEvent(::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::add_playerDidFinishEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_playerDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.remove_playerDidFinishEvent
void GlobalNamespace::MultiplayerPlayersManager::remove_playerDidFinishEvent(::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::remove_playerDidFinishEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_playerDidFinishEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.add_playerNetworkDidFailedEvent
void GlobalNamespace::MultiplayerPlayersManager::add_playerNetworkDidFailedEvent(::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::add_playerNetworkDidFailedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_playerNetworkDidFailedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.remove_playerNetworkDidFailedEvent
void GlobalNamespace::MultiplayerPlayersManager::remove_playerNetworkDidFailedEvent(::System::Action_1<::GlobalNamespace::MultiplayerLevelCompletionResults*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::remove_playerNetworkDidFailedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_playerNetworkDidFailedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerPlayersManager.SpawnPlayers
void GlobalNamespace::MultiplayerPlayersManager::SpawnPlayers(::GlobalNamespace::MultiplayerPlayerStartState localPlayerStartState, ::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>* allActiveAtGameStartPlayers) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::SpawnPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SpawnPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(localPlayerStartState), ::il2cpp_utils::ExtractType(allActiveAtGameStartPlayers)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, localPlayerStartState, allActiveAtGameStartPlayers);
}
// Autogenerated method: MultiplayerPlayersManager.TryGetConnectedPlayerController
bool GlobalNamespace::MultiplayerPlayersManager::TryGetConnectedPlayerController(::StringW userId, ByRef<::GlobalNamespace::MultiplayerConnectedPlayerFacade*> connectedPlayerController) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::TryGetConnectedPlayerController");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetConnectedPlayerController", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId), ::il2cpp_utils::ExtractIndependentType<::GlobalNamespace::MultiplayerConnectedPlayerFacade*&>()})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, userId, byref(connectedPlayerController));
}
// Autogenerated method: MultiplayerPlayersManager.TryGetConnectedCenterFacingRotation
bool GlobalNamespace::MultiplayerPlayersManager::TryGetConnectedCenterFacingRotation(::StringW userId, ByRef<float> centerFacingRotation) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::TryGetConnectedCenterFacingRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetConnectedCenterFacingRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId), ::il2cpp_utils::ExtractIndependentType<float&>()})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, userId, byref(centerFacingRotation));
}
// Autogenerated method: MultiplayerPlayersManager.SwitchLocalPlayerToInactive
void GlobalNamespace::MultiplayerPlayersManager::SwitchLocalPlayerToInactive() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::SwitchLocalPlayerToInactive");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchLocalPlayerToInactive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.ReportLocalPlayerNetworkDidFailed
void GlobalNamespace::MultiplayerPlayersManager::ReportLocalPlayerNetworkDidFailed(::GlobalNamespace::MultiplayerLevelCompletionResults* levelCompletionResults) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::ReportLocalPlayerNetworkDidFailed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReportLocalPlayerNetworkDidFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(levelCompletionResults)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, levelCompletionResults);
}
// Autogenerated method: MultiplayerPlayersManager.SwitchLocalPlayerToInactiveCoroutine
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerPlayersManager::SwitchLocalPlayerToInactiveCoroutine() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::SwitchLocalPlayerToInactiveCoroutine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchLocalPlayerToInactiveCoroutine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager.BindPlayerFactories
void GlobalNamespace::MultiplayerPlayersManager::BindPlayerFactories(::GlobalNamespace::MultiplayerPlayerLayout layout) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::BindPlayerFactories");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BindPlayerFactories", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layout)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, layout);
}
// Autogenerated method: MultiplayerPlayersManager.HandlePlayerDidFinish
void GlobalNamespace::MultiplayerPlayersManager::HandlePlayerDidFinish(::GlobalNamespace::MultiplayerLevelCompletionResults* levelCompletionResults) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::HandlePlayerDidFinish");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerDidFinish", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(levelCompletionResults)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, levelCompletionResults);
}
// Autogenerated method: MultiplayerPlayersManager.HandlePlayerNetworkDidFailed
void GlobalNamespace::MultiplayerPlayersManager::HandlePlayerNetworkDidFailed(::GlobalNamespace::MultiplayerLevelCompletionResults* levelCompletionResults) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::HandlePlayerNetworkDidFailed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerNetworkDidFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(levelCompletionResults)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, levelCompletionResults);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51
#include "GlobalNamespace/MultiplayerPlayersManager_-SwitchLocalPlayerToInactiveCoroutine-d__51.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerPlayersManager <>4__this
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51.MoveNext
bool GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPlayersManager/<SwitchLocalPlayerToInactiveCoroutine>d__51.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPlayersManager::$SwitchLocalPlayerToInactiveCoroutine$d__51::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPositionDisplay
#include "GlobalNamespace/MultiplayerPositionDisplay.hpp"
// Including type: TMPro.TextMeshPro
#include "TMPro/TextMeshPro.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshPro _text
::TMPro::TextMeshPro*& GlobalNamespace::MultiplayerPositionDisplay::dyn__text() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_text"))->offset;
return *reinterpret_cast<::TMPro::TextMeshPro**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _normalColor
::UnityEngine::Color& GlobalNamespace::MultiplayerPositionDisplay::dyn__normalColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__normalColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_normalColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _leadingColor
::UnityEngine::Color& GlobalNamespace::MultiplayerPositionDisplay::dyn__leadingColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__leadingColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leadingColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _failedColor
::UnityEngine::Color& GlobalNamespace::MultiplayerPositionDisplay::dyn__failedColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__failedColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_failedColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _fadeInDuration
float& GlobalNamespace::MultiplayerPositionDisplay::dyn__fadeInDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__fadeInDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _crossFadeDuration
float& GlobalNamespace::MultiplayerPositionDisplay::dyn__crossFadeDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__crossFadeDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_crossFadeDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _fadeOutDuration
float& GlobalNamespace::MultiplayerPositionDisplay::dyn__fadeOutDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__fadeOutDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeOutDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreProvider
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerPositionDisplay::dyn__scoreProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__scoreProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerPositionDisplay::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _wasFirst
bool& GlobalNamespace::MultiplayerPositionDisplay::dyn__wasFirst() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__wasFirst");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_wasFirst"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isFailed
bool& GlobalNamespace::MultiplayerPositionDisplay::dyn__isFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__isFailed");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isFailed"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _updatingColor
bool& GlobalNamespace::MultiplayerPositionDisplay::dyn__updatingColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__updatingColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_updatingColor"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _startColor
::UnityEngine::Color& GlobalNamespace::MultiplayerPositionDisplay::dyn__startColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__startColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_startColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _targetColor
::UnityEngine::Color& GlobalNamespace::MultiplayerPositionDisplay::dyn__targetColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__targetColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_targetColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _colorAnimationStartTime
float& GlobalNamespace::MultiplayerPositionDisplay::dyn__colorAnimationStartTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__colorAnimationStartTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorAnimationStartTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _colorAnimationStartDuration
float& GlobalNamespace::MultiplayerPositionDisplay::dyn__colorAnimationStartDuration() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::dyn__colorAnimationStartDuration");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorAnimationStartDuration"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerPositionDisplay.Start
void GlobalNamespace::MultiplayerPositionDisplay::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.OnDestroy
void GlobalNamespace::MultiplayerPositionDisplay::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.Update
void GlobalNamespace::MultiplayerPositionDisplay::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.UpdateColors
void GlobalNamespace::MultiplayerPositionDisplay::UpdateColors() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::UpdateColors");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateColors", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.UpdatePosition
void GlobalNamespace::MultiplayerPositionDisplay::UpdatePosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::UpdatePosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdatePosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.HandlePlayerFailed
void GlobalNamespace::MultiplayerPositionDisplay::HandlePlayerFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::HandlePlayerFailed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerPositionDisplay.HandleFirstPlayerDidChange
void GlobalNamespace::MultiplayerPositionDisplay::HandleFirstPlayerDidChange(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* obj) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::HandleFirstPlayerDidChange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleFirstPlayerDidChange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obj);
}
// Autogenerated method: MultiplayerPositionDisplay.ChangeColor
void GlobalNamespace::MultiplayerPositionDisplay::ChangeColor(::UnityEngine::Color toColor, float duration) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerPositionDisplay::ChangeColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ChangeColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(toColor), ::il2cpp_utils::ExtractType(duration)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, toColor, duration);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerPsPlusFeatureNotifier
#include "GlobalNamespace/MultiplayerPsPlusFeatureNotifier.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsAvatarController
#include "GlobalNamespace/MultiplayerResultsAvatarController.hpp"
// Including type: AvatarVisualController
#include "GlobalNamespace/AvatarVisualController.hpp"
// Including type: MultiplayerAvatarPoseController
#include "GlobalNamespace/MultiplayerAvatarPoseController.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private AvatarVisualController _avatarVisualController
::GlobalNamespace::AvatarVisualController*& GlobalNamespace::MultiplayerResultsAvatarController::dyn__avatarVisualController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsAvatarController::dyn__avatarVisualController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_avatarVisualController"))->offset;
return *reinterpret_cast<::GlobalNamespace::AvatarVisualController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerAvatarPoseController _multiplayerAvatarPoseController
::GlobalNamespace::MultiplayerAvatarPoseController*& GlobalNamespace::MultiplayerResultsAvatarController::dyn__multiplayerAvatarPoseController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsAvatarController::dyn__multiplayerAvatarPoseController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerAvatarPoseController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerAvatarPoseController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerResultsAvatarController.SetScale
void GlobalNamespace::MultiplayerResultsAvatarController::SetScale(float scale) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsAvatarController::SetScale");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetScale", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(scale)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, scale);
}
// Autogenerated method: MultiplayerResultsAvatarController.Setup
void GlobalNamespace::MultiplayerResultsAvatarController::Setup(::GlobalNamespace::IConnectedPlayer* connectedPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsAvatarController::Setup");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Setup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(connectedPlayer)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, connectedPlayer);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsData
#include "GlobalNamespace/MultiplayerResultsData.hpp"
// Including type: MultiplayerPlayerResultsData
#include "GlobalNamespace/MultiplayerPlayerResultsData.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
// Including type: MultiplayerLevelCompletionResults
#include "GlobalNamespace/MultiplayerLevelCompletionResults.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: MultiplayerBadgesProvider
#include "GlobalNamespace/MultiplayerBadgesProvider.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.String _gameId
::StringW& GlobalNamespace::MultiplayerResultsData::dyn__gameId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::dyn__gameId");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameId"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayerResultsData _localPlayerResultData
::GlobalNamespace::MultiplayerPlayerResultsData*& GlobalNamespace::MultiplayerResultsData::dyn__localPlayerResultData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::dyn__localPlayerResultData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerResultData"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayerResultsData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.IReadOnlyList`1<MultiplayerPlayerResultsData> _otherPlayersData
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>*& GlobalNamespace::MultiplayerResultsData::dyn__otherPlayersData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::dyn__otherPlayersData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_otherPlayersData"))->offset;
return *reinterpret_cast<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.IReadOnlyList`1<MultiplayerPlayerResultsData> _allPlayersSortedData
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>*& GlobalNamespace::MultiplayerResultsData::dyn__allPlayersSortedData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::dyn__allPlayersSortedData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allPlayersSortedData"))->offset;
return *reinterpret_cast<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerResultsData.get_gameId
::StringW GlobalNamespace::MultiplayerResultsData::get_gameId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::get_gameId");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_gameId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsData.get_localPlayerResultData
::GlobalNamespace::MultiplayerPlayerResultsData* GlobalNamespace::MultiplayerResultsData::get_localPlayerResultData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::get_localPlayerResultData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_localPlayerResultData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerPlayerResultsData*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsData.get_otherPlayersData
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>* GlobalNamespace::MultiplayerResultsData::get_otherPlayersData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::get_otherPlayersData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_otherPlayersData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsData.get_allPlayersSortedData
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>* GlobalNamespace::MultiplayerResultsData::get_allPlayersSortedData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsData::get_allPlayersSortedData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_allPlayersSortedData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>*, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsPyramidView
#include "GlobalNamespace/MultiplayerResultsPyramidView.hpp"
// Including type: MultiplayerOffsetPositionByLocalPlayerPosition
#include "GlobalNamespace/MultiplayerOffsetPositionByLocalPlayerPosition.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: MultiplayerPlayerResultsData
#include "GlobalNamespace/MultiplayerPlayerResultsData.hpp"
// Including type: MultiplayerResultsPyramidViewAvatar/Factory
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatar_Factory.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private MultiplayerOffsetPositionByLocalPlayerPosition _multiplayerOffsetByLocalPlayerPosition
::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition*& GlobalNamespace::MultiplayerResultsPyramidView::dyn__multiplayerOffsetByLocalPlayerPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__multiplayerOffsetByLocalPlayerPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerOffsetByLocalPlayerPosition"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerOffsetPositionByLocalPlayerPosition**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform[] _spawnPoints
::ArrayW<::UnityEngine::Transform*>& GlobalNamespace::MultiplayerResultsPyramidView::dyn__spawnPoints() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__spawnPoints");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnPoints"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Transform*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _spawnPointsParent
::UnityEngine::Transform*& GlobalNamespace::MultiplayerResultsPyramidView::dyn__spawnPointsParent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__spawnPointsParent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnPointsParent"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _evenCountOffset
float& GlobalNamespace::MultiplayerResultsPyramidView::dyn__evenCountOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__evenCountOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_evenCountOffset"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerResultsPyramidViewAvatar/Factory _avatarsFactory
::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Factory*& GlobalNamespace::MultiplayerResultsPyramidView::dyn__avatarsFactory() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__avatarsFactory");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_avatarsFactory"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Factory**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<System.String,MultiplayerResultsPyramidViewAvatar> _avatarsDictionary
::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerResultsPyramidViewAvatar*>*& GlobalNamespace::MultiplayerResultsPyramidView::dyn__avatarsDictionary() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__avatarsDictionary");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_avatarsDictionary"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerResultsPyramidViewAvatar*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.GameObject[] _resultAvatarDirectors
::ArrayW<::UnityEngine::GameObject*>& GlobalNamespace::MultiplayerResultsPyramidView::dyn__resultAvatarDirectors() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__resultAvatarDirectors");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_resultAvatarDirectors"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::GameObject*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.GameObject[] _badgeTimelines
::ArrayW<::UnityEngine::GameObject*>& GlobalNamespace::MultiplayerResultsPyramidView::dyn__badgeTimelines() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__badgeTimelines");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeTimelines"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::GameObject*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerResultsPyramidViewAvatar _anyResultsAvatar
::GlobalNamespace::MultiplayerResultsPyramidViewAvatar*& GlobalNamespace::MultiplayerResultsPyramidView::dyn__anyResultsAvatar() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::dyn__anyResultsAvatar");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_anyResultsAvatar"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerResultsPyramidViewAvatar**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerResultsPyramidView.get_resultAvatarDirectors
::ArrayW<::UnityEngine::GameObject*> GlobalNamespace::MultiplayerResultsPyramidView::get_resultAvatarDirectors() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::get_resultAvatarDirectors");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_resultAvatarDirectors", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::ArrayW<::UnityEngine::GameObject*>, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsPyramidView.get_badgeTimelines
::ArrayW<::UnityEngine::GameObject*> GlobalNamespace::MultiplayerResultsPyramidView::get_badgeTimelines() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::get_badgeTimelines");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_badgeTimelines", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::ArrayW<::UnityEngine::GameObject*>, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsPyramidView.PrespawnAvatars
void GlobalNamespace::MultiplayerResultsPyramidView::PrespawnAvatars(::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IConnectedPlayer*>* activePlayers) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::PrespawnAvatars");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PrespawnAvatars", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(activePlayers)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, activePlayers);
}
// Autogenerated method: MultiplayerResultsPyramidView.SetupResults
void GlobalNamespace::MultiplayerResultsPyramidView::SetupResults(::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerPlayerResultsData*>* resultsData, ::UnityEngine::Transform* badgeStartTransform, ::UnityEngine::Transform* badgeMidTransform) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidView::SetupResults");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupResults", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resultsData), ::il2cpp_utils::ExtractType(badgeStartTransform), ::il2cpp_utils::ExtractType(badgeMidTransform)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, resultsData, badgeStartTransform, badgeMidTransform);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsPyramidViewAvatar
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatar.hpp"
// Including type: MultiplayerResultsPyramidViewAvatar/Factory
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatar_Factory.hpp"
// Including type: UnityEngine.Playables.PlayableDirector
#include "UnityEngine/Playables/PlayableDirector.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: TMPro.TextMeshProUGUI
#include "TMPro/TextMeshProUGUI.hpp"
// Including type: HMUI.ImageView
#include "HMUI/ImageView.hpp"
// Including type: UnityEngine.CanvasGroup
#include "UnityEngine/CanvasGroup.hpp"
// Including type: GhostDuplicationEffect
#include "GlobalNamespace/GhostDuplicationEffect.hpp"
// Including type: UnityEngine.Sprite
#include "UnityEngine/Sprite.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: PlayerDataModel
#include "GlobalNamespace/PlayerDataModel.hpp"
// Including type: IDifficultyBeatmap
#include "GlobalNamespace/IDifficultyBeatmap.hpp"
// Including type: Tweening.Vector3Tween
#include "Tweening/Vector3Tween.hpp"
// Including type: Tweening.FloatTween
#include "Tweening/FloatTween.hpp"
// Including type: Tweening.ColorTween
#include "Tweening/ColorTween.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: MultiplayerPlayerResultsData
#include "GlobalNamespace/MultiplayerPlayerResultsData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Playables.PlayableDirector _badgeDirector
::UnityEngine::Playables::PlayableDirector*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeDirector() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeDirector");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeDirector"))->offset;
return *reinterpret_cast<::UnityEngine::Playables::PlayableDirector**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _ghostFirstTrackName
::StringW& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostFirstTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostFirstTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ghostFirstTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _ghostSecondTrackName
::StringW& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostSecondTrackName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostSecondTrackName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ghostSecondTrackName"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _standWithAvatarTransform
::UnityEngine::Transform*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__standWithAvatarTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__standWithAvatarTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_standWithAvatarTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _perPositionRotation
float& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__perPositionRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__perPositionRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_perPositionRotation"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _localPlayerColor
::UnityEngine::Color& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__localPlayerColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__localPlayerColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localPlayerColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI _positionText
::TMPro::TextMeshProUGUI*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__positionText() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__positionText");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_positionText"))->offset;
return *reinterpret_cast<::TMPro::TextMeshProUGUI**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI _nameText
::TMPro::TextMeshProUGUI*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameText() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameText");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nameText"))->offset;
return *reinterpret_cast<::TMPro::TextMeshProUGUI**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private HMUI.ImageView _nameBackground
::HMUI::ImageView*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameBackground() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameBackground");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nameBackground"))->offset;
return *reinterpret_cast<::HMUI::ImageView**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.CanvasGroup _badgeCanvas
::UnityEngine::CanvasGroup*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeCanvas() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeCanvas");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeCanvas"))->offset;
return *reinterpret_cast<::UnityEngine::CanvasGroup**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI[] _badgeTitles
::ArrayW<::TMPro::TextMeshProUGUI*>& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeTitles() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeTitles");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeTitles"))->offset;
return *reinterpret_cast<::ArrayW<::TMPro::TextMeshProUGUI*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private HMUI.ImageView[] _badgeImages
::ArrayW<::HMUI::ImageView*>& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeImages() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeImages");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeImages"))->offset;
return *reinterpret_cast<::ArrayW<::HMUI::ImageView*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI _badgeSubtitleText
::TMPro::TextMeshProUGUI*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeSubtitleText() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeSubtitleText");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeSubtitleText"))->offset;
return *reinterpret_cast<::TMPro::TextMeshProUGUI**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.CanvasGroup _badgeSubtitleCanvas
::UnityEngine::CanvasGroup*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeSubtitleCanvas() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeSubtitleCanvas");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeSubtitleCanvas"))->offset;
return *reinterpret_cast<::UnityEngine::CanvasGroup**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private GhostDuplicationEffect _ghostDuplicationEffect
::GlobalNamespace::GhostDuplicationEffect*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostDuplicationEffect() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostDuplicationEffect");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ghostDuplicationEffect"))->offset;
return *reinterpret_cast<::GlobalNamespace::GhostDuplicationEffect**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private GhostDuplicationEffect/GhostEffectParams _ghostAppear
::GlobalNamespace::GhostDuplicationEffect::GhostEffectParams& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostAppear() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostAppear");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ghostAppear"))->offset;
return *reinterpret_cast<::GlobalNamespace::GhostDuplicationEffect::GhostEffectParams*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private GhostDuplicationEffect/GhostEffectParams _ghostReceive
::GlobalNamespace::GhostDuplicationEffect::GhostEffectParams& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostReceive() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__ghostReceive");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ghostReceive"))->offset;
return *reinterpret_cast<::GlobalNamespace::GhostDuplicationEffect::GhostEffectParams*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private HMUI.ImageView _trophyImage
::HMUI::ImageView*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__trophyImage() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__trophyImage");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_trophyImage"))->offset;
return *reinterpret_cast<::HMUI::ImageView**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Sprite _firstPlaceTrophy
::UnityEngine::Sprite*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__firstPlaceTrophy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__firstPlaceTrophy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_firstPlaceTrophy"))->offset;
return *reinterpret_cast<::UnityEngine::Sprite**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Sprite _secondPlaceTrophy
::UnityEngine::Sprite*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__secondPlaceTrophy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__secondPlaceTrophy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_secondPlaceTrophy"))->offset;
return *reinterpret_cast<::UnityEngine::Sprite**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Sprite _thirdPlaceTrophy
::UnityEngine::Sprite*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__thirdPlaceTrophy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__thirdPlaceTrophy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_thirdPlaceTrophy"))->offset;
return *reinterpret_cast<::UnityEngine::Sprite**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _firstPlaceColor
::UnityEngine::Color& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__firstPlaceColor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__firstPlaceColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_firstPlaceColor"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.GameObject _personalBestVisual
::UnityEngine::GameObject*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__personalBestVisual() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__personalBestVisual");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_personalBestVisual"))->offset;
return *reinterpret_cast<::UnityEngine::GameObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly PlayerDataModel _playerDataModel
::GlobalNamespace::PlayerDataModel*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__playerDataModel() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__playerDataModel");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerDataModel"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerDataModel**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IDifficultyBeatmap _difficultyBeatmap
::GlobalNamespace::IDifficultyBeatmap*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__difficultyBeatmap() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__difficultyBeatmap");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_difficultyBeatmap"))->offset;
return *reinterpret_cast<::GlobalNamespace::IDifficultyBeatmap**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Vector3Tween _riseTween
::Tweening::Vector3Tween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__riseTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__riseTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_riseTween"))->offset;
return *reinterpret_cast<::Tweening::Vector3Tween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Vector3Tween _avatarRiseTween
::Tweening::Vector3Tween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__avatarRiseTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__avatarRiseTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_avatarRiseTween"))->offset;
return *reinterpret_cast<::Tweening::Vector3Tween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Vector3Tween _badgePositionTween
::Tweening::Vector3Tween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgePositionTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgePositionTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgePositionTween"))->offset;
return *reinterpret_cast<::Tweening::Vector3Tween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.FloatTween _badgeOpacityTween
::Tweening::FloatTween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeOpacityTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__badgeOpacityTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_badgeOpacityTween"))->offset;
return *reinterpret_cast<::Tweening::FloatTween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.FloatTween _nameOpacityTween
::Tweening::FloatTween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameOpacityTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__nameOpacityTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nameOpacityTween"))->offset;
return *reinterpret_cast<::Tweening::FloatTween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Vector3Tween _namePositionTween
::Tweening::Vector3Tween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__namePositionTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__namePositionTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_namePositionTween"))->offset;
return *reinterpret_cast<::Tweening::Vector3Tween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.ColorTween _localGlowTween
::Tweening::ColorTween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__localGlowTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__localGlowTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_localGlowTween"))->offset;
return *reinterpret_cast<::Tweening::ColorTween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Vector3Tween _titleMakingSpaceForBadgeTween
::Tweening::Vector3Tween*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__titleMakingSpaceForBadgeTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__titleMakingSpaceForBadgeTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_titleMakingSpaceForBadgeTween"))->offset;
return *reinterpret_cast<::Tweening::Vector3Tween**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _originalBadgeLocalPos
::UnityEngine::Vector3& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__originalBadgeLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__originalBadgeLocalPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_originalBadgeLocalPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerResultsPyramidViewAvatar.get_badgeDirector
::UnityEngine::Playables::PlayableDirector* GlobalNamespace::MultiplayerResultsPyramidViewAvatar::get_badgeDirector() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::get_badgeDirector");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_badgeDirector", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Playables::PlayableDirector*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsPyramidViewAvatar.Awake
void GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerResultsPyramidViewAvatar.Setup
void GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Setup(::GlobalNamespace::MultiplayerPlayerResultsData* resultData, int position, int playerCount) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::Setup");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Setup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(resultData), ::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(playerCount)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, resultData, position, playerCount);
}
// Autogenerated method: MultiplayerResultsPyramidViewAvatar.SetupBadgeTimeline
void GlobalNamespace::MultiplayerResultsPyramidViewAvatar::SetupBadgeTimeline(::UnityEngine::Transform* startTransform, ::UnityEngine::Transform* midTransform) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatar::SetupBadgeTimeline");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupBadgeTimeline", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(startTransform), ::il2cpp_utils::ExtractType(midTransform)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, startTransform, midTransform);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsPyramidViewAvatar/Factory
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatar_Factory.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerResultsPyramidViewAvatarInstaller
#include "GlobalNamespace/MultiplayerResultsPyramidViewAvatarInstaller.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerResultsPyramidViewAvatarInstaller::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatarInstaller::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerResultsPyramidViewAvatarInstaller.InstallBindings
void GlobalNamespace::MultiplayerResultsPyramidViewAvatarInstaller::InstallBindings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerResultsPyramidViewAvatarInstaller::InstallBindings");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InstallBindings", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreProvider
#include "GlobalNamespace/MultiplayerScoreProvider.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
// Including type: MultiplayerScoreProvider/<>c
#include "GlobalNamespace/MultiplayerScoreProvider_--c.hpp"
// Including type: MultiplayerScoreProvider/<>c__DisplayClass18_0
#include "GlobalNamespace/MultiplayerScoreProvider_--c__DisplayClass18_0.hpp"
// Including type: IScoreSyncStateManager
#include "GlobalNamespace/IScoreSyncStateManager.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IScoreSyncStateManager _scoreSyncStateManager
::GlobalNamespace::IScoreSyncStateManager*& GlobalNamespace::MultiplayerScoreProvider::dyn__scoreSyncStateManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn__scoreSyncStateManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreSyncStateManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IScoreSyncStateManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreProvider/RankedPlayer <firstPlayer>k__BackingField
::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*& GlobalNamespace::MultiplayerScoreProvider::dyn_$firstPlayer$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn_$firstPlayer$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<firstPlayer>k__BackingField"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<MultiplayerScoreProvider/RankedPlayer> firstPlayerDidChangeEvent
::System::Action_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>*& GlobalNamespace::MultiplayerScoreProvider::dyn_firstPlayerDidChangeEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn_firstPlayerDidChangeEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "firstPlayerDidChangeEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _sharedOffsetSyncTime
float& GlobalNamespace::MultiplayerScoreProvider::dyn__sharedOffsetSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn__sharedOffsetSyncTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sharedOffsetSyncTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.List`1<MultiplayerScoreProvider/RankedPlayer> _rankedPlayers
::System::Collections::Generic::List_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>*& GlobalNamespace::MultiplayerScoreProvider::dyn__rankedPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn__rankedPlayers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rankedPlayers"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<System.String,MultiplayerScoreProvider/RankedPlayer> _players
::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>*& GlobalNamespace::MultiplayerScoreProvider::dyn__players() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::dyn__players");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_players"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerScoreProvider.get_scoresAvailable
bool GlobalNamespace::MultiplayerScoreProvider::get_scoresAvailable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::get_scoresAvailable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_scoresAvailable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider.get_firstPlayer
::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* GlobalNamespace::MultiplayerScoreProvider::get_firstPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::get_firstPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_firstPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider.set_firstPlayer
void GlobalNamespace::MultiplayerScoreProvider::set_firstPlayer(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::set_firstPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_firstPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerScoreProvider.get_rankedPlayers
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>* GlobalNamespace::MultiplayerScoreProvider::get_rankedPlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::get_rankedPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_rankedPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider.add_firstPlayerDidChangeEvent
void GlobalNamespace::MultiplayerScoreProvider::add_firstPlayerDidChangeEvent(::System::Action_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::add_firstPlayerDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_firstPlayerDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerScoreProvider.remove_firstPlayerDidChangeEvent
void GlobalNamespace::MultiplayerScoreProvider::remove_firstPlayerDidChangeEvent(::System::Action_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::remove_firstPlayerDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_firstPlayerDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerScoreProvider.Update
void GlobalNamespace::MultiplayerScoreProvider::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider.TryGetScore
bool GlobalNamespace::MultiplayerScoreProvider::TryGetScore(::StringW userId, ByRef<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*> data) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::TryGetScore");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TryGetScore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId), ::il2cpp_utils::ExtractIndependentType<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*&>()})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, userId, byref(data));
}
// Autogenerated method: MultiplayerScoreProvider.GetPositionOfPlayer
int GlobalNamespace::MultiplayerScoreProvider::GetPositionOfPlayer(::StringW userId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::GetPositionOfPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetPositionOfPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, userId);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
// Including type: MultiplayerSyncState`3
#include "GlobalNamespace/MultiplayerSyncState_3.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerSyncState`3<StandardScoreSyncState,StandardScoreSyncState/Score,System.Int32> _multiplayerSyncState
::GlobalNamespace::MultiplayerSyncState_3<::GlobalNamespace::StandardScoreSyncState, ::GlobalNamespace::StandardScoreSyncState_Score, int>*& GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::dyn__multiplayerSyncState() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::dyn__multiplayerSyncState");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSyncState"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSyncState_3<::GlobalNamespace::StandardScoreSyncState, ::GlobalNamespace::StandardScoreSyncState_Score, int>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreSyncManager
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::dyn__scoreSyncManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::dyn__scoreSyncManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreSyncManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_offsetSyncTime
float GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_offsetSyncTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_offsetSyncTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_offsetSyncTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_lastScoreTime
float GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_lastScoreTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_lastScoreTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_lastScoreTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_score
int GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_score() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_score");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_score", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_isConnected
bool GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isConnected() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isConnected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isConnected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_isActiveOrFinished
bool GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isActiveOrFinished() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isActiveOrFinished");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isActiveOrFinished", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_isFailed
bool GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isFailed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isFailed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_wasActiveAtLevelStart
bool GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_wasActiveAtLevelStart() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_wasActiveAtLevelStart");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_wasActiveAtLevelStart", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_isMe
bool GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isMe() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_isMe");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isMe", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_userId
::StringW GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_userId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_userId");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_userId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.get_userName
::StringW GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_userName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::get_userName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_userName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/RankedPlayer.CompareTo
int GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::CompareTo(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* other) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer::CompareTo");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CompareTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, other);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreProvider/<>c
#include "GlobalNamespace/MultiplayerScoreProvider_--c.hpp"
// Including type: System.Func`2
#include "System/Func_2.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly MultiplayerScoreProvider/<>c <>9
::GlobalNamespace::MultiplayerScoreProvider::$$c* GlobalNamespace::MultiplayerScoreProvider::$$c::_get_$$9() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::_get_$$9");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerScoreProvider::$$c*>("", "MultiplayerScoreProvider/<>c", "<>9")));
}
// Autogenerated static field setter
// Set static field: static public readonly MultiplayerScoreProvider/<>c <>9
void GlobalNamespace::MultiplayerScoreProvider::$$c::_set_$$9(::GlobalNamespace::MultiplayerScoreProvider::$$c* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::_set_$$9");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerScoreProvider/<>c", "<>9", value)));
}
// Autogenerated static field getter
// Get static field: static public System.Func`2<MultiplayerScoreProvider/RankedPlayer,System.Boolean> <>9__16_0
::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>* GlobalNamespace::MultiplayerScoreProvider::$$c::_get_$$9__16_0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::_get_$$9__16_0");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>*>("", "MultiplayerScoreProvider/<>c", "<>9__16_0")));
}
// Autogenerated static field setter
// Set static field: static public System.Func`2<MultiplayerScoreProvider/RankedPlayer,System.Boolean> <>9__16_0
void GlobalNamespace::MultiplayerScoreProvider::$$c::_set_$$9__16_0(::System::Func_2<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*, bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::_set_$$9__16_0");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerScoreProvider/<>c", "<>9__16_0", value)));
}
// Autogenerated method: MultiplayerScoreProvider/<>c..cctor
void GlobalNamespace::MultiplayerScoreProvider::$$c::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerScoreProvider/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated method: MultiplayerScoreProvider/<>c.<Update>b__16_0
bool GlobalNamespace::MultiplayerScoreProvider::$$c::$Update$b__16_0(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* p) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c::<Update>b__16_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Update>b__16_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p)})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, p);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreProvider/<>c__DisplayClass18_0
#include "GlobalNamespace/MultiplayerScoreProvider_--c__DisplayClass18_0.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.String userId
::StringW& GlobalNamespace::MultiplayerScoreProvider::$$c__DisplayClass18_0::dyn_userId() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c__DisplayClass18_0::dyn_userId");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "userId"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerScoreProvider/<>c__DisplayClass18_0.<GetPositionOfPlayer>b__0
bool GlobalNamespace::MultiplayerScoreProvider::$$c__DisplayClass18_0::$GetPositionOfPlayer$b__0(::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer* p) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreProvider::$$c__DisplayClass18_0::<GetPositionOfPlayer>b__0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<GetPositionOfPlayer>b__0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p)})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, p);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreRingItem
#include "GlobalNamespace/MultiplayerScoreRingItem.hpp"
// Including type: MultiplayerScoreRingItem/Pool
#include "GlobalNamespace/MultiplayerScoreRingItem_Pool.hpp"
// Including type: TMPro.TextMeshProUGUI
#include "TMPro/TextMeshProUGUI.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: Tweening.Tween`1
#include "Tweening/Tween_1.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: EaseType
#include "GlobalNamespace/EaseType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI _scoreText
::TMPro::TextMeshProUGUI*& GlobalNamespace::MultiplayerScoreRingItem::dyn__scoreText() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::dyn__scoreText");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreText"))->offset;
return *reinterpret_cast<::TMPro::TextMeshProUGUI**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TMPro.TextMeshProUGUI _nameText
::TMPro::TextMeshProUGUI*& GlobalNamespace::MultiplayerScoreRingItem::dyn__nameText() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::dyn__nameText");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nameText"))->offset;
return *reinterpret_cast<::TMPro::TextMeshProUGUI**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Tweening.TimeTweeningManager _tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::MultiplayerScoreRingItem::dyn__tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::dyn__tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<UnityEngine.Color> _nameColorTween
::Tweening::Tween_1<::UnityEngine::Color>*& GlobalNamespace::MultiplayerScoreRingItem::dyn__nameColorTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::dyn__nameColorTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nameColorTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<::UnityEngine::Color>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<UnityEngine.Color> _scoreColorTween
::Tweening::Tween_1<::UnityEngine::Color>*& GlobalNamespace::MultiplayerScoreRingItem::dyn__scoreColorTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::dyn__scoreColorTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreColorTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<::UnityEngine::Color>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerScoreRingItem.Awake
void GlobalNamespace::MultiplayerScoreRingItem::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingItem.OnDestroy
void GlobalNamespace::MultiplayerScoreRingItem::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingItem.SetPositionAndRotation
void GlobalNamespace::MultiplayerScoreRingItem::SetPositionAndRotation(::UnityEngine::Vector3 position, ::UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::SetPositionAndRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetPositionAndRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(rotation)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, position, rotation);
}
// Autogenerated method: MultiplayerScoreRingItem.AnimateColors
void GlobalNamespace::MultiplayerScoreRingItem::AnimateColors(::UnityEngine::Color nameColor, ::UnityEngine::Color scoreColor, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::AnimateColors");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateColors", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(nameColor), ::il2cpp_utils::ExtractType(scoreColor), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, nameColor, scoreColor, duration, easeType);
}
// Autogenerated method: MultiplayerScoreRingItem.SetName
void GlobalNamespace::MultiplayerScoreRingItem::SetName(::StringW text) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::SetName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, text);
}
// Autogenerated method: MultiplayerScoreRingItem.SetScore
void GlobalNamespace::MultiplayerScoreRingItem::SetScore(::StringW text) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::SetScore");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetScore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(text)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, text);
}
// Autogenerated method: MultiplayerScoreRingItem.<Awake>b__6_0
void GlobalNamespace::MultiplayerScoreRingItem::$Awake$b__6_0(::UnityEngine::Color val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::<Awake>b__6_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__6_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: MultiplayerScoreRingItem.<Awake>b__6_1
void GlobalNamespace::MultiplayerScoreRingItem::$Awake$b__6_1(::UnityEngine::Color val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingItem::<Awake>b__6_1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<Awake>b__6_1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreRingItem/Pool
#include "GlobalNamespace/MultiplayerScoreRingItem_Pool.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerScoreRingManager
#include "GlobalNamespace/MultiplayerScoreRingManager.hpp"
// Including type: MultiplayerScoreRingItem/Pool
#include "GlobalNamespace/MultiplayerScoreRingItem_Pool.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: BeatmapObjectSpawnCenter
#include "GlobalNamespace/BeatmapObjectSpawnCenter.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: MultiplayerScoreProvider
#include "GlobalNamespace/MultiplayerScoreProvider.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: UnityEngine.Color
#include "UnityEngine/Color.hpp"
// Including type: EaseType
#include "GlobalNamespace/EaseType.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: MultiplayerController/State
#include "GlobalNamespace/MultiplayerController.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _delayBetweenScoreUpdates
float& GlobalNamespace::MultiplayerScoreRingManager::dyn__delayBetweenScoreUpdates() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__delayBetweenScoreUpdates");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_delayBetweenScoreUpdates"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _centerDistanceOffset
float& GlobalNamespace::MultiplayerScoreRingManager::dyn__centerDistanceOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__centerDistanceOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_centerDistanceOffset"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _multiplayerPlayersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerPlayersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerPlayersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerPlayersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectSpawnCenter _spawnCenter
::GlobalNamespace::BeatmapObjectSpawnCenter*& GlobalNamespace::MultiplayerScoreRingManager::dyn__spawnCenter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__spawnCenter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnCenter"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectSpawnCenter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerScoreRingManager::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreProvider
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreRingItem/Pool _scoreRingItemPool
::GlobalNamespace::MultiplayerScoreRingItem::Pool*& GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreRingItemPool() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreRingItemPool");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreRingItemPool"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreRingItem::Pool**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<System.String,MultiplayerScoreRingItem> _scoreRingItems
::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerScoreRingItem*>*& GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreRingItems() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__scoreRingItems");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreRingItems"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::StringW, ::GlobalNamespace::MultiplayerScoreRingItem*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.List`1<IConnectedPlayer> _allActivePlayers
::System::Collections::Generic::List_1<::GlobalNamespace::IConnectedPlayer*>*& GlobalNamespace::MultiplayerScoreRingManager::dyn__allActivePlayers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__allActivePlayers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_allActivePlayers"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::IConnectedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _currentlyScoreUpdateIndex
int& GlobalNamespace::MultiplayerScoreRingManager::dyn__currentlyScoreUpdateIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__currentlyScoreUpdateIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentlyScoreUpdateIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _timeSinceLastScoreUpdate
float& GlobalNamespace::MultiplayerScoreRingManager::dyn__timeSinceLastScoreUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__timeSinceLastScoreUpdate");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_timeSinceLastScoreUpdate"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private MultiplayerScoreRingItem _firstPlayerItem
::GlobalNamespace::MultiplayerScoreRingItem*& GlobalNamespace::MultiplayerScoreRingManager::dyn__firstPlayerItem() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__firstPlayerItem");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_firstPlayerItem"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreRingItem**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _spawnCenterDistanceFound
bool& GlobalNamespace::MultiplayerScoreRingManager::dyn__spawnCenterDistanceFound() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__spawnCenterDistanceFound");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spawnCenterDistanceFound"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _playersSpawned
bool& GlobalNamespace::MultiplayerScoreRingManager::dyn__playersSpawned() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::dyn__playersSpawned");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playersSpawned"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerScoreRingManager.Start
void GlobalNamespace::MultiplayerScoreRingManager::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.OnDestroy
void GlobalNamespace::MultiplayerScoreRingManager::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.Update
void GlobalNamespace::MultiplayerScoreRingManager::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.UpdateScore
void GlobalNamespace::MultiplayerScoreRingManager::UpdateScore(::GlobalNamespace::IConnectedPlayer* playerToUpdate) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::UpdateScore");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateScore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(playerToUpdate)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, playerToUpdate);
}
// Autogenerated method: MultiplayerScoreRingManager.AnimateColorsForPlayer
void GlobalNamespace::MultiplayerScoreRingManager::AnimateColorsForPlayer(::StringW userId, ::UnityEngine::Color nameColor, ::UnityEngine::Color scoreColor, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::AnimateColorsForPlayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateColorsForPlayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId), ::il2cpp_utils::ExtractType(nameColor), ::il2cpp_utils::ExtractType(scoreColor), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, userId, nameColor, scoreColor, duration, easeType);
}
// Autogenerated method: MultiplayerScoreRingManager.GetScoreRingItem
::GlobalNamespace::MultiplayerScoreRingItem* GlobalNamespace::MultiplayerScoreRingManager::GetScoreRingItem(::StringW userId) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::GetScoreRingItem");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetScoreRingItem", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(userId)})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::MultiplayerScoreRingItem*, false>(this, ___internal__method, userId);
}
// Autogenerated method: MultiplayerScoreRingManager.GetScoreRingItems
::ArrayW<::UnityEngine::GameObject*> GlobalNamespace::MultiplayerScoreRingManager::GetScoreRingItems() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::GetScoreRingItems");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetScoreRingItems", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::ArrayW<::UnityEngine::GameObject*>, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.AnimateColorsForAllPlayers
void GlobalNamespace::MultiplayerScoreRingManager::AnimateColorsForAllPlayers(::UnityEngine::Color nameColor, ::UnityEngine::Color scoreColor, float duration, ::GlobalNamespace::EaseType easeType) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::AnimateColorsForAllPlayers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AnimateColorsForAllPlayers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(nameColor), ::il2cpp_utils::ExtractType(scoreColor), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, nameColor, scoreColor, duration, easeType);
}
// Autogenerated method: MultiplayerScoreRingManager.SetPlayerToFailedState
void GlobalNamespace::MultiplayerScoreRingManager::SetPlayerToFailedState(::GlobalNamespace::IConnectedPlayer* player) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::SetPlayerToFailedState");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetPlayerToFailedState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(player)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, player);
}
// Autogenerated method: MultiplayerScoreRingManager.TrySpawnTexts
void GlobalNamespace::MultiplayerScoreRingManager::TrySpawnTexts() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::TrySpawnTexts");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "TrySpawnTexts", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.SpawnTexts
void GlobalNamespace::MultiplayerScoreRingManager::SpawnTexts() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::SpawnTexts");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SpawnTexts", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.HandleStateChanged
void GlobalNamespace::MultiplayerScoreRingManager::HandleStateChanged(::GlobalNamespace::MultiplayerController::State state) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::HandleStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(state)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, state);
}
// Autogenerated method: MultiplayerScoreRingManager.HandleSpawnCenterDistanceWasFound
void GlobalNamespace::MultiplayerScoreRingManager::HandleSpawnCenterDistanceWasFound(float spawnCenterDistance) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::HandleSpawnCenterDistanceWasFound");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSpawnCenterDistanceWasFound", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spawnCenterDistance)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, spawnCenterDistance);
}
// Autogenerated method: MultiplayerScoreRingManager.HandlePlayerSpawningDidFinish
void GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerSpawningDidFinish() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerSpawningDidFinish");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerSpawningDidFinish", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerScoreRingManager.HandlePlayerStateChanged
void GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerStateChanged(::GlobalNamespace::IConnectedPlayer* player) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(player)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, player);
}
// Autogenerated method: MultiplayerScoreRingManager.HandlePlayerDisconnected
void GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerDisconnected(::GlobalNamespace::IConnectedPlayer* player) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerScoreRingManager::HandlePlayerDisconnected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerDisconnected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(player)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, player);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerSongEntitlementsStatus
#include "GlobalNamespace/MultiplayerSongEntitlementsStatus.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public MultiplayerSongEntitlementsStatus Ok
::GlobalNamespace::MultiplayerSongEntitlementsStatus GlobalNamespace::MultiplayerSongEntitlementsStatus::_get_Ok() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSongEntitlementsStatus::_get_Ok");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerSongEntitlementsStatus>("", "MultiplayerSongEntitlementsStatus", "Ok"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerSongEntitlementsStatus Ok
void GlobalNamespace::MultiplayerSongEntitlementsStatus::_set_Ok(::GlobalNamespace::MultiplayerSongEntitlementsStatus value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSongEntitlementsStatus::_set_Ok");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerSongEntitlementsStatus", "Ok", value));
}
// Autogenerated static field getter
// Get static field: static public MultiplayerSongEntitlementsStatus Invalid
::GlobalNamespace::MultiplayerSongEntitlementsStatus GlobalNamespace::MultiplayerSongEntitlementsStatus::_get_Invalid() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSongEntitlementsStatus::_get_Invalid");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerSongEntitlementsStatus>("", "MultiplayerSongEntitlementsStatus", "Invalid"));
}
// Autogenerated static field setter
// Set static field: static public MultiplayerSongEntitlementsStatus Invalid
void GlobalNamespace::MultiplayerSongEntitlementsStatus::_set_Invalid(::GlobalNamespace::MultiplayerSongEntitlementsStatus value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSongEntitlementsStatus::_set_Invalid");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "MultiplayerSongEntitlementsStatus", "Invalid", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::MultiplayerSongEntitlementsStatus::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSongEntitlementsStatus::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerVerticalPlayerMovementManager
#include "GlobalNamespace/MultiplayerVerticalPlayerMovementManager.hpp"
// Including type: MultiplayerPlayersManager
#include "GlobalNamespace/MultiplayerPlayersManager.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: MultiplayerLayoutProvider
#include "GlobalNamespace/MultiplayerLayoutProvider.hpp"
// Including type: MultiplayerScoreProvider/RankedPlayer
#include "GlobalNamespace/MultiplayerScoreProvider_RankedPlayer.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: MultiplayerConnectedPlayerFacade
#include "GlobalNamespace/MultiplayerConnectedPlayerFacade.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _movementRange
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__movementRange() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__movementRange");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_movementRange"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _duelMovementRange
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__duelMovementRange() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__duelMovementRange");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_duelMovementRange"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _maxMoveSpeedMetersPerSecond
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__maxMoveSpeedMetersPerSecond() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__maxMoveSpeedMetersPerSecond");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maxMoveSpeedMetersPerSecond"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _accelerationMetersPerSecondSquared
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__accelerationMetersPerSecondSquared() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__accelerationMetersPerSecondSquared");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_accelerationMetersPerSecondSquared"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _decelerationMetersPerSecondSquared
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__decelerationMetersPerSecondSquared() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__decelerationMetersPerSecondSquared");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_decelerationMetersPerSecondSquared"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _minScoreDifference
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__minScoreDifference() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__minScoreDifference");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_minScoreDifference"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerPlayersManager _multiplayerPlayersManager
::GlobalNamespace::MultiplayerPlayersManager*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__multiplayerPlayersManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__multiplayerPlayersManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerPlayersManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerPlayersManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerScoreProvider _scoreProvider
::GlobalNamespace::MultiplayerScoreProvider*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__scoreProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__scoreProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerScoreProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLayoutProvider _layoutProvider
::GlobalNamespace::MultiplayerLayoutProvider*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__layoutProvider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__layoutProvider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layoutProvider"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLayoutProvider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.List`1<MultiplayerScoreProvider/RankedPlayer> _reusablePlayersList
::System::Collections::Generic::List_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__reusablePlayersList() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__reusablePlayersList");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_reusablePlayersList"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::MultiplayerScoreProvider::RankedPlayer*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<MultiplayerConnectedPlayerFacade,System.Single> _currentSpeedsDictionary
::System::Collections::Generic::Dictionary_2<::GlobalNamespace::MultiplayerConnectedPlayerFacade*, float>*& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__currentSpeedsDictionary() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__currentSpeedsDictionary");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentSpeedsDictionary"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::GlobalNamespace::MultiplayerConnectedPlayerFacade*, float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _lastFrameBaseScore
float& GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__lastFrameBaseScore() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::dyn__lastFrameBaseScore");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastFrameBaseScore"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerVerticalPlayerMovementManager.Start
void GlobalNamespace::MultiplayerVerticalPlayerMovementManager::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerVerticalPlayerMovementManager.OnDestroy
void GlobalNamespace::MultiplayerVerticalPlayerMovementManager::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerVerticalPlayerMovementManager.Update
void GlobalNamespace::MultiplayerVerticalPlayerMovementManager::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerVerticalPlayerMovementManager.HandleStateChanged
void GlobalNamespace::MultiplayerVerticalPlayerMovementManager::HandleStateChanged(::GlobalNamespace::MultiplayerController::State state) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerVerticalPlayerMovementManager::HandleStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(state)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, state);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: ScaleAnimator
#include "GlobalNamespace/ScaleAnimator.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: Tweening.TimeTweeningManager
#include "Tweening/TimeTweeningManager.hpp"
// Including type: Tweening.Tween`1
#include "Tweening/Tween_1.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: EaseType
#include "GlobalNamespace/EaseType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _displayedScale
float& GlobalNamespace::ScaleAnimator::dyn__displayedScale() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__displayedScale");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_displayedScale"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _targetTransform
::UnityEngine::Transform*& GlobalNamespace::ScaleAnimator::dyn__targetTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__targetTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_targetTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Tweening.TimeTweeningManager _tweeningManager
::Tweening::TimeTweeningManager*& GlobalNamespace::ScaleAnimator::dyn__tweeningManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__tweeningManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_tweeningManager"))->offset;
return *reinterpret_cast<::Tweening::TimeTweeningManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _scaleUpTween
::Tweening::Tween_1<float>*& GlobalNamespace::ScaleAnimator::dyn__scaleUpTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__scaleUpTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scaleUpTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Tweening.Tween`1<System.Single> _scaleDownTween
::Tweening::Tween_1<float>*& GlobalNamespace::ScaleAnimator::dyn__scaleDownTween() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__scaleDownTween");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scaleDownTween"))->offset;
return *reinterpret_cast<::Tweening::Tween_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _initialized
bool& GlobalNamespace::ScaleAnimator::dyn__initialized() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::dyn__initialized");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_initialized"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ScaleAnimator.OnDestroy
void GlobalNamespace::ScaleAnimator::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ScaleAnimator.InitIfNeeded
void GlobalNamespace::ScaleAnimator::InitIfNeeded() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::InitIfNeeded");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitIfNeeded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ScaleAnimator.SetPositionAndRotation
void GlobalNamespace::ScaleAnimator::SetPositionAndRotation(::UnityEngine::Vector3 position, ::UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::SetPositionAndRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetPositionAndRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(rotation)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, position, rotation);
}
// Autogenerated method: ScaleAnimator.HideInstant
void GlobalNamespace::ScaleAnimator::HideInstant() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::HideInstant");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HideInstant", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ScaleAnimator.ShowInstant
void GlobalNamespace::ScaleAnimator::ShowInstant() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::ShowInstant");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ShowInstant", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ScaleAnimator.Animate
void GlobalNamespace::ScaleAnimator::Animate(bool show, float duration, ::GlobalNamespace::EaseType easeType, float delay) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::Animate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Animate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(show), ::il2cpp_utils::ExtractType(duration), ::il2cpp_utils::ExtractType(easeType), ::il2cpp_utils::ExtractType(delay)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, show, duration, easeType, delay);
}
// Autogenerated method: ScaleAnimator.<InitIfNeeded>b__7_0
void GlobalNamespace::ScaleAnimator::$InitIfNeeded$b__7_0(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::<InitIfNeeded>b__7_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__7_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: ScaleAnimator.<InitIfNeeded>b__7_2
void GlobalNamespace::ScaleAnimator::$InitIfNeeded$b__7_2() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::<InitIfNeeded>b__7_2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__7_2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ScaleAnimator.<InitIfNeeded>b__7_1
void GlobalNamespace::ScaleAnimator::$InitIfNeeded$b__7_1(float val) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::<InitIfNeeded>b__7_1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__7_1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(val)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, val);
}
// Autogenerated method: ScaleAnimator.<InitIfNeeded>b__7_3
void GlobalNamespace::ScaleAnimator::$InitIfNeeded$b__7_3() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ScaleAnimator::<InitIfNeeded>b__7_3");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<InitIfNeeded>b__7_3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: IMultiplayerSpectatingSpot
#include "GlobalNamespace/IMultiplayerSpectatingSpot.hpp"
// Including type: IMultiplayerObservable
#include "GlobalNamespace/IMultiplayerObservable.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: IMultiplayerSpectatingSpot.get_isMain
bool GlobalNamespace::IMultiplayerSpectatingSpot::get_isMain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::get_isMain");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isMain", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: IMultiplayerSpectatingSpot.get_observable
::GlobalNamespace::IMultiplayerObservable* GlobalNamespace::IMultiplayerSpectatingSpot::get_observable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::get_observable");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_observable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerObservable*, false>(this, ___internal__method);
}
// Autogenerated method: IMultiplayerSpectatingSpot.get_transform
::UnityEngine::Transform* GlobalNamespace::IMultiplayerSpectatingSpot::get_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::get_transform");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_transform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Transform*, false>(this, ___internal__method);
}
// Autogenerated method: IMultiplayerSpectatingSpot.get_spotName
::StringW GlobalNamespace::IMultiplayerSpectatingSpot::get_spotName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::get_spotName");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_spotName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: IMultiplayerSpectatingSpot.add_hasBeenRemovedEvent
void GlobalNamespace::IMultiplayerSpectatingSpot::add_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::add_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IMultiplayerSpectatingSpot.remove_hasBeenRemovedEvent
void GlobalNamespace::IMultiplayerSpectatingSpot::remove_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::remove_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IMultiplayerSpectatingSpot.SetIsObserved
void GlobalNamespace::IMultiplayerSpectatingSpot::SetIsObserved(bool isObserved) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IMultiplayerSpectatingSpot::SetIsObserved");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIsObserved", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isObserved)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isObserved);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerConnectedPlayerSpectatingSpot
#include "GlobalNamespace/MultiplayerConnectedPlayerSpectatingSpot.hpp"
// Including type: IConnectedPlayer
#include "GlobalNamespace/IConnectedPlayer.hpp"
// Including type: IMultiplayerSessionManager
#include "GlobalNamespace/IMultiplayerSessionManager.hpp"
// Including type: MultiplayerSpectatingSpotManager
#include "GlobalNamespace/MultiplayerSpectatingSpotManager.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: IMultiplayerObservable
#include "GlobalNamespace/IMultiplayerObservable.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly IConnectedPlayer _connectedPlayer
::GlobalNamespace::IConnectedPlayer*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__connectedPlayer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__connectedPlayer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_connectedPlayer"))->offset;
return *reinterpret_cast<::GlobalNamespace::IConnectedPlayer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IMultiplayerSessionManager _multiplayerSessionManager
::GlobalNamespace::IMultiplayerSessionManager*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__multiplayerSessionManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__multiplayerSessionManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerSessionManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSessionManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerSpectatingSpotManager _spectatingSpotManager
::GlobalNamespace::MultiplayerSpectatingSpotManager*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__spectatingSpotManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__spectatingSpotManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spectatingSpotManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSpectatingSpotManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<IMultiplayerSpectatingSpot> hasBeenRemovedEvent
::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_hasBeenRemovedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_hasBeenRemovedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hasBeenRemovedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<System.Boolean> isObservedChangedEvent
::System::Action_1<bool>*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_isObservedChangedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_isObservedChangedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isObservedChangedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<bool>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private IMultiplayerObservable <observable>k__BackingField
::GlobalNamespace::IMultiplayerObservable*& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_$observable$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn_$observable$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<observable>k__BackingField"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerObservable**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _playerFailed
bool& GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__playerFailed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::dyn__playerFailed");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerFailed"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.get_observable
::GlobalNamespace::IMultiplayerObservable* GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_observable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_observable");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_observable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerObservable*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.set_observable
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::set_observable(::GlobalNamespace::IMultiplayerObservable* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::set_observable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_observable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.get_spotName
::StringW GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_spotName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_spotName");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_spotName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.get_isMain
bool GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_isMain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::get_isMain");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isMain", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.IMultiplayerSpectatingSpot.get_transform
::UnityEngine::Transform* GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::IMultiplayerSpectatingSpot_get_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::IMultiplayerSpectatingSpot.get_transform");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IMultiplayerSpectatingSpot.get_transform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Transform*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.add_hasBeenRemovedEvent
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::add_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::add_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.remove_hasBeenRemovedEvent
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::remove_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::remove_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.add_isObservedChangedEvent
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::add_isObservedChangedEvent(::System::Action_1<bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::add_isObservedChangedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_isObservedChangedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.remove_isObservedChangedEvent
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::remove_isObservedChangedEvent(::System::Action_1<bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::remove_isObservedChangedEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_isObservedChangedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.Start
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.OnDestroy
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.SetIsObserved
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::SetIsObserved(bool isObserved) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::SetIsObserved");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIsObserved", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isObserved)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isObserved);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.ReloadBasedOnPlayerCurrentState
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::ReloadBasedOnPlayerCurrentState(::GlobalNamespace::IConnectedPlayer* connectedPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::ReloadBasedOnPlayerCurrentState");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReloadBasedOnPlayerCurrentState", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(connectedPlayer)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, connectedPlayer);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.HandlePlayerStateChanged
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::HandlePlayerStateChanged(::GlobalNamespace::IConnectedPlayer* connectedPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::HandlePlayerStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(connectedPlayer)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, connectedPlayer);
}
// Autogenerated method: MultiplayerConnectedPlayerSpectatingSpot.HandlePlayerDisconnected
void GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::HandlePlayerDisconnected(::GlobalNamespace::IConnectedPlayer* connectedPlayer) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerConnectedPlayerSpectatingSpot::HandlePlayerDisconnected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerDisconnected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(connectedPlayer)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, connectedPlayer);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerEnvironmentSpectatingSpot
#include "GlobalNamespace/MultiplayerEnvironmentSpectatingSpot.hpp"
// Including type: MultiplayerSpectatingSpotManager
#include "GlobalNamespace/MultiplayerSpectatingSpotManager.hpp"
// Including type: MultiplayerActivePlayersTimeOffsetAverage
#include "GlobalNamespace/MultiplayerActivePlayersTimeOffsetAverage.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: IMultiplayerObservable
#include "GlobalNamespace/IMultiplayerObservable.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Boolean _preferredSpectatingSpot
bool& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__preferredSpectatingSpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__preferredSpectatingSpot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_preferredSpectatingSpot"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _displaySpotNumber
bool& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__displaySpotNumber() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__displaySpotNumber");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_displaySpotNumber"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _spotNumber
int& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__spotNumber() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__spotNumber");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spotNumber"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerSpectatingSpotManager _spectatingSpotManager
::GlobalNamespace::MultiplayerSpectatingSpotManager*& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__spectatingSpotManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__spectatingSpotManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spectatingSpotManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSpectatingSpotManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerActivePlayersTimeOffsetAverage _activePlayersTimeOffsetAverage
::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage*& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__activePlayersTimeOffsetAverage() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn__activePlayersTimeOffsetAverage");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_activePlayersTimeOffsetAverage"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerActivePlayersTimeOffsetAverage**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<IMultiplayerSpectatingSpot> hasBeenRemovedEvent
::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>*& GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn_hasBeenRemovedEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::dyn_hasBeenRemovedEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hasBeenRemovedEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.get_observable
::GlobalNamespace::IMultiplayerObservable* GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_observable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_observable");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_observable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerObservable*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.get_spotName
::StringW GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_spotName() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_spotName");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_spotName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::StringW, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.get_isMain
bool GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_isMain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::get_isMain");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isMain", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.IMultiplayerSpectatingSpot.get_transform
::UnityEngine::Transform* GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::IMultiplayerSpectatingSpot_get_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::IMultiplayerSpectatingSpot.get_transform");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IMultiplayerSpectatingSpot.get_transform", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Transform*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.add_hasBeenRemovedEvent
void GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::add_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::add_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.remove_hasBeenRemovedEvent
void GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::remove_hasBeenRemovedEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::remove_hasBeenRemovedEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_hasBeenRemovedEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.Start
void GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.OnDisable
void GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::OnDisable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::OnDisable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDisable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerEnvironmentSpectatingSpot.SetIsObserved
void GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::SetIsObserved(bool isObserved) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerEnvironmentSpectatingSpot::SetIsObserved");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIsObserved", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(isObserved)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, isObserved);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerSpectatingSpotManager
#include "GlobalNamespace/MultiplayerSpectatingSpotManager.hpp"
// Including type: MultiplayerSpectatingSpotManager/<>c
#include "GlobalNamespace/MultiplayerSpectatingSpotManager_--c.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: IMultiplayerSpectatingSpot
#include "GlobalNamespace/IMultiplayerSpectatingSpot.hpp"
// Including type: System.Collections.Generic.Dictionary`2
#include "System/Collections/Generic/Dictionary_2.hpp"
// Including type: System.Collections.Generic.IReadOnlyList`1
#include "System/Collections/Generic/IReadOnlyList_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.List`1<IMultiplayerSpectatingSpot> _spectatingSpots
::System::Collections::Generic::List_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>*& GlobalNamespace::MultiplayerSpectatingSpotManager::dyn__spectatingSpots() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::dyn__spectatingSpots");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spectatingSpots"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.Dictionary`2<IMultiplayerSpectatingSpot,System.Int32> _spotIndexBySpot
::System::Collections::Generic::Dictionary_2<::GlobalNamespace::IMultiplayerSpectatingSpot*, int>*& GlobalNamespace::MultiplayerSpectatingSpotManager::dyn__spotIndexBySpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::dyn__spotIndexBySpot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spotIndexBySpot"))->offset;
return *reinterpret_cast<::System::Collections::Generic::Dictionary_2<::GlobalNamespace::IMultiplayerSpectatingSpot*, int>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.get_spectatingSpots
::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* GlobalNamespace::MultiplayerSpectatingSpotManager::get_spectatingSpots() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::get_spectatingSpots");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_spectatingSpots", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::IReadOnlyList_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.get_defaultSpot
::GlobalNamespace::IMultiplayerSpectatingSpot* GlobalNamespace::MultiplayerSpectatingSpotManager::get_defaultSpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::get_defaultSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_defaultSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerSpectatingSpot*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.RegisterSpectatingSpot
void GlobalNamespace::MultiplayerSpectatingSpotManager::RegisterSpectatingSpot(::GlobalNamespace::IMultiplayerSpectatingSpot* spectatingSpot) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::RegisterSpectatingSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RegisterSpectatingSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spectatingSpot)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, spectatingSpot);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.GetAdjacentSpot
::GlobalNamespace::IMultiplayerSpectatingSpot* GlobalNamespace::MultiplayerSpectatingSpotManager::GetAdjacentSpot(::GlobalNamespace::IMultiplayerSpectatingSpot* spectatingSpot, int offset) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::GetAdjacentSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetAdjacentSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spectatingSpot), ::il2cpp_utils::ExtractType(offset)})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerSpectatingSpot*, false>(this, ___internal__method, spectatingSpot, offset);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.GetIndexBySpot
int GlobalNamespace::MultiplayerSpectatingSpotManager::GetIndexBySpot(::GlobalNamespace::IMultiplayerSpectatingSpot* spectatingSpot) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::GetIndexBySpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetIndexBySpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spectatingSpot)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, spectatingSpot);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.UpdateIndexBySpotDictionary
void GlobalNamespace::MultiplayerSpectatingSpotManager::UpdateIndexBySpotDictionary() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::UpdateIndexBySpotDictionary");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateIndexBySpotDictionary", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatingSpotManager.SpotOnHasBeenRemoved
void GlobalNamespace::MultiplayerSpectatingSpotManager::SpotOnHasBeenRemoved(::GlobalNamespace::IMultiplayerSpectatingSpot* spectatingSpot) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::SpotOnHasBeenRemoved");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SpotOnHasBeenRemoved", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spectatingSpot)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, spectatingSpot);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerSpectatingSpotManager/<>c
#include "GlobalNamespace/MultiplayerSpectatingSpotManager_--c.hpp"
// Including type: System.Func`2
#include "System/Func_2.hpp"
// Including type: IMultiplayerSpectatingSpot
#include "GlobalNamespace/IMultiplayerSpectatingSpot.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly MultiplayerSpectatingSpotManager/<>c <>9
::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c* GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_get_$$9() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_get_$$9");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c*>("", "MultiplayerSpectatingSpotManager/<>c", "<>9")));
}
// Autogenerated static field setter
// Set static field: static public readonly MultiplayerSpectatingSpotManager/<>c <>9
void GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_set_$$9(::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_set_$$9");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerSpectatingSpotManager/<>c", "<>9", value)));
}
// Autogenerated static field getter
// Get static field: static public System.Func`2<IMultiplayerSpectatingSpot,System.Boolean> <>9__3_0
::System::Func_2<::GlobalNamespace::IMultiplayerSpectatingSpot*, bool>* GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_get_$$9__3_0() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_get_$$9__3_0");
return THROW_UNLESS((il2cpp_utils::GetFieldValue<::System::Func_2<::GlobalNamespace::IMultiplayerSpectatingSpot*, bool>*>("", "MultiplayerSpectatingSpotManager/<>c", "<>9__3_0")));
}
// Autogenerated static field setter
// Set static field: static public System.Func`2<IMultiplayerSpectatingSpot,System.Boolean> <>9__3_0
void GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_set_$$9__3_0(::System::Func_2<::GlobalNamespace::IMultiplayerSpectatingSpot*, bool>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_set_$$9__3_0");
THROW_UNLESS((il2cpp_utils::SetFieldValue("", "MultiplayerSpectatingSpotManager/<>c", "<>9__3_0", value)));
}
// Autogenerated method: MultiplayerSpectatingSpotManager/<>c..cctor
void GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "MultiplayerSpectatingSpotManager/<>c", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated method: MultiplayerSpectatingSpotManager/<>c.<get_defaultSpot>b__3_0
bool GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::$get_defaultSpot$b__3_0(::GlobalNamespace::IMultiplayerSpectatingSpot* s) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatingSpotManager::$$c::<get_defaultSpot>b__3_0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "<get_defaultSpot>b__3_0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method, s);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplayerSpectatorController
#include "GlobalNamespace/MultiplayerSpectatorController.hpp"
// Including type: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17
#include "GlobalNamespace/MultiplayerSpectatorController_-SwitchToDefaultSpotWithFadeCoroutine-d__17.hpp"
// Including type: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18
#include "GlobalNamespace/MultiplayerSpectatorController_-SwitchToDefaultSpotCoroutine-d__18.hpp"
// Including type: MultiplayerSpectatingSpotManager
#include "GlobalNamespace/MultiplayerSpectatingSpotManager.hpp"
// Including type: MultiplayerLocalInactivePlayerSongSyncController
#include "GlobalNamespace/MultiplayerLocalInactivePlayerSongSyncController.hpp"
// Including type: MultiplayerController/State
#include "GlobalNamespace/MultiplayerController.hpp"
// Including type: FadeInOutController
#include "GlobalNamespace/FadeInOutController.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: IMultiplayerSpectatingSpot
#include "GlobalNamespace/IMultiplayerSpectatingSpot.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerSpectatingSpotManager _spotManager
::GlobalNamespace::MultiplayerSpectatingSpotManager*& GlobalNamespace::MultiplayerSpectatorController::dyn__spotManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__spotManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_spotManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSpectatingSpotManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerLocalInactivePlayerSongSyncController _songController
::GlobalNamespace::MultiplayerLocalInactivePlayerSongSyncController*& GlobalNamespace::MultiplayerSpectatorController::dyn__songController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__songController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_songController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerLocalInactivePlayerSongSyncController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly MultiplayerController _multiplayerController
::GlobalNamespace::MultiplayerController*& GlobalNamespace::MultiplayerSpectatorController::dyn__multiplayerController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__multiplayerController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplayerController"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly FadeInOutController _fadeInOutController
::GlobalNamespace::FadeInOutController*& GlobalNamespace::MultiplayerSpectatorController::dyn__fadeInOutController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__fadeInOutController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInOutController"))->offset;
return *reinterpret_cast<::GlobalNamespace::FadeInOutController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<IMultiplayerSpectatingSpot> spectatingSpotDidChangeEvent
::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>*& GlobalNamespace::MultiplayerSpectatorController::dyn_spectatingSpotDidChangeEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn_spectatingSpotDidChangeEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "spectatingSpotDidChangeEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _transform
::UnityEngine::Transform*& GlobalNamespace::MultiplayerSpectatorController::dyn__transform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_transform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private IMultiplayerSpectatingSpot _currentSpot
::GlobalNamespace::IMultiplayerSpectatingSpot*& GlobalNamespace::MultiplayerSpectatorController::dyn__currentSpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::dyn__currentSpot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_currentSpot"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSpectatingSpot**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerSpectatorController.get_currentSpot
::GlobalNamespace::IMultiplayerSpectatingSpot* GlobalNamespace::MultiplayerSpectatorController::get_currentSpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::get_currentSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_currentSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::IMultiplayerSpectatingSpot*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.add_spectatingSpotDidChangeEvent
void GlobalNamespace::MultiplayerSpectatorController::add_spectatingSpotDidChangeEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::add_spectatingSpotDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_spectatingSpotDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerSpectatorController.remove_spectatingSpotDidChangeEvent
void GlobalNamespace::MultiplayerSpectatorController::remove_spectatingSpotDidChangeEvent(::System::Action_1<::GlobalNamespace::IMultiplayerSpectatingSpot*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::remove_spectatingSpotDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_spectatingSpotDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: MultiplayerSpectatorController.Awake
void GlobalNamespace::MultiplayerSpectatorController::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.Start
void GlobalNamespace::MultiplayerSpectatorController::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.OnDestroy
void GlobalNamespace::MultiplayerSpectatorController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToDefaultSpot
void GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToDefaultSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToPrev
void GlobalNamespace::MultiplayerSpectatorController::SwitchToPrev() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToPrev");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToPrev", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToNext
void GlobalNamespace::MultiplayerSpectatorController::SwitchToNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToNext");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToDefaultSpotWithFadeCoroutine
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpotWithFadeCoroutine() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpotWithFadeCoroutine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToDefaultSpotWithFadeCoroutine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToDefaultSpotCoroutine
::System::Collections::IEnumerator* GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpotCoroutine() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToDefaultSpotCoroutine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToDefaultSpotCoroutine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::IEnumerator*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController.SwitchToSpectatingSpot
void GlobalNamespace::MultiplayerSpectatorController::SwitchToSpectatingSpot(::GlobalNamespace::IMultiplayerSpectatingSpot* spectatingSpot) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::SwitchToSpectatingSpot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SwitchToSpectatingSpot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spectatingSpot)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, spectatingSpot);
}
// Autogenerated method: MultiplayerSpectatorController.HandleStateChanged
void GlobalNamespace::MultiplayerSpectatorController::HandleStateChanged(::GlobalNamespace::MultiplayerController::State state) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::HandleStateChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleStateChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(state)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, state);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17
#include "GlobalNamespace/MultiplayerSpectatorController_-SwitchToDefaultSpotWithFadeCoroutine-d__17.hpp"
// Including type: IMultiplayerSpectatingSpot
#include "GlobalNamespace/IMultiplayerSpectatingSpot.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerSpectatorController <>4__this
::GlobalNamespace::MultiplayerSpectatorController*& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSpectatorController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private IMultiplayerSpectatingSpot <defaultSpot>5__2
::GlobalNamespace::IMultiplayerSpectatingSpot*& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$defaultSpot$5__2() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::dyn_$defaultSpot$5__2");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<defaultSpot>5__2"))->offset;
return *reinterpret_cast<::GlobalNamespace::IMultiplayerSpectatingSpot**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17.MoveNext
bool GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotWithFadeCoroutine>d__17.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotWithFadeCoroutine$d__17::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18
#include "GlobalNamespace/MultiplayerSpectatorController_-SwitchToDefaultSpotCoroutine-d__18.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 <>1__state
int& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$1__state() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$1__state");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>1__state"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Object <>2__current
::Il2CppObject*& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$2__current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$2__current");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>2__current"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public MultiplayerSpectatorController <>4__this
::GlobalNamespace::MultiplayerSpectatorController*& GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$4__this() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::dyn_$$4__this");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<>4__this"))->offset;
return *reinterpret_cast<::GlobalNamespace::MultiplayerSpectatorController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18.System.Collections.Generic.IEnumerator<System.Object>.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System_Collections_Generic_IEnumerator$System_Object$_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System.Collections.Generic.IEnumerator<System.Object>.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.Generic.IEnumerator<System.Object>.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18.System.Collections.IEnumerator.get_Current
::Il2CppObject* GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System_Collections_IEnumerator_get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System.Collections.IEnumerator.get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::Il2CppObject*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18.System.IDisposable.Dispose
void GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System_IDisposable_Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System.IDisposable.Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.IDisposable.Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18.MoveNext
bool GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: MultiplayerSpectatorController/<SwitchToDefaultSpotCoroutine>d__18.System.Collections.IEnumerator.Reset
void GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System_Collections_IEnumerator_Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplayerSpectatorController::$SwitchToDefaultSpotCoroutine$d__18::System.Collections.IEnumerator.Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerator.Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: GameEnergyCounter
#include "GlobalNamespace/GameEnergyCounter.hpp"
// Including type: GameEnergyCounter/InitData
#include "GlobalNamespace/GameEnergyCounter_InitData.hpp"
// Including type: SaberClashChecker
#include "GlobalNamespace/SaberClashChecker.hpp"
// Including type: BeatmapObjectManager
#include "GlobalNamespace/BeatmapObjectManager.hpp"
// Including type: PlayerHeadAndObstacleInteraction
#include "GlobalNamespace/PlayerHeadAndObstacleInteraction.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: NoteController
#include "GlobalNamespace/NoteController.hpp"
// Including type: NoteCutInfo
#include "GlobalNamespace/NoteCutInfo.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private System.Single kBadNoteEnergyDrain
float GlobalNamespace::GameEnergyCounter::_get_kBadNoteEnergyDrain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kBadNoteEnergyDrain");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kBadNoteEnergyDrain"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kBadNoteEnergyDrain
void GlobalNamespace::GameEnergyCounter::_set_kBadNoteEnergyDrain(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kBadNoteEnergyDrain");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kBadNoteEnergyDrain", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kBadBurstSliderElementEnergyDrain
float GlobalNamespace::GameEnergyCounter::_get_kBadBurstSliderElementEnergyDrain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kBadBurstSliderElementEnergyDrain");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kBadBurstSliderElementEnergyDrain"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kBadBurstSliderElementEnergyDrain
void GlobalNamespace::GameEnergyCounter::_set_kBadBurstSliderElementEnergyDrain(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kBadBurstSliderElementEnergyDrain");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kBadBurstSliderElementEnergyDrain", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kMissNoteEnergyDrain
float GlobalNamespace::GameEnergyCounter::_get_kMissNoteEnergyDrain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kMissNoteEnergyDrain");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kMissNoteEnergyDrain"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kMissNoteEnergyDrain
void GlobalNamespace::GameEnergyCounter::_set_kMissNoteEnergyDrain(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kMissNoteEnergyDrain");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kMissNoteEnergyDrain", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kMissBurstSliderElementEnergyDrain
float GlobalNamespace::GameEnergyCounter::_get_kMissBurstSliderElementEnergyDrain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kMissBurstSliderElementEnergyDrain");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kMissBurstSliderElementEnergyDrain"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kMissBurstSliderElementEnergyDrain
void GlobalNamespace::GameEnergyCounter::_set_kMissBurstSliderElementEnergyDrain(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kMissBurstSliderElementEnergyDrain");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kMissBurstSliderElementEnergyDrain", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kHitBombEnergyDrain
float GlobalNamespace::GameEnergyCounter::_get_kHitBombEnergyDrain() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kHitBombEnergyDrain");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kHitBombEnergyDrain"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kHitBombEnergyDrain
void GlobalNamespace::GameEnergyCounter::_set_kHitBombEnergyDrain(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kHitBombEnergyDrain");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kHitBombEnergyDrain", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kGoodNoteEnergyCharge
float GlobalNamespace::GameEnergyCounter::_get_kGoodNoteEnergyCharge() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kGoodNoteEnergyCharge");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kGoodNoteEnergyCharge"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kGoodNoteEnergyCharge
void GlobalNamespace::GameEnergyCounter::_set_kGoodNoteEnergyCharge(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kGoodNoteEnergyCharge");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kGoodNoteEnergyCharge", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kGoodBurstSliderElementCharge
float GlobalNamespace::GameEnergyCounter::_get_kGoodBurstSliderElementCharge() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kGoodBurstSliderElementCharge");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kGoodBurstSliderElementCharge"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kGoodBurstSliderElementCharge
void GlobalNamespace::GameEnergyCounter::_set_kGoodBurstSliderElementCharge(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kGoodBurstSliderElementCharge");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kGoodBurstSliderElementCharge", value));
}
// Autogenerated static field getter
// Get static field: static private System.Single kObstacleEnergyDrainPerSecond
float GlobalNamespace::GameEnergyCounter::_get_kObstacleEnergyDrainPerSecond() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_get_kObstacleEnergyDrainPerSecond");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<float>("", "GameEnergyCounter", "kObstacleEnergyDrainPerSecond"));
}
// Autogenerated static field setter
// Set static field: static private System.Single kObstacleEnergyDrainPerSecond
void GlobalNamespace::GameEnergyCounter::_set_kObstacleEnergyDrainPerSecond(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::_set_kObstacleEnergyDrainPerSecond");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "GameEnergyCounter", "kObstacleEnergyDrainPerSecond", value));
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _batteryLives
int& GlobalNamespace::GameEnergyCounter::dyn__batteryLives() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__batteryLives");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_batteryLives"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameEnergyCounter/InitData _initData
::GlobalNamespace::GameEnergyCounter::InitData*& GlobalNamespace::GameEnergyCounter::dyn__initData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__initData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_initData"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameEnergyCounter::InitData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SaberClashChecker _saberClashChecker
::GlobalNamespace::SaberClashChecker*& GlobalNamespace::GameEnergyCounter::dyn__saberClashChecker() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__saberClashChecker");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberClashChecker"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberClashChecker**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectManager _beatmapObjectManager
::GlobalNamespace::BeatmapObjectManager*& GlobalNamespace::GameEnergyCounter::dyn__beatmapObjectManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__beatmapObjectManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly PlayerHeadAndObstacleInteraction _playerHeadAndObstacleInteraction
::GlobalNamespace::PlayerHeadAndObstacleInteraction*& GlobalNamespace::GameEnergyCounter::dyn__playerHeadAndObstacleInteraction() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__playerHeadAndObstacleInteraction");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerHeadAndObstacleInteraction"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerHeadAndObstacleInteraction**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action didInitEvent
::System::Action*& GlobalNamespace::GameEnergyCounter::dyn_didInitEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_didInitEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "didInitEvent"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action gameEnergyDidReach0Event
::System::Action*& GlobalNamespace::GameEnergyCounter::dyn_gameEnergyDidReach0Event() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_gameEnergyDidReach0Event");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "gameEnergyDidReach0Event"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<System.Single> gameEnergyDidChangeEvent
::System::Action_1<float>*& GlobalNamespace::GameEnergyCounter::dyn_gameEnergyDidChangeEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_gameEnergyDidChangeEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "gameEnergyDidChangeEvent"))->offset;
return *reinterpret_cast<::System::Action_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single <energy>k__BackingField
float& GlobalNamespace::GameEnergyCounter::dyn_$energy$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_$energy$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<energy>k__BackingField"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private GameplayModifiers/EnergyType <energyType>k__BackingField
::GlobalNamespace::GameplayModifiers::EnergyType& GlobalNamespace::GameEnergyCounter::dyn_$energyType$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_$energyType$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<energyType>k__BackingField"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayModifiers::EnergyType*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <noFail>k__BackingField
bool& GlobalNamespace::GameEnergyCounter::dyn_$noFail$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_$noFail$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<noFail>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <instaFail>k__BackingField
bool& GlobalNamespace::GameEnergyCounter::dyn_$instaFail$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_$instaFail$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<instaFail>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <failOnSaberClash>k__BackingField
bool& GlobalNamespace::GameEnergyCounter::dyn_$failOnSaberClash$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn_$failOnSaberClash$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<failOnSaberClash>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isInitialized
bool& GlobalNamespace::GameEnergyCounter::dyn__isInitialized() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__isInitialized");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isInitialized"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _didReach0Energy
bool& GlobalNamespace::GameEnergyCounter::dyn__didReach0Energy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__didReach0Energy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_didReach0Energy"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _nextFrameEnergyChange
float& GlobalNamespace::GameEnergyCounter::dyn__nextFrameEnergyChange() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::dyn__nextFrameEnergyChange");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nextFrameEnergyChange"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: GameEnergyCounter.get_isInitialized
bool GlobalNamespace::GameEnergyCounter::get_isInitialized() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_isInitialized");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isInitialized", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.get_energy
float GlobalNamespace::GameEnergyCounter::get_energy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_energy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_energy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.set_energy
void GlobalNamespace::GameEnergyCounter::set_energy(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::set_energy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_energy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.get_batteryEnergy
int GlobalNamespace::GameEnergyCounter::get_batteryEnergy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_batteryEnergy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_batteryEnergy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.get_batteryLives
int GlobalNamespace::GameEnergyCounter::get_batteryLives() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_batteryLives");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_batteryLives", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.get_energyType
::GlobalNamespace::GameplayModifiers::EnergyType GlobalNamespace::GameEnergyCounter::get_energyType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_energyType");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_energyType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::GameplayModifiers::EnergyType, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.set_energyType
void GlobalNamespace::GameEnergyCounter::set_energyType(::GlobalNamespace::GameplayModifiers::EnergyType value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::set_energyType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_energyType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.get_noFail
bool GlobalNamespace::GameEnergyCounter::get_noFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_noFail");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_noFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.set_noFail
void GlobalNamespace::GameEnergyCounter::set_noFail(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::set_noFail");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_noFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.get_instaFail
bool GlobalNamespace::GameEnergyCounter::get_instaFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_instaFail");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_instaFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.set_instaFail
void GlobalNamespace::GameEnergyCounter::set_instaFail(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::set_instaFail");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_instaFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.get_failOnSaberClash
bool GlobalNamespace::GameEnergyCounter::get_failOnSaberClash() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::get_failOnSaberClash");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_failOnSaberClash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.set_failOnSaberClash
void GlobalNamespace::GameEnergyCounter::set_failOnSaberClash(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::set_failOnSaberClash");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_failOnSaberClash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.add_didInitEvent
void GlobalNamespace::GameEnergyCounter::add_didInitEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::add_didInitEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_didInitEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.remove_didInitEvent
void GlobalNamespace::GameEnergyCounter::remove_didInitEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::remove_didInitEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_didInitEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.add_gameEnergyDidReach0Event
void GlobalNamespace::GameEnergyCounter::add_gameEnergyDidReach0Event(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::add_gameEnergyDidReach0Event");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_gameEnergyDidReach0Event", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.remove_gameEnergyDidReach0Event
void GlobalNamespace::GameEnergyCounter::remove_gameEnergyDidReach0Event(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::remove_gameEnergyDidReach0Event");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_gameEnergyDidReach0Event", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.add_gameEnergyDidChangeEvent
void GlobalNamespace::GameEnergyCounter::add_gameEnergyDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::add_gameEnergyDidChangeEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_gameEnergyDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.remove_gameEnergyDidChangeEvent
void GlobalNamespace::GameEnergyCounter::remove_gameEnergyDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::remove_gameEnergyDidChangeEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_gameEnergyDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: GameEnergyCounter.Start
void GlobalNamespace::GameEnergyCounter::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.OnDestroy
void GlobalNamespace::GameEnergyCounter::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.LateUpdate
void GlobalNamespace::GameEnergyCounter::LateUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::LateUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: GameEnergyCounter.HandleNoteWasCut
void GlobalNamespace::GameEnergyCounter::HandleNoteWasCut(::GlobalNamespace::NoteController* noteController, ByRef<::GlobalNamespace::NoteCutInfo> noteCutInfo) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::HandleNoteWasCut");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleNoteWasCut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(noteController), ::il2cpp_utils::ExtractType(noteCutInfo)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, noteController, byref(noteCutInfo));
}
// Autogenerated method: GameEnergyCounter.HandleNoteWasMissed
void GlobalNamespace::GameEnergyCounter::HandleNoteWasMissed(::GlobalNamespace::NoteController* noteController) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::HandleNoteWasMissed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleNoteWasMissed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(noteController)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, noteController);
}
// Autogenerated method: GameEnergyCounter.ProcessEnergyChange
void GlobalNamespace::GameEnergyCounter::ProcessEnergyChange(float energyChange) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::ProcessEnergyChange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ProcessEnergyChange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(energyChange)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, energyChange);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: GameEnergyCounter/InitData
#include "GlobalNamespace/GameEnergyCounter_InitData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public readonly GameplayModifiers/EnergyType energyType
::GlobalNamespace::GameplayModifiers::EnergyType& GlobalNamespace::GameEnergyCounter::InitData::dyn_energyType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::InitData::dyn_energyType");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "energyType"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayModifiers::EnergyType*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly System.Boolean noFail
bool& GlobalNamespace::GameEnergyCounter::InitData::dyn_noFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::InitData::dyn_noFail");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "noFail"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly System.Boolean instaFail
bool& GlobalNamespace::GameEnergyCounter::InitData::dyn_instaFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::InitData::dyn_instaFail");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "instaFail"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly System.Boolean failOnSaberClash
bool& GlobalNamespace::GameEnergyCounter::InitData::dyn_failOnSaberClash() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::GameEnergyCounter::InitData::dyn_failOnSaberClash");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "failOnSaberClash"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: IGameEnergyCounter
#include "GlobalNamespace/IGameEnergyCounter.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: GameplayModifiers/EnergyType
#include "GlobalNamespace/GameplayModifiers.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: IGameEnergyCounter.get_isInitialized
bool GlobalNamespace::IGameEnergyCounter::get_isInitialized() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_isInitialized");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isInitialized", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_energy
float GlobalNamespace::IGameEnergyCounter::get_energy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_energy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_energy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_batteryEnergy
int GlobalNamespace::IGameEnergyCounter::get_batteryEnergy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_batteryEnergy");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_batteryEnergy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_batteryLives
int GlobalNamespace::IGameEnergyCounter::get_batteryLives() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_batteryLives");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_batteryLives", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_energyType
::GlobalNamespace::GameplayModifiers::EnergyType GlobalNamespace::IGameEnergyCounter::get_energyType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_energyType");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_energyType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::GameplayModifiers::EnergyType, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_noFail
bool GlobalNamespace::IGameEnergyCounter::get_noFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_noFail");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_noFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_instaFail
bool GlobalNamespace::IGameEnergyCounter::get_instaFail() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_instaFail");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_instaFail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.get_failOnSaberClash
bool GlobalNamespace::IGameEnergyCounter::get_failOnSaberClash() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::get_failOnSaberClash");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_failOnSaberClash", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: IGameEnergyCounter.add_didInitEvent
void GlobalNamespace::IGameEnergyCounter::add_didInitEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::add_didInitEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_didInitEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IGameEnergyCounter.remove_didInitEvent
void GlobalNamespace::IGameEnergyCounter::remove_didInitEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::remove_didInitEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_didInitEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IGameEnergyCounter.add_gameEnergyDidReach0Event
void GlobalNamespace::IGameEnergyCounter::add_gameEnergyDidReach0Event(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::add_gameEnergyDidReach0Event");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_gameEnergyDidReach0Event", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IGameEnergyCounter.remove_gameEnergyDidReach0Event
void GlobalNamespace::IGameEnergyCounter::remove_gameEnergyDidReach0Event(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::remove_gameEnergyDidReach0Event");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_gameEnergyDidReach0Event", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IGameEnergyCounter.add_gameEnergyDidChangeEvent
void GlobalNamespace::IGameEnergyCounter::add_gameEnergyDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::add_gameEnergyDidChangeEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_gameEnergyDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: IGameEnergyCounter.remove_gameEnergyDidChangeEvent
void GlobalNamespace::IGameEnergyCounter::remove_gameEnergyDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::IGameEnergyCounter::remove_gameEnergyDidChangeEvent");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_gameEnergyDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MoveBackWall
#include "GlobalNamespace/MoveBackWall.hpp"
// Including type: UnityEngine.MeshRenderer
#include "UnityEngine/MeshRenderer.hpp"
// Including type: PlayerTransforms
#include "GlobalNamespace/PlayerTransforms.hpp"
// Including type: UnityEngine.Material
#include "UnityEngine/Material.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Single _fadeInRegion
float& GlobalNamespace::MoveBackWall::dyn__fadeInRegion() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__fadeInRegion");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_fadeInRegion"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.MeshRenderer _meshRenderer
::UnityEngine::MeshRenderer*& GlobalNamespace::MoveBackWall::dyn__meshRenderer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__meshRenderer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_meshRenderer"))->offset;
return *reinterpret_cast<::UnityEngine::MeshRenderer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly PlayerTransforms _playerTransforms
::GlobalNamespace::PlayerTransforms*& GlobalNamespace::MoveBackWall::dyn__playerTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__playerTransforms");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTransforms"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerTransforms**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _thisZ
float& GlobalNamespace::MoveBackWall::dyn__thisZ() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__thisZ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_thisZ"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isVisible
bool& GlobalNamespace::MoveBackWall::dyn__isVisible() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__isVisible");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isVisible"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Material _material
::UnityEngine::Material*& GlobalNamespace::MoveBackWall::dyn__material() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::dyn__material");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_material"))->offset;
return *reinterpret_cast<::UnityEngine::Material**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MoveBackWall.Start
void GlobalNamespace::MoveBackWall::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MoveBackWall.Update
void GlobalNamespace::MoveBackWall::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MoveBackWall::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplierValuesRecorder
#include "GlobalNamespace/MultiplierValuesRecorder.hpp"
// Including type: IScoreController
#include "GlobalNamespace/IScoreController.hpp"
// Including type: AudioTimeSyncController
#include "GlobalNamespace/AudioTimeSyncController.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private IScoreController _scoreController
::GlobalNamespace::IScoreController*& GlobalNamespace::MultiplierValuesRecorder::dyn__scoreController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::dyn__scoreController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreController"))->offset;
return *reinterpret_cast<::GlobalNamespace::IScoreController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private AudioTimeSyncController _audioTimeSyncController
::GlobalNamespace::AudioTimeSyncController*& GlobalNamespace::MultiplierValuesRecorder::dyn__audioTimeSyncController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::dyn__audioTimeSyncController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_audioTimeSyncController"))->offset;
return *reinterpret_cast<::GlobalNamespace::AudioTimeSyncController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.List`1<MultiplierValuesRecorder/MultiplierValue> _multiplierValues
::System::Collections::Generic::List_1<::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue>*& GlobalNamespace::MultiplierValuesRecorder::dyn__multiplierValues() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::dyn__multiplierValues");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplierValues"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplierValuesRecorder.get_multiplierValues
::System::Collections::Generic::List_1<::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue>* GlobalNamespace::MultiplierValuesRecorder::get_multiplierValues() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::get_multiplierValues");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_multiplierValues", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::System::Collections::Generic::List_1<::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue>*, false>(this, ___internal__method);
}
// Autogenerated method: MultiplierValuesRecorder.Start
void GlobalNamespace::MultiplierValuesRecorder::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplierValuesRecorder.OnDestroy
void GlobalNamespace::MultiplierValuesRecorder::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: MultiplierValuesRecorder.HandleScoreControllerMultiplierDidChange
void GlobalNamespace::MultiplierValuesRecorder::HandleScoreControllerMultiplierDidChange(int multiplier, float multiplierProgress) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::HandleScoreControllerMultiplierDidChange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleScoreControllerMultiplierDidChange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(multiplier), ::il2cpp_utils::ExtractType(multiplierProgress)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, multiplier, multiplierProgress);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultiplierValuesRecorder/MultiplierValue
#include "GlobalNamespace/MultiplierValuesRecorder.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public readonly System.Int32 multiplier
int& GlobalNamespace::MultiplierValuesRecorder::MultiplierValue::dyn_multiplier() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue::dyn_multiplier");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "multiplier"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly System.Single time
float& GlobalNamespace::MultiplierValuesRecorder::MultiplierValue::dyn_time() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MultiplierValuesRecorder::MultiplierValue::dyn_time");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "time"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultiplierValuesRecorder/MultiplierValue..ctor
// ABORTED elsewhere. GlobalNamespace::MultiplierValuesRecorder::MultiplierValue::MultiplierValue(int multiplier, float time)
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerHeadAndObstacleInteraction
#include "GlobalNamespace/PlayerHeadAndObstacleInteraction.hpp"
// Including type: PlayerTransforms
#include "GlobalNamespace/PlayerTransforms.hpp"
// Including type: BeatmapObjectManager
#include "GlobalNamespace/BeatmapObjectManager.hpp"
// Including type: System.Action
#include "System/Action.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: ObstacleController
#include "GlobalNamespace/ObstacleController.hpp"
// Including type: System.Collections.Generic.HashSet`1
#include "System/Collections/Generic/HashSet_1.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly PlayerTransforms _playerTransforms
::GlobalNamespace::PlayerTransforms*& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__playerTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__playerTransforms");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTransforms"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerTransforms**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectManager _beatmapObjectManager
::GlobalNamespace::BeatmapObjectManager*& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__beatmapObjectManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__beatmapObjectManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action headDidEnterObstaclesEvent
::System::Action*& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn_headDidEnterObstaclesEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn_headDidEnterObstaclesEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "headDidEnterObstaclesEvent"))->offset;
return *reinterpret_cast<::System::Action**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<ObstacleController> headDidEnterObstacleEvent
::System::Action_1<::GlobalNamespace::ObstacleController*>*& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn_headDidEnterObstacleEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn_headDidEnterObstacleEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "headDidEnterObstacleEvent"))->offset;
return *reinterpret_cast<::System::Action_1<::GlobalNamespace::ObstacleController*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _lastFrameNumCheck
int& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__lastFrameNumCheck() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__lastFrameNumCheck");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastFrameNumCheck"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.Generic.HashSet`1<ObstacleController> _intersectingObstacles
::System::Collections::Generic::HashSet_1<::GlobalNamespace::ObstacleController*>*& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__intersectingObstacles() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__intersectingObstacles");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_intersectingObstacles"))->offset;
return *reinterpret_cast<::System::Collections::Generic::HashSet_1<::GlobalNamespace::ObstacleController*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _prevFrameNumberOfIntersectingObstaclesCount
int& GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__prevFrameNumberOfIntersectingObstaclesCount() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::dyn__prevFrameNumberOfIntersectingObstaclesCount");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_prevFrameNumberOfIntersectingObstaclesCount"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.get_playerHeadIsInObstacle
bool GlobalNamespace::PlayerHeadAndObstacleInteraction::get_playerHeadIsInObstacle() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::get_playerHeadIsInObstacle");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_playerHeadIsInObstacle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.add_headDidEnterObstaclesEvent
void GlobalNamespace::PlayerHeadAndObstacleInteraction::add_headDidEnterObstaclesEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::add_headDidEnterObstaclesEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_headDidEnterObstaclesEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.remove_headDidEnterObstaclesEvent
void GlobalNamespace::PlayerHeadAndObstacleInteraction::remove_headDidEnterObstaclesEvent(::System::Action* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::remove_headDidEnterObstaclesEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_headDidEnterObstaclesEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.add_headDidEnterObstacleEvent
void GlobalNamespace::PlayerHeadAndObstacleInteraction::add_headDidEnterObstacleEvent(::System::Action_1<::GlobalNamespace::ObstacleController*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::add_headDidEnterObstacleEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_headDidEnterObstacleEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.remove_headDidEnterObstacleEvent
void GlobalNamespace::PlayerHeadAndObstacleInteraction::remove_headDidEnterObstacleEvent(::System::Action_1<::GlobalNamespace::ObstacleController*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::remove_headDidEnterObstacleEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_headDidEnterObstacleEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.RefreshIntersectingObstacles
void GlobalNamespace::PlayerHeadAndObstacleInteraction::RefreshIntersectingObstacles(::UnityEngine::Vector3 worldPos) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::RefreshIntersectingObstacles");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RefreshIntersectingObstacles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(worldPos)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, worldPos);
}
// Autogenerated method: PlayerHeadAndObstacleInteraction.Update
void GlobalNamespace::PlayerHeadAndObstacleInteraction::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeadAndObstacleInteraction::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PrepareLevelCompletionResults
#include "GlobalNamespace/PrepareLevelCompletionResults.hpp"
// Including type: GameplayModifiersModelSO
#include "GlobalNamespace/GameplayModifiersModelSO.hpp"
// Including type: SaberActivityCounter
#include "GlobalNamespace/SaberActivityCounter.hpp"
// Including type: BeatmapObjectExecutionRatingsRecorder
#include "GlobalNamespace/BeatmapObjectExecutionRatingsRecorder.hpp"
// Including type: IScoreController
#include "GlobalNamespace/IScoreController.hpp"
// Including type: GameEnergyCounter
#include "GlobalNamespace/GameEnergyCounter.hpp"
// Including type: IReadonlyBeatmapData
#include "GlobalNamespace/IReadonlyBeatmapData.hpp"
// Including type: AudioTimeSyncController
#include "GlobalNamespace/AudioTimeSyncController.hpp"
// Including type: GameplayModifiers
#include "GlobalNamespace/GameplayModifiers.hpp"
// Including type: ComboController
#include "GlobalNamespace/ComboController.hpp"
// Including type: LevelCompletionResults/LevelEndStateType
#include "GlobalNamespace/LevelCompletionResults.hpp"
// Including type: LevelCompletionResults/LevelEndAction
// Already included the same include: GlobalNamespace/LevelCompletionResults.hpp
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private GameplayModifiersModelSO _gameplayModifiersModelSO
::GlobalNamespace::GameplayModifiersModelSO*& GlobalNamespace::PrepareLevelCompletionResults::dyn__gameplayModifiersModelSO() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__gameplayModifiersModelSO");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameplayModifiersModelSO"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayModifiersModelSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SaberActivityCounter _saberActivityCounter
::GlobalNamespace::SaberActivityCounter*& GlobalNamespace::PrepareLevelCompletionResults::dyn__saberActivityCounter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__saberActivityCounter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberActivityCounter"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberActivityCounter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapObjectExecutionRatingsRecorder _beatmapObjectExecutionRatingsRecorder
::GlobalNamespace::BeatmapObjectExecutionRatingsRecorder*& GlobalNamespace::PrepareLevelCompletionResults::dyn__beatmapObjectExecutionRatingsRecorder() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__beatmapObjectExecutionRatingsRecorder");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectExecutionRatingsRecorder"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapObjectExecutionRatingsRecorder**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IScoreController _scoreController
::GlobalNamespace::IScoreController*& GlobalNamespace::PrepareLevelCompletionResults::dyn__scoreController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__scoreController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_scoreController"))->offset;
return *reinterpret_cast<::GlobalNamespace::IScoreController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameEnergyCounter _gameEnergyCounter
::GlobalNamespace::GameEnergyCounter*& GlobalNamespace::PrepareLevelCompletionResults::dyn__gameEnergyCounter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__gameEnergyCounter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameEnergyCounter"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameEnergyCounter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IReadonlyBeatmapData _beatmapData
::GlobalNamespace::IReadonlyBeatmapData*& GlobalNamespace::PrepareLevelCompletionResults::dyn__beatmapData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__beatmapData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapData"))->offset;
return *reinterpret_cast<::GlobalNamespace::IReadonlyBeatmapData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly AudioTimeSyncController _audioTimeSyncController
::GlobalNamespace::AudioTimeSyncController*& GlobalNamespace::PrepareLevelCompletionResults::dyn__audioTimeSyncController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__audioTimeSyncController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_audioTimeSyncController"))->offset;
return *reinterpret_cast<::GlobalNamespace::AudioTimeSyncController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly GameplayModifiers _gameplayModifiers
::GlobalNamespace::GameplayModifiers*& GlobalNamespace::PrepareLevelCompletionResults::dyn__gameplayModifiers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__gameplayModifiers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_gameplayModifiers"))->offset;
return *reinterpret_cast<::GlobalNamespace::GameplayModifiers**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly ComboController _comboController
::GlobalNamespace::ComboController*& GlobalNamespace::PrepareLevelCompletionResults::dyn__comboController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::dyn__comboController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_comboController"))->offset;
return *reinterpret_cast<::GlobalNamespace::ComboController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PrepareLevelCompletionResults.FillLevelCompletionResults
::GlobalNamespace::LevelCompletionResults* GlobalNamespace::PrepareLevelCompletionResults::FillLevelCompletionResults(::GlobalNamespace::LevelCompletionResults::LevelEndStateType levelEndStateType, ::GlobalNamespace::LevelCompletionResults::LevelEndAction levelEndAction) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PrepareLevelCompletionResults::FillLevelCompletionResults");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FillLevelCompletionResults", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(levelEndStateType), ::il2cpp_utils::ExtractType(levelEndAction)})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::LevelCompletionResults*, false>(this, ___internal__method, levelEndStateType, levelEndAction);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: ShowTextOnGameEventController
#include "GlobalNamespace/ShowTextOnGameEventController.hpp"
// Including type: ShowTextOnGameEventController/EventTextBinding
#include "GlobalNamespace/ShowTextOnGameEventController_EventTextBinding.hpp"
// Including type: TextFadeTransitions
#include "GlobalNamespace/TextFadeTransitions.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private TextFadeTransitions _textFadeTransitions
::GlobalNamespace::TextFadeTransitions*& GlobalNamespace::ShowTextOnGameEventController::dyn__textFadeTransitions() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::dyn__textFadeTransitions");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textFadeTransitions"))->offset;
return *reinterpret_cast<::GlobalNamespace::TextFadeTransitions**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private ShowTextOnGameEventController/EventTextBinding[] _eventTextBindings
::ArrayW<::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding*>& GlobalNamespace::ShowTextOnGameEventController::dyn__eventTextBindings() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::dyn__eventTextBindings");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_eventTextBindings"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ShowTextOnGameEventController.Awake
void GlobalNamespace::ShowTextOnGameEventController::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ShowTextOnGameEventController.OnDestroy
void GlobalNamespace::ShowTextOnGameEventController::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: ShowTextOnGameEventController/EventTextBinding
#include "GlobalNamespace/ShowTextOnGameEventController_EventTextBinding.hpp"
// Including type: Signal
#include "GlobalNamespace/Signal.hpp"
// Including type: TextFadeTransitions
#include "GlobalNamespace/TextFadeTransitions.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private Signal _signal
::GlobalNamespace::Signal*& GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__signal() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__signal");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_signal"))->offset;
return *reinterpret_cast<::GlobalNamespace::Signal**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _text
::StringW& GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__text() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_text"))->offset;
return *reinterpret_cast<::StringW*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private TextFadeTransitions _textFadeTransitions
::GlobalNamespace::TextFadeTransitions*& GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__textFadeTransitions() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::dyn__textFadeTransitions");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_textFadeTransitions"))->offset;
return *reinterpret_cast<::GlobalNamespace::TextFadeTransitions**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ShowTextOnGameEventController/EventTextBinding.Init
void GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::Init(::GlobalNamespace::TextFadeTransitions* textFadeTransitions) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::Init");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Init", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(textFadeTransitions)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, textFadeTransitions);
}
// Autogenerated method: ShowTextOnGameEventController/EventTextBinding.Deinit
void GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::Deinit() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::Deinit");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Deinit", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: ShowTextOnGameEventController/EventTextBinding.HandleGameEvent
void GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::HandleGameEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::ShowTextOnGameEventController::EventTextBinding::HandleGameEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleGameEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerSpaceConvertor
#include "GlobalNamespace/PlayerSpaceConvertor.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _worldToPlayerSpaceRotation
::UnityEngine::Quaternion& GlobalNamespace::PlayerSpaceConvertor::dyn__worldToPlayerSpaceRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerSpaceConvertor::dyn__worldToPlayerSpaceRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_worldToPlayerSpaceRotation"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerSpaceConvertor.get_worldToPlayerSpaceRotation
::UnityEngine::Quaternion GlobalNamespace::PlayerSpaceConvertor::get_worldToPlayerSpaceRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerSpaceConvertor::get_worldToPlayerSpaceRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_worldToPlayerSpaceRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: PlayerSpaceConvertor.Start
void GlobalNamespace::PlayerSpaceConvertor::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerSpaceConvertor::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerTransforms
#include "GlobalNamespace/PlayerTransforms.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _headTransform
::UnityEngine::Transform*& GlobalNamespace::PlayerTransforms::dyn__headTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__headTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_headTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _originTransform
::UnityEngine::Transform*& GlobalNamespace::PlayerTransforms::dyn__originTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__originTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_originTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _leftHandTransform
::UnityEngine::Transform*& GlobalNamespace::PlayerTransforms::dyn__leftHandTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__leftHandTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leftHandTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _rightHandTransform
::UnityEngine::Transform*& GlobalNamespace::PlayerTransforms::dyn__rightHandTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__rightHandTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rightHandTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _overrideHeadPos
bool& GlobalNamespace::PlayerTransforms::dyn__overrideHeadPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__overrideHeadPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_overrideHeadPos"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _overriddenHeadPos
::UnityEngine::Vector3& GlobalNamespace::PlayerTransforms::dyn__overriddenHeadPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__overriddenHeadPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_overriddenHeadPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _headWorldPos
::UnityEngine::Vector3& GlobalNamespace::PlayerTransforms::dyn__headWorldPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__headWorldPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_headWorldPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _headWorldRot
::UnityEngine::Quaternion& GlobalNamespace::PlayerTransforms::dyn__headWorldRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__headWorldRot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_headWorldRot"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _headPseudoLocalPos
::UnityEngine::Vector3& GlobalNamespace::PlayerTransforms::dyn__headPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__headPseudoLocalPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_headPseudoLocalPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _headPseudoLocalRot
::UnityEngine::Quaternion& GlobalNamespace::PlayerTransforms::dyn__headPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__headPseudoLocalRot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_headPseudoLocalRot"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _leftHandPseudoLocalPos
::UnityEngine::Vector3& GlobalNamespace::PlayerTransforms::dyn__leftHandPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__leftHandPseudoLocalPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leftHandPseudoLocalPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _leftHandPseudoLocalRot
::UnityEngine::Quaternion& GlobalNamespace::PlayerTransforms::dyn__leftHandPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__leftHandPseudoLocalRot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leftHandPseudoLocalRot"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _rightHandPseudoLocalPos
::UnityEngine::Vector3& GlobalNamespace::PlayerTransforms::dyn__rightHandPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__rightHandPseudoLocalPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rightHandPseudoLocalPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _rightHandPseudoLocalRot
::UnityEngine::Quaternion& GlobalNamespace::PlayerTransforms::dyn__rightHandPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__rightHandPseudoLocalRot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rightHandPseudoLocalRot"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _originParentTransform
::UnityEngine::Transform*& GlobalNamespace::PlayerTransforms::dyn__originParentTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__originParentTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_originParentTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _useOriginParentTransformForPseudoLocalCalculations
bool& GlobalNamespace::PlayerTransforms::dyn__useOriginParentTransformForPseudoLocalCalculations() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::dyn__useOriginParentTransformForPseudoLocalCalculations");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_useOriginParentTransformForPseudoLocalCalculations"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerTransforms.get_headWorldPos
::UnityEngine::Vector3 GlobalNamespace::PlayerTransforms::get_headWorldPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_headWorldPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_headWorldPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_headWorldRot
::UnityEngine::Quaternion GlobalNamespace::PlayerTransforms::get_headWorldRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_headWorldRot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_headWorldRot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_headPseudoLocalPos
::UnityEngine::Vector3 GlobalNamespace::PlayerTransforms::get_headPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_headPseudoLocalPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_headPseudoLocalPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_headPseudoLocalRot
::UnityEngine::Quaternion GlobalNamespace::PlayerTransforms::get_headPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_headPseudoLocalRot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_headPseudoLocalRot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_leftHandPseudoLocalPos
::UnityEngine::Vector3 GlobalNamespace::PlayerTransforms::get_leftHandPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_leftHandPseudoLocalPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_leftHandPseudoLocalPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_leftHandPseudoLocalRot
::UnityEngine::Quaternion GlobalNamespace::PlayerTransforms::get_leftHandPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_leftHandPseudoLocalRot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_leftHandPseudoLocalRot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_rightHandPseudoLocalPos
::UnityEngine::Vector3 GlobalNamespace::PlayerTransforms::get_rightHandPseudoLocalPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_rightHandPseudoLocalPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_rightHandPseudoLocalPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.get_rightHandPseudoLocalRot
::UnityEngine::Quaternion GlobalNamespace::PlayerTransforms::get_rightHandPseudoLocalRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::get_rightHandPseudoLocalRot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_rightHandPseudoLocalRot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.Awake
void GlobalNamespace::PlayerTransforms::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.OverrideHeadPos
void GlobalNamespace::PlayerTransforms::OverrideHeadPos(::UnityEngine::Vector3 pos) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::OverrideHeadPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OverrideHeadPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pos)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, pos);
}
// Autogenerated method: PlayerTransforms.Update
void GlobalNamespace::PlayerTransforms::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerTransforms.MoveTowardsHead
float GlobalNamespace::PlayerTransforms::MoveTowardsHead(float start, float end, ::UnityEngine::Quaternion noteInverseWorldRotation, float t) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::MoveTowardsHead");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveTowardsHead", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(start), ::il2cpp_utils::ExtractType(end), ::il2cpp_utils::ExtractType(noteInverseWorldRotation), ::il2cpp_utils::ExtractType(t)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, start, end, noteInverseWorldRotation, t);
}
// Autogenerated method: PlayerTransforms.GetZPosOffsetByHeadPosAtTime
float GlobalNamespace::PlayerTransforms::GetZPosOffsetByHeadPosAtTime(float start, float end, float t) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::GetZPosOffsetByHeadPosAtTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetZPosOffsetByHeadPosAtTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(start), ::il2cpp_utils::ExtractType(end), ::il2cpp_utils::ExtractType(t)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, start, end, t);
}
// Autogenerated method: PlayerTransforms.GetZPos
float GlobalNamespace::PlayerTransforms::GetZPos(float start, float end, float headOffsetZ, float t) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::GetZPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetZPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(start), ::il2cpp_utils::ExtractType(end), ::il2cpp_utils::ExtractType(headOffsetZ), ::il2cpp_utils::ExtractType(t)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, start, end, headOffsetZ, t);
}
// Autogenerated method: PlayerTransforms.HeadOffsetZ
float GlobalNamespace::PlayerTransforms::HeadOffsetZ(::UnityEngine::Quaternion noteInverseWorldRotation) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerTransforms::HeadOffsetZ");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HeadOffsetZ", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(noteInverseWorldRotation)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method, noteInverseWorldRotation);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerVRControllersManager
#include "GlobalNamespace/PlayerVRControllersManager.hpp"
// Including type: VRController
#include "GlobalNamespace/VRController.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private VRController _leftHandVRController
::GlobalNamespace::VRController*& GlobalNamespace::PlayerVRControllersManager::dyn__leftHandVRController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerVRControllersManager::dyn__leftHandVRController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_leftHandVRController"))->offset;
return *reinterpret_cast<::GlobalNamespace::VRController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private VRController _rightHandVRController
::GlobalNamespace::VRController*& GlobalNamespace::PlayerVRControllersManager::dyn__rightHandVRController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerVRControllersManager::dyn__rightHandVRController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_rightHandVRController"))->offset;
return *reinterpret_cast<::GlobalNamespace::VRController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerVRControllersManager.get_leftHandVRController
::GlobalNamespace::VRController* GlobalNamespace::PlayerVRControllersManager::get_leftHandVRController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerVRControllersManager::get_leftHandVRController");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_leftHandVRController", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::VRController*, false>(this, ___internal__method);
}
// Autogenerated method: PlayerVRControllersManager.get_rightHandVRController
::GlobalNamespace::VRController* GlobalNamespace::PlayerVRControllersManager::get_rightHandVRController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerVRControllersManager::get_rightHandVRController");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_rightHandVRController", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::VRController*, false>(this, ___internal__method);
}
// Autogenerated method: PlayerVRControllersManager.DisableAllVRControllers
void GlobalNamespace::PlayerVRControllersManager::DisableAllVRControllers() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerVRControllersManager::DisableAllVRControllers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DisableAllVRControllers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerHeightDetector
#include "GlobalNamespace/PlayerHeightDetector.hpp"
// Including type: PlayerHeightDetector/InitData
#include "GlobalNamespace/PlayerHeightDetector_InitData.hpp"
// Including type: PlayerTransforms
#include "GlobalNamespace/PlayerTransforms.hpp"
// Including type: BeatmapCallbacksController
#include "GlobalNamespace/BeatmapCallbacksController.hpp"
// Including type: IAudioTimeSource
#include "GlobalNamespace/IAudioTimeSource.hpp"
// Including type: System.Action`1
#include "System/Action_1.hpp"
// Including type: BeatmapDataCallbackWrapper
#include "GlobalNamespace/BeatmapDataCallbackWrapper.hpp"
// Including type: ObstacleData
#include "GlobalNamespace/ObstacleData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly PlayerTransforms _playerTransforms
::GlobalNamespace::PlayerTransforms*& GlobalNamespace::PlayerHeightDetector::dyn__playerTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__playerTransforms");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerTransforms"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerTransforms**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly BeatmapCallbacksController _beatmapCallbacksController
::GlobalNamespace::BeatmapCallbacksController*& GlobalNamespace::PlayerHeightDetector::dyn__beatmapCallbacksController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__beatmapCallbacksController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapCallbacksController"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapCallbacksController**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly IAudioTimeSource _audioTimeSyncController
::GlobalNamespace::IAudioTimeSource*& GlobalNamespace::PlayerHeightDetector::dyn__audioTimeSyncController() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__audioTimeSyncController");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_audioTimeSyncController"))->offset;
return *reinterpret_cast<::GlobalNamespace::IAudioTimeSource**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly PlayerHeightDetector/InitData _initData
::GlobalNamespace::PlayerHeightDetector::InitData*& GlobalNamespace::PlayerHeightDetector::dyn__initData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__initData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_initData"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerHeightDetector::InitData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Action`1<System.Single> playerHeightDidChangeEvent
::System::Action_1<float>*& GlobalNamespace::PlayerHeightDetector::dyn_playerHeightDidChangeEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn_playerHeightDidChangeEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "playerHeightDidChangeEvent"))->offset;
return *reinterpret_cast<::System::Action_1<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private BeatmapDataCallbackWrapper _beatmapObjectCallbackWrapper
::GlobalNamespace::BeatmapDataCallbackWrapper*& GlobalNamespace::PlayerHeightDetector::dyn__beatmapObjectCallbackWrapper() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__beatmapObjectCallbackWrapper");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_beatmapObjectCallbackWrapper"))->offset;
return *reinterpret_cast<::GlobalNamespace::BeatmapDataCallbackWrapper**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _noTopObstaclesStartTime
float& GlobalNamespace::PlayerHeightDetector::dyn__noTopObstaclesStartTime() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__noTopObstaclesStartTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_noTopObstaclesStartTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _computedPlayerHeight
float& GlobalNamespace::PlayerHeightDetector::dyn__computedPlayerHeight() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__computedPlayerHeight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_computedPlayerHeight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _changeWeight
float& GlobalNamespace::PlayerHeightDetector::dyn__changeWeight() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__changeWeight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_changeWeight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _lastReportedHeight
float& GlobalNamespace::PlayerHeightDetector::dyn__lastReportedHeight() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::dyn__lastReportedHeight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_lastReportedHeight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerHeightDetector.get_playerHeight
float GlobalNamespace::PlayerHeightDetector::get_playerHeight() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::get_playerHeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_playerHeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightDetector.add_playerHeightDidChangeEvent
void GlobalNamespace::PlayerHeightDetector::add_playerHeightDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::add_playerHeightDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_playerHeightDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeightDetector.remove_playerHeightDidChangeEvent
void GlobalNamespace::PlayerHeightDetector::remove_playerHeightDidChangeEvent(::System::Action_1<float>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::remove_playerHeightDidChangeEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_playerHeightDidChangeEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: PlayerHeightDetector.Start
void GlobalNamespace::PlayerHeightDetector::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightDetector.OnDestroy
void GlobalNamespace::PlayerHeightDetector::OnDestroy() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::OnDestroy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDestroy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightDetector.LateUpdate
void GlobalNamespace::PlayerHeightDetector::LateUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::LateUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightDetector.BeatmapObjectSpawnCallback
void GlobalNamespace::PlayerHeightDetector::BeatmapObjectSpawnCallback(::GlobalNamespace::ObstacleData* obstacleData) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::BeatmapObjectSpawnCallback");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeatmapObjectSpawnCallback", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obstacleData)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, obstacleData);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerHeightDetector/InitData
#include "GlobalNamespace/PlayerHeightDetector_InitData.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public readonly System.Single headPosToPlayerHeightOffset
float& GlobalNamespace::PlayerHeightDetector::InitData::dyn_headPosToPlayerHeightOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::InitData::dyn_headPosToPlayerHeightOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "headPosToPlayerHeightOffset"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public readonly System.Single startPlayerHeight
float& GlobalNamespace::PlayerHeightDetector::InitData::dyn_startPlayerHeight() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightDetector::InitData::dyn_startPlayerHeight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "startPlayerHeight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: PlayerHeightToJumpOffsetYProvider
#include "GlobalNamespace/PlayerHeightToJumpOffsetYProvider.hpp"
// Including type: PlayerHeightDetector
#include "GlobalNamespace/PlayerHeightDetector.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly PlayerHeightDetector _playerHeightDetector
::GlobalNamespace::PlayerHeightDetector*& GlobalNamespace::PlayerHeightToJumpOffsetYProvider::dyn__playerHeightDetector() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::dyn__playerHeightDetector");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_playerHeightDetector"))->offset;
return *reinterpret_cast<::GlobalNamespace::PlayerHeightDetector**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _jumpOffsetY
float& GlobalNamespace::PlayerHeightToJumpOffsetYProvider::dyn__jumpOffsetY() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::dyn__jumpOffsetY");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_jumpOffsetY"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: PlayerHeightToJumpOffsetYProvider.get_jumpOffsetY
float GlobalNamespace::PlayerHeightToJumpOffsetYProvider::get_jumpOffsetY() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::get_jumpOffsetY");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_jumpOffsetY", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightToJumpOffsetYProvider.Initialize
void GlobalNamespace::PlayerHeightToJumpOffsetYProvider::Initialize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::Initialize");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initialize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightToJumpOffsetYProvider.Dispose
void GlobalNamespace::PlayerHeightToJumpOffsetYProvider::Dispose() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::Dispose");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: PlayerHeightToJumpOffsetYProvider.HandlePlayerHeightDidChange
void GlobalNamespace::PlayerHeightToJumpOffsetYProvider::HandlePlayerHeightDidChange(float playerHeight) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::HandlePlayerHeightDidChange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandlePlayerHeightDidChange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(playerHeight)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, playerHeight);
}
// Autogenerated method: PlayerHeightToJumpOffsetYProvider.JumpOffsetYForPlayerHeight
float GlobalNamespace::PlayerHeightToJumpOffsetYProvider::JumpOffsetYForPlayerHeight(float playerHeight) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::PlayerHeightToJumpOffsetYProvider::JumpOffsetYForPlayerHeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "PlayerHeightToJumpOffsetYProvider", "JumpOffsetYForPlayerHeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(playerHeight)})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method, playerHeight);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: BlocksBlade
#include "GlobalNamespace/BlocksBlade.hpp"
// Including type: BlocksBlade/Element
#include "GlobalNamespace/BlocksBlade_Element.hpp"
// Including type: UnityEngine.Mesh
#include "UnityEngine/Mesh.hpp"
// Including type: UnityEngine.Material
#include "UnityEngine/Material.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: UnityEngine.MaterialPropertyBlock
#include "UnityEngine/MaterialPropertyBlock.hpp"
// Including type: UnityEngine.Vector2
#include "UnityEngine/Vector2.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0x1255C08
// Autogenerated static field getter
// Get static field: static private readonly System.Int32 _positionPropertyID
int GlobalNamespace::BlocksBlade::_get__positionPropertyID() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_get__positionPropertyID");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "BlocksBlade", "_positionPropertyID"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Int32 _positionPropertyID
void GlobalNamespace::BlocksBlade::_set__positionPropertyID(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_set__positionPropertyID");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "BlocksBlade", "_positionPropertyID", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0x1255C18
// Autogenerated static field getter
// Get static field: static private readonly System.Int32 _sizePropertyID
int GlobalNamespace::BlocksBlade::_get__sizePropertyID() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_get__sizePropertyID");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "BlocksBlade", "_sizePropertyID"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Int32 _sizePropertyID
void GlobalNamespace::BlocksBlade::_set__sizePropertyID(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_set__sizePropertyID");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "BlocksBlade", "_sizePropertyID", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0x1255C28
// Autogenerated static field getter
// Get static field: static private readonly System.Int32 _colorPropertyID
int GlobalNamespace::BlocksBlade::_get__colorPropertyID() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_get__colorPropertyID");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "BlocksBlade", "_colorPropertyID"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Int32 _colorPropertyID
void GlobalNamespace::BlocksBlade::_set__colorPropertyID(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_set__colorPropertyID");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "BlocksBlade", "_colorPropertyID", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0x1255C38
// Autogenerated static field getter
// Get static field: static private readonly System.Int32 _zClipPropertyID
int GlobalNamespace::BlocksBlade::_get__zClipPropertyID() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_get__zClipPropertyID");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "BlocksBlade", "_zClipPropertyID"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Int32 _zClipPropertyID
void GlobalNamespace::BlocksBlade::_set__zClipPropertyID(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::_set__zClipPropertyID");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "BlocksBlade", "_zClipPropertyID", value));
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Mesh _elementMesh
::UnityEngine::Mesh*& GlobalNamespace::BlocksBlade::dyn__elementMesh() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__elementMesh");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_elementMesh"))->offset;
return *reinterpret_cast<::UnityEngine::Mesh**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Material _material
::UnityEngine::Material*& GlobalNamespace::BlocksBlade::dyn__material() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__material");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_material"))->offset;
return *reinterpret_cast<::UnityEngine::Material**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _numberOfElements
int& GlobalNamespace::BlocksBlade::dyn__numberOfElements() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__numberOfElements");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_numberOfElements"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _radius
float& GlobalNamespace::BlocksBlade::dyn__radius() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__radius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_radius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _length
float& GlobalNamespace::BlocksBlade::dyn__length() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__length");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_length"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _minVelocity
float& GlobalNamespace::BlocksBlade::dyn__minVelocity() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__minVelocity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_minVelocity"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _maxVelocity
float& GlobalNamespace::BlocksBlade::dyn__maxVelocity() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__maxVelocity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maxVelocity"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _elementWidth
float& GlobalNamespace::BlocksBlade::dyn__elementWidth() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__elementWidth");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_elementWidth"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _minElementLength
float& GlobalNamespace::BlocksBlade::dyn__minElementLength() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__minElementLength");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_minElementLength"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _maxElementLength
float& GlobalNamespace::BlocksBlade::dyn__maxElementLength() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__maxElementLength");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_maxElementLength"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color <color>k__BackingField
::UnityEngine::Color& GlobalNamespace::BlocksBlade::dyn_$color$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn_$color$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<color>k__BackingField"))->offset;
return *reinterpret_cast<::UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.List`1<BlocksBlade/Element> _elements
::System::Collections::Generic::List_1<::GlobalNamespace::BlocksBlade::Element*>*& GlobalNamespace::BlocksBlade::dyn__elements() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__elements");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_elements"))->offset;
return *reinterpret_cast<::System::Collections::Generic::List_1<::GlobalNamespace::BlocksBlade::Element*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector4[] _positions
::ArrayW<::UnityEngine::Vector4>& GlobalNamespace::BlocksBlade::dyn__positions() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__positions");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_positions"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Vector4>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector4[] _sizes
::ArrayW<::UnityEngine::Vector4>& GlobalNamespace::BlocksBlade::dyn__sizes() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__sizes");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_sizes"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Vector4>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector4[] _colors
::ArrayW<::UnityEngine::Vector4>& GlobalNamespace::BlocksBlade::dyn__colors() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__colors");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colors"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Vector4>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Matrix4x4[] _matrices
::ArrayW<::UnityEngine::Matrix4x4>& GlobalNamespace::BlocksBlade::dyn__matrices() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__matrices");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_matrices"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Matrix4x4>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.MaterialPropertyBlock _materialPropertyBlock
::UnityEngine::MaterialPropertyBlock*& GlobalNamespace::BlocksBlade::dyn__materialPropertyBlock() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__materialPropertyBlock");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_materialPropertyBlock"))->offset;
return *reinterpret_cast<::UnityEngine::MaterialPropertyBlock**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 _layer
int& GlobalNamespace::BlocksBlade::dyn__layer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::dyn__layer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_layer"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: BlocksBlade.get_color
::UnityEngine::Color GlobalNamespace::BlocksBlade::get_color() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::get_color");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Color, false>(this, ___internal__method);
}
// Autogenerated method: BlocksBlade.set_color
void GlobalNamespace::BlocksBlade::set_color(::UnityEngine::Color value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::set_color");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: BlocksBlade.Start
void GlobalNamespace::BlocksBlade::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: BlocksBlade.Update
void GlobalNamespace::BlocksBlade::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: BlocksBlade.SetUpElement
void GlobalNamespace::BlocksBlade::SetUpElement(::GlobalNamespace::BlocksBlade::Element* element, float velocity, ::UnityEngine::Color color) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::SetUpElement");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetUpElement", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(element), ::il2cpp_utils::ExtractType(velocity), ::il2cpp_utils::ExtractType(color)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, element, velocity, color);
}
// Autogenerated method: BlocksBlade.RandomPointOnCircle
::UnityEngine::Vector2 GlobalNamespace::BlocksBlade::RandomPointOnCircle(float radius) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::RandomPointOnCircle");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RandomPointOnCircle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(radius)})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector2, false>(this, ___internal__method, radius);
}
// Autogenerated method: BlocksBlade..cctor
void GlobalNamespace::BlocksBlade::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "BlocksBlade", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(static_cast<Il2CppObject*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: BlocksBlade/Element
#include "GlobalNamespace/BlocksBlade_Element.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Int32 idx
int& GlobalNamespace::BlocksBlade::Element::dyn_idx() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::Element::dyn_idx");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "idx"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single velocity
float& GlobalNamespace::BlocksBlade::Element::dyn_velocity() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BlocksBlade::Element::dyn_velocity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "velocity"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: BoxCuttableBySaber
#include "GlobalNamespace/BoxCuttableBySaber.hpp"
// Including type: UnityEngine.BoxCollider
#include "UnityEngine/BoxCollider.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.BoxCollider _collider
::UnityEngine::BoxCollider*& GlobalNamespace::BoxCuttableBySaber::dyn__collider() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::dyn__collider");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_collider"))->offset;
return *reinterpret_cast<::UnityEngine::BoxCollider**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _canBeCut
bool& GlobalNamespace::BoxCuttableBySaber::dyn__canBeCut() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::dyn__canBeCut");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_canBeCut"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _radius
float& GlobalNamespace::BoxCuttableBySaber::dyn__radius() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::dyn__radius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_radius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: BoxCuttableBySaber.get_colliderSize
::UnityEngine::Vector3 GlobalNamespace::BoxCuttableBySaber::get_colliderSize() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::get_colliderSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colliderSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.set_colliderSize
void GlobalNamespace::BoxCuttableBySaber::set_colliderSize(::UnityEngine::Vector3 value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::set_colliderSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_colliderSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: BoxCuttableBySaber.get_colliderCenter
::UnityEngine::Vector3 GlobalNamespace::BoxCuttableBySaber::get_colliderCenter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::get_colliderCenter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colliderCenter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.set_colliderCenter
void GlobalNamespace::BoxCuttableBySaber::set_colliderCenter(::UnityEngine::Vector3 value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::set_colliderCenter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_colliderCenter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: BoxCuttableBySaber.Awake
void GlobalNamespace::BoxCuttableBySaber::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.SetColliderCenterAndSize
void GlobalNamespace::BoxCuttableBySaber::SetColliderCenterAndSize(::UnityEngine::Vector3 center, ::UnityEngine::Vector3 size) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::SetColliderCenterAndSize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetColliderCenterAndSize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(center), ::il2cpp_utils::ExtractType(size)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, center, size);
}
// Autogenerated method: BoxCuttableBySaber.RefreshRadius
void GlobalNamespace::BoxCuttableBySaber::RefreshRadius() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::RefreshRadius");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "RefreshRadius", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.get_radius
float GlobalNamespace::BoxCuttableBySaber::get_radius() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::get_radius");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_radius", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.get_canBeCut
bool GlobalNamespace::BoxCuttableBySaber::get_canBeCut() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::get_canBeCut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_canBeCut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: BoxCuttableBySaber.set_canBeCut
void GlobalNamespace::BoxCuttableBySaber::set_canBeCut(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::set_canBeCut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_canBeCut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: BoxCuttableBySaber.Cut
void GlobalNamespace::BoxCuttableBySaber::Cut(::GlobalNamespace::Saber* saber, ::UnityEngine::Vector3 cutPoint, ::UnityEngine::Quaternion orientation, ::UnityEngine::Vector3 cutDirVec) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::BoxCuttableBySaber::Cut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Cut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber), ::il2cpp_utils::ExtractType(cutPoint), ::il2cpp_utils::ExtractType(orientation), ::il2cpp_utils::ExtractType(cutDirVec)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, saber, cutPoint, orientation, cutDirVec);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: CuttableBySaber
#include "GlobalNamespace/CuttableBySaber.hpp"
// Including type: CuttableBySaber/WasCutBySaberDelegate
#include "GlobalNamespace/CuttableBySaber_WasCutBySaberDelegate.hpp"
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private CuttableBySaber/WasCutBySaberDelegate wasCutBySaberEvent
::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate*& GlobalNamespace::CuttableBySaber::dyn_wasCutBySaberEvent() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::dyn_wasCutBySaberEvent");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "wasCutBySaberEvent"))->offset;
return *reinterpret_cast<::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: CuttableBySaber.get_canBeCut
bool GlobalNamespace::CuttableBySaber::get_canBeCut() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::get_canBeCut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_canBeCut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<bool, false>(this, ___internal__method);
}
// Autogenerated method: CuttableBySaber.set_canBeCut
void GlobalNamespace::CuttableBySaber::set_canBeCut(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::set_canBeCut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_canBeCut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: CuttableBySaber.get_radius
float GlobalNamespace::CuttableBySaber::get_radius() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::get_radius");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_radius", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: CuttableBySaber.add_wasCutBySaberEvent
void GlobalNamespace::CuttableBySaber::add_wasCutBySaberEvent(::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::add_wasCutBySaberEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "add_wasCutBySaberEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: CuttableBySaber.remove_wasCutBySaberEvent
void GlobalNamespace::CuttableBySaber::remove_wasCutBySaberEvent(::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate* value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::remove_wasCutBySaberEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "remove_wasCutBySaberEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, value);
}
// Autogenerated method: CuttableBySaber.CallWasCutBySaberEvent
void GlobalNamespace::CuttableBySaber::CallWasCutBySaberEvent(::GlobalNamespace::Saber* saber, ::UnityEngine::Vector3 cutPoint, ::UnityEngine::Quaternion orientation, ::UnityEngine::Vector3 cutDirVec) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::CallWasCutBySaberEvent");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CallWasCutBySaberEvent", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber), ::il2cpp_utils::ExtractType(cutPoint), ::il2cpp_utils::ExtractType(orientation), ::il2cpp_utils::ExtractType(cutDirVec)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, saber, cutPoint, orientation, cutDirVec);
}
// Autogenerated method: CuttableBySaber.Cut
void GlobalNamespace::CuttableBySaber::Cut(::GlobalNamespace::Saber* saber, ::UnityEngine::Vector3 cutPoint, ::UnityEngine::Quaternion orientation, ::UnityEngine::Vector3 cutDirVec) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::Cut");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Cut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber), ::il2cpp_utils::ExtractType(cutPoint), ::il2cpp_utils::ExtractType(orientation), ::il2cpp_utils::ExtractType(cutDirVec)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, saber, cutPoint, orientation, cutDirVec);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: CuttableBySaber/WasCutBySaberDelegate
#include "GlobalNamespace/CuttableBySaber_WasCutBySaberDelegate.hpp"
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: System.IAsyncResult
#include "System/IAsyncResult.hpp"
// Including type: System.AsyncCallback
#include "System/AsyncCallback.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: CuttableBySaber/WasCutBySaberDelegate.Invoke
void GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::Invoke(::GlobalNamespace::Saber* saber, ::UnityEngine::Vector3 cutPoint, ::UnityEngine::Quaternion orientation, ::UnityEngine::Vector3 cutDirVec) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::Invoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Invoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber), ::il2cpp_utils::ExtractType(cutPoint), ::il2cpp_utils::ExtractType(orientation), ::il2cpp_utils::ExtractType(cutDirVec)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, saber, cutPoint, orientation, cutDirVec);
}
// Autogenerated method: CuttableBySaber/WasCutBySaberDelegate.BeginInvoke
::System::IAsyncResult* GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::BeginInvoke(::GlobalNamespace::Saber* saber, ::UnityEngine::Vector3 cutPoint, ::UnityEngine::Quaternion orientation, ::UnityEngine::Vector3 cutDirVec, ::System::AsyncCallback* callback, ::Il2CppObject* object) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::BeginInvoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeginInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber), ::il2cpp_utils::ExtractType(cutPoint), ::il2cpp_utils::ExtractType(orientation), ::il2cpp_utils::ExtractType(cutDirVec), ::il2cpp_utils::ExtractType(callback), ::il2cpp_utils::ExtractType(object)})));
return ::il2cpp_utils::RunMethodRethrow<::System::IAsyncResult*, false>(this, ___internal__method, saber, cutPoint, orientation, cutDirVec, callback, object);
}
// Autogenerated method: CuttableBySaber/WasCutBySaberDelegate.EndInvoke
void GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::EndInvoke(::System::IAsyncResult* result) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttableBySaber::WasCutBySaberDelegate::EndInvoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "EndInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, result);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: CuttingManager
#include "GlobalNamespace/CuttingManager.hpp"
// Including type: SaberManager
#include "GlobalNamespace/SaberManager.hpp"
// Including type: NoteCutter
#include "GlobalNamespace/NoteCutter.hpp"
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private SaberManager _saberManager
::GlobalNamespace::SaberManager*& GlobalNamespace::CuttingManager::dyn__saberManager() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttingManager::dyn__saberManager");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberManager"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberManager**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly NoteCutter _noteCutter
::GlobalNamespace::NoteCutter*& GlobalNamespace::CuttingManager::dyn__noteCutter() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttingManager::dyn__noteCutter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_noteCutter"))->offset;
return *reinterpret_cast<::GlobalNamespace::NoteCutter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: CuttingManager.OnEnable
void GlobalNamespace::CuttingManager::OnEnable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttingManager::OnEnable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnEnable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: CuttingManager.OnDisable
void GlobalNamespace::CuttingManager::OnDisable() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttingManager::OnDisable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDisable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: CuttingManager.HandleSaberManagerDidUpdateSaberPositions
void GlobalNamespace::CuttingManager::HandleSaberManagerDidUpdateSaberPositions(::GlobalNamespace::Saber* leftSaber, ::GlobalNamespace::Saber* rightSaber) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::CuttingManager::HandleSaberManagerDidUpdateSaberPositions");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HandleSaberManagerDidUpdateSaberPositions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(leftSaber), ::il2cpp_utils::ExtractType(rightSaber)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, leftSaber, rightSaber);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MovementHistoryRecorder
#include "GlobalNamespace/MovementHistoryRecorder.hpp"
// Including type: AveragingValueRecorder
#include "GlobalNamespace/AveragingValueRecorder.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private AveragingValueRecorder _averagingValueRecorer
::GlobalNamespace::AveragingValueRecorder*& GlobalNamespace::MovementHistoryRecorder::dyn__averagingValueRecorer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::dyn__averagingValueRecorer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_averagingValueRecorer"))->offset;
return *reinterpret_cast<::GlobalNamespace::AveragingValueRecorder**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _increaseSpeed
float& GlobalNamespace::MovementHistoryRecorder::dyn__increaseSpeed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::dyn__increaseSpeed");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_increaseSpeed"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _decreaseSpeed
float& GlobalNamespace::MovementHistoryRecorder::dyn__decreaseSpeed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::dyn__decreaseSpeed");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_decreaseSpeed"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single _accum
float& GlobalNamespace::MovementHistoryRecorder::dyn__accum() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::dyn__accum");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_accum"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MovementHistoryRecorder.get_averagingValueRecorer
::GlobalNamespace::AveragingValueRecorder* GlobalNamespace::MovementHistoryRecorder::get_averagingValueRecorer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::get_averagingValueRecorer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_averagingValueRecorer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::AveragingValueRecorder*, false>(this, ___internal__method);
}
// Autogenerated method: MovementHistoryRecorder.AddMovement
void GlobalNamespace::MovementHistoryRecorder::AddMovement(float distance) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::AddMovement");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddMovement", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(distance)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, distance);
}
// Autogenerated method: MovementHistoryRecorder.ManualUpdate
void GlobalNamespace::MovementHistoryRecorder::ManualUpdate(float deltaTime) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::MovementHistoryRecorder::ManualUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ManualUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(deltaTime)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, deltaTime);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: NoteCutter
#include "GlobalNamespace/NoteCutter.hpp"
// Including type: NoteCutter/CuttableBySaberSortParams
#include "GlobalNamespace/NoteCutter_CuttableBySaberSortParams.hpp"
// Including type: NoteCutter/CuttableBySaberSortParamsComparer
#include "GlobalNamespace/NoteCutter_CuttableBySaberSortParamsComparer.hpp"
// Including type: UnityEngine.Collider
#include "UnityEngine/Collider.hpp"
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private System.Int32 kMaxNumberOfColliders
int GlobalNamespace::NoteCutter::_get_kMaxNumberOfColliders() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::_get_kMaxNumberOfColliders");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "NoteCutter", "kMaxNumberOfColliders"));
}
// Autogenerated static field setter
// Set static field: static private System.Int32 kMaxNumberOfColliders
void GlobalNamespace::NoteCutter::_set_kMaxNumberOfColliders(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::_set_kMaxNumberOfColliders");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "NoteCutter", "kMaxNumberOfColliders", value));
}
// Autogenerated instance field getter
// Get instance field: private readonly UnityEngine.Collider[] _colliders
::ArrayW<::UnityEngine::Collider*>& GlobalNamespace::NoteCutter::dyn__colliders() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::dyn__colliders");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colliders"))->offset;
return *reinterpret_cast<::ArrayW<::UnityEngine::Collider*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly NoteCutter/CuttableBySaberSortParams[] _cuttableBySaberSortParams
::ArrayW<::GlobalNamespace::NoteCutter::CuttableBySaberSortParams*>& GlobalNamespace::NoteCutter::dyn__cuttableBySaberSortParams() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::dyn__cuttableBySaberSortParams");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_cuttableBySaberSortParams"))->offset;
return *reinterpret_cast<::ArrayW<::GlobalNamespace::NoteCutter::CuttableBySaberSortParams*>*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly NoteCutter/CuttableBySaberSortParamsComparer _comparer
::GlobalNamespace::NoteCutter::CuttableBySaberSortParamsComparer*& GlobalNamespace::NoteCutter::dyn__comparer() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::dyn__comparer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_comparer"))->offset;
return *reinterpret_cast<::GlobalNamespace::NoteCutter::CuttableBySaberSortParamsComparer**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: NoteCutter.Cut
void GlobalNamespace::NoteCutter::Cut(::GlobalNamespace::Saber* saber) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::Cut");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Cut", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(saber)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, saber);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: NoteCutter/CuttableBySaberSortParams
#include "GlobalNamespace/NoteCutter_CuttableBySaberSortParams.hpp"
// Including type: CuttableBySaber
#include "GlobalNamespace/CuttableBySaber.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public CuttableBySaber cuttableBySaber
::GlobalNamespace::CuttableBySaber*& GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_cuttableBySaber() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_cuttableBySaber");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cuttableBySaber"))->offset;
return *reinterpret_cast<::GlobalNamespace::CuttableBySaber**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single distance
float& GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_distance() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_distance");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "distance"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 pos
::UnityEngine::Vector3& GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_pos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::CuttableBySaberSortParams::dyn_pos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "pos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
// Including type: NoteCutter/CuttableBySaberSortParamsComparer
#include "GlobalNamespace/NoteCutter_CuttableBySaberSortParamsComparer.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: NoteCutter/CuttableBySaberSortParamsComparer.Compare
int GlobalNamespace::NoteCutter::CuttableBySaberSortParamsComparer::Compare(::Il2CppObject* p0, ::Il2CppObject* p1) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::NoteCutter::CuttableBySaberSortParamsComparer::Compare");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Compare", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p0), ::il2cpp_utils::ExtractType(p1)})));
return ::il2cpp_utils::RunMethodRethrow<int, false>(this, ___internal__method, p0, p1);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Saber
#include "GlobalNamespace/Saber.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: SaberTypeObject
#include "GlobalNamespace/SaberTypeObject.hpp"
// Including type: SaberMovementData
#include "GlobalNamespace/SaberMovementData.hpp"
// Including type: SaberType
#include "GlobalNamespace/SaberType.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _saberBladeTopTransform
::UnityEngine::Transform*& GlobalNamespace::Saber::dyn__saberBladeTopTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__saberBladeTopTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBladeTopTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _saberBladeBottomTransform
::UnityEngine::Transform*& GlobalNamespace::Saber::dyn__saberBladeBottomTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__saberBladeBottomTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBladeBottomTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform _handleTransform
::UnityEngine::Transform*& GlobalNamespace::Saber::dyn__handleTransform() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__handleTransform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_handleTransform"))->offset;
return *reinterpret_cast<::UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private SaberTypeObject _saberType
::GlobalNamespace::SaberTypeObject*& GlobalNamespace::Saber::dyn__saberType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__saberType");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberType"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberTypeObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly SaberMovementData _movementData
::GlobalNamespace::SaberMovementData*& GlobalNamespace::Saber::dyn__movementData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__movementData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_movementData"))->offset;
return *reinterpret_cast<::GlobalNamespace::SaberMovementData**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _saberBladeTopPos
::UnityEngine::Vector3& GlobalNamespace::Saber::dyn__saberBladeTopPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__saberBladeTopPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBladeTopPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _saberBladeBottomPos
::UnityEngine::Vector3& GlobalNamespace::Saber::dyn__saberBladeBottomPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__saberBladeBottomPos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBladeBottomPos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 _handlePos
::UnityEngine::Vector3& GlobalNamespace::Saber::dyn__handlePos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__handlePos");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_handlePos"))->offset;
return *reinterpret_cast<::UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion _handleRot
::UnityEngine::Quaternion& GlobalNamespace::Saber::dyn__handleRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::dyn__handleRot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_handleRot"))->offset;
return *reinterpret_cast<::UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Saber.get_saberType
::GlobalNamespace::SaberType GlobalNamespace::Saber::get_saberType() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_saberType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::SaberType, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_saberBladeTopPos
::UnityEngine::Vector3 GlobalNamespace::Saber::get_saberBladeTopPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_saberBladeTopPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberBladeTopPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_saberBladeBottomPos
::UnityEngine::Vector3 GlobalNamespace::Saber::get_saberBladeBottomPos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_saberBladeBottomPos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberBladeBottomPos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_handlePos
::UnityEngine::Vector3 GlobalNamespace::Saber::get_handlePos() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_handlePos");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_handlePos", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Vector3, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_handleRot
::UnityEngine::Quaternion GlobalNamespace::Saber::get_handleRot() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_handleRot");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_handleRot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::UnityEngine::Quaternion, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_bladeSpeed
float GlobalNamespace::Saber::get_bladeSpeed() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_bladeSpeed");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_bladeSpeed", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<float, false>(this, ___internal__method);
}
// Autogenerated method: Saber.get_movementData
::GlobalNamespace::SaberMovementData* GlobalNamespace::Saber::get_movementData() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::get_movementData");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_movementData", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodRethrow<::GlobalNamespace::SaberMovementData*, false>(this, ___internal__method);
}
// Autogenerated method: Saber.ManualUpdate
void GlobalNamespace::Saber::ManualUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::ManualUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ManualUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method);
}
// Autogenerated method: Saber.OverridePositionAndRotation
void GlobalNamespace::Saber::OverridePositionAndRotation(::UnityEngine::Vector3 pos, ::UnityEngine::Quaternion rot) {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Saber::OverridePositionAndRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OverridePositionAndRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(pos), ::il2cpp_utils::ExtractType(rot)})));
::il2cpp_utils::RunMethodRethrow<void, false>(this, ___internal__method, pos, rot);
}
| 82.542001 | 390 | 0.806517 | [
"mesh",
"object",
"vector",
"transform"
] |
70c1bf68a2b33b71caceb41fcfa5cbdc306433b8 | 1,454 | cpp | C++ | DynamicProgramming/SubsetSum.cpp | Guerreiro51/Competitive-Programming | 54ce0b40b01bce3b53b595ef36f431389a340a64 | [
"MIT"
] | 1 | 2021-11-18T22:09:58.000Z | 2021-11-18T22:09:58.000Z | DynamicProgramming/SubsetSum.cpp | Guerreiro51/Competitive-Programming | 54ce0b40b01bce3b53b595ef36f431389a340a64 | [
"MIT"
] | null | null | null | DynamicProgramming/SubsetSum.cpp | Guerreiro51/Competitive-Programming | 54ce0b40b01bce3b53b595ef36f431389a340a64 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int solve(vector<int>& numbers) {
int maxSum = accumulate(numbers.begin(), numbers.end(), 0);
vector<vector<bool>> dp(numbers.size(), vector<bool>(maxSum + 1, false));
// initial condition, it is possible to sum to numbers[0] using only the numbers[0]
dp[0][numbers[0]] = true;
for (size_t index = 1; index < numbers.size(); index++) { // expanding the numbers in consideration
dp[index][numbers[index]] = true; // we can now create a subset consisting of only number[index]
for (size_t sum = 0; sum <= maxSum; sum++) {
if (dp[index - 1][sum]) {
dp[index][sum] = true; // create a new subset where we DON'T sum number[index]
dp[index][sum + numbers[index]] = true; // create a new subset where we DO sum number[index]
}
}
}
// calculate the sum of all the subsets
int retval = 0;
for (int sum = 0; sum <= maxSum; sum++)
if (dp[numbers.size() - 1][sum])
retval += sum;
return retval;
}
int main() {
size_t numberOfTestCases;
cin >> numberOfTestCases;
while (numberOfTestCases--) {
size_t numberOfIntegers;
cin >> numberOfIntegers;
vector<int> numbers(numberOfIntegers);
for (auto& number : numbers)
cin >> number;
cout << solve(numbers) << '\n';
}
} | 31.608696 | 125 | 0.563961 | [
"vector"
] |
70c25d0eb42f3759b4390be51e66c5801ed37e6b | 17,927 | cpp | C++ | resource/gcs_rqt/gcs_plugin.cpp | icsl-Jeon/px4_code2 | 52c5b0c3577cf3c7dc2e52bf357c8b6cb7382481 | [
"MIT"
] | 5 | 2021-03-02T09:08:25.000Z | 2022-01-21T05:40:27.000Z | resource/gcs_rqt/gcs_plugin.cpp | icsl-Jeon/px4_code2 | 52c5b0c3577cf3c7dc2e52bf357c8b6cb7382481 | [
"MIT"
] | null | null | null | resource/gcs_rqt/gcs_plugin.cpp | icsl-Jeon/px4_code2 | 52c5b0c3577cf3c7dc2e52bf357c8b6cb7382481 | [
"MIT"
] | 3 | 2021-03-02T08:57:26.000Z | 2022-01-25T23:24:20.000Z | //
// Created by jbs on 21. 1. 23..
//
#include "gcs_plugin.h"
#include <pluginlib/class_list_macros.h>
namespace px4_code2{
std::string labelClient = "[[ px4_code/client ]] ";
GcsPlugin::GcsPlugin() : rqt_gui_cpp::Plugin() , widget(new Widget){
setObjectName("FelipeSuite");
}
void GcsPlugin::initPlugin(qt_gui_cpp::PluginContext &context) {
std::cout << "init plugin" << std::endl;
QStringList argv = context.argv();
context.addWidget(widget);
// Signal - slot connect
connect(widget,SIGNAL(callService(int,std::string,std::vector<double>,int *)),
this,SLOT(callService(int, std::string,std::vector<double>,int *)));
connect(this,SIGNAL(enablePushButton(bool)),widget,SLOT(enableButton(bool)));
connect(this,SIGNAL(enablePushButtonPX4(int, bool)),widget,SLOT(enableButtonPX4(int, bool)));
connect(this,SIGNAL(updateMissionStatus(bool,bool)),widget,SLOT(updateMissionStatus(bool,bool)));
connect(this,SIGNAL(updatePX4State(int, bool)),widget,SLOT(updatePX4Status(int, bool)));
connect (widget,SIGNAL(toggleWaypoints(int, bool)),this,SLOT(toggleWaypoints(int, bool)));
connect (widget,SIGNAL(eraseWaypoitns(int)),this,SLOT(eraseWaypoints(int)));
connect (widget,SIGNAL(generateTrajectory(int,int,double,double)),this,SLOT(generateTrajectory(int,int,double,double)));
connect (widget,SIGNAL(saveTrajectory(int,std::string)),this,SLOT(saveTrajectoryTxt(int,std::string)));
connect (widget,SIGNAL(loadTrajectory(int,std::string)),this,SLOT(loadTrajectoryTxt(int,std::string)));
connect (widget,SIGNAL(doTest(bool)),this,SLOT(doTest(bool)));
// ROS initialization
timer = nh.createTimer(ros::Duration(0.01),&GcsPlugin::callbackTimer,this);
// 0. Slot loading
nh = getNodeHandle();
nh.getParam("/qt_setting_dir",param.setting_file);
nh.getParam("/world_frame_id",param.worldFrameId);
nh.getParam("/print_ros_warning",param.printRosWarning);
nh.getParam("/slider_max_height",param.maxHeightSlider);
// cout << param.maxHeightSlider << endl;
widget->setMaxSlideValue(param.maxHeightSlider);
// cout << param.worldFrameId << endl;
std::cout << labelClient + " : setting file : " << param.setting_file << std::endl;
widget->readSettings(param.setting_file);
// 1. Drone set
std::vector<std::string> droneNameSet;
nh.getParam("/drone_name_set",droneNameSet);
waypointsSet = vector<vector<geometry_msgs::Point>>(droneNameSet.size());
trajectorySet.resize(droneNameSet.size());
missionSet.resize(droneNameSet.size());
int idx = 0;
std::cout << labelClient << ": mission drones are [ ";
for (auto it = droneNameSet.begin() ; it < droneNameSet.end() ; it++){
// Subscribing phase
ros::Subscriber sub = nh.subscribe<px4_code2_msgs::Phase>("/" + *it + phaseTopicName,
1,boost::bind(&GcsPlugin::callbackPhase,this,_1,idx));
subPhaseSet.push_back(sub);
// Subscribing px4 state
sub = nh.subscribe<mavros_msgs::State>("/" + *it + px4StateTopicName,
1,boost::bind(&GcsPlugin::callbackPX4State,this,_1,idx));
subPX4Set.push_back(sub);
// Phase init
px4_code2_msgs::Phase phase_; phase_.isMissionExist = false;
status.phaseSet.push_back(phase_);
status.px4StateSet.push_back(mavros_msgs::State ());
lastCommTimePX4.push_back(ros::Time(0));
// Publish for waypoint selection and trajectory
ros::Publisher pub = nh.advertise<nav_msgs::Path>("/" + *it + "/waypoints",1);
pubWaypointsSet.push_back(pub);
pub = nh.advertise<nav_msgs::Path>("/" + *it + "/trajectory",1);
pubTrajSet.push_back(pub);
trajectorySet[idx].first = false; // init with invalid trajectory
missionSet[idx].first = false;
// Publish for testing
pub = nh.advertise<geometry_msgs::PoseStamped>("/"+*it + "/testing_pose",1);
pubTestPoseSet.push_back(pub);
// Printing
std::cout << *it ;
if (it != droneNameSet.end()-1)
std::cout << ", ";
idx++;
}
std::cout << " ]"<<std::endl;
param.droneNameSet = droneNameSet;
subWaypoints = nh.subscribe("waypoints",1,&GcsPlugin::callbackWaypoint,this);
widget->initNames(droneNameSet);
}
void GcsPlugin::shutdownPlugin()
{
// Save slot values
ROS_INFO_STREAM(labelClient + " : writing config file to " << param.setting_file );
widget->writeSettings(param.setting_file);
// unregister all publishers here
}
void GcsPlugin::saveSettings(qt_gui_cpp::Settings& plugin_settings,
qt_gui_cpp::Settings& instance_settings) const
{
// instance_settings.setValue(k, v)
}
void GcsPlugin::restoreSettings(
const qt_gui_cpp::Settings& plugin_settings,
const qt_gui_cpp::Settings& instance_settings)
{
// v = instance_settings.value(k)
}
GcsPlugin::~GcsPlugin() {};
void GcsPlugin::callService(int droneId, std::string service,std::vector<double> args,int* out) {
if (droneId < param.getNdrone()) {
std::cout << labelClient << " : for drone " << param.droneNameSet[droneId] <<
", service " << service << " is called." << std::endl;
if (service == "takeoff") {
px4_code2_msgs::Takeoff takeoffSrv;
takeoffSrv.request.height = args[0];
double takeoffSpeed = args[1];
if (takeoffSpeed<= 0){
ROS_WARN_STREAM(labelClient << " : takeoff speed is below zero. resetting 0.05 [m/s]" );
takeoffSpeed = 0.05;
}
takeoffSrv.request.speed=takeoffSpeed;
ros::service::call<px4_code2_msgs::Takeoff>("/" + param.droneNameSet[droneId] + takeoffServiceName,
takeoffSrv);
}
if (service == "lock") {
px4_code2_msgs::Lock lockSrv;
ros::service::call<px4_code2_msgs::Lock>("/" + param.droneNameSet[droneId] +lockServiceName,
lockSrv);
// we should fill output
if (out != NULL){
*out = lockSrv.response.mission_remain;
}
}
if (service == "land") {
px4_code2_msgs::Land landSrv;
double landGround = args[0]; double landSpeed = args[1];
if (landGround > 0)
ROS_WARN_STREAM(labelClient << " : landing ground is larger than zero." );
if (landSpeed <= 0){
ROS_WARN_STREAM(labelClient << " : landing speed is below zero. resetting 0.05 [m/s]" );
landSpeed = 0.05;
}
landSrv.request.ground = landGround; landSrv.request.speed = landSpeed;
ros::service::call<px4_code2_msgs::Land>("/" + param.droneNameSet[droneId] + landServiceName,
landSrv);
}
if (service == "arm"){
mavros_msgs::CommandBool cmdSrv;
if (args[0] == 0) { // not armed. This service is arm
cmdSrv.request.value = true;
ros::service::call<mavros_msgs::CommandBool>("/" + param.droneNameSet[droneId] + armServiceName,cmdSrv);
}else{ // armed. This service is disarm
cmdSrv.request.value = false;
ros::service::call<mavros_msgs::CommandBool>("/" + param.droneNameSet[droneId] + armServiceName,cmdSrv);
}
}
if (service == "offboard"){
mavros_msgs::SetMode modeSrv;
if (args[0] == 0) { // not offboard. This service is to offboard
modeSrv.request.custom_mode= "OFFBOARD";
ros::service::call<mavros_msgs::SetMode>("/" + param.droneNameSet[droneId] + modeSwitchName,modeSrv);
}else{ // offboard. This service is to manual
modeSrv.request.custom_mode = "MANUAL";
ros::service::call<mavros_msgs::SetMode>("/" + param.droneNameSet[droneId] + modeSwitchName,modeSrv);
}
}
if (service == "trajectory_follow"){
px4_code2_msgs::UploadTrajectory trajSrv;
bool isValid = trajectorySet[droneId].first;
Trajectory traj = trajectorySet[droneId].second;
if (isValid){
trajSrv.request.ts = traj.ts;
trajSrv.request.xs = traj.xs;
trajSrv.request.ys = traj.ys;
trajSrv.request.zs = traj.zs;
trajSrv.request.yaws = traj.yaws;
ros::service::call<px4_code2_msgs::UploadTrajectory>("/"+ param.droneNameSet[droneId] + trajFollowServiceName ,trajSrv);
}else{
widget->writeMakise("No valid trajectory for service call");
}
}
}
}
void GcsPlugin::toggleWaypoints(int droneId, bool startListen) {
if (startListen) {
status.isListenWaypoints = true;
status.curWaypointTarget = droneId;
waypointsSet[droneId].clear();
ROS_INFO_STREAM(labelClient+ " : Start listening waypoints for drone " +
to_string(droneId) + " . Initialize waypoints set");
}else{
status.isListenWaypoints = false;
ROS_INFO_STREAM(labelClient+ " : Finish listening waypoints.");
}
}
void GcsPlugin::callbackWaypoint(const geometry_msgs::PoseStampedPtr &msgPtr) {
if (status.isListenWaypoints) {
geometry_msgs::Point curWaypoint;
curWaypoint.x = msgPtr->pose.position.x;
curWaypoint.y = msgPtr->pose.position.y;
curWaypoint.z = widget->getSliderValue() * param.maxHeightSlider;
waypointsSet[status.curWaypointTarget].push_back(curWaypoint);
string msg = "Received points [" + to_string(curWaypoint.x) + " , "+
to_string(curWaypoint.y) + " , "+ to_string(curWaypoint.z) + "]";
widget->writeMakise(msg);
}
}
void GcsPlugin::eraseWaypoints(int droneId) {
if (not waypointsSet[droneId].empty()) {
widget->writeMakise("Erased last waypoint.");
waypointsSet[droneId].pop_back();
}else{
widget->writeMakise("Already empty.");
}
}
void GcsPlugin::generateTrajectory(int droneId,int polyOrder, double tf_, double margin_) {
// Read waypoints
int N = waypointsSet[droneId].size() -1;
if (N >= 0) {
double t0 = 0, tf = tf_;
double margin = margin_;
// 1. Time knots proportion to interval distance
trajgen::time_knots<double> ts(N + 1);
ts[0] = t0;
double lengthSum = 0;
for (int n = 1; n <= N; n++) {
double dist = distance(waypointsSet[droneId][n], waypointsSet[droneId][n - 1]);
lengthSum += dist;
ts[n] = lengthSum * tf;
}
for (int n = 1; n <= N; n++) {
ts[n] /= lengthSum; // TODO check
}
// 2. Define pin
vector<Pin *> pinSet(N + 1 + 2); // 2 = initial vel, accel
for (int n = 0; n <= N; n++) {
double t = ts[n];
auto waypoint = waypointsSet[droneId][n];
TrajVector xl(waypoint.x - margin, waypoint.y - margin, waypoint.z - margin);
TrajVector xu(waypoint.x + margin, waypoint.y + margin, waypoint.z + margin);
pinSet[n] = new LoosePin(t, 0, xl, xu);
}
FixPin xdot0(0.0, 1, TrajVector(0, 0, 0));
FixPin xddot0(0.0, 2, TrajVector(0, 0, 0));
pinSet[N + 1] = &xdot0;
pinSet[N + 2] = &xddot0;
// TrajGen settings
trajgen::PolyParam pp(polyOrder, 2, trajgen::ALGORITHM::POLY_COEFF);
TrajGenObj trajGenObj(ts, pp);
trajGenObj.setDerivativeObj(TrajVector(0, 1, 1));
trajGenObj.addPinSet(pinSet);
if (trajGenObj.solve(false)) {
auto traj = make_pair<bool, Trajectory>(true, Trajectory(&trajGenObj, tf));
trajectorySet[droneId] = traj;
widget->writeMakise("Generation success!");
} else {
auto traj = make_pair<bool, Trajectory>(false, Trajectory());
trajectorySet[droneId] = traj;
widget->writeMakise("Trajectory generation failed.");
}
}else
widget->writeMakise("No waypoints.");
}
void GcsPlugin::saveTrajectoryTxt(int droneId, std::string fileDir) {
if (trajectorySet[droneId].first){
if (trajectorySet[droneId].second.writeTxt(fileDir))
widget->writeMakise("Trajectory saved to : "+ fileDir);
else
widget->writeMakise("File "+ fileDir + " was not opened");
}else{
widget->writeMakise("Still no trajectory to save");
}
}
void GcsPlugin::loadTrajectoryTxt(int droneId, std::string fileName) {
bool isLoaded;
Trajectory traj (fileName,isLoaded);
if (isLoaded){
// upload trajectory
trajectorySet[droneId].first = isLoaded;
trajectorySet[droneId].second = traj;
// upload mission from the trajectory
missionSet[droneId].first = isLoaded;
auto mission = Mission (param.worldFrameId,Phase::TRAJ_FOLLOWING);
mission.loadTrajectory(traj);
missionSet[droneId].second = mission;
widget->writeMakise("Loaded txt. Updated trajectory.");
}else{
widget->writeMakise("Loading txt failed.");
}
}
void GcsPlugin::doTest(bool doTest_) {
// Mode switcher
if (status.isDuringTest) { // switch to pause
status.isDuringTest = false;
} else { // switch to start testing
status.isDuringTest = true;
}
for (int n =0 ; n < param.getNdrone() ; n++) {
if (missionSet[n].first) { // valid mission ?
if (status.isDuringTest)
missionSet[n].second.trigger();
else
missionSet[n].second.stop();
}
}
}
void GcsPlugin::callbackPhase(const px4_code2_msgs::PhaseConstPtr &msgPtr,int droneId) {
status.phaseSet[droneId] =*(msgPtr);
lastCommTime = ros::Time::now();
}
void GcsPlugin::callbackPX4State(const mavros_msgs::StateConstPtr &msgPtr, int droneId) {
status.px4StateSet[droneId] = *msgPtr;
lastCommTimePX4[droneId] = ros::Time::now();
}
void GcsPlugin::callbackTimer(const ros::TimerEvent &event) {
// 1. Phase update and q_emit (From px4_code2 server)
if ((ros::Time::now() - lastCommTime).toSec() > 3){
if (param.printRosWarning)
ROS_WARN_STREAM_THROTTLE(3,labelClient + " : Communication with drones are missing.");
Q_EMIT enablePushButton(false);
}else{
bool isAllInit = true;
bool isAnyDuringMission = false;
for (auto phase_ : status.phaseSet){
isAllInit = isAllInit and (phase_.phase.data != "NOT_INIT");
}
if (isAllInit){
ROS_INFO_STREAM_ONCE(labelClient + " : All drones are ready");
for (auto phase_: status.phaseSet){
isAnyDuringMission = isAnyDuringMission or (phase_.phase.data != "STANDBY");
Q_EMIT updateMissionStatus(isAnyDuringMission,phase_.isMissionExist);
}
}
Q_EMIT enablePushButton(true);
}
for (int m = 0 ; m < param.getNdrone() ; m++) {
// Update mavros topics
if ((ros::Time::now() - lastCommTimePX4[m]).toSec() < 3) {
// PX4 update and q_emit (From mavros)
bool isOffboard = status.px4StateSet[m].mode == "OFFBOARD";
Q_EMIT enablePushButtonPX4(m,true);
Q_EMIT updatePX4State(m,isOffboard);
} else {
if (param.printRosWarning)
ROS_WARN_STREAM_THROTTLE(3, labelClient + " : Communication with mavros of drones are missing.");
Q_EMIT enablePushButtonPX4(m,false);
}
}
// publish
for (int m = 0 ; m < param.getNdrone() ; m++){
nav_msgs::Path path = convertTo(waypointsSet[m]);
path.header.frame_id = param.worldFrameId;
pubWaypointsSet[m].publish(path);
if (trajectorySet[m].first) { // if it is valid trajectory,
// publish the entire path
pubTrajSet[m].publish(trajectorySet[m].second.getPath(param.worldFrameId));
// is during test
if (missionSet[m].second.isTriggered()){
pubTestPoseSet[m].publish(missionSet[m].second.emitDesPose(ros::Time::now()));
}
}
}
}
}
PLUGINLIB_EXPORT_CLASS(px4_code2::GcsPlugin, rqt_gui_cpp::Plugin)
| 40.650794 | 140 | 0.557148 | [
"vector"
] |
70c710bf95b1811b1f5c91f314c923886a12985d | 5,256 | cc | C++ | RecoEgamma/EgammaTools/plugins/EG8XObjectUpdateModifier.cc | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 4 | 2020-06-27T23:27:21.000Z | 2020-11-19T09:17:01.000Z | RecoEgamma/EgammaTools/plugins/EG8XObjectUpdateModifier.cc | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 524 | 2018-01-29T15:50:45.000Z | 2021-08-04T14:03:21.000Z | RecoEgamma/EgammaTools/plugins/EG8XObjectUpdateModifier.cc | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 7 | 2018-02-19T11:17:13.000Z | 2020-10-12T21:57:00.000Z | #include "CommonTools/CandAlgos/interface/ModifyObjectValueBase.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/Common/interface/Handle.h"
#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include <vdt/vdtMath.h>
//this modifier fills variables where not present in CMSSW_8X
//use case is when reading older 80X samples in newer releases, aka legacy
class EG8XObjectUpdateModifier : public ModifyObjectValueBase {
public:
EG8XObjectUpdateModifier(const edm::ParameterSet& conf, edm::ConsumesCollector& cc);
~EG8XObjectUpdateModifier() override {}
void setEvent(const edm::Event&) final;
void setEventContent(const edm::EventSetup&) final;
void modifyObject(reco::GsfElectron& ele) const final;
void modifyObject(reco::Photon& pho) const final;
void modifyObject(pat::Electron& ele) const final { return modifyObject(static_cast<reco::GsfElectron&>(ele)); }
void modifyObject(pat::Photon& pho) const final { return modifyObject(static_cast<reco::Photon&>(pho)); }
private:
std::pair<int, bool> getSaturationInfo(const reco::SuperCluster& superClus) const;
CaloTopology const* caloTopo_ = nullptr;
EcalRecHitCollection const* ecalRecHitsEB_ = nullptr;
EcalRecHitCollection const* ecalRecHitsEE_ = nullptr;
edm::ESGetToken<CaloTopology, CaloTopologyRecord> caloTopoToken_;
edm::EDGetTokenT<EcalRecHitCollection> ecalRecHitsEBToken_;
edm::EDGetTokenT<EcalRecHitCollection> ecalRecHitsEEToken_;
};
EG8XObjectUpdateModifier::EG8XObjectUpdateModifier(const edm::ParameterSet& conf, edm::ConsumesCollector& cc)
: ModifyObjectValueBase(conf),
caloTopoToken_{cc.esConsumes()},
ecalRecHitsEBToken_(cc.consumes(conf.getParameter<edm::InputTag>("ecalRecHitsEB"))),
ecalRecHitsEEToken_(cc.consumes(conf.getParameter<edm::InputTag>("ecalRecHitsEE"))) {}
void EG8XObjectUpdateModifier::setEvent(const edm::Event& iEvent) {
ecalRecHitsEB_ = &iEvent.get(ecalRecHitsEBToken_);
ecalRecHitsEE_ = &iEvent.get(ecalRecHitsEEToken_);
}
void EG8XObjectUpdateModifier::setEventContent(const edm::EventSetup& iSetup) {
caloTopo_ = &iSetup.getData(caloTopoToken_);
}
void EG8XObjectUpdateModifier::modifyObject(reco::GsfElectron& ele) const {
const reco::CaloCluster& seedClus = *(ele.superCluster()->seed());
const EcalRecHitCollection* ecalRecHits = ele.isEB() ? ecalRecHitsEB_ : ecalRecHitsEE_;
auto full5x5ShowerShapes = ele.full5x5_showerShape();
full5x5ShowerShapes.e2x5Left = noZS::EcalClusterTools::e2x5Left(seedClus, ecalRecHits, caloTopo_);
full5x5ShowerShapes.e2x5Right = noZS::EcalClusterTools::e2x5Right(seedClus, ecalRecHits, caloTopo_);
full5x5ShowerShapes.e2x5Top = noZS::EcalClusterTools::e2x5Top(seedClus, ecalRecHits, caloTopo_);
full5x5ShowerShapes.e2x5Bottom = noZS::EcalClusterTools::e2x5Bottom(seedClus, ecalRecHits, caloTopo_);
ele.full5x5_setShowerShape(full5x5ShowerShapes);
auto showerShapes = ele.showerShape();
showerShapes.e2x5Left = EcalClusterTools::e2x5Left(seedClus, ecalRecHits, caloTopo_);
showerShapes.e2x5Right = EcalClusterTools::e2x5Right(seedClus, ecalRecHits, caloTopo_);
showerShapes.e2x5Top = EcalClusterTools::e2x5Top(seedClus, ecalRecHits, caloTopo_);
showerShapes.e2x5Bottom = EcalClusterTools::e2x5Bottom(seedClus, ecalRecHits, caloTopo_);
ele.setShowerShape(showerShapes);
reco::GsfElectron::SaturationInfo eleSatInfo;
auto satInfo = getSaturationInfo(*ele.superCluster());
eleSatInfo.nSaturatedXtals = satInfo.first;
eleSatInfo.isSeedSaturated = satInfo.second;
ele.setSaturationInfo(eleSatInfo);
}
void EG8XObjectUpdateModifier::modifyObject(reco::Photon& pho) const {
reco::Photon::SaturationInfo phoSatInfo;
auto satInfo = getSaturationInfo(*pho.superCluster());
phoSatInfo.nSaturatedXtals = satInfo.first;
phoSatInfo.isSeedSaturated = satInfo.second;
pho.setSaturationInfo(phoSatInfo);
}
std::pair<int, bool> EG8XObjectUpdateModifier::getSaturationInfo(const reco::SuperCluster& superClus) const {
bool isEB = superClus.seed()->seed().subdetId() == EcalBarrel;
const auto& ecalRecHits = isEB ? *ecalRecHitsEB_ : *ecalRecHitsEE_;
int nrSatCrys = 0;
bool seedSaturated = false;
const auto& hitsAndFractions = superClus.seed()->hitsAndFractions();
for (const auto& hitFractionPair : hitsAndFractions) {
auto ecalRecHitIt = ecalRecHits.find(hitFractionPair.first);
if (ecalRecHitIt != ecalRecHits.end() && ecalRecHitIt->checkFlag(EcalRecHit::Flags::kSaturated)) {
nrSatCrys++;
if (hitFractionPair.first == superClus.seed()->seed())
seedSaturated = true;
}
}
return {nrSatCrys, seedSaturated};
}
DEFINE_EDM_PLUGIN(ModifyObjectValueFactory, EG8XObjectUpdateModifier, "EG8XObjectUpdateModifier");
| 46.513274 | 114 | 0.788813 | [
"geometry"
] |
70c83773d3d8a65e5f229eed215fa025bb1d9d0c | 16,113 | cc | C++ | Models/CommonStateSignalAuthorChatAccept.pb.cc | wpscott/AcFunDanmaku-C- | c1b834dbb7133fd9d3908a8e0840747b759bdb0f | [
"MIT"
] | null | null | null | Models/CommonStateSignalAuthorChatAccept.pb.cc | wpscott/AcFunDanmaku-C- | c1b834dbb7133fd9d3908a8e0840747b759bdb0f | [
"MIT"
] | null | null | null | Models/CommonStateSignalAuthorChatAccept.pb.cc | wpscott/AcFunDanmaku-C- | c1b834dbb7133fd9d3908a8e0840747b759bdb0f | [
"MIT"
] | null | null | null | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: CommonStateSignalAuthorChatAccept.proto
#include "CommonStateSignalAuthorChatAccept.pb.h"
#include <algorithm>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
namespace AcFunDanmu {
class CommonStateSignalAuthorChatAcceptDefaultTypeInternal {
public:
::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<CommonStateSignalAuthorChatAccept> _instance;
} _CommonStateSignalAuthorChatAccept_default_instance_;
} // namespace AcFunDanmu
static void InitDefaultsscc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
void* ptr = &::AcFunDanmu::_CommonStateSignalAuthorChatAccept_default_instance_;
new (ptr) ::AcFunDanmu::CommonStateSignalAuthorChatAccept();
::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
}
}
::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto =
{{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 0, 0, InitDefaultsscc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto}, {}};
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_CommonStateSignalAuthorChatAccept_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_CommonStateSignalAuthorChatAccept_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_CommonStateSignalAuthorChatAccept_2eproto = nullptr;
const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_CommonStateSignalAuthorChatAccept_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
PROTOBUF_FIELD_OFFSET(::AcFunDanmu::CommonStateSignalAuthorChatAccept, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
PROTOBUF_FIELD_OFFSET(::AcFunDanmu::CommonStateSignalAuthorChatAccept, authorchatid_),
PROTOBUF_FIELD_OFFSET(::AcFunDanmu::CommonStateSignalAuthorChatAccept, aryasignalinfo_),
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, sizeof(::AcFunDanmu::CommonStateSignalAuthorChatAccept)},
};
static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::AcFunDanmu::_CommonStateSignalAuthorChatAccept_default_instance_),
};
const char descriptor_table_protodef_CommonStateSignalAuthorChatAccept_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
"\n\'CommonStateSignalAuthorChatAccept.prot"
"o\022\nAcFunDanmu\"Q\n!CommonStateSignalAuthor"
"ChatAccept\022\024\n\014authorChatId\030\001 \001(\t\022\026\n\016arya"
"SignalInfo\030\002 \001(\tb\006proto3"
;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_deps[1] = {
};
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_sccs[1] = {
&scc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto.base,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_CommonStateSignalAuthorChatAccept_2eproto = {
false, false, descriptor_table_protodef_CommonStateSignalAuthorChatAccept_2eproto, "CommonStateSignalAuthorChatAccept.proto", 144,
&descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_once, descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_sccs, descriptor_table_CommonStateSignalAuthorChatAccept_2eproto_deps, 1, 0,
schemas, file_default_instances, TableStruct_CommonStateSignalAuthorChatAccept_2eproto::offsets,
file_level_metadata_CommonStateSignalAuthorChatAccept_2eproto, 1, file_level_enum_descriptors_CommonStateSignalAuthorChatAccept_2eproto, file_level_service_descriptors_CommonStateSignalAuthorChatAccept_2eproto,
};
// Force running AddDescriptors() at dynamic initialization time.
static bool dynamic_init_dummy_CommonStateSignalAuthorChatAccept_2eproto = (static_cast<void>(::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_CommonStateSignalAuthorChatAccept_2eproto)), true);
namespace AcFunDanmu {
// ===================================================================
class CommonStateSignalAuthorChatAccept::_Internal {
public:
};
CommonStateSignalAuthorChatAccept::CommonStateSignalAuthorChatAccept(::PROTOBUF_NAMESPACE_ID::Arena* arena)
: ::PROTOBUF_NAMESPACE_ID::Message(arena) {
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:AcFunDanmu.CommonStateSignalAuthorChatAccept)
}
CommonStateSignalAuthorChatAccept::CommonStateSignalAuthorChatAccept(const CommonStateSignalAuthorChatAccept& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
authorchatid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_authorchatid().empty()) {
authorchatid_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_authorchatid(),
GetArena());
}
aryasignalinfo_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_aryasignalinfo().empty()) {
aryasignalinfo_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aryasignalinfo(),
GetArena());
}
// @@protoc_insertion_point(copy_constructor:AcFunDanmu.CommonStateSignalAuthorChatAccept)
}
void CommonStateSignalAuthorChatAccept::SharedCtor() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto.base);
authorchatid_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
aryasignalinfo_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
CommonStateSignalAuthorChatAccept::~CommonStateSignalAuthorChatAccept() {
// @@protoc_insertion_point(destructor:AcFunDanmu.CommonStateSignalAuthorChatAccept)
SharedDtor();
_internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
void CommonStateSignalAuthorChatAccept::SharedDtor() {
GOOGLE_DCHECK(GetArena() == nullptr);
authorchatid_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
aryasignalinfo_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
void CommonStateSignalAuthorChatAccept::ArenaDtor(void* object) {
CommonStateSignalAuthorChatAccept* _this = reinterpret_cast< CommonStateSignalAuthorChatAccept* >(object);
(void)_this;
}
void CommonStateSignalAuthorChatAccept::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void CommonStateSignalAuthorChatAccept::SetCachedSize(int size) const {
_cached_size_.Set(size);
}
const CommonStateSignalAuthorChatAccept& CommonStateSignalAuthorChatAccept::default_instance() {
::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_CommonStateSignalAuthorChatAccept_CommonStateSignalAuthorChatAccept_2eproto.base);
return *internal_default_instance();
}
void CommonStateSignalAuthorChatAccept::Clear() {
// @@protoc_insertion_point(message_clear_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
authorchatid_.ClearToEmpty();
aryasignalinfo_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* CommonStateSignalAuthorChatAccept::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
while (!ctx->Done(&ptr)) {
::PROTOBUF_NAMESPACE_ID::uint32 tag;
ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
CHK_(ptr);
switch (tag >> 3) {
// string authorChatId = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
auto str = _internal_mutable_authorchatid();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "AcFunDanmu.CommonStateSignalAuthorChatAccept.authorChatId"));
CHK_(ptr);
} else goto handle_unusual;
continue;
// string aryaSignalInfo = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
auto str = _internal_mutable_aryasignalinfo();
ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "AcFunDanmu.CommonStateSignalAuthorChatAccept.aryaSignalInfo"));
CHK_(ptr);
} else goto handle_unusual;
continue;
default: {
handle_unusual:
if ((tag & 7) == 4 || tag == 0) {
ctx->SetLastTag(tag);
goto success;
}
ptr = UnknownFieldParse(tag,
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
ptr, ctx);
CHK_(ptr != nullptr);
continue;
}
} // switch
} // while
success:
return ptr;
failure:
ptr = nullptr;
goto success;
#undef CHK_
}
::PROTOBUF_NAMESPACE_ID::uint8* CommonStateSignalAuthorChatAccept::_InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string authorChatId = 1;
if (this->authorchatid().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_authorchatid().data(), static_cast<int>(this->_internal_authorchatid().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"AcFunDanmu.CommonStateSignalAuthorChatAccept.authorChatId");
target = stream->WriteStringMaybeAliased(
1, this->_internal_authorchatid(), target);
}
// string aryaSignalInfo = 2;
if (this->aryasignalinfo().size() > 0) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_aryasignalinfo().data(), static_cast<int>(this->_internal_aryasignalinfo().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"AcFunDanmu.CommonStateSignalAuthorChatAccept.aryaSignalInfo");
target = stream->WriteStringMaybeAliased(
2, this->_internal_aryasignalinfo(), target);
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
}
// @@protoc_insertion_point(serialize_to_array_end:AcFunDanmu.CommonStateSignalAuthorChatAccept)
return target;
}
size_t CommonStateSignalAuthorChatAccept::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
size_t total_size = 0;
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// string authorChatId = 1;
if (this->authorchatid().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_authorchatid());
}
// string aryaSignalInfo = 2;
if (this->aryasignalinfo().size() > 0) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_aryasignalinfo());
}
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
_internal_metadata_, total_size, &_cached_size_);
}
int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
SetCachedSize(cached_size);
return total_size;
}
void CommonStateSignalAuthorChatAccept::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
GOOGLE_DCHECK_NE(&from, this);
const CommonStateSignalAuthorChatAccept* source =
::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<CommonStateSignalAuthorChatAccept>(
&from);
if (source == nullptr) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:AcFunDanmu.CommonStateSignalAuthorChatAccept)
::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:AcFunDanmu.CommonStateSignalAuthorChatAccept)
MergeFrom(*source);
}
}
void CommonStateSignalAuthorChatAccept::MergeFrom(const CommonStateSignalAuthorChatAccept& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.authorchatid().size() > 0) {
_internal_set_authorchatid(from._internal_authorchatid());
}
if (from.aryasignalinfo().size() > 0) {
_internal_set_aryasignalinfo(from._internal_aryasignalinfo());
}
}
void CommonStateSignalAuthorChatAccept::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommonStateSignalAuthorChatAccept::CopyFrom(const CommonStateSignalAuthorChatAccept& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:AcFunDanmu.CommonStateSignalAuthorChatAccept)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommonStateSignalAuthorChatAccept::IsInitialized() const {
return true;
}
void CommonStateSignalAuthorChatAccept::InternalSwap(CommonStateSignalAuthorChatAccept* other) {
using std::swap;
_internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
authorchatid_.Swap(&other->authorchatid_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
aryasignalinfo_.Swap(&other->aryasignalinfo_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
}
::PROTOBUF_NAMESPACE_ID::Metadata CommonStateSignalAuthorChatAccept::GetMetadata() const {
return GetMetadataStatic();
}
// @@protoc_insertion_point(namespace_scope)
} // namespace AcFunDanmu
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::AcFunDanmu::CommonStateSignalAuthorChatAccept* Arena::CreateMaybeMessage< ::AcFunDanmu::CommonStateSignalAuthorChatAccept >(Arena* arena) {
return Arena::CreateMessageInternal< ::AcFunDanmu::CommonStateSignalAuthorChatAccept >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
| 48.242515 | 213 | 0.793645 | [
"object"
] |
70ca3ebaed483ad69f98e1da1c8dacdcfd1428c1 | 2,907 | cpp | C++ | matrix_test.cpp | mjaakkol/matrix_multiplication | db7f9409eabcb0824ef88d3b09ad5de8bef7b2e3 | [
"MIT"
] | null | null | null | matrix_test.cpp | mjaakkol/matrix_multiplication | db7f9409eabcb0824ef88d3b09ad5de8bef7b2e3 | [
"MIT"
] | null | null | null | matrix_test.cpp | mjaakkol/matrix_multiplication | db7f9409eabcb0824ef88d3b09ad5de8bef7b2e3 | [
"MIT"
] | null | null | null | #include <iostream>
#include "matrix.hpp"
#include "test_vectors.hpp"
typedef Matrix<unsigned int> MatInt;
using namespace std;
int main()
{
cout<<"\n============TESTING STARTS=============\n";
MatInt a(matrix_1_data, matrix_1_rows, matrix_1_cols);
MatInt b(matrix_1_data, matrix_1_rows, matrix_1_cols);
assert(a == b);
cout<<"Equal operator succeeded\n"<<endl;
cout<<"Before transpose:"<<b;
// We must copy matrix in place as otherwise it will modify
// memory shared with matrix 1
assert(b.copy_matrix_inplace());
b.transpose();
cout<<"\nAfter transpose:"<<b;
// Creating transposed vector from external vectors
MatInt transpose_test(matrix_1_transpose_data,
matrix_1_transpose_rows,
matrix_1_transpose_cols);
assert(b == transpose_test);
// Double-checking that the conversion works also otherway around
b.transpose();
assert(b == a);
cout<<"\nTranspose succeeded\n"<<endl;
// Testing multiplication with memory allocation
// Transposing b back to transposed version as we use that in
// multiplications and against pre-calculated vectors
b.transpose();
assert(b == transpose_test);
MatInt product_result_test(matrix_1_product_data,
matrix_1_product_rows,
matrix_1_product_cols);
MatInt product_result;
assert(product_result.initialize_matrix(matrix_1_rows, matrix_1_transpose_cols));
cout<<"\nMatrices to be multiplied\n";
cout<<a;
cout<<b;
// In this case matmul needs to both allocate the memory
// and do the multiplication. Assert tests if the memory
// allocation worked.
a.matmul(product_result, b);
cout<<"\nResult matrix\n";
cout<<product_result;
assert(product_result == product_result_test);
// REPEAT THE SAME AS ABOVE WITH VECTORS
// Another round of product testing corner case where
// end result is matrix with 1x1 dimensions
MatInt a2(matrix_2_data, matrix_2_rows, matrix_2_cols);
MatInt a2_right(matrix_2_data, matrix_2_rows, matrix_2_cols);
assert(a2_right.copy_matrix_inplace());
a2_right.transpose();
MatInt a2_transpose(matrix_2_transpose_data, matrix_2_transpose_rows, matrix_2_transpose_cols);
assert(a2_right == a2_transpose);
cout<<"\n\nTranspose succeeded with matrix 2\n";
MatInt p2_result_test(matrix_2_product_data, matrix_2_product_rows, matrix_2_product_cols);
MatInt p2_result;
assert(p2_result.initialize_matrix(matrix_2_rows, matrix_2_transpose_cols));
cout<<"\nMatrices to be multiplied:\n";
cout<<a2;
cout<<a2_right;
a2.matmul(p2_result, a2_right);
assert(p2_result == p2_result_test);
cout<<"\nResult matrix\n";
cout<<p2_result;
cout<<"\n============TESTS PASSED=============";
} | 26.669725 | 99 | 0.674235 | [
"vector"
] |
70ca67fd02e88af5ff25b859e7b4c906ecddd807 | 2,314 | cpp | C++ | CryptoLib/CryptoLibTest/TestKeyDerivation.cpp | sn2234/cryptdisk | 796e5ed9f9b7d74c5fabb9dda67d45ec171f0e81 | [
"BSD-2-Clause"
] | 1 | 2021-12-04T19:35:53.000Z | 2021-12-04T19:35:53.000Z | CryptoLib/CryptoLibTest/TestKeyDerivation.cpp | caraioniurie47/cryptdisk | 796e5ed9f9b7d74c5fabb9dda67d45ec171f0e81 | [
"BSD-2-Clause"
] | null | null | null | CryptoLib/CryptoLibTest/TestKeyDerivation.cpp | caraioniurie47/cryptdisk | 796e5ed9f9b7d74c5fabb9dda67d45ec171f0e81 | [
"BSD-2-Clause"
] | 1 | 2021-12-04T16:16:57.000Z | 2021-12-04T16:16:57.000Z |
#include "stdafx.h"
using namespace CryptoLib;
using namespace boost;
using namespace std;
using namespace stdext;
// Test cases are generated using Crypto++ as reference implementation
struct PBKDF2Test
{
size_t passwordLength;
const unsigned char* password;
size_t saltLength;
const unsigned char* salt;
unsigned long iterations;
size_t keyLength;
const unsigned char* key;
};
const unsigned char test1Password[] = {0x70, 0x61, 0x73, 0x73, 0x77, 0x6F, 0x72, 0x64};
const unsigned char test1Salt[] = {0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12};
const unsigned char test1Key[] = {0x74, 0xE9, 0x8B, 0x2E, 0x9E, 0xED, 0xDA, 0xAB};
const unsigned char test2Password[] = {0x41, 0x6C, 0x6C, 0x20, 0x6E, 0x2D, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x6D, 0x75, 0x73, 0x74, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x75, 0x6E, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6F, 0x74, 0x68, 0x65, 0x72, 0x20, 0x6E, 0x2D, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x20, 0x76, 0x69, 0x61, 0x20, 0x6E, 0x2D, 0x31, 0x20, 0x65, 0x6E, 0x74, 0x69, 0x74, 0x65, 0x65, 0x68, 0x65, 0x65, 0x68, 0x65, 0x65, 0x73};
const unsigned char test2Salt[] = {0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12};
const unsigned char test2Key[] = {0x80, 0xB, 0x1C, 0x9D, 0x6D, 0x0, 0x75, 0xA8, 0xF3, 0xDF, 0x7A, 0x17, 0xCA, 0x32, 0x72, 0x2E, 0x93, 0x1, 0xA1, 0x9F, 0x6C, 0xB0, 0x52, 0x65};
const PBKDF2Test testCases[] =
{
{
sizeof(test1Password), test1Password, sizeof(test1Salt), test1Salt, 5, sizeof(test1Key), test1Key
},
{
sizeof(test2Password), test2Password, sizeof(test2Salt), test2Salt, 500, sizeof(test2Key), test2Key
}
};
void DoPkcs5HmacSha256Test(const PBKDF2Test& testData)
{
vector<unsigned char> tmp(testData.keyLength, 0);
Pkcs5DeriveKey<SHA256_HASH>(testData.passwordLength, testData.password,
testData.saltLength, testData.salt, testData.iterations,
testData.keyLength, &tmp[0]);
BOOST_CHECK(equal(boost::begin(tmp), boost::end(tmp),
checked_array_iterator<const unsigned char*>(testData.key, testData.keyLength)));
}
BOOST_AUTO_TEST_CASE( pkcs5HmacSha256Test )
{
BOOST_TEST_MESSAGE("PKCS 5.2.1 with HMAC-SHA-256 test");
for_each(begin(testCases), end(testCases), DoPkcs5HmacSha256Test);
}
| 41.321429 | 496 | 0.708297 | [
"vector"
] |
70cfc3f473c40845b5d241087ce35154f705f4f3 | 1,190 | hpp | C++ | perception/feature_extraction/include/feature_extraction/feature_extraction.hpp | probabilistic-anchoring/probanch | cfba24fd431ed7e7109b715018e344d7989f565d | [
"Apache-2.0"
] | 1 | 2020-02-27T14:00:27.000Z | 2020-02-27T14:00:27.000Z | perception/feature_extraction/include/feature_extraction/feature_extraction.hpp | probabilistic-anchoring/probanch | cfba24fd431ed7e7109b715018e344d7989f565d | [
"Apache-2.0"
] | null | null | null | perception/feature_extraction/include/feature_extraction/feature_extraction.hpp | probabilistic-anchoring/probanch | cfba24fd431ed7e7109b715018e344d7989f565d | [
"Apache-2.0"
] | null | null | null | #ifndef __FEATURE_EXTRACTION_HPP__
#define __FEATURE_EXTRACTION_HPP__
#include <image_transport/image_transport.h>
#include <std_msgs/String.h>
#include <anchor_msgs/ObjectArray.h>
#include <features/spatial.hpp>
#include <features/visual.hpp>
class FeatureExtraction {
private:
// Color feature object
visual_2d::ColorFeatures _cf;
// Spatial thresholds
double min_x_, max_x_;
double min_y_, max_y_;
double min_z_, max_z_;
// ROS node handles
ros::NodeHandle nh_;
ros::NodeHandle priv_nh_;
image_transport::ImageTransport it_;
// Publisher/subscribers
ros::Subscriber obj_sub_;
ros::Publisher obj_pub_;
// Display trigger (and image publisher)
std::string display_image_;
ros::Subscriber display_trigger_sub_;
image_transport::Publisher display_image_pub_;
// Callback functions
void triggerCb( const std_msgs::String::ConstPtr &msg);
void processCb(const anchor_msgs::ObjectArray::ConstPtr &objects_msg);
// Helper functions
bool checkSpatialPosition( const geometry_msgs::Pose &pos );
public:
FeatureExtraction(ros::NodeHandle nh);
~FeatureExtraction() {}
void spin();
};
#endif // __FEATURE_EXTRACTION_HPP__
| 22.884615 | 72 | 0.752941 | [
"object"
] |
70d159d97fb4117715bea63fb764b43719c7914b | 5,185 | hpp | C++ | AirLib/include/safety/SafetyEval.hpp | mtmal/UrdfSim | a78e6301220fbc97724fd742ceb5ec04270f638d | [
"MIT"
] | 81 | 2019-02-13T07:26:38.000Z | 2022-03-28T05:59:13.000Z | AirLib/include/safety/SafetyEval.hpp | mtmal/UrdfSim | a78e6301220fbc97724fd742ceb5ec04270f638d | [
"MIT"
] | 53 | 2019-04-04T15:15:22.000Z | 2021-11-12T20:24:35.000Z | AirLib/include/safety/SafetyEval.hpp | mtmal/UrdfSim | a78e6301220fbc97724fd742ceb5ec04270f638d | [
"MIT"
] | 22 | 2019-04-12T21:26:42.000Z | 2021-10-05T07:31:17.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#ifndef air_SafetyEval_hpp
#define air_SafetyEval_hpp
#include <functional>
#include <array>
#include <memory>
#include "ObstacleMap.hpp"
#include "common/common_utils/Utils.hpp"
#include "IGeoFence.hpp"
#include "common/Common.hpp"
#include "vehicles/multirotor/api/MultirotorCommon.hpp"
#include "common/common_utils/EnumFlags.hpp"
namespace msr { namespace airlib {
//this class takes all inputs and outputs in NEU world coordinates in metric system
class SafetyEval {
public:
enum class SafetyViolationType_ :uint {
NoSafetyViolation = 0,
GeoFence = 1 << 0,
Obstacle = 1 << 1,
VelocityLimit = 1 << 2,
All = Utils::max<uint>()
};
//add bitwise operators for enum
typedef common_utils::EnumFlags<SafetyViolationType_> SafetyViolationType;
//to disable obstacle avoidance entirely, disable it in SafetyViolationType
enum class ObsAvoidanceStrategy : uint {
RaiseException = 0, //will return suggested velocity vector = 0
ClosestMove, //find closest obstacle free destination along desired destination
OppositeMove //find closest obstacle free destination along opposite of desired destination
};
//result of the safety evaluation
struct EvalResult {
//information in data structure may only be partially filled if is_safe = true
bool is_safe;
SafetyViolationType reason;
//obstacle info around cur and towards dest, if no obs found then cur might not be evaluated
ObstacleMap::ObstacleInfo cur_obs, dest_obs, suggested_obs;
//locations that were considered while evaluation
Vector3r cur_pos, dest_pos;
//transformed cur to destination vector in body frame
Vector3r cur_dest_body;
string message;
//suggested unit vector without obstacle, must be zero if no suggestions available
Vector3r suggested_vec;
//risk distances indicates how far we are in to risk zone, lower (<= 0) better than higher
//cur is for risk distance around current position
//dest if risk distance towards destination
float cur_risk_dist, dest_risk_dist;
//setup default result
EvalResult()
: is_safe(true), reason(SafetyViolationType_::NoSafetyViolation), suggested_vec(Vector3r::Zero()),
cur_risk_dist(Utils::nan<float>()), dest_risk_dist(Utils::nan<float>())
{}
string toString() const
{
return Utils::stringf("SafetyEval: is_safe=%i, reason=%X, cur_risk_dist=%f, dest_risk_dist=%f, suggested_vec=%s,"
" cur=%s, dest=%s, cur_dest_body=%s, cur_obs=[%s], dest_obs=[%s], suggested_obs=[%s], message=%s",
is_safe, uint(reason), cur_risk_dist, dest_risk_dist, VectorMath::toString(suggested_vec).c_str(),
VectorMath::toString(cur_pos).c_str(), VectorMath::toString(dest_pos).c_str(), VectorMath::toString(cur_dest_body).c_str(),
cur_obs.toString().c_str(), dest_obs.toString().c_str(), suggested_obs.toString().c_str(), message.c_str());
}
};
private:
MultirotorApiParams vehicle_params_;
shared_ptr<IGeoFence> fence_ptr_;
shared_ptr<ObstacleMap> obs_xy_ptr_;
SafetyViolationType enable_reasons_ = SafetyEval::SafetyViolationType_::GeoFence;
ObsAvoidanceStrategy obs_strategy_ = SafetyEval::ObsAvoidanceStrategy::RaiseException;
void checkFence(const Vector3r& cur_pos, const Vector3r& dest_pos, EvalResult& appendToResult);
void isSafeDestination(const Vector3r& dest,const Vector3r& cur_pos, const Quaternionr& quaternion, SafetyEval::EvalResult& result);
Vector3r getDestination(const Vector3r& cur_pos, const Vector3r& velocity) const;
bool isThisRiskDistLess(float this_risk_dist, float other_risk_dist) const;
void isCurrentSafer(SafetyEval::EvalResult& result);
void setSuggestedVelocity(SafetyEval::EvalResult& result, const Quaternionr& quaternion);
float adjustClearanceForPrStl(float base_clearance, float obs_confidence);
public:
SafetyEval(MultirotorApiParams vehicle_params, shared_ptr<IGeoFence> fence_ptr, shared_ptr<ObstacleMap> obs_xy);
EvalResult isSafeVelocity(const Vector3r& cur_pos, const Vector3r& velocity, const Quaternionr& quaternion);
EvalResult isSafeVelocityZ(const Vector3r& cur_pos, float vx, float vy, float z, const Quaternionr& quaternion);
EvalResult isSafeDestination(const Vector3r& dest,const Vector3r& cur_pos, const Quaternionr& quaternion);
EvalResult isSafePosition(const Vector3r& cur_pos, const Quaternionr& quaternion);
void setSafety(SafetyViolationType enable_reasons, float obs_clearance, SafetyEval::ObsAvoidanceStrategy obs_strategy,
const Vector3r& origin, float xy_length, float max_z, float min_z);
void setObsAvoidanceStrategy(SafetyEval::ObsAvoidanceStrategy obs_strategy);
SafetyEval::ObsAvoidanceStrategy getObsAvoidanceStrategy();
};
}} //namespace
#endif
| 50.339806 | 139 | 0.714176 | [
"vector"
] |
70d4c1baddd5aa133061819f9d5b4a6bd173810c | 4,128 | cpp | C++ | Vishv_GE/Engine/Vishv/Src/ThirdPersonControllerComponent.cpp | InFaNsO/Vishv_GameEngine | e721afa899fb8715e52cdd67c2656ba6cce7ffed | [
"MIT"
] | 1 | 2021-12-19T02:06:12.000Z | 2021-12-19T02:06:12.000Z | Vishv_GE/Engine/Vishv/Src/ThirdPersonControllerComponent.cpp | InFaNsO/Vishv_GameEngine | e721afa899fb8715e52cdd67c2656ba6cce7ffed | [
"MIT"
] | null | null | null | Vishv_GE/Engine/Vishv/Src/ThirdPersonControllerComponent.cpp | InFaNsO/Vishv_GameEngine | e721afa899fb8715e52cdd67c2656ba6cce7ffed | [
"MIT"
] | null | null | null | #include "Precompiled.h"
#include "ThirdPersonControllerComponent.h"
#include "TransformComponent.h"
#include "GameObject.h"
#include "GameWorld.h"
#include "CameraService.h"
META_DERIVED_BEGIN(Vishv::Components::ThirdPersonControllerComponent, Vishv::Components::Component)
META_FIELD_BEGIN
META_FIELD(mLookSencivity, "LookSencivity")
META_FIELD(mMoveSpeed, "MoveSpeed")
META_FIELD_END
META_CLASS_END
namespace
{
bool customCompare(const Vishv::Math::Vector3& a, const Vishv::Math::Vector3& b, int order = 1000)
{
int ax = (int)(a.x * order);
int ay = (int)(a.y * order);
int az = (int)(a.z * order);
int bx = (int)(b.x * order);
int by = (int)(b.y * order);
int bz = (int)(b.z * order);
return ax == bx && ay == by && az == bz;
}
}
void Vishv::Components::ThirdPersonControllerComponent::Initialize()
{
mCamSys = GetOwner().GetWorld().GetService<CameraSystem>();
std::string name = "TP_Camera";
//mCamera = mCamSys->SetMainCamera(name);
mTransformComponent = GetOwner().GetComponent<Vishv::Components::TransformComponent>();
offsetCamera = { 0.0f, 250.0f, -200.0f };
}
void Vishv::Components::ThirdPersonControllerComponent::Update()
{
auto input = Vishv::Input::InputSystem::Get();
float deltaTime = Core::Time::Get()->DeltaTime();
if (input->IsKeyDown(Input::KeyCode::W) && input->IsKeyDown(Input::KeyCode::LSHIFT) || mForward && mBoost)
{
mTransformComponent->TranslateForward(mMoveSpeed * deltaTime);
mForward = false;
}
else if (input->IsKeyDown(Input::KeyCode::W) || mForward)
{
mTransformComponent->TranslateForward(mMoveSpeed * deltaTime);
mForward = false;
}
if (input->IsKeyDown(Input::KeyCode::S) && input->IsKeyDown(Input::KeyCode::LSHIFT) || mBackward && mBoost)
{
mTransformComponent->TranslateForward(-mMoveSpeed * deltaTime);
mBackward = false;
}
else if (input->IsKeyDown(Input::KeyCode::S) || mBackward)
{
mTransformComponent->TranslateForward(-mMoveSpeed * deltaTime);
mBackward = false;
}
if (input->IsKeyDown(Input::KeyCode::Q))
{
mTransformComponent->RotateUp(-60.0f * deltaTime);
float angle = Vishv::Math::GetAngle(Math::Normalize((mTransformComponent->Position() - mCamera->transform->Position())), mCamera->transform->Forward());
mCamera->transform->RotateY(-angle * Math::Constans::RadToDeg * deltaTime);
}
else if (input->IsKeyDown(Input::KeyCode::E))
{
mTransformComponent->RotateUp(60.0f * deltaTime);
float angle = Vishv::Math::GetAngle(Math::Normalize((mTransformComponent->Position() - mCamera->transform->Position())), mCamera->transform->Forward());
mCamera->transform->RotateY(angle * Math::Constans::RadToDeg * deltaTime);
//mCamera->transform->RotateY(-60.0f * deltaTime);
}
//update position
Math::Vector3 upRot = { 0.0f, offsetCamera.y, 0.0f };
mCamera->transform->mPosition = mTransformComponent->Position() + upRot + (mTransformComponent->Forward() * offsetCamera.z);
if (!input->IsKeyDown(Input::KeyCode::TAB))
return;
int lr = input->GetMouseMoveX();
int ud = input->GetMouseMoveY();
auto upP = mTransformComponent->Up();
upP = -upP;
if (lr != 0)
prvLr = lr;
mTransformComponent->Rotate(upP, lr * mLookSencivity);
float angle = Vishv::Math::GetAngle(Math::Normalize((mTransformComponent->Position() - mCamera->transform->Position())), mCamera->transform->Forward());
auto forwardPlayer = mTransformComponent->Forward();
auto forwardCam = mCamera->transform->Forward();
if (angle)//(!customCompare(mCamera->transform->Forward(), mTransformComponent->Forward(), 10))
{
float deg = angle * Math::Constans::RadToDeg;
if (Math::Abs(deg - prvDeg) < 0.01f)
return;
prvDeg = deg;
if (prvLr > 0)
deg *= -1;
//if (forwardPlayer.x < forwardCam.x && forwardPlayer.y > 0.0f)
// deg *= -1.0f;
//else if (forwardPlayer.x > forwardCam.x && forwardPlayer.y < 0.0f)
// deg *= -1.0f;
mCamera->transform->RotateY(deg * deltaTime);
//mCamera->transform->RotateX(-ud);
//mCamera->LookAt(mTransformComponent->Position() + upRot);
}
}
void Vishv::Components::ThirdPersonControllerComponent::DebugUI()
{
//make it like cinemachine free look cam
}
| 29.697842 | 154 | 0.699612 | [
"transform"
] |
70d81cb91e7d8b9442fae31c73b69a3a1612f21c | 49,472 | hpp | C++ | src/algoim_blitzinc.hpp | OptimalDesignLab/algoim | 98c58c344ca0d1a08661d27a1ac79d76ad0d029a | [
"BSD-3-Clause-LBNL"
] | 20 | 2018-10-20T06:34:07.000Z | 2022-03-23T05:01:01.000Z | src/algoim_blitzinc.hpp | OptimalDesignLab/algoim | 98c58c344ca0d1a08661d27a1ac79d76ad0d029a | [
"BSD-3-Clause-LBNL"
] | 2 | 2021-05-25T21:52:56.000Z | 2021-05-31T19:00:41.000Z | src/algoim_blitzinc.hpp | OptimalDesignLab/algoim | 98c58c344ca0d1a08661d27a1ac79d76ad0d029a | [
"BSD-3-Clause-LBNL"
] | 6 | 2019-01-15T08:46:56.000Z | 2022-01-24T14:05:22.000Z | #ifndef ALGOIM_BLITZINC_HPP
#define ALGOIM_BLITZINC_HPP
// Management of Algoim's use of blitz++, mainly to inject blitz::TinyVector into the Algoim namespace
// and to enable vector expressions when using QD for double-double or quadruple-double precision.
#include <blitz/array.h>
#if __has_include(<blitz/tinyvec-et.h>)
#include <blitz/tinyvec-et.h> // to support backwards compatibility with blitz-0.9
#endif
#include "algoim_real.hpp"
namespace Algoim
{
// Algoim makes heavy use of blitz::TinyVector, but try not to pollute global namespace by using all of blitz
using ::blitz::TinyVector;
}
// std::equal_to for blitz::TinyVector
namespace std
{
template<typename T, int N>
struct equal_to<blitz::TinyVector<T,N>>
{
bool operator()(const blitz::TinyVector<T,N>& x, const blitz::TinyVector<T,N>& y) const
{
return blitz::all(x == y);
}
};
}
#ifdef ALGOIM_HPREAL
// Enable blitz vector expressions for Real
BZ_NAMESPACE(blitz)
// Should be fine to leave this out, but specifying it could inform blitz that a trivial
// constructor is available.
//BZDECLNUMTRAIT(Real, Real, Real, Real, Real);
// Use this to inform blitz that all types can be promoted to Real as it has more precision
//BZ_DECLARE_PRECISION(Real,710)
// The following has been copied from vecbops.cc, isolating those routines containing
// 'long double' and replaced with Real.
// Vector<P_numtype1> + Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real > > >
operator+(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> + Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Add<typename P_expr1::T_numtype, Real > > >
operator+(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Add<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> + Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real > > >
operator+(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range + Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Add<int, Real > > >
operator+(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Add<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> + Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real > > >
operator+(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Add<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real + Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Add<Real, P_numtype2 > > >
operator+(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Add<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real + _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Add<Real, typename P_expr2::T_numtype > > >
operator+(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Add<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real + VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Add<Real, P_numtype2 > > >
operator+(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Add<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real + Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Add<Real, int > > >
operator+(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Add<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real + TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Add<Real, P_numtype2 > > >
operator+(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Add<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> - Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real > > >
operator-(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> - Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<typename P_expr1::T_numtype, Real > > >
operator-(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> - Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real > > >
operator-(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range - Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Subtract<int, Real > > >
operator-(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Subtract<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> - Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real > > >
operator-(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Subtract<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real - Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Subtract<Real, P_numtype2 > > >
operator-(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Subtract<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real - _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Subtract<Real, typename P_expr2::T_numtype > > >
operator-(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Subtract<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real - VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Subtract<Real, P_numtype2 > > >
operator-(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Subtract<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real - Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Subtract<Real, int > > >
operator-(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Subtract<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real - TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Subtract<Real, P_numtype2 > > >
operator-(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Subtract<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> * Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real > > >
operator*(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> * Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<typename P_expr1::T_numtype, Real > > >
operator*(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> * Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real > > >
operator*(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range * Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Multiply<int, Real > > >
operator*(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Multiply<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> * Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real > > >
operator*(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Multiply<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real * Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Multiply<Real, P_numtype2 > > >
operator*(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Multiply<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real * _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Multiply<Real, typename P_expr2::T_numtype > > >
operator*(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Multiply<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real * VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Multiply<Real, P_numtype2 > > >
operator*(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Multiply<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real * Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Multiply<Real, int > > >
operator*(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Multiply<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real * TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Multiply<Real, P_numtype2 > > >
operator*(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Multiply<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> / Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real > > >
operator/(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> / Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Divide<typename P_expr1::T_numtype, Real > > >
operator/(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Divide<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> / Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real > > >
operator/(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range / Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Divide<int, Real > > >
operator/(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Divide<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> / Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real > > >
operator/(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Divide<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real / Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Divide<Real, P_numtype2 > > >
operator/(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Divide<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real / _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Divide<Real, typename P_expr2::T_numtype > > >
operator/(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Divide<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real / VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Divide<Real, P_numtype2 > > >
operator/(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Divide<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real / Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Divide<Real, int > > >
operator/(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Divide<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real / TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Divide<Real, P_numtype2 > > >
operator/(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Divide<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> > Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real > > >
operator>(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> > Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Greater<typename P_expr1::T_numtype, Real > > >
operator>(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Greater<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> > Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real > > >
operator>(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range > Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Greater<int, Real > > >
operator>(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Greater<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> > Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real > > >
operator>(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Greater<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real > Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Greater<Real, P_numtype2 > > >
operator>(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Greater<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real > _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Greater<Real, typename P_expr2::T_numtype > > >
operator>(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Greater<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real > VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Greater<Real, P_numtype2 > > >
operator>(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Greater<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real > Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Greater<Real, int > > >
operator>(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Greater<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real > TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Greater<Real, P_numtype2 > > >
operator>(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Greater<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> < Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real > > >
operator<(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> < Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Less<typename P_expr1::T_numtype, Real > > >
operator<(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Less<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> < Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real > > >
operator<(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range < Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Less<int, Real > > >
operator<(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Less<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> < Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real > > >
operator<(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Less<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real < Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Less<Real, P_numtype2 > > >
operator<(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Less<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real < _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Less<Real, typename P_expr2::T_numtype > > >
operator<(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Less<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real < VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Less<Real, P_numtype2 > > >
operator<(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Less<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real < Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Less<Real, int > > >
operator<(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Less<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real < TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Less<Real, P_numtype2 > > >
operator<(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Less<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> >= Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real > > >
operator>=(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> >= Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<typename P_expr1::T_numtype, Real > > >
operator>=(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> >= Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real > > >
operator>=(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range >= Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<int, Real > > >
operator>=(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> >= Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real > > >
operator>=(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_GreaterOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real >= Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_GreaterOrEqual<Real, P_numtype2 > > >
operator>=(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_GreaterOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real >= _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_GreaterOrEqual<Real, typename P_expr2::T_numtype > > >
operator>=(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_GreaterOrEqual<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real >= VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_GreaterOrEqual<Real, P_numtype2 > > >
operator>=(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_GreaterOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real >= Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_GreaterOrEqual<Real, int > > >
operator>=(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_GreaterOrEqual<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real >= TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_GreaterOrEqual<Real, P_numtype2 > > >
operator>=(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_GreaterOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> <= Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real > > >
operator<=(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> <= Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<typename P_expr1::T_numtype, Real > > >
operator<=(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> <= Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real > > >
operator<=(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range <= Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<int, Real > > >
operator<=(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> <= Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real > > >
operator<=(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_LessOrEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real <= Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_LessOrEqual<Real, P_numtype2 > > >
operator<=(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_LessOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real <= _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_LessOrEqual<Real, typename P_expr2::T_numtype > > >
operator<=(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_LessOrEqual<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real <= VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_LessOrEqual<Real, P_numtype2 > > >
operator<=(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_LessOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real <= Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_LessOrEqual<Real, int > > >
operator<=(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_LessOrEqual<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real <= TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_LessOrEqual<Real, P_numtype2 > > >
operator<=(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_LessOrEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> == Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real > > >
operator==(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> == Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Equal<typename P_expr1::T_numtype, Real > > >
operator==(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_Equal<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> == Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real > > >
operator==(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range == Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Equal<int, Real > > >
operator==(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_Equal<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> == Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real > > >
operator==(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_Equal<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real == Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Equal<Real, P_numtype2 > > >
operator==(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_Equal<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real == _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Equal<Real, typename P_expr2::T_numtype > > >
operator==(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_Equal<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real == VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Equal<Real, P_numtype2 > > >
operator==(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_Equal<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real == Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Equal<Real, int > > >
operator==(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_Equal<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real == TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Equal<Real, P_numtype2 > > >
operator==(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_Equal<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Vector<P_numtype1> != Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real > > >
operator!=(const Vector<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// _bz_VecExpr<P_expr1> != Real
template<class P_expr1>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<typename P_expr1::T_numtype, Real > > >
operator!=(_bz_VecExpr<P_expr1> d1,
Real d2)
{
typedef _bz_VecExprOp<_bz_VecExpr<P_expr1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<typename P_expr1::T_numtype, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// VectorPick<P_numtype1> != Real
template<class P_numtype1>
inline
_bz_VecExpr<_bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real > > >
operator!=(const VectorPick<P_numtype1>& d1,
Real d2)
{
typedef _bz_VecExprOp<VectorPickIterConst<P_numtype1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Range != Real
inline
_bz_VecExpr<_bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_NotEqual<int, Real > > >
operator!=(Range d1,
Real d2)
{
typedef _bz_VecExprOp<Range,
_bz_VecExprConstant<Real>,
_bz_NotEqual<int, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1,
_bz_VecExprConstant<Real>(d2)));
}
// TinyVector<P_numtype1, N_length1> != Real
template<class P_numtype1, int N_length1>
inline
_bz_VecExpr<_bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real > > >
operator!=(const TinyVector<P_numtype1, N_length1>& d1,
Real d2)
{
typedef _bz_VecExprOp<TinyVectorIterConst<P_numtype1, N_length1>,
_bz_VecExprConstant<Real>,
_bz_NotEqual<P_numtype1, Real> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(d1.beginFast(),
_bz_VecExprConstant<Real>(d2)));
}
// Real != Vector<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_NotEqual<Real, P_numtype2 > > >
operator!=(Real d1,
const Vector<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorIterConst<P_numtype2>,
_bz_NotEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real != _bz_VecExpr<P_expr2>
template<class P_expr2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_NotEqual<Real, typename P_expr2::T_numtype > > >
operator!=(Real d1,
_bz_VecExpr<P_expr2> d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
_bz_VecExpr<P_expr2>,
_bz_NotEqual<Real, typename P_expr2::T_numtype> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real != VectorPick<P_numtype2>
template<class P_numtype2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_NotEqual<Real, P_numtype2 > > >
operator!=(Real d1,
const VectorPick<P_numtype2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
VectorPickIterConst<P_numtype2>,
_bz_NotEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Real != Range
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_NotEqual<Real, int > > >
operator!=(Real d1,
Range d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
Range,
_bz_NotEqual<Real, int> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2));
}
// Real != TinyVector<P_numtype2, N_length2>
template<class P_numtype2, int N_length2>
inline
_bz_VecExpr<_bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_NotEqual<Real, P_numtype2 > > >
operator!=(Real d1,
const TinyVector<P_numtype2, N_length2>& d2)
{
typedef _bz_VecExprOp<_bz_VecExprConstant<Real>,
TinyVectorIterConst<P_numtype2, N_length2>,
_bz_NotEqual<Real, P_numtype2> > T_expr;
return _bz_VecExpr<T_expr>(T_expr(_bz_VecExprConstant<Real>(d1),
d2.beginFast()));
}
// Expression templates for blitz::Array
BZ_DECLARE_ARRAY_ET_SCALAR_OPS(Real)
BZ_NAMESPACE_END
#endif
#endif
| 28.189174 | 113 | 0.712827 | [
"vector"
] |
70db0a24ce0fbf78c5ff92899091e47acc3599f9 | 1,172 | cpp | C++ | main.cpp | sebknzl/byacc-ragel | 60ae0db6abbc99fb69270678b587ca1511b48a19 | [
"MIT"
] | 12 | 2015-01-17T19:46:40.000Z | 2022-02-12T15:23:34.000Z | main.cpp | sebknzl/byacc-ragel | 60ae0db6abbc99fb69270678b587ca1511b48a19 | [
"MIT"
] | null | null | null | main.cpp | sebknzl/byacc-ragel | 60ae0db6abbc99fb69270678b587ca1511b48a19 | [
"MIT"
] | 1 | 2022-02-12T16:18:29.000Z | 2022-02-12T16:18:29.000Z | /* Copyright (c) 2014 Sebastian Kienzl <seb at knzl.de>
* Licensed under the MIT License, see LICENSE.
*/
#include <stdio.h>
#include <cmath>
#include "Expr.h"
using namespace std;
static bool var_callback( const std::string& name, float& value )
{
if( name == "a" ) {
value = 6.f;
return true;
}
else if( name == "PI" ) {
value = M_PI;
return true;
}
else {
return false;
}
}
static bool func_callback( const std::string& name, const std::vector<float>& args, float& result )
{
if( name == "sum" ) {
for( vector<float>::const_iterator i = args.begin(); i != args.end(); ++i ) {
result += *i;
}
return true;
}
else if( name == "cos" && args.size() == 1 ) {
result = cos( args[0] );
return true;
}
else if( name == "one" && args.size() == 0 ) {
result = 1.f;
return true;
}
else {
return false;
}
}
int main()
{
const char* expr = "sum( cos(PI), cos(-2*PI), one() ) + 3 * ( 2 - 4 )";
float result;
string errorMsg;
if( Expr::parse( expr, result, &errorMsg, var_callback, func_callback ) ) {
printf( "%s = %.2f\n", expr, result );
return 0;
}
else {
printf( "Error: %s\n", errorMsg.c_str() );
return 1;
}
}
| 18.903226 | 99 | 0.581911 | [
"vector"
] |
70e316358150a63bb451abd6a6a8cb70cae30d50 | 181 | cpp | C++ | algorithms/p643/643_test.cpp | baishuai/leetcode_go | 440ff08cf15e03ee64b3aa18370af1f75e958d18 | [
"Apache-2.0"
] | 9 | 2017-06-05T15:10:35.000Z | 2021-06-08T03:10:46.000Z | algorithms/p643/643_test.cpp | baishuai/leetcode | 440ff08cf15e03ee64b3aa18370af1f75e958d18 | [
"Apache-2.0"
] | 3 | 2017-07-12T14:08:39.000Z | 2017-10-11T03:08:15.000Z | algorithms/p643/643_test.cpp | baishuai/leetcode_go | 440ff08cf15e03ee64b3aa18370af1f75e958d18 | [
"Apache-2.0"
] | 1 | 2017-07-21T03:51:51.000Z | 2017-07-21T03:51:51.000Z |
#include "643.hpp"
#include <gtest/gtest.h>
TEST(p643, example) {
Solution s;
vector<int> arr = {1, 12, -5, -6, 50, 3};
ASSERT_EQ(12.75, s.findMaxAverage(arr, 4));
}
| 16.454545 | 47 | 0.59116 | [
"vector"
] |
70e3dea200cd2afcfdc8d091e9e406466134b327 | 606 | cpp | C++ | CSES/Missing_Number.cpp | raad1masum/Competitive-Programming | f4bc58f2bd370a398c37b9fe8ffbfac548a488b2 | [
"MIT"
] | null | null | null | CSES/Missing_Number.cpp | raad1masum/Competitive-Programming | f4bc58f2bd370a398c37b9fe8ffbfac548a488b2 | [
"MIT"
] | null | null | null | CSES/Missing_Number.cpp | raad1masum/Competitive-Programming | f4bc58f2bd370a398c37b9fe8ffbfac548a488b2 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int main() {
ios_base::sync_with_stdio(false);
ll n; cin >> n;
vector<int> v;
for (ll i=0; i<n-1; ++i) {
ll x; cin >> x;
v.push_back(x);
}
if (v.size()==1 && v[0]==2) {
cout << 1 << endl;
return 0;
}
if (v.size()==1 && v[0]==1) {
cout << 2 << endl;
return 0;
}
sort(v.begin(), v.end());
for (ll i=0; i<n+1; ++i) {
if (v[i]!=v[n+1] && v[i+1]!=v[i]+1) {
cout << v[i]+1 << endl;
return 0;
}
}
}
| 17.823529 | 45 | 0.392739 | [
"vector"
] |
70e724d4d9cc08fdd9b347cbffa76ce5ab81cdd5 | 3,291 | cpp | C++ | src/main.cpp | bebauke/TTGO-T-Call-PlatformIO | 080c64e37dc255ba53e4cb63d27dd3b304b96666 | [
"MIT"
] | null | null | null | src/main.cpp | bebauke/TTGO-T-Call-PlatformIO | 080c64e37dc255ba53e4cb63d27dd3b304b96666 | [
"MIT"
] | null | null | null | src/main.cpp | bebauke/TTGO-T-Call-PlatformIO | 080c64e37dc255ba53e4cb63d27dd3b304b96666 | [
"MIT"
] | null | null | null | #include <Arduino.h>
// Import required libraries
#include "WiFi.h"
#include "ESPAsyncWebServer.h"
#include <OneWire.h>
#include <DallasTemperature.h>
// Replace with your network credentials
const char* ssid = "FRITZ!Box 7490B";
const char* password = "25262499827645483664";
#define SENSOR_PIN 27 // Digital pin connected to the Temp sensor
OneWire oneWire(SENSOR_PIN);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
String readTemperature() {
sensors.requestTemperatures();
float tempC = sensors.getTempCByIndex(0);
if (isnan(tempC)|| tempC == -127.0) {
Serial.println("Failed to read from sensor!");
return "--.--";
}
else {
Serial.println(tempC);
return String(tempC);
}
}
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
<title>Temperatur-Sensor</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<style>
html {
font-family: Arial;
display: inline-block;
margin: 0px auto;
text-align: center;
}
h2 { font-size: 3.0rem; }
p { font-size: 3.0rem; }
.units { font-size: 1.2rem; }
.dht-labels{
font-size: 1.5rem;
vertical-align:middle;
padding-bottom: 15px;
}
</style>
</head>
<body>
<h2>Temperatursensor</h2>
<p>
<i class="fas fa-thermometer-half" style="color:#059e8a;"></i>
<span class="dht-labels">Temperatur</span>
<span id="temperature">%TEMPERATURE%</span>
<sup class="units">°C</sup>
</p>
</body>
<script>
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("temperature").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/temperature", true);
xhttp.send();
}, 20000 ) ;
</script>
</html>)rawliteral";
// Replaces placeholder with DHT values
String processor(const String& var){
//Serial.println(var);
if(var == "TEMPERATURE"){
return readTemperature();
}
// else if(var == "HUMIDITY"){
// return readDHTHumidity();
// }
return String();
}
void setup(){
// Serial port for debugging purposes
Serial.begin(115200);
sensors.begin();
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
// Print ESP32 Local IP Address
Serial.println(WiFi.localIP());
// Route for root / web page
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/html", index_html, processor);
});
server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", readTemperature().c_str());
});
// server.on("/humidity", HTTP_GET, [](AsyncWebServerRequest *request){
// request->send_P(200, "text/plain", readDHTHumidity().c_str());
// });
// Start server
server.begin();
}
void loop(){
}
| 24.931818 | 196 | 0.661501 | [
"object"
] |
70e8a6c0b99c46e1a37713412362118762d9af77 | 1,313 | cpp | C++ | dnn/test/cpu/warp_affine.cpp | Olalaye/MegEngine | 695d24f24517536e6544b07936d189dbc031bbce | [
"Apache-2.0"
] | 5,168 | 2020-03-19T06:10:04.000Z | 2022-03-31T11:11:54.000Z | dnn/test/cpu/warp_affine.cpp | Olalaye/MegEngine | 695d24f24517536e6544b07936d189dbc031bbce | [
"Apache-2.0"
] | 286 | 2020-03-25T01:36:23.000Z | 2022-03-31T10:26:33.000Z | dnn/test/cpu/warp_affine.cpp | Olalaye/MegEngine | 695d24f24517536e6544b07936d189dbc031bbce | [
"Apache-2.0"
] | 515 | 2020-03-19T06:10:05.000Z | 2022-03-30T09:15:59.000Z | /**
* \file dnn/test/cpu/warp_affine.cpp
* MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
*
* Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include "test/common/warp_affine.h"
#include "test/common/checker.h"
#include "test/cpu/fixture.h"
namespace megdnn {
namespace test {
TEST_F(CPU, WARP_AFFINE_CV) {
using namespace warp_affine;
std::vector<TestArg> args = get_cv_args();
Checker<WarpAffine> checker(handle());
for (auto&& arg : args) {
checker.set_param(arg.param)
.set_dtype(0, dtype::Uint8())
.set_dtype(1, dtype::Float32())
.set_dtype(2, dtype::Uint8())
.execs({arg.src, arg.trans, arg.dst});
}
for (auto&& arg : args) {
checker.set_param(arg.param)
.set_dtype(0, dtype::Float32())
.set_dtype(1, dtype::Float32())
.set_dtype(2, dtype::Float32())
.execs({arg.src, arg.trans, arg.dst});
}
}
} // namespace test
} // namespace megdnn
// vim: syntax=cpp.doxygen
| 30.534884 | 89 | 0.618431 | [
"vector"
] |
70e8eb92c9bbaf576119e242e5157e6482e27baf | 24,451 | cpp | C++ | plugin/hdCycles/utils.cpp | boberfly/hdcycles | 08ac8f99017ae0823a9606301799f9f3b34e285e | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2021-02-06T18:04:12.000Z | 2021-02-06T18:04:12.000Z | plugin/hdCycles/utils.cpp | boberfly/hdcycles | 08ac8f99017ae0823a9606301799f9f3b34e285e | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | plugin/hdCycles/utils.cpp | boberfly/hdcycles | 08ac8f99017ae0823a9606301799f9f3b34e285e | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | // Copyright 2020 Tangent Animation
//
// 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,
// including without limitation, as related to merchantability and fitness
// for a particular purpose.
//
// In no event shall any copyright holder be liable for any damages of any kind
// arising from the use of this software, whether in contract, tort or otherwise.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "utils.h"
#include "config.h"
#include <render/nodes.h>
#include <subd/subd_dice.h>
#include <subd/subd_split.h>
#include <util/util_path.h>
#include <pxr/base/gf/vec2f.h>
#include <pxr/base/tf/stringUtils.h>
#include <pxr/imaging/hd/extComputationUtils.h>
#include <pxr/usd/sdf/assetPath.h>
#ifdef USE_HBOOST
# include <hboost/filesystem.hpp>
#else
# include <boost/filesystem.hpp>
#endif
PXR_NAMESPACE_OPEN_SCOPE
/* =========- Texture ========== */
bool
HdCyclesPathIsUDIM(const ccl::string& a_filepath)
{
#ifndef USD_HAS_UDIM_RESOLVE_FIX
// Added precheck to ensure no UDIM is accepted with relative path
BOOST_NS::filesystem::path filepath(a_filepath);
if (filepath.is_relative())
return false;
#endif
return a_filepath.find("<UDIM>") != std::string::npos;
}
// TODO: Investigate getting these tiles from uv data
// The cycles function ImageTextureNode::cull_tiles does not properly load tiles
// in an interactive session when not provided by Blender. We could assume these
// tiles based on uv primvars, but I have a feeling the material loading happens
// before the mesh syncing. More rnd needs to be done.
void
HdCyclesParseUDIMS(const ccl::string& a_filepath, ccl::vector<int>& a_tiles)
{
BOOST_NS::filesystem::path filepath(a_filepath);
size_t offset = filepath.stem().string().find("<UDIM>");
std::string baseFileName = filepath.stem().string().substr(0, offset);
std::vector<std::string> files;
BOOST_NS::filesystem::path path(ccl::path_dirname(a_filepath));
for (BOOST_NS::filesystem::directory_iterator it(path);
it != BOOST_NS::filesystem::directory_iterator(); ++it) {
if (BOOST_NS::filesystem::is_regular_file(it->status())
|| BOOST_NS::filesystem::is_symlink(it->status())) {
std::string foundFile = BOOST_NS::filesystem::basename(
it->path().filename());
if (baseFileName == (foundFile.substr(0, offset))) {
files.push_back(foundFile);
}
}
}
a_tiles.clear();
for (std::string file : files) {
a_tiles.push_back(atoi(file.substr(offset, offset + 3).c_str()));
}
}
void
HdCyclesMeshTextureSpace(ccl::Geometry* a_geom, ccl::float3& a_loc,
ccl::float3& a_size)
{
// m_cyclesMesh->compute_bounds must be called before this
a_loc = (a_geom->bounds.max + a_geom->bounds.min) / 2.0f;
a_size = (a_geom->bounds.max - a_geom->bounds.min) / 2.0f;
if (a_size.x != 0.0f)
a_size.x = 0.5f / a_size.x;
if (a_size.y != 0.0f)
a_size.y = 0.5f / a_size.y;
if (a_size.z != 0.0f)
a_size.z = 0.5f / a_size.z;
a_loc = a_loc * a_size - ccl::make_float3(0.5f, 0.5f, 0.5f);
}
/* ========== Material ========== */
ccl::Shader*
HdCyclesCreateDefaultShader()
{
ccl::Shader* shader = new ccl::Shader();
shader->graph = new ccl::ShaderGraph();
ccl::VertexColorNode* vc = new ccl::VertexColorNode();
vc->layer_name = ccl::ustring("displayColor");
ccl::PrincipledBsdfNode* bsdf = new ccl::PrincipledBsdfNode();
shader->graph->add(bsdf);
shader->graph->add(vc);
ccl::ShaderNode* out = shader->graph->output();
shader->graph->connect(vc->output("Color"), bsdf->input("Base Color"));
shader->graph->connect(bsdf->output("BSDF"), out->input("Surface"));
return shader;
}
bool
_DumpGraph(ccl::ShaderGraph* shaderGraph, const char* name)
{
if (!shaderGraph)
return false;
static const HdCyclesConfig& config = HdCyclesConfig::GetInstance();
if (config.cycles_shader_graph_dump_dir.size() > 0) {
std::string dump_location = config.cycles_shader_graph_dump_dir + "/"
+ TfMakeValidIdentifier(name)
+ "_graph.txt";
std::cout << "Dumping shader graph: " << dump_location << '\n';
try {
shaderGraph->dump_graph(dump_location.c_str());
return true;
} catch (...) {
std::cout << "Couldn't dump shadergraph: " << dump_location << "\n";
}
}
return false;
}
/* ========= Conversion ========= */
// TODO: Make this function more robust
// Along with making point sampling more robust
// UPDATE:
// This causes a known slowdown to deforming motion blur renders
// This will be addressed in an upcoming PR
HdTimeSampleArray<GfMatrix4d, HD_CYCLES_MOTION_STEPS>
HdCyclesSetTransform(ccl::Object* object, HdSceneDelegate* delegate,
const SdfPath& id, bool use_motion)
{
if (!object)
return {};
HdTimeSampleArray<GfMatrix4d, HD_CYCLES_MOTION_STEPS> xf {};
delegate->SampleTransform(id, &xf);
int sampleCount = xf.count;
if (sampleCount == 0) {
object->tfm = ccl::transform_identity();
return xf;
}
if (sampleCount > 1) {
bool foundCenter = false;
for (int i = 0; i < sampleCount; i++) {
if (xf.times.data()[i] == 0.0f) {
object->tfm = mat4d_to_transform(xf.values.data()[i]);
foundCenter = true;
}
}
if (!foundCenter)
object->tfm = mat4d_to_transform(xf.values.data()[0]);
} else {
object->tfm = mat4d_to_transform(xf.values.data()[0]);
}
if (!use_motion) {
return xf;
}
object->motion.clear();
if (object->geometry) {
if (object->geometry->use_motion_blur
&& object->geometry->motion_steps != sampleCount) {
object->motion.resize(object->geometry->motion_steps, object->tfm);
return xf;
}
}
// TODO: This might still be wrong on some edge cases...
// The order of point sampling and transform sampling is the only reason
// that this works
if (object->geometry && object->geometry->motion_steps == sampleCount) {
object->geometry->use_motion_blur = true;
if (object->geometry->type == ccl::Geometry::MESH) {
ccl::Mesh* mesh = (ccl::Mesh*)object->geometry;
if (mesh->transform_applied)
mesh->need_update = true;
}
object->motion.resize(sampleCount, ccl::transform_empty());
for (int i = 0; i < sampleCount; i++) {
if (xf.times.data()[i] == 0.0f) {
object->tfm = mat4d_to_transform(xf.values.data()[i]);
}
int idx = i;
if (object->geometry)
object->geometry->motion_step(xf.times.data()[i]);
object->motion[idx] = mat4d_to_transform(xf.values.data()[i]);
}
}
return xf;
}
ccl::Transform
HdCyclesExtractTransform(HdSceneDelegate* delegate, const SdfPath& id)
{
constexpr size_t maxSamples = 2;
HdTimeSampleArray<GfMatrix4d, maxSamples> xf {};
delegate->SampleTransform(id, &xf);
return mat4d_to_transform(xf.values[0]);
}
GfMatrix4d
ConvertCameraTransform(const GfMatrix4d& a_cameraTransform)
{
GfMatrix4d viewToWorldCorrectionMatrix(1.0);
GfMatrix4d flipZ(1.0);
flipZ[2][2] = -1.0;
viewToWorldCorrectionMatrix = flipZ * viewToWorldCorrectionMatrix;
return viewToWorldCorrectionMatrix * a_cameraTransform;
}
ccl::Transform
mat4d_to_transform(const GfMatrix4d& mat)
{
ccl::Transform outTransform = ccl::transform_identity();
outTransform.x.x = static_cast<float>(mat[0][0]);
outTransform.x.y = static_cast<float>(mat[1][0]);
outTransform.x.z = static_cast<float>(mat[2][0]);
outTransform.x.w = static_cast<float>(mat[3][0]);
outTransform.y.x = static_cast<float>(mat[0][1]);
outTransform.y.y = static_cast<float>(mat[1][1]);
outTransform.y.z = static_cast<float>(mat[2][1]);
outTransform.y.w = static_cast<float>(mat[3][1]);
outTransform.z.x = static_cast<float>(mat[0][2]);
outTransform.z.y = static_cast<float>(mat[1][2]);
outTransform.z.z = static_cast<float>(mat[2][2]);
outTransform.z.w = static_cast<float>(mat[3][2]);
return outTransform;
}
ccl::Transform
mat4f_to_transform(const GfMatrix4f& mat)
{
ccl::Transform outTransform = ccl::transform_identity();
outTransform.x.x = static_cast<float>(mat[0][0]);
outTransform.x.y = static_cast<float>(mat[1][0]);
outTransform.x.z = static_cast<float>(mat[2][0]);
outTransform.x.w = static_cast<float>(mat[3][0]);
outTransform.y.x = static_cast<float>(mat[0][1]);
outTransform.y.y = static_cast<float>(mat[1][1]);
outTransform.y.z = static_cast<float>(mat[2][1]);
outTransform.y.w = static_cast<float>(mat[3][1]);
outTransform.z.x = static_cast<float>(mat[0][2]);
outTransform.z.y = static_cast<float>(mat[1][2]);
outTransform.z.z = static_cast<float>(mat[2][2]);
outTransform.z.w = static_cast<float>(mat[3][2]);
return outTransform;
}
ccl::int2
vec2i_to_int2(const GfVec2i& a_vec)
{
return ccl::make_int2(a_vec[0], a_vec[1]);
}
GfVec2i
int2_to_vec2i(const ccl::int2& a_int)
{
return GfVec2i(a_int.x, a_int.y);
}
ccl::float2
vec2f_to_float2(const GfVec2f& a_vec)
{
return ccl::make_float2(a_vec[0], a_vec[1]);
}
ccl::float2
vec3f_to_float2(const GfVec3f& a_vec)
{
return ccl::make_float2(a_vec[0], a_vec[1]);
}
ccl::float3
float_to_float3(const float& a_vec)
{
return ccl::make_float3(a_vec, a_vec, a_vec);
}
ccl::float3
vec2f_to_float3(const GfVec2f& a_vec)
{
return ccl::make_float3(a_vec[0], a_vec[1], 0.0f);
}
ccl::float3
vec3f_to_float3(const GfVec3f& a_vec)
{
return ccl::make_float3(a_vec[0], a_vec[1], a_vec[2]);
}
ccl::float3
vec4f_to_float3(const GfVec4f& a_vec)
{
return ccl::make_float3(a_vec[0], a_vec[1], a_vec[2]);
}
ccl::float4
vec3f_to_float4(const GfVec3f& a_vec, float a_alpha)
{
return ccl::make_float4(a_vec[0], a_vec[1], a_vec[2], a_alpha);
}
ccl::float4
vec4f_to_float4(const GfVec4f& a_vec)
{
return ccl::make_float4(a_vec[0], a_vec[1], a_vec[2], a_vec[3]);
}
/* ========= Primvars ========= */
const std::array<HdInterpolation, HdInterpolationCount> interpolations {
HdInterpolationConstant, HdInterpolationUniform,
HdInterpolationVarying, HdInterpolationVertex,
HdInterpolationFaceVarying, HdInterpolationInstance,
};
inline void
_HdCyclesInsertPrimvar(HdCyclesPrimvarMap& primvars, const TfToken& name,
const TfToken& role, HdInterpolation interpolation,
const VtValue& value)
{
auto it = primvars.find(name);
if (it == primvars.end()) {
primvars.insert({ name, { value, role, interpolation } });
} else {
it->second.value = value;
it->second.role = role;
it->second.interpolation = interpolation;
it->second.dirtied = true;
}
}
// Get Computed primvars
bool
HdCyclesGetComputedPrimvars(HdSceneDelegate* a_delegate, const SdfPath& a_id,
HdDirtyBits a_dirtyBits,
HdCyclesPrimvarMap& a_primvars)
{
// First we are querying which primvars need to be computed, and storing them in a list to rely
// on the batched computation function in HdExtComputationUtils.
HdExtComputationPrimvarDescriptorVector dirtyPrimvars;
for (HdInterpolation interpolation : interpolations) {
auto computedPrimvars
= a_delegate->GetExtComputationPrimvarDescriptors(a_id,
interpolation);
for (const auto& primvar : computedPrimvars) {
if (HdChangeTracker::IsPrimvarDirty(a_dirtyBits, a_id,
primvar.name)) {
dirtyPrimvars.emplace_back(primvar);
}
}
}
// Early exit.
if (dirtyPrimvars.empty()) {
return false;
}
auto changed = false;
auto valueStore
= HdExtComputationUtils::GetComputedPrimvarValues(dirtyPrimvars,
a_delegate);
for (const auto& primvar : dirtyPrimvars) {
const auto itComputed = valueStore.find(primvar.name);
if (itComputed == valueStore.end()) {
continue;
}
changed = true;
_HdCyclesInsertPrimvar(a_primvars, primvar.name, primvar.role,
primvar.interpolation, itComputed->second);
}
return changed;
}
// Get Non-computed primvars
bool
HdCyclesGetPrimvars(HdSceneDelegate* a_delegate, const SdfPath& a_id,
HdDirtyBits a_dirtyBits, bool a_multiplePositionKeys,
HdCyclesPrimvarMap& a_primvars)
{
for (auto interpolation : interpolations) {
const auto primvarDescs
= a_delegate->GetPrimvarDescriptors(a_id, interpolation);
for (const auto& primvarDesc : primvarDescs) {
if (primvarDesc.name == HdTokens->points) {
continue;
}
// The number of motion keys has to be matched between points and normals, so
_HdCyclesInsertPrimvar(a_primvars, primvarDesc.name,
primvarDesc.role, primvarDesc.interpolation,
(a_multiplePositionKeys
&& primvarDesc.name == HdTokens->normals)
? VtValue {}
: a_delegate->Get(a_id,
primvarDesc.name));
}
}
return true;
}
void
HdCyclesPopulatePrimvarDescsPerInterpolation(
HdSceneDelegate* a_sceneDelegate, SdfPath const& a_id,
HdCyclesPDPIMap* a_primvarDescsPerInterpolation)
{
if (!a_primvarDescsPerInterpolation->empty()) {
return;
}
auto interpolations = {
HdInterpolationConstant, HdInterpolationUniform,
HdInterpolationVarying, HdInterpolationVertex,
HdInterpolationFaceVarying, HdInterpolationInstance,
};
for (auto& interpolation : interpolations) {
a_primvarDescsPerInterpolation->emplace(
interpolation,
a_sceneDelegate->GetPrimvarDescriptors(a_id, interpolation));
}
}
bool
HdCyclesIsPrimvarExists(TfToken const& a_name,
HdCyclesPDPIMap const& a_primvarDescsPerInterpolation,
HdInterpolation* a_interpolation)
{
for (auto& entry : a_primvarDescsPerInterpolation) {
for (auto& pv : entry.second) {
if (pv.name == a_name) {
if (a_interpolation) {
*a_interpolation = entry.first;
}
return true;
}
}
}
return false;
}
/* ========= MikkTSpace ========= */
struct MikkUserData {
MikkUserData(const char* layer_name, ccl::Mesh* mesh, ccl::float3* tangent,
float* tangent_sign)
: mesh(mesh)
, texface(NULL)
, tangent(tangent)
, tangent_sign(tangent_sign)
{
const ccl::AttributeSet& attributes = (mesh->subd_faces.size())
? mesh->subd_attributes
: mesh->attributes;
ccl::Attribute* attr_vN = attributes.find(ccl::ATTR_STD_VERTEX_NORMAL);
if (!attr_vN) {
mesh->add_face_normals();
mesh->add_vertex_normals();
attr_vN = attributes.find(ccl::ATTR_STD_VERTEX_NORMAL);
}
vertex_normal = attr_vN->data_float3();
ccl::Attribute* attr_uv = attributes.find(ccl::ustring(layer_name));
if (attr_uv != NULL) {
texface = attr_uv->data_float2();
}
}
ccl::Mesh* mesh;
int num_faces;
ccl::float3* vertex_normal;
ccl::float2* texface;
ccl::float3* tangent;
float* tangent_sign;
};
int
mikk_get_num_faces(const SMikkTSpaceContext* context)
{
const MikkUserData* userdata = (const MikkUserData*)context->m_pUserData;
if (userdata->mesh->subd_faces.size()) {
return userdata->mesh->subd_faces.size();
} else {
return userdata->mesh->num_triangles();
}
}
int
mikk_get_num_verts_of_face(const SMikkTSpaceContext* context,
const int face_num)
{
const MikkUserData* userdata = (const MikkUserData*)context->m_pUserData;
if (userdata->mesh->subd_faces.size()) {
const ccl::Mesh* mesh = userdata->mesh;
return mesh->subd_faces[face_num].num_corners;
} else {
return 3;
}
}
int
mikk_vertex_index(const ccl::Mesh* mesh, const int face_num, const int vert_num)
{
if (mesh->subd_faces.size()) {
const ccl::Mesh::SubdFace& face = mesh->subd_faces[face_num];
return mesh->subd_face_corners[face.start_corner + vert_num];
} else {
return mesh->triangles[face_num * 3 + vert_num];
}
}
int
mikk_corner_index(const ccl::Mesh* mesh, const int face_num, const int vert_num)
{
if (mesh->subd_faces.size()) {
const ccl::Mesh::SubdFace& face = mesh->subd_faces[face_num];
return face.start_corner + vert_num;
} else {
return face_num * 3 + vert_num;
}
}
void
mikk_get_position(const SMikkTSpaceContext* context, float P[3],
const int face_num, const int vert_num)
{
const MikkUserData* userdata = (const MikkUserData*)context->m_pUserData;
const ccl::Mesh* mesh = userdata->mesh;
const int vertex_index = mikk_vertex_index(mesh, face_num, vert_num);
const ccl::float3 vP = mesh->verts[vertex_index];
P[0] = vP.x;
P[1] = vP.y;
P[2] = vP.z;
}
void
mikk_get_texture_coordinate(const SMikkTSpaceContext* context, float uv[2],
const int face_num, const int vert_num)
{
const MikkUserData* userdata = (const MikkUserData*)context->m_pUserData;
const ccl::Mesh* mesh = userdata->mesh;
if (userdata->texface != NULL) {
const int corner_index = mikk_corner_index(mesh, face_num, vert_num);
ccl::float2 tfuv = userdata->texface[corner_index];
uv[0] = tfuv.x;
uv[1] = tfuv.y;
} else {
uv[0] = 0.0f;
uv[1] = 0.0f;
}
}
void
mikk_get_normal(const SMikkTSpaceContext* context, float N[3],
const int face_num, const int vert_num)
{
const MikkUserData* userdata = (const MikkUserData*)context->m_pUserData;
const ccl::Mesh* mesh = userdata->mesh;
ccl::float3 vN;
if (mesh->subd_faces.size()) {
const ccl::Mesh::SubdFace& face = mesh->subd_faces[face_num];
if (face.smooth) {
const int vertex_index = mikk_vertex_index(mesh, face_num,
vert_num);
vN = userdata->vertex_normal[vertex_index];
} else {
vN = face.normal(mesh);
}
} else {
if (mesh->smooth[face_num]) {
const int vertex_index = mikk_vertex_index(mesh, face_num,
vert_num);
vN = userdata->vertex_normal[vertex_index];
} else {
const ccl::Mesh::Triangle tri = mesh->get_triangle(face_num);
vN = tri.compute_normal(&mesh->verts[0]);
}
}
N[0] = vN.x;
N[1] = vN.y;
N[2] = vN.z;
}
void
mikk_set_tangent_space(const SMikkTSpaceContext* context, const float T[],
const float sign, const int face_num, const int vert_num)
{
MikkUserData* userdata = (MikkUserData*)context->m_pUserData;
const ccl::Mesh* mesh = userdata->mesh;
const int corner_index = mikk_corner_index(mesh, face_num, vert_num);
userdata->tangent[corner_index] = ccl::make_float3(T[0], T[1], T[2]);
if (userdata->tangent_sign != NULL) {
userdata->tangent_sign[corner_index] = sign;
}
}
void
mikk_compute_tangents(const char* layer_name, ccl::Mesh* mesh, bool need_sign,
bool active_render)
{
/* Create tangent attributes. */
ccl::AttributeSet& attributes = (mesh->subd_faces.size())
? mesh->subd_attributes
: mesh->attributes;
ccl::Attribute* attr;
ccl::ustring name;
if (layer_name != NULL) {
name = ccl::ustring((std::string(layer_name) + ".tangent").c_str());
} else {
name = ccl::ustring("orco.tangent");
}
if (active_render) {
attr = attributes.add(ccl::ATTR_STD_UV_TANGENT, name);
} else {
attr = attributes.add(name, ccl::TypeDesc::TypeVector,
ccl::ATTR_ELEMENT_CORNER);
}
ccl::float3* tangent = attr->data_float3();
/* Create bitangent sign attribute. */
float* tangent_sign = NULL;
if (need_sign) {
ccl::Attribute* attr_sign;
ccl::ustring name_sign;
if (layer_name != NULL) {
name_sign = ccl::ustring(
(std::string(layer_name) + ".tangent_sign").c_str());
} else {
name_sign = ccl::ustring("orco.tangent_sign");
}
if (active_render) {
attr_sign = attributes.add(ccl::ATTR_STD_UV_TANGENT_SIGN,
name_sign);
} else {
attr_sign = attributes.add(name_sign, ccl::TypeDesc::TypeFloat,
ccl::ATTR_ELEMENT_CORNER);
}
tangent_sign = attr_sign->data_float();
}
/* Setup userdata. */
MikkUserData userdata(layer_name, mesh, tangent, tangent_sign);
/* Setup interface. */
SMikkTSpaceInterface sm_interface;
memset(&sm_interface, 0, sizeof(sm_interface));
sm_interface.m_getNumFaces = mikk_get_num_faces;
sm_interface.m_getNumVerticesOfFace = mikk_get_num_verts_of_face;
sm_interface.m_getPosition = mikk_get_position;
sm_interface.m_getTexCoord = mikk_get_texture_coordinate;
sm_interface.m_getNormal = mikk_get_normal;
sm_interface.m_setTSpaceBasic = mikk_set_tangent_space;
/* Setup context. */
SMikkTSpaceContext context;
memset(&context, 0, sizeof(context));
context.m_pUserData = &userdata;
context.m_pInterface = &sm_interface;
/* Compute tangents. */
genTangSpaceDefault(&context);
}
template<>
bool
_HdCyclesGetVtValue<bool>(VtValue a_value, bool a_default, bool* a_hasChanged,
bool a_checkWithDefault)
{
bool val = a_default;
if (!a_value.IsEmpty()) {
if (a_value.IsHolding<bool>()) {
if (!a_checkWithDefault && a_hasChanged)
*a_hasChanged = true;
val = a_value.UncheckedGet<bool>();
} else if (a_value.IsHolding<int>()) {
if (!a_checkWithDefault && a_hasChanged)
*a_hasChanged = true;
val = (bool)a_value.UncheckedGet<int>();
} else if (a_value.IsHolding<float>()) {
if (!a_checkWithDefault && a_hasChanged)
val = (a_value.UncheckedGet<float>() == 1.0f);
} else if (a_value.IsHolding<double>()) {
if (!a_checkWithDefault && a_hasChanged)
*a_hasChanged = true;
val = (a_value.UncheckedGet<double>() == 1.0);
}
}
if (a_hasChanged && a_checkWithDefault && val != a_default)
*a_hasChanged = true;
return val;
}
PXR_NAMESPACE_CLOSE_SCOPE | 32.38543 | 99 | 0.606683 | [
"mesh",
"geometry",
"render",
"object",
"vector",
"transform"
] |
70eaf6fb530caca9e65ec451b1ba0b44022c4f7e | 2,573 | cpp | C++ | 100/153.cpp | correipj/ProjectEuler | 0173d8ec7f309b4f0c243a94351772b1be55e8bf | [
"Unlicense"
] | null | null | null | 100/153.cpp | correipj/ProjectEuler | 0173d8ec7f309b4f0c243a94351772b1be55e8bf | [
"Unlicense"
] | null | null | null | 100/153.cpp | correipj/ProjectEuler | 0173d8ec7f309b4f0c243a94351772b1be55e8bf | [
"Unlicense"
] | null | null | null | // https://projecteuler.net/problem=153
// Investigating Gaussian Integers
#include <iostream>
#include <vector>
#include <set>
#include <functional>
#include <map>
#include <utility>
#include "../Shared/primes.h"
using namespace std;
typedef unsigned long long num_t;
struct gaussint {
public:
num_t a, b;
gaussint() {
a = 0;
b = 0;
}
gaussint(const num_t& A, const num_t& B) {
a = A;
b = B;
}
gaussint(const gaussint& g) {
a = g.a;
b = g.b;
}
gaussint& operator=(const gaussint& g) {
a = g.a;
b = g.b;
return *this;
}
bool operator==(const gaussint& rhs) const {
return a == rhs.a && b == rhs.b;
}
bool operator<(const gaussint& rhs) const {
return (a*a + b*b) < (rhs.a*rhs.a + rhs.b*rhs.b);
}
};
/*
for integers a, b > 0
(a^2 + b^2) = N
(a + bi) and (a - bi) divide N
(b + ai) and (b - ai) divide N
N may never == 3 (mod 4)
k(a+bi) divides N iff k(a^2+b^2) divides Na and Nb
k = {divisors of qa} union {divisors of qb}
qa = Na / (a^2 + b^2)
qb = Nb / (a^2 + b^2)
if a and b coprime, call (a + bi) a gaussian prime
*/
num_t gcd(num_t a, num_t b) {
while(b) {
num_t t = b;
b = a % b;
a = t;
}
return a;
}
bool myComp(const pair<num_t, num_t>& a, const pair<num_t, num_t>& b) {
num_t sa = a.first*a.first + a.second*a.second;
num_t ga = gcd(a.first, a.second);
num_t sb = b.first*b.first + b.second*b.second;
num_t gb = gcd(b.first, b.second);
if (ga == gb)
return a.second < b.second;
return ga > gb;
//return (sa/ga) < (sb/gb);
}
int main(int argc, char* argv[]) {
const num_t lim = 100000;
num_t sum = 0;
for (num_t n = 1; n <= lim; n++) {
sum += n * (lim / n);
if (2*n <= lim)
sum += 2*n*(lim/(2*n));
}
printf("0\n");
for (num_t a = 1; 5*a <= lim; a++) {
if (a % 1000 == 0)
printf("%lld\n", a);
set<num_t, greater<num_t> > divisors;
// Compute divisors of a
for (num_t i = 1; i <= sqrt(a); i++)
if (a % i == 0) {
divisors.insert(i);
if (i != a/i)
divisors.insert(a/i);
}
set<num_t> foundSums;
for (auto d : divisors) {
for (num_t b = a + d; a*a + b*b <= d*lim; b += d) {
if (foundSums.count(b) == 1)
continue;
foundSums.insert(b);
num_t s = a*a + b*b;
num_t k = lim/(s/d);
sum += 2*k*a;
if (a != b)
sum += 2*k*b;
}
}
}
printf("\n");
printf("sum = %11lld\n", sum);
printf(" 00111222333\n");/**/
getchar();
return 0;
}
| 17.039735 | 72 | 0.513797 | [
"vector"
] |
70ecce5ce00e06557c876a08cdf3aa7cd7c2841a | 7,043 | cpp | C++ | mainwindow.cpp | emako/font-awesome-maker | 8caca872c64ca66a3b032f94a49ec138cd3a4c99 | [
"Apache-2.0"
] | null | null | null | mainwindow.cpp | emako/font-awesome-maker | 8caca872c64ca66a3b032f94a49ec138cd3a4c99 | [
"Apache-2.0"
] | null | null | null | mainwindow.cpp | emako/font-awesome-maker | 8caca872c64ca66a3b032f94a49ec138cd3a4c99 | [
"Apache-2.0"
] | null | null | null | #include "mainwindow.h"
#include "define_dialog.h"
#include "ui_mainwindow.h"
#include "version.hpp"
#define DEFAULT_FONT_SIZE 9
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setup();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::setup(void)
{
loadFonts();
loadFontsMeta();
loadFontsPreview();
ui->actionMakeDefine->setIcon(QIcon(BRANDS_MARKDOWN));
ui->actionAbout->setIcon(QIcon(SOLID_INFO_CIRCLE));
ui->actionAbout->connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout()));
ui->actionMakeDefine->connect(ui->actionMakeDefine, SIGNAL(triggered()), this, SLOT(slotMake()));
}
void MainWindow::loadFonts(void)
{
static QList<QPair<QFont*, QString>> fontNames = {
{ &m_iconFontBrandsRegular, ":/otfs/Font Awesome 5 Brands-Regular-400.otf" },
{ &m_iconFontFreeRegular, ":/otfs/Font Awesome 5 Free-Regular-400.otf" },
{ &m_iconFontFreeSolid, ":/otfs/Font Awesome 5 Free-Solid-900.otf" },
};
enum {
IconFontBrands,
IconFontRegular,
IconFontSolid,
IconFontMax,
};
for(int i = 0; i < fontNames.length(); i++)
{
int fontId = QFontDatabase::addApplicationFont(fontNames.at(i).second);
QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);
if(fontFamilies.isEmpty())
{
continue;
}
if(i == IconFontBrands)
{
m_iconFontBrandsRegular = QFont(fontFamilies.first());
}
else if(i == IconFontRegular)
{
m_iconFontFreeRegular = QFont(fontFamilies.first());
}
else if(i == IconFontSolid)
{
m_iconFontFreeSolid = QFont(fontFamilies.first());
}
fontNames.at(i).first->setPointSize(DEFAULT_FONT_SIZE);
}
}
void MainWindow::loadFontsMeta(const QString &a_filename)
{
QString jsonString = Common::getFileText(a_filename);
QJsonObject json = Common::getJsonFromString(jsonString);
for(QJsonObject::iterator i = json.begin(); i != json.end(); i++)
{
static QMap<QString, QFont> fontstyles = {
{ "brands", m_iconFontBrandsRegular },
{ "regular", m_iconFontFreeRegular },
{ "solid", m_iconFontFreeSolid },
};
QString label = i.key();
QString unicode = i.value().toObject().value("unicode").toString();
for(QJsonValue arrayValue : i.value().toObject().value("styles").toArray())
{
QString style = arrayValue.toString();
bool ok = false;
QChar unicodeChar = unicode.toInt(&ok, 16);
if(ok)
{
m_iconFontPreview.insert(QString("%1-%2").arg(style).arg(label), {style, label, unicode, unicodeChar, fontstyles[style]});
}
else
{
qDebug() << QString("Unicode(0x%1) convert to char error!").arg(unicode);
}
m_iconFontDefind.insert(QString("%1-%2").arg(style).arg(label), {style, label, unicode});
qDebug() << QString("label=%1,unicode=0x%2,styles=%3").arg(label).arg(unicode).arg(style);
}
}
}
void MainWindow::loadFontsPreview(void)
{
enum {
PreviewStyle,
PreviewLabel,
PreviewUnicode,
PreviewUnicodeChar,
PreviewFont,
PreviewMax,
};
qDeleteAll(labs);
labs.clear();
uint count = 0;
for(QMap<QString, QList<QVariant>>::iterator i = m_iconFontPreview.begin(); i != m_iconFontPreview.end(); i++)
{
QString key = i.key();
QList<QVariant> value = i.value();
QLabel *lab = new QLabel();
Q_UNUSED(key)
value.at(PreviewFont).value<QFont>().setPixelSize(15);
lab->setAlignment(Qt::AlignCenter);
lab->setFont(value.at(PreviewFont).value<QFont>());
lab->setText(value.at(PreviewUnicodeChar).toChar());
lab->setToolTip(QString("Styles=%1\nLabel=%2\nUnicode=0x%3\nFont=%4\nCount=%5").arg(value.at(PreviewStyle).toString()).arg(value.at(PreviewLabel).toString()).arg(value.at(PreviewUnicode).toString()).arg(value.at(PreviewFont).value<QFont>().family()).arg(++count));
lab->setMinimumSize(30, 30);
lab->setMaximumSize(30, 30);
labs.append(lab);
}
ui->widgetFontPanel->setWidget(labs, 50);
ui->widgetFontPanel->setMargin(0);
ui->widgetFontPanel->setSpacing(0);
}
void MainWindow::slotAbout(void)
{
QMessageBox::about(this, tr("Font Awesome %1").arg(Version::c_font_version), Common::getFileText(":/LICENSE.txt"));
}
void MainWindow::slotMake(void)
{
DefineDialog dialog;
dialog.mainUi = this;
dialog.exec();
}
void MainWindow::slotMetaDefine(void)
{
enum {
DefindStyle,
DefindLabel,
DefindUnicode,
DefindMax,
};
static const char *c_fontawesome_unicode_define_header_filename = "fontawesome_define_unicode.h";
QStringList texts;
texts << "#ifndef FONTAWESOME_DEFINE_UNICODE_H";
texts << "#define FONTAWESOME_DEFINE_UNICODE_H";
texts << QString();
uint count = 0;
for(QMap<QString, QList<QString>>::iterator i = m_iconFontDefind.begin(); i != m_iconFontDefind.end(); i++)
{
QString key = i.key();
QString unicode = i.value().at(DefindUnicode);
texts << QString("#define %1_UNICODE 0x%2 // count=%3").arg(key.replace("-", "_").toUpper()).arg(unicode).arg(++count);
}
texts << QString();
texts << "#endif // FONTAWESOME_DEFINE_UNICODE_H";
if(!Common::setFileText(c_fontawesome_unicode_define_header_filename, texts.join("\r\n")))
{
qDebug() << QString("file: %1 saved!").arg(c_fontawesome_unicode_define_header_filename);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static const char *c_fontawesome_filename_define_header_filename = "fontawesome_define.h";
texts.clear();
texts << "#ifndef FONTAWESOME_DEFINE_H";
texts << "#define FONTAWESOME_DEFINE_H";
texts << QString();
texts << "#define PREFIX \":/svgs/\"";
texts << "#define CONCAT(__x1, __x2) __x1 ## __x2";
texts << QString();
count = 0;
for(QMap<QString, QList<QString>>::iterator i = m_iconFontDefind.begin(); i != m_iconFontDefind.end(); i++)
{
QString key = i.key();
QString style = i.value().at(DefindStyle);
QString label = i.value().at(DefindLabel);
texts << QString("#define %1 CONCAT(PREFIX, \"%2/%3.svg\") // count=%4").arg(key.replace("-", "_").toUpper()).arg(style).arg(label).arg(++count);
}
texts << QString();
texts << "#endif // FONTAWESOME_DEFINE_H";
if(!Common::setFileText(c_fontawesome_filename_define_header_filename, texts.join("\r\n")))
{
qDebug() << QString("file: %1 saved!").arg(c_fontawesome_filename_define_header_filename);
}
}
| 31.163717 | 272 | 0.605566 | [
"solid"
] |
70f48c2ff14336da286ff47ae01985adc4170f4e | 32,454 | hpp | C++ | include/matlab_data.hpp | realjc/stereo-lidar-calibration | 4eb74321ad383cd24b43667043459d90884b925b | [
"Apache-2.0"
] | null | null | null | include/matlab_data.hpp | realjc/stereo-lidar-calibration | 4eb74321ad383cd24b43667043459d90884b925b | [
"Apache-2.0"
] | null | null | null | include/matlab_data.hpp | realjc/stereo-lidar-calibration | 4eb74321ad383cd24b43667043459d90884b925b | [
"Apache-2.0"
] | null | null | null | #ifndef STEREO_LIDAR_CALIBRATION_MATLAB_DATA_HPP
#define STEREO_LIDAR_CALIBRATION_MATLAB_DATA_HPP
#include<vector>
#include<Eigen/Core>
#include <iostream>
using namespace std;
using namespace Eigen;
struct matlab_data1
{
matlab_data1(string camera_id){
m_camera_id = camera_id;
}
string m_camera_id;
double left_camera_intrinsic_matrix[4] = {1625.5120, 1625.6034,640.1925,480.6192};
double left_camera_distortion_vector[2] = {-0.0001, -0.0056};
double right_camera_intrinsic_matrix[4] = {1624.8574, 1624.9360,639.9705,480.8486};
double right_camera_distortion_vector[2] = {-0.0013, 0.0200};
double left_image_corners_3d[96] = {
-0.7846, -0.8075, 4.1335,
0.8074, -0.7923, 3.9739,
0.7897, 0.2043, 3.8928,
-0.8022, 0.1890, 4.0523,
-0.7843, -0.8206, 3.9727,
0.8071, -0.7796, 4.1333,
0.7894, 0.2170, 4.0535,
-0.8019, 0.1760, 3.8928,
-0.9859, -0.8200, 4.0254,
0.6108, -0.7840, 4.1206,
0.5932, 0.2126, 4.0403,
-1.0036, 0.1766, 3.9450,
-0.9900, -0.6126, 4.1002,
0.5943, -0.5885, 3.8779,
0.5971, 0.4032, 4.0062,
-0.9872, 0.3791, 4.2284,
-1.0067, -0.9712, 3.8949,
0.5780, -0.9253, 3.6792,
0.6138, -0.0342, 4.1317,
-0.9710, -0.0801, 4.3473,
-0.9866, -0.6869, 3.8626,
0.6106, -0.6850, 3.9567,
0.5937, 0.2786, 4.2234,
-1.0035, 0.2767, 4.1293,
-0.9389, -0.5215, 4.3308,
0.5895, -0.4857, 3.8589,
0.5461, 0.5112, 3.7938,
-0.9823, 0.4754, 4.2657,
-0.5112, -0.4822, 4.4126,
0.9243, -0.5180, 3.7068,
0.9145, 0.4794, 3.6362,
-0.5210, 0.5153, 4.3420};
double left_image_points[448] = {
885.9869, 481.7691,
886.3540, 399.5270,
886.7717, 318.0023,
887.2300, 237.2270,
802.7710, 480.9914,
803.4655, 399.2424,
804.2442, 317.9894,
805.0462, 237.7691,
720.3563, 480.1073,
721.5405, 398.7608,
722.6545, 318.0105,
723.7645, 238.0044,
638.9120, 479.3011,
640.2981, 398.5266,
641.7699, 318.2290,
643.1475, 238.5338,
558.1542, 478.5383,
559.9219, 398.0044,
561.6630, 318.2415,
563.3445, 238.9805,
478.2398, 477.7606,
480.3157, 397.7560,
482.3459, 318.2252,
484.3589, 239.2269,
399.1126, 477.0003,
401.4577, 397.2351,
403.8841, 318.2298,
406.1297, 239.7638,
878.5270, 485.5561,
878.9847, 405.8163,
879.4628, 326.6525,
879.9998, 248.1206,
799.4828, 483.4800,
800.2332, 403.3443,
800.9957, 323.8718,
801.8198, 244.9490,
719.5920, 481.4051,
720.7587, 400.9039,
721.7825, 321.0201,
722.8920, 241.7857,
638.9044, 479.3441,
640.3039, 398.3670,
641.7714, 318.1177,
643.1498, 238.5389,
557.3546, 477.2105,
559.1196, 395.8989,
560.9362, 315.2245,
562.6793, 235.1911,
475.0414, 475.1109,
477.1309, 393.3468,
479.2504, 312.3092,
481.3349, 231.8829,
391.8830, 472.9510,
394.3245, 390.8649,
396.8130, 309.3530,
399.1636, 228.6140,
799.6411, 484.0006,
800.4121, 404.1227,
801.2186, 324.9557,
802.0087, 246.3470,
719.6557, 482.1556,
720.7665, 402.1129,
721.7872, 322.7032,
722.9262, 243.9021,
639.1173, 480.3444,
640.5833, 400.0930,
642.0091, 320.3890,
643.3669, 241.3583,
558.1463, 478.5544,
559.9248, 398.0182,
561.6948, 318.1232,
563.3604, 238.8765,
476.7341, 476.7316,
478.8736, 395.9561,
480.8823, 315.8786,
482.9548, 236.3437,
394.8307, 474.8886,
397.1689, 393.8820,
399.6219, 313.5549,
401.9592, 233.8652,
312.3471, 472.9862,
315.1101, 391.8117,
317.8880, 311.1643,
320.6266, 231.2466,
801.7625, 562.3442,
802.4547, 481.9193,
803.2521, 400.4235,
804.1164, 317.7666,
720.7495, 560.6030,
720.9858, 480.6946,
721.2357, 399.7730,
721.7520, 317.7723,
640.9953, 558.8420,
640.7617, 479.4531,
640.4554, 399.0005,
640.2349, 317.7658,
562.2290, 557.0750,
561.5377, 478.2371,
560.7775, 398.4097,
560.0173, 317.5409,
484.6555, 555.3455,
483.3874, 477.0301,
482.2190, 397.7776,
480.9809, 317.4582,
408.0005, 553.6962,
406.3443, 475.8848,
404.6522, 397.0923,
402.9121, 317.2236,
332.3684, 552.0205,
330.2910, 474.7801,
328.1316, 396.5417,
325.9143, 317.2219,
803.2435, 393.2531,
804.0748, 318.3891,
804.9869, 240.0060,
805.7740, 158.0050,
723.5416, 391.5919,
722.5703, 317.1683,
721.5439, 239.2989,
720.3495, 157.7676,
644.8825, 389.8976,
642.1068, 315.9991,
639.1641, 238.6626,
636.1299, 157.7746,
567.1721, 388.2349,
562.7200, 314.7621,
558.0303, 237.9893,
553.1279, 157.5447,
490.5529, 386.6314,
484.3428, 313.5838,
477.9717, 237.2299,
471.1896, 157.2497,
414.8761, 384.9957,
407.0446, 312.3663,
398.9594, 236.5426,
390.4232, 157.2462,
340.1196, 383.3686,
330.7779, 311.2293,
320.9460, 235.8665,
310.7944, 157.0067,
795.3543, 513.9946,
798.8220, 438.0143,
802.1716, 360.0915,
805.7643, 280.1338,
717.6333, 514.0070,
719.8976, 437.7709,
722.3330, 359.7538,
724.8398, 279.4661,
639.2424, 513.9983,
640.6299, 437.4764,
642.0005, 359.2324,
643.3543, 278.7574,
560.4561, 514.0017,
560.7660, 437.3506,
561.2341, 358.7702,
561.5412, 278.0005,
481.2543, 513.9993,
480.6133, 437.2250,
479.8221, 358.2290,
479.0400, 277.2805,
401.6966, 513.9957,
399.8833, 436.9922,
398.0558, 357.8541,
396.1375, 276.6784,
321.6310, 513.9976,
318.7063, 436.7538,
315.7888, 357.4379,
312.7920, 275.9910,
351.1069, 359.2301,
346.9088, 435.1193,
342.6782, 511.6285,
338.3698, 588.4698,
421.0540, 359.2310,
416.9934, 436.2252,
412.8939, 513.8150,
408.8007, 591.8227,
492.9566, 359.2303,
489.1026, 437.3434,
485.1337, 515.9990,
481.2029, 595.1265,
566.9586, 359.2354,
563.2097, 438.5351,
559.5463, 518.3446,
555.7878, 598.6774,
643.1102, 359.2298,
639.6253, 439.7722,
636.0430, 520.7213,
632.4357, 602.1806,
721.5476, 359.2401,
718.1541, 440.9879,
714.8863, 523.1107,
711.5671, 605.9072,
802.2941, 359.2205,
799.1889, 442.2148,
796.0915, 525.6840,
792.9420, 609.7101,
514.0675, 372.0843,
512.9627, 447.2784,
511.7722, 522.9993,
510.6110, 599.0999,
580.5529, 368.1400,
579.6158, 444.8970,
578.6630, 522.1396,
577.6754, 599.9064,
649.9094, 363.9744,
649.1210, 442.3361,
648.3486, 521.2338,
647.6396, 600.7680,
722.2328, 359.6640,
721.7803, 439.7195,
721.2200, 520.2991,
720.7538, 601.5361,
797.7661, 355.1077,
797.4646, 436.9421,
797.2307, 519.3843,
797.0094, 602.4337,
876.7736, 350.3514,
876.7682, 434.1115,
876.9844, 518.3894,
877.0202, 603.3289,
959.4753, 345.4333,
959.9011, 431.1021,
960.2319, 517.3485,
960.4689, 604.2580};
double left_camera_lidar_tform[16] = {
1.015437305360809978e-01, -2.957116006341369840e-01, 9.498650009549850504e-01, 0.000000000000000000e+00,
-9.914756090855629811e-01, -1.084361750034519983e-01, 7.223373546365559339e-02, 0.000000000000000000e+00,
8.163937393946869847e-02, -9.491028633404380299e-01, -3.042018530873110138e-01, 0.000000000000000000e+00,
-4.316486076179240072e-01, 3.181553584549249858e-01, -1.240190567511030018e-01, 1.000000000000000000e+00};
double right_image_corners_3d[96] = {
-9.052999999999999936e-01, -8.088999999999999524e-01, 4.128700000000000259e+00,
6.865999999999999881e-01, -7.934999999999999831e-01, 3.968900000000000095e+00,
6.689000000000000501e-01, 2.031000000000000028e-01, 3.888500000000000068e+00,
-9.230000000000000426e-01, 1.877000000000000057e-01, 4.048399999999999999e+00,
-9.051000000000000156e-01, -8.218999999999999639e-01, 3.968700000000000117e+00,
6.864000000000000101e-01, -7.808000000000000496e-01, 4.128400000000000070e+00,
6.686999999999999611e-01, 2.157999999999999918e-01, 4.048399999999999999e+00,
-9.227999999999999536e-01, 1.748000000000000109e-01, 3.888700000000000045e+00,
-1.106800000000000006e+00, -8.212000000000000410e-01, 4.020599999999999952e+00,
4.899000000000000021e-01, -7.852999999999999980e-01, 4.116900000000000226e+00,
4.723999999999999866e-01, 2.112999999999999878e-01, 4.036299999999999777e+00,
-1.124300000000000077e+00, 1.754000000000000004e-01, 3.939999999999999947e+00,
-1.110700000000000021e+00, -6.138000000000000123e-01, 4.094999999999999751e+00,
4.737000000000000099e-01, -5.897999999999999909e-01, 3.873200000000000198e+00,
4.764999999999999791e-01, 4.020000000000000240e-01, 4.001199999999999868e+00,
-1.107799999999999896e+00, 3.779000000000000137e-01, 4.222999999999999865e+00,
-1.127399999999999958e+00, -9.723000000000000531e-01, 3.889600000000000168e+00,
4.573999999999999733e-01, -9.262000000000000233e-01, 3.674399999999999888e+00,
4.929999999999999938e-01, -3.549999999999999684e-02, 4.127600000000000158e+00,
-1.091800000000000104e+00, -8.160000000000000586e-02, 4.342699999999999783e+00,
-1.107399999999999940e+00, -6.883000000000000229e-01, 3.858200000000000074e+00,
4.898000000000000131e-01, -6.864000000000000101e-01, 3.952500000000000124e+00,
4.729999999999999760e-01, 2.773999999999999799e-01, 4.218600000000000350e+00,
-1.124200000000000088e+00, 2.755000000000000226e-01, 4.124299999999999855e+00,
-1.059700000000000086e+00, -5.228000000000000425e-01, 4.325499999999999901e+00,
4.687999999999999945e-01, -4.868999999999999995e-01, 3.854099999999999859e+00,
4.254999999999999893e-01, 5.100999999999999979e-01, 3.789400000000000102e+00,
-1.103099999999999969e+00, 4.741000000000000214e-01, 4.260799999999999699e+00,
-6.320999999999999952e-01, -4.835999999999999743e-01, 4.407099999999999795e+00,
8.034999999999999920e-01, -5.188000000000000389e-01, 3.701600000000000001e+00,
7.939000000000000501e-01, 4.787000000000000144e-01, 3.632200000000000095e+00,
-6.417000000000000481e-01, 5.139000000000000234e-01, 4.337699999999999889e+00};
double right_image_points[448] = {
8.362355000000000018e+02, 4.817699000000000069e+02,
8.369811999999999443e+02, 3.994603999999999928e+02,
8.374587999999999965e+02, 3.180004999999999882e+02,
8.382291999999999916e+02, 2.372254000000000076e+02,
7.532605999999999540e+02, 4.809828999999999724e+02,
7.542499000000000251e+02, 3.992280999999999835e+02,
7.552437999999999647e+02, 3.179920000000000186e+02,
7.562373999999999796e+02, 2.377690000000000055e+02,
6.712201999999999771e+02, 4.801082000000000107e+02,
6.725625000000000000e+02, 3.987688999999999737e+02,
6.738913000000000011e+02, 3.179993000000000052e+02,
6.751358000000000175e+02, 2.379976000000000056e+02,
5.900023999999999660e+02, 4.793056000000000267e+02,
5.916101999999999634e+02, 3.985357999999999947e+02,
5.931974000000000160e+02, 3.182289999999999850e+02,
5.948482999999999947e+02, 2.385424999999999898e+02,
5.094805999999999813e+02, 4.785144999999999982e+02,
5.114168999999999983e+02, 3.979898000000000025e+02,
5.133460999999999785e+02, 3.182339999999999804e+02,
5.152804999999999609e+02, 2.389706999999999937e+02,
4.298663000000000238e+02, 4.777737000000000194e+02,
4.320731000000000108e+02, 3.977703999999999951e+02,
4.343168000000000006e+02, 3.182173000000000229e+02,
4.365731999999999857e+02, 2.392522999999999911e+02,
3.509309999999999832e+02, 4.770027999999999793e+02,
3.535414999999999850e+02, 3.972474000000000274e+02,
3.560328999999999837e+02, 3.182298999999999864e+02,
3.585645000000000095e+02, 2.397660999999999945e+02,
8.304180000000000064e+02, 4.855280000000000200e+02,
8.309823999999999842e+02, 4.058220000000000027e+02,
8.317631000000000085e+02, 3.266662999999999784e+02,
8.323623000000000047e+02, 2.481100000000000136e+02,
7.510069999999999482e+02, 4.834488000000000056e+02,
7.520123999999999569e+02, 4.033457999999999970e+02,
7.529946999999999662e+02, 3.238774000000000228e+02,
7.539950999999999794e+02, 2.449484999999999957e+02,
6.709281999999999471e+02, 4.813869000000000256e+02,
6.722278999999999769e+02, 4.008827999999999747e+02,
6.734624999999999773e+02, 3.209984000000000037e+02,
6.747866000000000213e+02, 2.417894000000000005e+02,
5.900016000000000531e+02, 4.793301000000000158e+02,
5.916453999999999951e+02, 3.983985000000000127e+02,
5.932061999999999671e+02, 3.181127999999999929e+02,
5.948677999999999884e+02, 2.385613999999999919e+02,
5.081890000000000214e+02, 4.771936000000000035e+02,
5.101580999999999904e+02, 3.958985000000000127e+02,
5.121227999999999838e+02, 3.152117000000000075e+02,
5.141103000000000520e+02, 2.351829999999999927e+02,
4.256510999999999854e+02, 4.751224000000000274e+02,
4.279513999999999783e+02, 3.933473999999999933e+02,
4.302312999999999761e+02, 3.123208000000000197e+02,
4.325765999999999849e+02, 2.319044000000000096e+02,
3.421850999999999772e+02, 4.729436000000000035e+02,
3.448759999999999764e+02, 3.908851000000000226e+02,
3.475763999999999783e+02, 3.093713000000000193e+02,
3.501186999999999898e+02, 2.286213999999999942e+02,
7.513460999999999785e+02, 4.839780999999999835e+02,
7.523261999999999716e+02, 4.041035999999999717e+02,
7.532539000000000442e+02, 3.249295000000000186e+02,
7.542421000000000504e+02, 2.463509999999999991e+02,
6.712300000000000182e+02, 4.821315999999999917e+02,
6.725443999999999960e+02, 4.021240000000000236e+02,
6.738116999999999734e+02, 3.227072999999999752e+02,
6.750780999999999494e+02, 2.438795000000000073e+02,
5.906382999999999583e+02, 4.803605999999999767e+02,
5.922083000000000084e+02, 4.000761999999999716e+02,
5.938622000000000298e+02, 3.203897000000000048e+02,
5.954261000000000195e+02, 2.413581000000000074e+02,
5.094698000000000206e+02, 4.785480000000000018e+02,
5.114119999999999777e+02, 3.980178999999999974e+02,
5.133492999999999711e+02, 3.181143999999999892e+02,
5.152771999999999935e+02, 2.388711999999999875e+02,
4.278933000000000106e+02, 4.767203000000000088e+02,
4.301360000000000241e+02, 3.959515999999999849e+02,
4.323983000000000061e+02, 3.158552000000000248e+02,
4.346949999999999932e+02, 2.363568999999999960e+02,
3.458681000000000267e+02, 4.748915000000000077e+02,
3.484026000000000067e+02, 3.938647000000000276e+02,
3.510296999999999912e+02, 3.135765999999999849e+02,
3.536428999999999974e+02, 2.338505999999999858e+02,
2.632327999999999975e+02, 4.729807999999999879e+02,
2.661526000000000067e+02, 3.918070999999999913e+02,
2.691258000000000266e+02, 3.111646000000000072e+02,
2.720715999999999894e+02, 2.312350000000000136e+02,
7.530113000000000056e+02, 5.623437000000000126e+02,
7.535390999999999622e+02, 4.819143000000000256e+02,
7.540164999999999509e+02, 4.004119999999999777e+02,
7.545370000000000346e+02, 3.177574999999999932e+02,
6.724675999999999476e+02, 5.606035000000000537e+02,
6.724565000000000055e+02, 4.807056000000000040e+02,
6.724655999999999949e+02, 3.997622000000000071e+02,
6.722358000000000402e+02, 3.177722999999999729e+02,
5.929882000000000062e+02, 5.588414999999999964e+02,
5.924887999999999693e+02, 4.794660000000000082e+02,
5.919547999999999774e+02, 3.990034999999999741e+02,
5.912720000000000482e+02, 3.177735999999999876e+02,
5.146168000000000120e+02, 5.570488000000000284e+02,
5.135621999999999616e+02, 4.782343999999999937e+02,
5.125353000000000065e+02, 3.984254000000000246e+02,
5.115153999999999996e+02, 3.174793999999999983e+02,
4.372402000000000157e+02, 5.553523000000000138e+02,
4.357712999999999965e+02, 4.770240000000000009e+02,
4.342244000000000028e+02, 3.977701999999999884e+02,
4.326979999999999791e+02, 3.175323999999999955e+02,
3.609336999999999875e+02, 5.536906999999999925e+02,
3.589963999999999942e+02, 4.758981999999999744e+02,
3.570049000000000206e+02, 3.970998999999999910e+02,
3.549714000000000169e+02, 3.172291000000000167e+02,
2.856997000000000071e+02, 5.520000999999999749e+02,
2.832388000000000261e+02, 4.747760000000000105e+02,
2.808104999999999905e+02, 3.965269999999999868e+02,
2.783100000000000023e+02, 3.172459000000000060e+02,
7.552320999999999458e+02, 3.932549999999999955e+02,
7.550125000000000455e+02, 3.183865000000000123e+02,
7.547738000000000511e+02, 2.400089000000000112e+02,
7.544546000000000276e+02, 1.580054000000000087e+02,
6.758784000000000560e+02, 3.916044999999999732e+02,
6.738519999999999754e+02, 3.171754000000000246e+02,
6.716662999999999784e+02, 2.392684000000000140e+02,
6.693416999999999462e+02, 1.577770999999999901e+02,
5.975945000000000391e+02, 3.899141000000000190e+02,
5.937133000000000038e+02, 3.159889000000000010e+02,
5.896901000000000295e+02, 2.386348999999999876e+02,
5.854480999999999540e+02, 1.577660999999999945e+02,
5.201326000000000249e+02, 3.882255999999999858e+02,
5.146499999999999773e+02, 3.147660999999999945e+02,
5.088842999999999961e+02, 2.379832000000000107e+02,
5.027787999999999897e+02, 1.574496000000000038e+02,
4.438283999999999878e+02, 3.866462999999999965e+02,
4.366050999999999931e+02, 3.135597999999999956e+02,
4.290661000000000058e+02, 2.372309999999999945e+02,
4.211911999999999807e+02, 1.572392000000000110e+02,
3.683713000000000193e+02, 3.850002000000000066e+02,
3.596453000000000202e+02, 3.123917000000000144e+02,
3.504076000000000022e+02, 2.365241000000000042e+02,
3.408351000000000113e+02, 1.572241999999999962e+02,
2.940017000000000280e+02, 3.833595000000000255e+02,
2.836467999999999847e+02, 3.112382000000000062e+02,
2.728233999999999924e+02, 2.358632000000000062e+02,
2.613761000000000081e+02, 1.569986000000000104e+02,
7.485406000000000404e+02, 5.139981999999999971e+02,
7.512091000000000349e+02, 4.379753999999999792e+02,
7.540614000000000487e+02, 3.600993000000000279e+02,
7.569509000000000469e+02, 2.801274999999999977e+02,
6.704583999999999833e+02, 5.139976000000000340e+02,
6.722224999999999682e+02, 4.377678999999999974e+02,
6.740253999999999905e+02, 3.597715000000000032e+02,
6.758807000000000471e+02, 2.794589000000000283e+02,
5.920179000000000542e+02, 5.139969999999999573e+02,
5.927554000000000087e+02, 4.374682000000000244e+02,
5.935348999999999933e+02, 3.592382999999999811e+02,
5.942311999999999443e+02, 2.787701000000000136e+02,
5.132290000000000418e+02, 5.139923999999999751e+02,
5.129823999999999842e+02, 4.373432000000000244e+02,
5.124636000000000422e+02, 3.587574000000000183e+02,
5.122323000000000093e+02, 2.779934999999999832e+02,
4.338822999999999865e+02, 5.140009999999999764e+02,
4.324683999999999742e+02, 4.372454000000000178e+02,
4.311259000000000015e+02, 3.582316999999999894e+02,
4.297407999999999788e+02, 2.772875000000000227e+02,
3.540935000000000059e+02, 5.140040000000000191e+02,
3.516718000000000188e+02, 4.370033000000000243e+02,
3.491501000000000090e+02, 3.578564999999999827e+02,
3.466415000000000077e+02, 2.766847000000000207e+02,
2.738501999999999725e+02, 5.139964999999999691e+02,
2.703358000000000061e+02, 4.367714000000000283e+02,
2.667647000000000048e+02, 3.574354999999999905e+02,
2.630969999999999800e+02, 2.759970999999999890e+02,
3.052724999999999795e+02, 3.592201999999999771e+02,
3.009318000000000097e+02, 4.351114999999999782e+02,
2.966009000000000242e+02, 5.116417000000000144e+02,
2.921433999999999855e+02, 5.884636000000000422e+02,
3.746358000000000175e+02, 3.592393999999999892e+02,
3.703380000000000223e+02, 4.362300999999999931e+02,
3.661600999999999999e+02, 5.137907999999999902e+02,
3.618777000000000044e+02, 5.918203999999999496e+02,
4.458643999999999892e+02, 3.592327000000000226e+02,
4.418238999999999805e+02, 4.373568000000000211e+02,
4.377653999999999996e+02, 5.160480999999999767e+02,
4.336909999999999741e+02, 5.951309999999999718e+02,
5.191276000000000295e+02, 3.592259000000000242e+02,
5.152711000000000467e+02, 4.385308999999999742e+02,
5.113736000000000104e+02, 5.183296000000000276e+02,
5.074649999999999750e+02, 5.986381000000000085e+02,
5.946449999999999818e+02, 3.592407999999999788e+02,
5.909266000000000076e+02, 4.397672000000000025e+02,
5.871808999999999514e+02, 5.207047000000000025e+02,
5.835675999999999704e+02, 6.021874000000000251e+02,
6.722933000000000447e+02, 3.592187999999999874e+02,
6.688564000000000078e+02, 4.410024999999999977e+02,
6.653244999999999436e+02, 5.231156999999999471e+02,
6.618558000000000447e+02, 6.058894000000000233e+02,
7.523301000000000158e+02, 3.592259000000000242e+02,
7.490974999999999682e+02, 4.422287999999999784e+02,
7.458455999999999904e+02, 5.257039999999999509e+02,
7.424736000000000331e+02, 6.096793000000000120e+02,
4.688358999999999810e+02, 3.721089999999999804e+02,
4.674531999999999812e+02, 4.472855999999999881e+02,
4.661791999999999803e+02, 5.229796000000000049e+02,
4.648820000000000050e+02, 5.990997999999999593e+02,
5.343220999999999776e+02, 3.681104000000000269e+02,
5.332306999999999562e+02, 4.448808999999999969e+02,
5.320759000000000469e+02, 5.221154000000000224e+02,
5.309868000000000166e+02, 5.998990000000000009e+02,
6.027237999999999829e+02, 3.640043999999999755e+02,
6.017609999999999673e+02, 4.423351999999999862e+02,
6.008306000000000040e+02, 5.212383999999999560e+02,
5.999538000000000011e+02, 6.007612000000000307e+02,
6.739958000000000311e+02, 3.596523000000000252e+02,
6.732418999999999869e+02, 4.397083999999999833e+02,
6.725828999999999951e+02, 5.203438999999999623e+02,
6.719880000000000564e+02, 6.015429000000000315e+02,
7.484551999999999907e+02, 3.551200999999999794e+02,
7.480041999999999689e+02, 4.369746999999999844e+02,
7.475457999999999856e+02, 5.194066000000000258e+02,
7.472486999999999853e+02, 6.024456999999999880e+02,
8.263497999999999593e+02, 3.503695999999999913e+02,
8.262229999999999563e+02, 4.340933999999999742e+02,
8.259913999999999987e+02, 5.183884000000000469e+02,
8.260185000000000173e+02, 6.033328000000000202e+02,
9.080099000000000160e+02, 3.453761999999999830e+02,
9.079998000000000502e+02, 4.311050999999999931e+02,
9.082327999999999975e+02, 5.173468000000000302e+02,
9.082372000000000298e+02, 6.042518000000000029e+02};
double lidar_corners_3d[96] = {
4.343700000000000117e+00, 7.839000000000000412e-01, -2.575000000000000067e-01,
4.349700000000000344e+00, -8.105999999999999872e-01, -8.469999999999999751e-02,
3.968799999999999883e+00, -9.126999999999999558e-01, -1.013700000000000045e+00,
3.962899999999999867e+00, 6.817999999999999616e-01, -1.186399999999999899e+00,
4.189000000000000057e+00, 7.731999999999999984e-01, -1.971999999999999864e-01,
4.503400000000000070e+00, -7.979000000000000536e-01, -1.534999999999999976e-01,
4.124600000000000044e+00, -8.993999999999999773e-01, -1.077399999999999913e+00,
3.810200000000000031e+00, 6.716999999999999638e-01, -1.121099999999999985e+00,
4.222500000000000142e+00, 9.647999999999999909e-01, -2.190999999999999892e-01,
4.456000000000000405e+00, -6.099999999999999867e-01, -1.567000000000000060e-01,
4.091000000000000192e+00, -7.009999999999999565e-01, -1.087800000000000100e+00,
3.857400000000000162e+00, 8.738000000000000211e-01, -1.150199999999999889e+00,
4.243299999999999628e+00, 9.639999999999999680e-01, -4.491999999999999882e-01,
4.176000000000000156e+00, -6.260999999999999899e-01, -2.677999999999999825e-01,
3.994899999999999896e+00, -7.307000000000000162e-01, -1.251500000000000057e+00,
4.062199999999999811e+00, 8.594000000000000528e-01, -1.432900000000000063e+00,
4.143900000000000361e+00, 1.002099999999999991e+00, -4.399999999999999745e-02,
4.073900000000000077e+00, -5.884000000000000341e-01, 1.121000000000000052e-01,
4.255700000000000038e+00, -6.934000000000000163e-01, -8.758000000000000229e-01,
4.325800000000000090e+00, 8.971000000000000085e-01, -1.031900000000000039e+00,
4.023200000000000109e+00, 9.456999999999999851e-01, -3.024000000000000021e-01,
4.274700000000000166e+00, -6.319000000000000172e-01, -2.056999999999999940e-01,
4.249699999999999811e+00, -6.971000000000000529e-01, -1.205200000000000049e+00,
3.998099999999999987e+00, 8.804999999999999494e-01, -1.301900000000000057e+00,
4.424199999999999910e+00, 9.136999999999999567e-01, -5.969999999999999751e-01,
4.136999999999999567e+00, -6.383999999999999675e-01, -3.634999999999999898e-01,
3.769499999999999851e+00, -7.097999999999999865e-01, -1.290200000000000014e+00,
4.056700000000000195e+00, 8.423000000000000487e-01, -1.523800000000000043e+00,
4.528100000000000236e+00, 4.929000000000000048e-01, -6.188000000000000167e-01,
4.021200000000000330e+00, -9.818999999999999950e-01, -2.667999999999999816e-01,
3.658900000000000041e+00, -1.078999999999999959e+00, -1.195100000000000051e+00,
4.165799999999999947e+00, 3.958999999999999742e-01, -1.547099999999999920e+00};
double right_camera_lidar_tform[16] = {
1.014350332686559941e-01, -2.958916038515250202e-01, 9.498205582087380083e-01, 0.000000000000000000e+00,
-9.914805267441609837e-01, -1.084886623008390061e-01, 7.208727515515500617e-02, 0.000000000000000000e+00,
8.171474232295750095e-02, -9.490407625188429508e-01, -3.043753143156420204e-01, 0.000000000000000000e+00,
-5.518978994097529789e-01, 3.177245705797350217e-01, -1.286218134910069866e-01, 1.000000000000000000e+00};
MatrixXd get_camera_intrinsic_matrix(){
double* camera_intrinsic_matrix;
if(m_camera_id == "left"){
camera_intrinsic_matrix = left_camera_intrinsic_matrix;
}else if(m_camera_id == "right"){
camera_intrinsic_matrix = right_camera_intrinsic_matrix;
}else{
cerr << "only left or right camera !!! "<<endl;
exit(-1);
}
MatrixXd m;
m = Matrix3d::Identity(3,3);
m(0,0) = *(camera_intrinsic_matrix);
m(0,2) = *(camera_intrinsic_matrix+2);
m(1,1) = *(camera_intrinsic_matrix+1);
m(1,2) = *(camera_intrinsic_matrix+3);
return m;
}
VectorXd get_camera_distortion_vector()
{
double* camera_distortion_vector;
if(m_camera_id == "left"){
camera_distortion_vector = left_camera_distortion_vector;
}else if(m_camera_id == "right"){
camera_distortion_vector = right_camera_distortion_vector;
}else{
cerr << "only left or right camera !!! "<<endl;
exit(-1);
}
VectorXd v;
v.resize(5);
v << *(camera_distortion_vector),
*(camera_distortion_vector+1),
0, 0, 0;
return v;
}
vector<vector<Vector3d>> get_image_corners_3d()
{
double* image_corners_3d;
if(m_camera_id == "left"){
image_corners_3d = left_image_corners_3d;
}else if(m_camera_id == "right"){
image_corners_3d = right_image_corners_3d;
}else{
cerr << "only left or right camera !!! "<<endl;
exit(-1);
}
vector<vector<Vector3d>> p3d;
for(int i=0;i<8;i++){
vector<Vector3d> v3d;
for(int j=0;j<4;j++){
int k = i*12+j*3;
v3d.push_back(Vector3d(*(image_corners_3d + k),
*(image_corners_3d + k + 1),
*(image_corners_3d + k + 2)));
}
p3d.push_back(v3d);
}
return p3d;
}
vector<vector<Vector2d>> get_image_points()
{
double* image_points;
if(m_camera_id == "left"){
image_points = left_image_points;
}else if(m_camera_id == "right"){
image_points = right_image_points;
}else{
cerr << "only left or right camera !!! "<<endl;
exit(-1);
}
vector<vector<Vector2d>> p2d;
for(int i=0;i<8;i++){
vector<Vector2d> v2d;
for(int j=0;j<28;++j){
int k = i*56+j*2;
v2d.push_back(Vector2d(*(image_points+k),*(image_points+k+1)));
}
p2d.push_back(v2d);
}
return p2d;
}
vector<vector<Vector3d>> get_lidar_corners_3d()
{
vector<vector<Vector3d>> l3d;
for(int i=0;i<8;i++){
vector<Vector3d> v3d;
for(int j=0;j<4;j++){
int k = i*12+j*3;
v3d.push_back(Vector3d(*(lidar_corners_3d + k ),
*(lidar_corners_3d + k + 1),
*(lidar_corners_3d + k + 2)));
}
l3d.push_back(v3d);
}
return l3d;
}
MatrixXd get_camera_lidar_tform(){
double* camera_lidar_tform;
if(m_camera_id == "left"){
camera_lidar_tform = left_camera_lidar_tform;
}else if(m_camera_id == "right"){
camera_lidar_tform = right_camera_lidar_tform;
}else{
cerr << "only left or right camera !!! "<<endl;
exit(-1);
}
MatrixXd t;
t.resize(4,4);
t << *(camera_lidar_tform), *(camera_lidar_tform+4),*(camera_lidar_tform+8),*(camera_lidar_tform+12),
*(camera_lidar_tform+1),*(camera_lidar_tform+5),*(camera_lidar_tform+9),*(camera_lidar_tform+13),
*(camera_lidar_tform+2),*(camera_lidar_tform+6),*(camera_lidar_tform+10),*(camera_lidar_tform+14),
*(camera_lidar_tform+3),*(camera_lidar_tform+7),*(camera_lidar_tform+11),*(camera_lidar_tform+15); // 需要transpose
return t;
}
};
#endif | 45.517532 | 131 | 0.655636 | [
"vector"
] |
70f7e69591c0e19e29654abd11f949214769d57b | 13,769 | cpp | C++ | wxWidgets/samples/caret/caret.cpp | VonaInc/lokl | 83fbaa9c73d3112490edd042da812ceeb3cc9e53 | [
"MIT"
] | 86 | 2015-08-06T11:30:01.000Z | 2022-02-28T04:50:22.000Z | wxWidgets/samples/caret/caret.cpp | VonaInc/lokl | 83fbaa9c73d3112490edd042da812ceeb3cc9e53 | [
"MIT"
] | 6 | 2016-01-04T19:36:22.000Z | 2021-08-08T02:43:48.000Z | wxWidgets/samples/caret/caret.cpp | VonaInc/lokl | 83fbaa9c73d3112490edd042da812ceeb3cc9e53 | [
"MIT"
] | 22 | 2015-11-04T04:04:54.000Z | 2022-02-28T04:50:24.000Z | /////////////////////////////////////////////////////////////////////////////
// Name: caret.cpp
// Purpose: wxCaret sample
// Author: Robert Roebling
// Modified by:
// Created: 04/01/98
// Copyright: (c) wxWindows team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all <standard< wxWidgets headers
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/log.h"
#endif
#include "wx/caret.h"
#include "wx/numdlg.h"
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
// the application icon
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif
// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// ----------------------------
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit() wxOVERRIDE;
};
// MyCanvas is a canvas on which you can type
class MyCanvas: public wxScrolledWindow
{
public:
MyCanvas() { }
MyCanvas( wxWindow *parent );
~MyCanvas();
wxChar& CharAt(int x, int y) { return *(m_text + x + m_xChars * y); }
// operations
void SetFontSize(int fontSize);
void CreateCaret();
void MoveCaret(int x, int y);
// caret movement
void Home() { m_xCaret = 0; }
void End() { m_xCaret = m_xChars - 1; }
void FirstLine() { m_yCaret = 0; }
void LastLine() { m_yCaret = m_yChars - 1; }
void PrevChar() { if ( !m_xCaret-- ) { End(); PrevLine(); } }
void NextChar() { if ( ++m_xCaret == m_xChars ) { Home(); NextLine(); } }
void PrevLine() { if ( !m_yCaret-- ) LastLine(); }
void NextLine() { if ( ++m_yCaret == m_yChars ) FirstLine(); }
// event handlers
void OnPaint( wxPaintEvent &event );
void OnSize( wxSizeEvent &event );
void OnChar( wxKeyEvent &event );
private:
// move the caret to m_xCaret, m_yCaret
void DoMoveCaret();
// update the geometry
void ChangeSize();
wxFont m_font;
// the margin around the text (looks nicer)
int m_xMargin, m_yMargin;
// size (in pixels) of one character
long m_widthChar, m_heightChar;
// position (in text coords) of the caret
int m_xCaret, m_yCaret;
// the size (in text coords) of the window
int m_xChars, m_yChars;
// the text
wxChar *m_text;
wxDECLARE_DYNAMIC_CLASS(MyCanvas);
wxDECLARE_EVENT_TABLE();
};
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
// ctor(s)
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnSetBlinkTime(wxCommandEvent& event);
void OnSetFontSize(wxCommandEvent& event);
void OnCaretMove(wxCommandEvent& event);
private:
MyCanvas *m_canvas;
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
};
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// IDs for the controls and the menu commands
enum
{
// menu items
Caret_Quit = 1,
Caret_About,
Caret_SetBlinkTime,
Caret_SetFontSize,
Caret_Move,
// controls start here (the numbers are, of course, arbitrary)
Caret_Text = 1000
};
// ----------------------------------------------------------------------------
// event tables and other macros for wxWidgets
// ----------------------------------------------------------------------------
// the event tables connect the wxWidgets events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Caret_Quit, MyFrame::OnQuit)
EVT_MENU(Caret_About, MyFrame::OnAbout)
EVT_MENU(Caret_SetBlinkTime, MyFrame::OnSetBlinkTime)
EVT_MENU(Caret_SetFontSize, MyFrame::OnSetFontSize)
EVT_MENU(Caret_Move, MyFrame::OnCaretMove)
wxEND_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
wxIMPLEMENT_APP(MyApp);
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------
// `Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
// create and show the main application window
MyFrame *frame = new MyFrame("Caret wxWidgets sample",
wxPoint(50, 50), wxSize(450, 340));
frame->Show(true);
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// application would exit immediately.
return true;
}
// ----------------------------------------------------------------------------
// main frame
// ----------------------------------------------------------------------------
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{
// set the frame icon
SetIcon(wxICON(sample));
// create a menu bar
wxMenu *menuFile = new wxMenu;
menuFile->Append(Caret_SetBlinkTime, "&Blink time...\tCtrl-B");
menuFile->Append(Caret_SetFontSize, "&Font size...\tCtrl-S");
menuFile->Append(Caret_Move, "&Move caret\tCtrl-C");
menuFile->AppendSeparator();
menuFile->Append(Caret_About, "&About\tCtrl-A", "Show about dialog");
menuFile->AppendSeparator();
menuFile->Append(Caret_Quit, "E&xit\tAlt-X", "Quit this program");
// now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
m_canvas = new MyCanvas(this);
#if wxUSE_STATUSBAR
// create a status bar just for fun (by default with 1 pane only)
CreateStatusBar(2);
SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR
}
// event handlers
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// true is to force the frame to close
Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox("The caret wxWidgets sample.\n(c) 1999 Vadim Zeitlin",
"About Caret", wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnCaretMove(wxCommandEvent& WXUNUSED(event))
{
m_canvas->MoveCaret(10, 10);
}
void MyFrame::OnSetBlinkTime(wxCommandEvent& WXUNUSED(event))
{
long blinkTime = wxGetNumberFromUser
(
"The caret blink time is the time between two blinks",
"Time in milliseconds:",
"wxCaret sample",
wxCaret::GetBlinkTime(), 0, 10000,
this
);
if ( blinkTime != -1 )
{
wxCaret::SetBlinkTime((int)blinkTime);
m_canvas->CreateCaret();
wxLogStatus(this, "Blink time set to %ld milliseconds.", blinkTime);
}
}
void MyFrame::OnSetFontSize(wxCommandEvent& WXUNUSED(event))
{
long fontSize = wxGetNumberFromUser
(
"The font size also determines the caret size so\nthis demonstrates resizing the caret.",
"Font size (in points):",
"wxCaret sample",
12, 1, 100,
this
);
if ( fontSize != -1 )
{
m_canvas->SetFontSize((int)fontSize);
}
}
// ----------------------------------------------------------------------------
// MyCanvas
// ----------------------------------------------------------------------------
wxIMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow);
wxBEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_PAINT(MyCanvas::OnPaint)
EVT_SIZE(MyCanvas::OnSize)
EVT_CHAR(MyCanvas::OnChar)
wxEND_EVENT_TABLE()
MyCanvas::MyCanvas( wxWindow *parent )
: wxScrolledWindow( parent, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSUNKEN_BORDER )
{
m_text = (wxChar *)NULL;
SetBackgroundColour(*wxWHITE);
SetFontSize(12);
m_xCaret = m_yCaret =
m_xChars = m_yChars = 0;
m_xMargin = m_yMargin = 5;
CreateCaret();
}
MyCanvas::~MyCanvas()
{
free(m_text);
}
void MyCanvas::CreateCaret()
{
wxCaret *caret = new wxCaret(this, m_widthChar, m_heightChar);
SetCaret(caret);
caret->Move(m_xMargin, m_yMargin);
caret->Show();
}
void MyCanvas::SetFontSize(int fontSize)
{
m_font = wxFont(wxFontInfo(fontSize).Family(wxFONTFAMILY_TELETYPE));
wxClientDC dc(this);
dc.SetFont(m_font);
m_heightChar = dc.GetCharHeight();
m_widthChar = dc.GetCharWidth();
wxCaret *caret = GetCaret();
if ( caret )
{
caret->SetSize(m_widthChar, m_heightChar);
ChangeSize();
}
}
void MyCanvas::MoveCaret(int x, int y)
{
m_xCaret = x;
m_yCaret = y;
DoMoveCaret();
}
void MyCanvas::DoMoveCaret()
{
wxLogStatus("Caret is at (%d, %d)", m_xCaret, m_yCaret);
GetCaret()->Move(m_xMargin + m_xCaret * m_widthChar,
m_yMargin + m_yCaret * m_heightChar);
}
void MyCanvas::OnSize(wxSizeEvent& event)
{
ChangeSize();
event.Skip();
}
void MyCanvas::ChangeSize()
{
wxSize size = GetClientSize();
m_xChars = (size.x - 2*m_xMargin) / m_widthChar;
m_yChars = (size.y - 2*m_yMargin) / m_heightChar;
if ( !m_xChars )
m_xChars = 1;
if ( !m_yChars )
m_yChars = 1;
free(m_text);
m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar));
#if wxUSE_STATUSBAR
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && frame->GetStatusBar() )
{
wxString msg;
msg.Printf("Panel size is (%d, %d)", m_xChars, m_yChars);
frame->SetStatusText(msg, 1);
}
#endif // wxUSE_STATUSBAR
}
// NB: this method is horrible inefficient especially because the caret
// needs to be redrawn often and in this case we only have to redraw
// the caret location and not the entire window - in a real program we
// would use GetUpdateRegion() and iterate over rectangles it contains
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
wxCaretSuspend cs(this);
wxPaintDC dc( this );
PrepareDC( dc );
dc.Clear();
dc.SetFont( m_font );
for ( int y = 0; y < m_yChars; y++ )
{
wxString line;
for ( int x = 0; x < m_xChars; x++ )
{
wxChar ch = CharAt(x, y);
if ( !ch )
ch = ' ';
#ifdef __WXOSX__
dc.DrawText(ch, m_xMargin + x * m_widthChar,
m_yMargin + y * m_heightChar );
#else
line += ch;
#endif
}
#ifndef __WXOSX__
dc.DrawText( line, m_xMargin, m_yMargin + y * m_heightChar );
#endif
}
}
void MyCanvas::OnChar( wxKeyEvent &event )
{
switch ( event.GetKeyCode() )
{
case WXK_LEFT:
PrevChar();
break;
case WXK_RIGHT:
NextChar();
break;
case WXK_UP:
PrevLine();
break;
case WXK_DOWN:
NextLine();
break;
case WXK_HOME:
Home();
break;
case WXK_END:
End();
break;
case WXK_RETURN:
Home();
NextLine();
break;
default:
if ( !event.AltDown() && wxIsprint(event.GetKeyCode()) )
{
wxChar ch = (wxChar)event.GetKeyCode();
CharAt(m_xCaret, m_yCaret) = ch;
wxCaretSuspend cs(this);
wxClientDC dc(this);
dc.SetFont(m_font);
dc.SetBackgroundMode(wxBRUSHSTYLE_SOLID); // overwrite old value
dc.DrawText(ch, m_xMargin + m_xCaret * m_widthChar,
m_yMargin + m_yCaret * m_heightChar );
NextChar();
}
else
{
event.Skip();
}
}
DoMoveCaret();
}
| 27.704225 | 113 | 0.551747 | [
"geometry",
"object"
] |
cb013d4ca90bc93f54dfea9eb820a74e6a5f4598 | 1,556 | cpp | C++ | Lista_1/spanning_tree.cpp | Thulio-Carvalho/Advanced-Algorithms-Problems | 724bfb765d056ddab414df7dd640914aa0c665ae | [
"MIT"
] | null | null | null | Lista_1/spanning_tree.cpp | Thulio-Carvalho/Advanced-Algorithms-Problems | 724bfb765d056ddab414df7dd640914aa0c665ae | [
"MIT"
] | null | null | null | Lista_1/spanning_tree.cpp | Thulio-Carvalho/Advanced-Algorithms-Problems | 724bfb765d056ddab414df7dd640914aa0c665ae | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#define MAXV 200014
using namespace std;
typedef pair <int, int> ii;
int parent[MAXV], V, E;
vector <int> adjList[MAXV];
vector <ii> ans;
vector <ii> edges;
int degree[MAXV];
int find(int node){
while(parent[node] != node) {
parent[node] = parent[parent[node]];
node = parent[node];
}
return node;
}
int unionSets(int A, int B){
int rootA = find(A);
int rootB = find(B);
parent[rootA] = rootB;
}
int find(int A, int B) {
return find(A) == find(B);
}
int main(){
cin >> V >> E;
for (int i = 0; i < E; i++) {
int A, B;
cin >> A >> B;
adjList[A].push_back(B);
adjList[B].push_back(A);
edges.push_back({A, B});
}
int startVertex = -1;
int maximumDegree = -1;
for (int i = 1; i <= V; i++) {
int sz = adjList[i].size();
if (sz > maximumDegree){
maximumDegree = sz;
startVertex = i;
}
}
for (int i = 0; i <= V; i++) {
parent[i] = i;
}
for (int i = 0; i < adjList[startVertex].size(); i++) {
unionSets(startVertex, adjList[startVertex][i]);
ans.push_back({startVertex, adjList[startVertex][i]});
}
for (int i = 0; i < edges.size(); i++) {
ii e = edges[i];
if (!find(e.first, e.second)) {
unionSets(e.first, e.second);
ans.push_back(e);
}
}
for (int i = 0; i < ans.size(); i++) {
cout << ans[i].first << " " << ans[i].second << endl;
}
return 0;
} | 19.948718 | 62 | 0.494859 | [
"vector"
] |
cb02299b7e898c692b8b36113658b0f6c3e7f6ed | 3,919 | cpp | C++ | src/gui/private.cpp | Grossley/opengml | bc3494aae64092f1c32a16361fd781249e2ea630 | [
"MIT"
] | 26 | 2019-07-18T04:45:08.000Z | 2022-03-13T09:52:04.000Z | src/gui/private.cpp | Grossley/opengml | bc3494aae64092f1c32a16361fd781249e2ea630 | [
"MIT"
] | 6 | 2021-09-10T00:48:00.000Z | 2021-11-27T22:00:48.000Z | src/gui/private.cpp | Grossley/opengml | bc3494aae64092f1c32a16361fd781249e2ea630 | [
"MIT"
] | 9 | 2019-07-26T06:32:53.000Z | 2022-01-12T14:38:59.000Z | #include "private.hpp"
#if defined(IMGUI) && defined(GFX_AVAILABLE)
namespace ogm::gui
{
void ImageComponent::target(geometry::Vector<int32_t> dimensions)
{
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &m_prev_fbo);
if (!m_fbo)
{
glGenFramebuffers(1, &m_fbo);
}
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
if (dimensions.x < 1) dimensions.x = 1;
if (dimensions.y < 1) dimensions.y = 1;
if (m_texture)
{
if (m_dimensions != dimensions)
{
// delete texture
std::cout << "recreating texture." << std::endl;
glDeleteTextures(1, &m_texture);
m_texture = 0;
}
}
if (!m_texture)
{
m_dimensions = dimensions;
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dimensions.x, dimensions.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_texture, 0);
}
glViewport(0, 0, dimensions.x, dimensions.y);
glUseProgram(g_ShaderHandle);
}
void ImageComponent::button()
{
ImGui::ImageButton(
(void*)(intptr_t)m_texture,
{
static_cast<float>(m_dimensions.x),
static_cast<float>(m_dimensions.y)
},
{ 0, 0 }, {1, 1}, 0
);
}
void ImageComponent::untarget()
{
// TODO: consider binding just previous draw fbo.
glBindFramebuffer(GL_FRAMEBUFFER, m_prev_fbo);
m_prev_fbo = 0;
}
// from https://github.com/ocornut/imgui/issues/319#issuecomment-147364392
void DrawSplitter(int split_vertically, float thickness, float* size0, float min_size0, float max_size0)
{
ImVec2 backup_pos = ImGui::GetCursorPos();
if (split_vertically)
ImGui::SetCursorPosY(backup_pos.y + *size0);
else
ImGui::SetCursorPosX(backup_pos.x + *size0);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0,0,0,0));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0,0,0,0)); // We don't draw while active/pressed because as we move the panes the splitter button will be 1 frame late
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.6f,0.6f,0.6f,0.10f));
ImGui::Button("##Splitter", ImVec2(!split_vertically ? thickness : -1.0f, split_vertically ? thickness : -1.0f));
ImGui::PopStyleColor(3);
ImGui::SetItemAllowOverlap(); // This is to allow having other buttons OVER our splitter.
if (ImGui::IsItemActive())
{
float mouse_delta = split_vertically ? ImGui::GetIO().MouseDelta.y : ImGui::GetIO().MouseDelta.x;
// Minimum pane size
if (mouse_delta < min_size0 - *size0)
mouse_delta = min_size0 - *size0;
if (mouse_delta > max_size0 - *size0)
mouse_delta = max_size0 - *size0;
// Apply resize
*size0 += mouse_delta;
}
else
{
if (*size0 > max_size0)
{
*size0 = *size0*0.9 + (max_size0) * 0.1 - 1;
}
if (*size0 < min_size0)
{
*size0 = min_size0;
}
}
ImGui::SetCursorPos(backup_pos);
}
geometry::Vector<coord_t> get_mouse_position_from_cursor()
{
ImVec2 item_position = ImGui::GetCursorScreenPos();
return
{
ImGui::GetMousePos().x - item_position.x,
ImGui::GetMousePos().y - item_position.y
};
}
}
#endif | 33.211864 | 187 | 0.571574 | [
"geometry",
"vector"
] |
cb109a4da7c84ac106ab5d586a0d3103b8c72df2 | 13,005 | cpp | C++ | src/der_snr.cpp | a-lemonnier/spec_tools | 5ec9c38aaa31b1a677024bf9c53994142affdac3 | [
"MIT"
] | 1 | 2020-04-07T19:52:29.000Z | 2020-04-07T19:52:29.000Z | src/der_snr.cpp | a-lemonnier/spec_tools | 5ec9c38aaa31b1a677024bf9c53994142affdac3 | [
"MIT"
] | null | null | null | src/der_snr.cpp | a-lemonnier/spec_tools | 5ec9c38aaa31b1a677024bf9c53994142affdac3 | [
"MIT"
] | null | null | null | /**
* \file der_snr.cpp
* \brief An C++ implementation of the der_snr fortran code from:
* F. Stoehr et al: DER_SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm,\n
394, Astronomical Data Analysis Software and Systems (ADASS) XVII\n
2008ASPC..394..505S
* \author Audric Lemonnier
* \version 0.2
* \date 18/04/2020
*/
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
#include <thread>
#include <future>
#include <tuple>
#include <chrono>
#include <boost/program_options.hpp>
#if __has_include (<boost/timer/timer.hpp>)
#include <boost/timer/timer.hpp>
#define HAS_BOOST_TIMER /**< boost::timer availability */
#endif
#if __has_include (<sys/syscall.h>)
#include <sys/syscall.h>
#define HAS_SYSCALL /**< linux syscall availability */
#endif
#if __has_include (<filesystem>)
#include <filesystem>
#define FS_STD /**< std::filesystem availability (C++17) */
namespace fs = std::filesystem;
#elif __has_include (<experimental/filesystem>) && !__has_include (<filesystem>)
#include <experimental/filesystem>
#define FS_STDEXP /**< std::experimental::filesystem availability */
namespace fs = std::experimental::filesystem;
#elif __has_include(<boost/filesystem.hpp>) && !__has_include (<filesystem>) && !__has_include (<experimental/filesystem>)
#include <boost/filesystem.hpp>
#define FS_BOOST /**< boost::filesystem availability */
namespace fs = boost::filesystem;
#else
#error "No filesystem header found"
#endif
#include <csv.h>
#include <msg.h>
#include <log.h>
#include <der_snr.h>
// Reference
// ----------------------------------------------------
// F. Stoehr et al: DER_SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm
// 394, Astronomical Data Analysis Software and Systems (ADASS) XVII
// 2008ASPC..394..505S
// ----------------------------------------------------
int main(int argc, char** argv) {
#ifdef HAS_BOOST_TIMER
boost::timer::cpu_timer btTimer;
#endif
_msg msgM;
msgM.set_name("der_snr");
msgM.set_log(LOGFILE);
// Parse cmd line
// ----------------------------------------------------
namespace po = boost::program_options;
po::options_description description("Usage");
description.add_options()
("help,h", "Display this help message")
("filename,f", po::value<std::string>(),"Filename of the spectrum")
("directory,d", po::value<std::string>(),"Directory where compute the S/N")
("output,o", po::value<std::string>()->default_value("output.csv"),"Filename of results")
("separator,s", po::value<char>()->default_value('\t'),"The column separator. Do not set this option for \\tab.")
("exclude,e", po::value<std::string>(),"Exclude a string in filenames");
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(description).run(), vm);
po::notify(vm);
if (vm.count("help") || vm.size()<1 || !(vm.count("filename") ^ vm.count("directory"))) {
msgM.enable_log(false);
std::cout << description;
std::cout << std::endl;
std::cout << "Examples:\n";
std::cout << "./der_snr -f CPD-591792.obs\n";
msgM.msg(_msg::eMsg::START);
msgM.msg(_msg::eMsg::MID, "check command line");
msgM.msg(_msg::eMsg::MID, "compute S/N for 1 file");
msgM.msg(_msg::eMsg::MID, "CPD-591792.obs: S/N = 95.68");
msgM.msg(_msg::eMsg::MID, "output: output.csv");
msgM.msg(_msg::eMsg::END, " 0.039347s wall, 0.040000s user + 0.000000s system = 0.040000s CPU (101.7%)\n");
std::cout << std::endl;
std::cout << "./der_snr -d data\n";
msgM.msg(_msg::eMsg::START);
msgM.msg(_msg::eMsg::MID, "check command line");
msgM.msg(_msg::eMsg::MID, "CPU utilization: 0 %");
msgM.msg(_msg::eMsg::MID, "starting 8 async threads");
msgM.set_threadname("compute");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 521 files");
msgM.msg(_msg::eMsg::THREADS, "S/N for 524 files");
msgM.set_name("merge()");
msgM.msg(_msg::eMsg::MID, "merge file part1_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part2_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part3_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part4_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part5_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part6_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part7_snr.csv");
msgM.msg(_msg::eMsg::MID, "merge file part8_snr.csv");
msgM.set_name("der_snr");
msgM.msg(_msg::eMsg::MID, "output: output.csv");
msgM.msg(_msg::eMsg::END, " 56.395825s wall, 323.050000s user + 0.450000s system = 323.500000s CPU (573.6%)\n");
std::cout << "\nRef:\n";
std::cout << "F. Stoehr et al: DER_SNR: A Simple & General Spectroscopic Signal-to-Noise Measurement Algorithm\n";
std::cout << "394, Astronomical Data Analysis Software and Systems (ADASS) XVII\n";
std::cout << "2008ASPC..394..505S\n";
return EXIT_SUCCESS;
}
bool bDefExclude=false;
bool bDefSep=false;
std::string sOutput;
std::string sExclude;
char cSep;
fs::path pDirectory;
fs::path pFilename;
fs::path pOutput;
// ----------------------------------------------------
msgM.msg(_msg::eMsg::START);
_log log;
log.set_execname(argv);
log.set_historyname(HISTFILE);
log.set_logname(LOGFILE);
// Write history
// ----------------------------------------------------
msgM.msg(_msg::eMsg::MID, "write history");
if (!log.write_history(vm))
msgM.msg(_msg::eMsg::ERROR, "cannot open history");
// ----------------------------------------------------
// Remove duplicates
// ----------------------------------------------------
msgM.msg(_msg::eMsg::MID, "remove duplicates in history");
if (!log.remove_duplicate())
msgM.msg(_msg::eMsg::ERROR, "cannot open history");
// ----------------------------------------------------
msgM.msg(_msg::eMsg::MID, "check command line");
if (vm.count("directory") && vm.count("filename")) {
msgM.msg(_msg::eMsg::ERROR, "ambiguous entries");
return EXIT_FAILURE;
}
if (vm.count("directory")) {
pDirectory=fs::path(vm["directory"].as<std::string>());
if (!fs::is_directory(pDirectory)) {
msgM.msg(_msg::eMsg::ERROR, pDirectory.string(),"does not exist");
return EXIT_FAILURE;
}
}
if (vm.count("filename")) {
pFilename=fs::path(vm["filename"].as<std::string>());
if (!fs::exists(pFilename)) {
msgM.msg(_msg::eMsg::ERROR, "error:", pFilename.string(),"does not exist");
return EXIT_FAILURE;
}
}
if (vm.count("output")) {
pOutput=fs::path(vm["output"].as<std::string>());
if (fs::exists(pOutput)) {
msgM.msg(_msg::eMsg::MID, pOutput.string(), " exists: deleting");
fs::remove(pOutput);
}
sOutput=vm["output"].as<std::string>();
}
if (vm.count("separator")) {
cSep=vm["separator"].as<char>();
bDefSep=true;
}
if (vm.count("exclude")) {
sExclude=vm["exclude"].as<std::string>();
bDefExclude=true;
}
if (vm.count("filename")) {
msgM.msg(_msg::eMsg::MID, "compute S/N for 1 file");
std::string sFilename=vm["filename"].as<std::string>();
_csv<float> csv(sFilename, '\t');
if(csv.read()) {
csv.set_verbose(_csv<float>::eVerbose::QUIET);
msgM.msg(_msg::eMsg::MID,sFilename,": S/N =", der_snr(csv.select_column(1)));
}
}
if (vm.count("directory")) {
fs::recursive_directory_iterator step0(pDirectory);
std::vector<std::string> list;
if (bDefExclude) {
for(auto &file: boost::make_iterator_range(step0,{}) )
// csv<> unable to parse non csv file
if (!fs::is_directory(file) &&
file.path().has_extension() &&
file.path().filename().string().find(std::string(".tar"))==std::string::npos &&
file.path().filename().string().find(std::string(".tar.gz"))==std::string::npos &&
file.path().filename().string().find(std::string(".tgz"))==std::string::npos &&
file.path().filename().string().find(std::string(".zip"))==std::string::npos &&
file.path().filename().string().find(std::string(".txt"))==std::string::npos &&
file.path().filename().string().find(std::string(".directory"))==std::string::npos &&
file.path().filename().string().find(sExclude)==std::string::npos )
list.emplace_back(file.path().relative_path().string());
}
else {
for(auto &file: boost::make_iterator_range(step0,{}) )
// csv<> unable to parse non csv file
if (!fs::is_directory(file) &&
file.path().has_extension() &&
file.path().filename().string().find(std::string(".tar"))==std::string::npos &&
file.path().filename().string().find(std::string(".tar.gz"))==std::string::npos &&
file.path().filename().string().find(std::string(".tgz"))==std::string::npos &&
file.path().filename().string().find(std::string(".zip"))==std::string::npos &&
file.path().filename().string().find(std::string(".txt"))==std::string::npos &&
file.path().filename().string().find(std::string(".directory"))==std::string::npos )
list.emplace_back(file.path().relative_path().string());
}
int iMax_thread=std::thread::hardware_concurrency();
// Limit CPU usage -------------------------------------
#if defined (__linux__)
msgM.msg(_msg::eMsg::MID, "CPU utilization:", static_cast<int>(CPU_utilization()), "%");
if (CPU_utilization()>50) {
iMax_thread=1;
msgM.msg(_msg::eMsg::MID, "Reduce max thread");
}
#endif
// -----------------------------------------------------
if (iMax_thread>1) {
const std::size_t stSize_divided=list.size()/iMax_thread;
std::vector<std::vector<std::string> > vvsList_divided;
for(std::size_t i=0; i< iMax_thread-1; i++)
vvsList_divided.emplace_back(std::vector<std::string>(list.begin()+i*stSize_divided, list.begin() + stSize_divided*(i+1)));
// 1 extra thread for extra files : rest of division
vvsList_divided.emplace_back(std::vector<std::string>(list.begin()+(iMax_thread-1)*stSize_divided, list.end()));
msgM.msg(_msg::eMsg::MID, "starting", iMax_thread, " async threads");
// let's don't decide the flag
std::launch lFlag=std::launch::async | std::launch::deferred;
std::vector<std::future<void> > vfThread;
std::vector<std::vector<std::string> > vvsRes;
if (bDefSep) {
int iCount=0;
for(auto t_list: vvsList_divided) {
iCount++;
std::string sNewoutput="part"+std::to_string(iCount)+"_"+sOutput;
vfThread.emplace_back(std::async(lFlag, compute_sep, t_list, sNewoutput, cSep));
}
}
else {
int iCount=0;
for(auto t_list: vvsList_divided) {
iCount++;
std::string sNewoutput="part"+std::to_string(iCount)+"_"+sOutput;
vfThread.emplace_back(std::async(lFlag, compute, t_list, sNewoutput));
}
}
std::for_each(vfThread.begin(), vfThread.end(), [](std::future<void> &th) { th.get(); });
merge(sOutput);
}
else {
msgM.msg(_msg::eMsg::MID, "multi-threading disabled");
compute(list, sOutput);
}
}
msgM.msg(_msg::eMsg::MID, "output:", sOutput);
#ifdef HAS_BOOST_TIMER
msgM.msg(_msg::eMsg::END, btTimer.format());
#endif
return EXIT_SUCCESS;
}
| 39.770642 | 139 | 0.550711 | [
"vector"
] |
cb11fa24e4c5d83e618340ff247973d4454c3b05 | 19,104 | hh | C++ | src/Geometry/GeomTensor_default.hh | jmikeowen/Spheral | 3e1082a7aefd6b328bd3ae24ca1a477108cfc3c4 | [
"BSD-Source-Code",
"BSD-3-Clause-LBNL",
"FSFAP"
] | 22 | 2018-07-31T21:38:22.000Z | 2020-06-29T08:58:33.000Z | src/Geometry/GeomTensor_default.hh | markguozhiming/spheral | bbb982102e61edb8a1d00cf780bfa571835e1b61 | [
"BSD-Source-Code",
"BSD-3-Clause-LBNL",
"FSFAP"
] | 41 | 2020-09-28T23:14:27.000Z | 2022-03-28T17:01:33.000Z | src/Geometry/GeomTensor_default.hh | markguozhiming/spheral | bbb982102e61edb8a1d00cf780bfa571835e1b61 | [
"BSD-Source-Code",
"BSD-3-Clause-LBNL",
"FSFAP"
] | 7 | 2019-12-01T07:00:06.000Z | 2020-09-15T21:12:39.000Z | //---------------------------------Spheral++----------------------------------//
// GeomTensor -- Geometric Tensor Class.
//
// Created by JMO, Thu Apr 22 20:48:23 PDT 1999
// Modified by:
// Aug 1, 99: JMO, removing MTL inheritance due to compilation problems,
// and adding symmetric tensor type.
// 2004-08-19: JMO, converting to use boost::ublas library.
// 2004-08-23: JMO, ublas is still too slow, so going to primitive C
// internal data types in accordance with suggestions from
// Brian White
// 2004-11-10: JMO, experimenting with replacing the double array with individual
// double elements, again for speed.
//----------------------------------------------------------------------------//
#ifndef __Spheral_GeomTensor_default_hh__
#define __Spheral_GeomTensor_default_hh__
#include "Geometry/GeomVector_fwd.hh"
#include "Geometry/GeomTensor_fwd.hh"
#include "Geometry/GeomSymmetricTensor_fwd.hh"
#include "Geometry/GeomTensorBase.hh"
#include <iostream>
#include "Eigen/Dense"
#ifdef _OPENMP
#include "omp.h"
#endif
namespace Spheral {
template<int nDim>
class GeomTensor: public GeomTensorBase<nDim> {
public:
//--------------------------- Public Interface ---------------------------//
typedef const double* const_iterator;
typedef double* iterator;
typedef unsigned size_type;
typedef Eigen::Matrix<double, nDim, nDim> EigenType;
// Useful static memeber data.
static const size_type nDimensions;
static const size_type numElements;
static const GeomTensor zero;
static const GeomTensor one;
// Constructors.
GeomTensor();
explicit GeomTensor(const double a11);
GeomTensor(const double a11, const double a12,
const double a21, const double a22);
GeomTensor(const double a11, const double a12, const double a13,
const double a21, const double a22, const double a23,
const double a31, const double a32, const double a33);
GeomTensor(const GeomTensor& ten);
explicit GeomTensor(const GeomSymmetricTensor<nDim>& ten);
GeomTensor(const EigenType& ten);
template<typename Derived> GeomTensor(const Eigen::MatrixBase<Derived>& ten);
// Destructor.
~GeomTensor();
// Assignment.
GeomTensor& operator=(const GeomTensor& rhs);
GeomTensor& operator=(const GeomSymmetricTensor<nDim>& rhs);
template<typename Derived> GeomTensor& operator=(const Eigen::MatrixBase<Derived>& rhs);
// Access the elements by indicies.
double operator()(const size_type row, const size_type column) const;
double& operator()(const size_type row, const size_type column);
// More C++ style indexing.
double operator[](size_type index) const;
double& operator[](size_type index);
// Access the individual elements by (x,y,z) notation.
double xx() const;
double xy() const;
double xz() const;
double yx() const;
double yy() const;
double yz() const;
double zx() const;
double zy() const;
double zz() const;
void xx(double val);
void xy(double val);
void xz(double val);
void yx(double val);
void yy(double val);
void yz(double val);
void zx(double val);
void zy(double val);
void zz(double val);
// Get/set rows and columns.
GeomVector<nDim> getRow(size_type index) const;
GeomVector<nDim> getColumn(size_type index) const;
void setRow(size_type index, const GeomVector<nDim>& vec);
void setColumn(size_type index, const GeomVector<nDim>& vec);
// Iterator access to the raw data.
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
// The zero and identity matrices.
void Zero();
void Identity();
GeomTensor operator-() const;
GeomTensor operator+(const GeomTensor& rhs) const;
GeomTensor operator-(const GeomTensor& rhs) const;
GeomTensor operator*(const GeomTensor& rhs) const;
GeomTensor operator+(const GeomSymmetricTensor<nDim>& rhs) const;
GeomTensor operator-(const GeomSymmetricTensor<nDim>& rhs) const;
GeomTensor operator*(const GeomSymmetricTensor<nDim>& rhs) const;
GeomVector<nDim> operator*(const GeomVector<nDim>& rhs) const;
// GeomTensor operator+(const double val) const;
// GeomTensor operator-(const double val) const;
GeomTensor operator*(const double val) const;
GeomTensor operator/(const double val) const;
GeomTensor& operator+=(const GeomTensor& rhs);
GeomTensor& operator-=(const GeomTensor& rhs);
GeomTensor& operator*=(const GeomTensor& rhs);
GeomTensor& operator+=(const GeomSymmetricTensor<nDim>& rhs);
GeomTensor& operator-=(const GeomSymmetricTensor<nDim>& rhs);
GeomTensor& operator*=(const GeomSymmetricTensor<nDim>& rhs);
template<typename Derived> GeomTensor& operator+=(const Eigen::MatrixBase<Derived>& rhs);
template<typename Derived> GeomTensor& operator-=(const Eigen::MatrixBase<Derived>& rhs);
GeomTensor& operator*=(const double rhs);
GeomTensor& operator/=(const double rhs);
bool operator==(const GeomTensor& rhs) const;
bool operator!=(const GeomTensor& rhs) const;
bool operator<(const GeomTensor& rhs) const;
bool operator>(const GeomTensor& rhs) const;
bool operator<=(const GeomTensor& rhs) const;
bool operator>=(const GeomTensor& rhs) const;
bool operator==(const GeomSymmetricTensor<nDim>& rhs) const;
bool operator!=(const GeomSymmetricTensor<nDim>& rhs) const;
bool operator<(const GeomSymmetricTensor<nDim>& rhs) const;
bool operator>(const GeomSymmetricTensor<nDim>& rhs) const;
bool operator<=(const GeomSymmetricTensor<nDim>& rhs) const;
bool operator>=(const GeomSymmetricTensor<nDim>& rhs) const;
// bool operator==(const double rhs) const;
// bool operator!=(const double rhs) const;
// bool operator<(const double rhs) const;
// bool operator>(const double rhs) const;
// bool operator<=(const double rhs) const;
// bool operator>=(const double rhs) const;
GeomSymmetricTensor<nDim> Symmetric() const;
GeomTensor SkewSymmetric() const;
GeomTensor Transpose() const;
GeomTensor Inverse() const;
GeomVector<nDim> diagonalElements() const;
double Trace() const;
double Determinant() const;
GeomVector<nDim> dot(const GeomVector<nDim>& vec) const;
GeomTensor dot(const GeomTensor& rhs) const;
GeomTensor dot(const GeomSymmetricTensor<nDim>& rhs) const;
double doubledot(const GeomTensor& rhs) const;
double doubledot(const GeomSymmetricTensor<nDim>& rhs) const;
double selfDoubledot() const;
// Return the square of this tensor (using matrix multiplication).
GeomTensor square() const;
// Return a tensor where each element is the square of the corresponding
// element of this tensor.
GeomTensor squareElements() const;
// A simple method for returning the eigenvalues of a tensor.
GeomVector<nDim> eigenValues() const;
// Apply a rotational transform to this tensor ( R^-1 * (*this) * R ).
void rotationalTransform(const GeomTensor& R);
// Return the max absolute element.
double maxAbsElement() const;
// Convert to an Eigen Vector
EigenType eigen() const;
private:
//--------------------------- Private Interface ---------------------------//
size_type elementIndex(const size_type row, const size_type column) const;
};
// Declare specializations.
#ifndef WIN32
template<> const unsigned GeomTensor<1>::nDimensions;
template<> const unsigned GeomTensor<2>::nDimensions;
template<> const unsigned GeomTensor<3>::nDimensions;
template<> const unsigned GeomTensor<1>::numElements;
template<> const unsigned GeomTensor<2>::numElements;
template<> const unsigned GeomTensor<3>::numElements;
#endif
template<> GeomTensor<2>::GeomTensor(const double, const double,
const double, const double);
template<> GeomTensor<3>::GeomTensor(const double, const double, const double,
const double, const double, const double,
const double, const double, const double);
template<> GeomTensor<1>& GeomTensor<1>::operator=(const GeomTensor<1>& rhs);
template<> GeomTensor<2>& GeomTensor<2>::operator=(const GeomTensor<2>& rhs);
template<> GeomTensor<3>& GeomTensor<3>::operator=(const GeomTensor<3>& rhs);
template<> GeomTensor<1>& GeomTensor<1>::operator=(const GeomSymmetricTensor<1>& rhs);
template<> GeomTensor<2>& GeomTensor<2>::operator=(const GeomSymmetricTensor<2>& rhs);
template<> GeomTensor<3>& GeomTensor<3>::operator=(const GeomSymmetricTensor<3>& rhs);
template<> double GeomTensor<1>::xy() const;
template<> double GeomTensor<1>::xz() const;
template<> double GeomTensor<1>::yx() const;
template<> double GeomTensor<1>::yy() const;
template<> double GeomTensor<1>::yz() const;
template<> double GeomTensor<1>::zx() const;
template<> double GeomTensor<1>::zy() const;
template<> double GeomTensor<1>::zz() const;
template<> double GeomTensor<2>::xz() const;
template<> double GeomTensor<2>::yz() const;
template<> double GeomTensor<2>::zx() const;
template<> double GeomTensor<2>::zy() const;
template<> double GeomTensor<2>::zz() const;
template<> void GeomTensor<1>::xy(const double);
template<> void GeomTensor<1>::xz(const double);
template<> void GeomTensor<1>::yx(const double);
template<> void GeomTensor<1>::yy(const double);
template<> void GeomTensor<1>::yz(const double);
template<> void GeomTensor<1>::zx(const double);
template<> void GeomTensor<1>::zy(const double);
template<> void GeomTensor<1>::zz(const double);
template<> void GeomTensor<2>::xz(const double);
template<> void GeomTensor<2>::yz(const double);
template<> void GeomTensor<2>::zx(const double);
template<> void GeomTensor<2>::zy(const double);
template<> void GeomTensor<2>::zz(const double);
template<> GeomVector<1> GeomTensor<1>::getRow(const GeomTensor<1>::size_type) const;
template<> GeomVector<2> GeomTensor<2>::getRow(const GeomTensor<2>::size_type) const;
template<> GeomVector<3> GeomTensor<3>::getRow(const GeomTensor<3>::size_type) const;
template<> GeomVector<1> GeomTensor<1>::getColumn(const GeomTensor<1>::size_type) const;
template<> GeomVector<2> GeomTensor<2>::getColumn(const GeomTensor<2>::size_type) const;
template<> GeomVector<3> GeomTensor<3>::getColumn(const GeomTensor<3>::size_type) const;
template<> void GeomTensor<1>::setRow(const GeomTensor<1>::size_type, const GeomVector<1>&);
template<> void GeomTensor<2>::setRow(const GeomTensor<2>::size_type, const GeomVector<2>&);
template<> void GeomTensor<3>::setRow(const GeomTensor<3>::size_type, const GeomVector<3>&);
template<> void GeomTensor<1>::setColumn(const GeomTensor<1>::size_type, const GeomVector<1>&);
template<> void GeomTensor<2>::setColumn(const GeomTensor<2>::size_type, const GeomVector<2>&);
template<> void GeomTensor<3>::setColumn(const GeomTensor<3>::size_type, const GeomVector<3>&);
template<> GeomTensor<1> GeomTensor<1>::operator-() const;
template<> GeomTensor<2> GeomTensor<2>::operator-() const;
template<> GeomTensor<3> GeomTensor<3>::operator-() const;
// template<> GeomTensor<1> GeomTensor<1>::operator+(const double) const;
// template<> GeomTensor<2> GeomTensor<2>::operator+(const double) const;
// template<> GeomTensor<3> GeomTensor<3>::operator+(const double) const;
// template<> GeomTensor<1> GeomTensor<1>::operator-(const double) const;
// template<> GeomTensor<2> GeomTensor<2>::operator-(const double) const;
// template<> GeomTensor<3> GeomTensor<3>::operator-(const double) const;
template<> GeomTensor<1> GeomTensor<1>::operator*(const double) const;
template<> GeomTensor<2> GeomTensor<2>::operator*(const double) const;
template<> GeomTensor<3> GeomTensor<3>::operator*(const double) const;
template<> GeomTensor<1> GeomTensor<1>::operator/(const double) const;
template<> GeomTensor<2> GeomTensor<2>::operator/(const double) const;
template<> GeomTensor<3> GeomTensor<3>::operator/(const double) const;
template<> GeomTensor<1>& GeomTensor<1>::operator+=(const GeomTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator+=(const GeomTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator+=(const GeomTensor<3>&);
template<> GeomTensor<1>& GeomTensor<1>::operator+=(const GeomSymmetricTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator+=(const GeomSymmetricTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator+=(const GeomSymmetricTensor<3>&);
template<> GeomTensor<1>& GeomTensor<1>::operator-=(const GeomTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator-=(const GeomTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator-=(const GeomTensor<3>&);
template<> GeomTensor<1>& GeomTensor<1>::operator-=(const GeomSymmetricTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator-=(const GeomSymmetricTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator-=(const GeomSymmetricTensor<3>&);
template<> GeomTensor<1>& GeomTensor<1>::operator*=(const GeomTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator*=(const GeomTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator*=(const GeomTensor<3>&);
template<> GeomTensor<1>& GeomTensor<1>::operator*=(const GeomSymmetricTensor<1>&);
template<> GeomTensor<2>& GeomTensor<2>::operator*=(const GeomSymmetricTensor<2>&);
template<> GeomTensor<3>& GeomTensor<3>::operator*=(const GeomSymmetricTensor<3>&);
// template<> GeomTensor<1>& GeomTensor<1>::operator+=(const double);
// template<> GeomTensor<2>& GeomTensor<2>::operator+=(const double);
// template<> GeomTensor<3>& GeomTensor<3>::operator+=(const double);
// template<> GeomTensor<1>& GeomTensor<1>::operator-=(const double);
// template<> GeomTensor<2>& GeomTensor<2>::operator-=(const double);
// template<> GeomTensor<3>& GeomTensor<3>::operator-=(const double);
template<> GeomTensor<1>& GeomTensor<1>::operator*=(const double);
template<> GeomTensor<2>& GeomTensor<2>::operator*=(const double);
template<> GeomTensor<3>& GeomTensor<3>::operator*=(const double);
template<> GeomTensor<1>& GeomTensor<1>::operator/=(const double);
template<> GeomTensor<2>& GeomTensor<2>::operator/=(const double);
template<> GeomTensor<3>& GeomTensor<3>::operator/=(const double);
template<> bool GeomTensor<1>::operator==(const GeomTensor<1>&) const;
template<> bool GeomTensor<2>::operator==(const GeomTensor<2>&) const;
template<> bool GeomTensor<3>::operator==(const GeomTensor<3>&) const;
template<> bool GeomTensor<1>::operator==(const GeomSymmetricTensor<1>&) const;
template<> bool GeomTensor<2>::operator==(const GeomSymmetricTensor<2>&) const;
template<> bool GeomTensor<3>::operator==(const GeomSymmetricTensor<3>&) const;
template<> GeomSymmetricTensor<1> GeomTensor<1>::Symmetric() const;
template<> GeomSymmetricTensor<2> GeomTensor<2>::Symmetric() const;
template<> GeomSymmetricTensor<3> GeomTensor<3>::Symmetric() const;
template<> GeomTensor<1> GeomTensor<1>::SkewSymmetric() const;
template<> GeomTensor<2> GeomTensor<2>::SkewSymmetric() const;
template<> GeomTensor<3> GeomTensor<3>::SkewSymmetric() const;
template<> GeomTensor<1> GeomTensor<1>::Transpose() const;
template<> GeomTensor<2> GeomTensor<2>::Transpose() const;
template<> GeomTensor<3> GeomTensor<3>::Transpose() const;
template<> GeomTensor<1> GeomTensor<1>::Inverse() const;
template<> GeomTensor<2> GeomTensor<2>::Inverse() const;
template<> GeomTensor<3> GeomTensor<3>::Inverse() const;
template<> GeomVector<1> GeomTensor<1>::diagonalElements() const;
template<> GeomVector<2> GeomTensor<2>::diagonalElements() const;
template<> GeomVector<3> GeomTensor<3>::diagonalElements() const;
template<> double GeomTensor<1>::Trace() const;
template<> double GeomTensor<2>::Trace() const;
template<> double GeomTensor<3>::Trace() const;
template<> double GeomTensor<1>::Determinant() const;
template<> double GeomTensor<2>::Determinant() const;
template<> double GeomTensor<3>::Determinant() const;
template<> GeomVector<1> GeomTensor<1>::dot(const GeomVector<1>&) const;
template<> GeomVector<2> GeomTensor<2>::dot(const GeomVector<2>&) const;
template<> GeomVector<3> GeomTensor<3>::dot(const GeomVector<3>&) const;
template<> GeomTensor<1> GeomTensor<1>::dot(const GeomTensor<1>&) const;
template<> GeomTensor<2> GeomTensor<2>::dot(const GeomTensor<2>&) const;
template<> GeomTensor<3> GeomTensor<3>::dot(const GeomTensor<3>&) const;
template<> GeomTensor<1> GeomTensor<1>::dot(const GeomSymmetricTensor<1>&) const;
template<> GeomTensor<2> GeomTensor<2>::dot(const GeomSymmetricTensor<2>&) const;
template<> GeomTensor<3> GeomTensor<3>::dot(const GeomSymmetricTensor<3>&) const;
template<> double GeomTensor<1>::doubledot(const GeomTensor<1>&) const;
template<> double GeomTensor<2>::doubledot(const GeomTensor<2>&) const;
template<> double GeomTensor<3>::doubledot(const GeomTensor<3>&) const;
template<> double GeomTensor<1>::doubledot(const GeomSymmetricTensor<1>&) const;
template<> double GeomTensor<2>::doubledot(const GeomSymmetricTensor<2>&) const;
template<> double GeomTensor<3>::doubledot(const GeomSymmetricTensor<3>&) const;
template<> GeomTensor<1> GeomTensor<1>::square() const;
template<> GeomTensor<2> GeomTensor<2>::square() const;
template<> GeomTensor<3> GeomTensor<3>::square() const;
template<> GeomTensor<1> GeomTensor<1>::squareElements() const;
template<> GeomTensor<2> GeomTensor<2>::squareElements() const;
template<> GeomTensor<3> GeomTensor<3>::squareElements() const;
template<> void GeomTensor<1>::rotationalTransform(const GeomTensor<1>&);
template<> void GeomTensor<2>::rotationalTransform(const GeomTensor<2>&);
template<> void GeomTensor<3>::rotationalTransform(const GeomTensor<3>&);
template<> double GeomTensor<1>::maxAbsElement() const;
template<> double GeomTensor<2>::maxAbsElement() const;
template<> double GeomTensor<3>::maxAbsElement() const;
#ifndef _WIN32
template<> const GeomTensor<1> GeomTensor<1>::zero;
template<> const GeomTensor<2> GeomTensor<2>::zero;
template<> const GeomTensor<3> GeomTensor<3>::zero;
#endif
// Forward declare the global functions.
template<int nDim> GeomTensor<nDim> operator*(double lhs, const GeomTensor<nDim>& rhs);
template<int nDim> ::std::istream& operator>>(std::istream& is, GeomTensor<nDim>& ten);
template<int nDim> std::ostream& operator<<(std::ostream& os, const GeomTensor<nDim>& ten);
#if defined(_OPENMP) && _OPENMP >= 201107
#pragma omp declare reduction(tensadd : GeomTensor<1> : omp_out += omp_in ) initializer( omp_priv = GeomTensor<1>(0.0) )
#pragma omp declare reduction(tensdif : GeomTensor<1> : omp_out -= omp_in ) initializer( omp_priv = GeomTensor<1>(0.0) )
#pragma omp declare reduction(tensadd : GeomTensor<2> : omp_out += omp_in ) initializer( omp_priv = GeomTensor<2>(0.0,0.0,0.0,0.0))
#pragma omp declare reduction(tensdif : GeomTensor<2> : omp_out -= omp_in ) initializer( omp_priv = GeomTensor<2>(0.0,0.0,0.0,0.0))
#pragma omp declare reduction(tensadd : GeomTensor<3> : omp_out += omp_in ) initializer( omp_priv = GeomTensor<3>(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0) )
#pragma omp declare reduction(tensdif : GeomTensor<3> : omp_out -= omp_in ) initializer( omp_priv = GeomTensor<3>(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0) )
#endif
}
#include "GeomTensorInline_default.hh"
#endif
| 44.635514 | 153 | 0.722257 | [
"geometry",
"vector",
"transform"
] |
cb1364cbb46974e1221a92ebc4ceaa58ec1b6fcc | 2,167 | cpp | C++ | Examen2PC/P3_RectanguleCutting/RectangleCutting.cpp | VanessaMMH/ProgComp2021A | 03a3e0394b26eb78801246c7d6b7888fe53141bd | [
"BSD-3-Clause"
] | null | null | null | Examen2PC/P3_RectanguleCutting/RectangleCutting.cpp | VanessaMMH/ProgComp2021A | 03a3e0394b26eb78801246c7d6b7888fe53141bd | [
"BSD-3-Clause"
] | null | null | null | Examen2PC/P3_RectanguleCutting/RectangleCutting.cpp | VanessaMMH/ProgComp2021A | 03a3e0394b26eb78801246c7d6b7888fe53141bd | [
"BSD-3-Clause"
] | null | null | null | #include <iostream>
#include <vector>
#define ull unsigned long long
#define INF 100000
using namespace std;
vector<vector<int>> dp;
/* dp recursion: bottom up */
int min_cr(int a, int b)
{
if (a == b)
{
dp[a][b] = 0;
return dp[a][b];
}
if (dp[a][b] != -1)
{
dp[b][a] = dp[a][b];
return dp[a][b];
}
if (dp[b][a] != -1)
{
dp[a][b] = dp[b][a];
return dp[b][a];
}
else
{
if (a == 1)
{
int mini = INF;
for (int i = 1; i < b; ++i)
{
int x = 1 + min_cr(a, b - i) + min_cr(a, i);
if (x < mini)
mini = x;
}
dp[a][b] = mini;
dp[b][a] = mini;
return dp[a][b];
}
if (b == 1)
{
int mini = INF;
for (int i = 1; i < a; ++i)
{
int x = 1 + min_cr(a - i, b) + min_cr(i, b);
if (x < mini)
mini = x;
}
dp[a][b] = mini;
dp[b][a] = mini;
return dp[a][b];
}
int mini = INF;
for (int i = 1; i < a; ++i)
{
int x = 1 + min_cr(a - i, b) + min_cr(i, b);
if (x < mini)
mini = x;
}
for (int i = 1; i < b; ++i)
{
int x = 1 + min_cr(a, b - i) + min_cr(a, i);
if (x < mini)
mini = x;
}
dp[a][b] = mini;
return dp[a][b];
}
}
/* dp iterative: bottom-up */
int solve(int a, int b)
{
for (int i = 1; i <= a; ++i)
{
for (int j = 1; j <= b; ++j)
{
if (i == j)
dp[i][j] = 0;
else
{
int mini = INF;
for (int w = 1; w < j; ++w)
mini = min(mini, 1 + dp[i][j - w] + dp[i][w]);
for (int h = 1; h < i; ++h)
mini = min(mini, 1 + dp[i - h][j] + dp[h][j]);
dp[i][j] = mini;
}
}
}
return dp[a][b];
}
int main()
{
int a, b;
cin >> a >> b;
int n = max(a, b) + 1;
dp.resize(n);
for (int i = 0; i < n; i++)
dp[i].resize(n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
dp[i][j] = -1;
/* cout << min_cr(a, b) << endl; */
cout << solve(a, b) << endl;
return 0;
} | 18.521368 | 57 | 0.361329 | [
"vector"
] |
0e122a104476f2637537c2be3279055e81db30c6 | 4,159 | cxx | C++ | ARCHIVE/ICCDEF/TestSuite/itkIterativeInverseDisplacementFieldFilterTest2.cxx | pnlbwh/BRAINSTools | a2fe63ab5b795f03da140a4081d1fef6314dab95 | [
"Apache-2.0"
] | null | null | null | ARCHIVE/ICCDEF/TestSuite/itkIterativeInverseDisplacementFieldFilterTest2.cxx | pnlbwh/BRAINSTools | a2fe63ab5b795f03da140a4081d1fef6314dab95 | [
"Apache-2.0"
] | null | null | null | ARCHIVE/ICCDEF/TestSuite/itkIterativeInverseDisplacementFieldFilterTest2.cxx | pnlbwh/BRAINSTools | a2fe63ab5b795f03da140a4081d1fef6314dab95 | [
"Apache-2.0"
] | 1 | 2022-02-08T05:39:46.000Z | 2022-02-08T05:39:46.000Z | /*=========================================================================
*
* Copyright SINAPSE: Scalable Informatics for Neuroscience, Processing and Software Engineering
* The University of Iowa
*
* 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.txt
*
* 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 "itkImage.h"
#include "itkVector.h"
#include "itkImageRegionIterator.h"
#include "itkImageFileWriter.h"
// #include "itkIterativeInverseDisplacementFieldImageFilter.h"
// #include "itkIterativeInverseDisplacementFieldImageFilter1.h"
#include "itkICCIterativeInverseDisplacementFieldImageFilter.h"
int
itkIterativeInverseDisplacementFieldFilterTest2(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "You must supply two output filenames" << std::endl;
return EXIT_FAILURE;
}
using PixelType = float;
constexpr unsigned int dims = 3;
using ImageType = itk::Image<itk::Vector<PixelType, dims>, dims>;
using WriterType = itk::ImageFileWriter<ImageType>;
const ImageType::SizeType imageSize = { { 16, 16, 16 } };
const ImageType::IndexType imageIndex = { { 0, 0, 0 } };
ImageType::RegionType region;
region.SetSize(imageSize);
region.SetIndex(imageIndex);
ImageType::Pointer img = ImageType::New();
img->SetRegions(region);
img->Allocate();
ImageType::PixelType zeros;
zeros[0] = 1.0;
zeros[1] = 2.0;
zeros[2] = 3.0;
itk::ImageRegionIterator<ImageType> it(img, img->GetRequestedRegion());
it.GoToBegin();
while (!it.IsAtEnd())
{
zeros[0] += 0.1;
zeros[1] += 0.2;
zeros[2] += -0.1;
it.Value() = zeros;
++it;
}
using InverseDisplacementFieldImageType = itk::ICCIterativeInverseDisplacementFieldImageFilter<ImageType, ImageType>;
InverseDisplacementFieldImageType::Pointer inverse1 = InverseDisplacementFieldImageType::New();
inverse1->SetInput(img);
inverse1->SetStopValue(1.0e-7);
try
{
inverse1->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception detected while inverse image" << argv[1];
std::cerr << " : " << e.GetDescription();
return EXIT_FAILURE;
}
InverseDisplacementFieldImageType::Pointer inverse2 = InverseDisplacementFieldImageType::New();
inverse2->SetInput(inverse1->GetOutput());
inverse2->SetStopValue(1.0e-7);
try
{
inverse2->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception detected while inverse image" << argv[1];
std::cerr << " : " << e.GetDescription();
return EXIT_FAILURE;
}
WriterType::Pointer writer1 = WriterType::New();
writer1->SetInput(img);
writer1->SetFileName(argv[1]);
try
{
writer1->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception detected while writing image" << argv[1];
std::cerr << " : " << e.GetDescription();
return EXIT_FAILURE;
}
WriterType::Pointer writer2 = WriterType::New();
writer2->SetInput(inverse2->GetOutput());
writer2->SetFileName(argv[2]);
try
{
writer2->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception detected while writing image" << argv[1];
std::cerr << " : " << e.GetDescription();
return EXIT_FAILURE;
}
itk::ImageRegionIterator<ImageType> it2(img, img->GetRequestedRegion());
itk::ImageRegionIterator<ImageType> it1(inverse2->GetOutput(), inverse2->GetOutput()->GetRequestedRegion());
it1.GoToBegin();
it2.GoToBegin();
while (!it1.IsAtEnd())
{
std::cout << "1:" << it1.Value() << std::endl;
++it1;
std::cout << "2:" << it2.Value() << std::endl;
++it2;
}
return 0;
}
| 29.920863 | 119 | 0.651839 | [
"vector"
] |
0e124c0c3d596fc0ca1a7f80da6a99b5a627657a | 2,494 | cpp | C++ | code archive/codechef/AVGMAT.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | 4 | 2018-04-08T08:07:58.000Z | 2021-06-07T14:55:24.000Z | code archive/codechef/AVGMAT.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | null | null | null | code archive/codechef/AVGMAT.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | 1 | 2018-10-29T12:37:25.000Z | 2018-10-29T12:37:25.000Z | //{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
_do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
_s<<"{";
for(It _it=_ita;_it!=_itb;_it++)
{
_s<<(_it==_ita?"":",")<<*_it;
}
_s<<"}";
return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}
const ll MAXn=3e2+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);
ll ct[MAXn][MAXn][MAXn],d[MAXn][MAXn],tt[2*MAXn],tmp[2][3 * MAXn];
int main()
{
IOS();
ll T;
cin>>T;
while(T--)
{
FILL(tt,0);
ll n,m;
cin>>n>>m;
REP1(i,n)
{
string s;
cin>>s;
REP1(j,m)d[i][j] = (s[j-1] - '0' == 1);
}
FILL(ct,0);
REP1(i,n)REP1(j,m)
{
if(d[i][j])REP1(k,m)ct[i][k][abs(j-k)] ++;
}
REP1(j,m)
{
FILL(tmp,0);
REP1(i,n)REP(k,m)tmp[0][i + k] += ct[i][j][k];
REP1(i,n)
{
if(d[i][j])REP(k,n + m - 1)
{
debug(i,j,k,tmp[0][i+k],tmp[1][i-k+m]);
tt[k] += tmp[0][i + k];
tt[k] += tmp[1][i - k + n + m];
}
REP(k,m)tmp[0][i + k] -= ct[i][j][k],tmp[1][i - k + n + m] += ct[i][j][k];
}
}
REP1(i,n+m-2)cout<<tt[i]/2<<" ";
cout<<endl;
}
}
| 26.817204 | 129 | 0.532077 | [
"vector"
] |
0e12f433587457128cf32a8f4b321e8b13aaadb5 | 849 | cpp | C++ | Divisionals/D/submissions/accepted/peter_dubious.cpp | SouthPacificProgrammingContests/ICPC18 | d91dca96a91b869f3922eb0c57b086919abe1b3f | [
"MIT"
] | null | null | null | Divisionals/D/submissions/accepted/peter_dubious.cpp | SouthPacificProgrammingContests/ICPC18 | d91dca96a91b869f3922eb0c57b086919abe1b3f | [
"MIT"
] | null | null | null | Divisionals/D/submissions/accepted/peter_dubious.cpp | SouthPacificProgrammingContests/ICPC18 | d91dca96a91b869f3922eb0c57b086919abe1b3f | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#define x first
#define y second
#ifdef ONLINE_JUDGE
#define DEBUG(x)
#else
#define DEBUG(x) cerr << #x << ": " << x << endl;
#endif
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
const int mod=1000000000+7;
int addm(int& a,int b) {return (a+=b)<mod?a:a-=mod;}
template<class T,class U> bool smin(T& a,U b) {return a>b?(a=b,1):0;}
template<class T,class U> bool smax(T& a,U b) {return a<b?(a=b,1):0;}
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll sum=0,N,d=0;
cin >> N;
for (int i=0;i<N;++i) {
ll a;
cin >> a;
sum+=a*(i+1)*(N-i);
//d+=(ll)(i+1)*(N-i);
}
d=(N+1)*(N)/2;
ll g=gcd(sum,d);
cout << sum/g << '/' << d/g << '\n';
}
| 18.456522 | 69 | 0.58775 | [
"vector"
] |
0e1427266d5a260ce74cff8088e2f104ea7a0438 | 15,097 | hpp | C++ | src/core/thread/network_data.hpp | ddreyer/openthread | 23f465c681babb64ad813fe27d44ed5e958f878d | [
"BSD-3-Clause"
] | null | null | null | src/core/thread/network_data.hpp | ddreyer/openthread | 23f465c681babb64ad813fe27d44ed5e958f878d | [
"BSD-3-Clause"
] | null | null | null | src/core/thread/network_data.hpp | ddreyer/openthread | 23f465c681babb64ad813fe27d44ed5e958f878d | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2016, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file includes definitions for managing Thread Network Data.
*/
#ifndef NETWORK_DATA_HPP_
#define NETWORK_DATA_HPP_
#include <openthread/types.h>
#include "coap/coap.hpp"
#include "common/locator.hpp"
#include "net/udp6.hpp"
#include "thread/lowpan.hpp"
#include "thread/mle_router.hpp"
#include "thread/network_data_tlvs.hpp"
namespace ot {
/**
* @addtogroup core-netdata
* @brief
* This module includes definitions for generating, processing, and managing Thread Network Data.
*
* @{
*
* @defgroup core-netdata-core Core
* @defgroup core-netdata-leader Leader
* @defgroup core-netdata-local Local
* @defgroup core-netdata-tlvs TLVs
*
* @}
*
*/
/**
* @namespace ot::NetworkData
*
* @brief
* This namespace includes definitions for managing Thread Network Data.
*
*/
namespace NetworkData {
/**
* @addtogroup core-netdata-core
*
* @brief
* This module includes definitions for managing Thread Network Data.
*
* @{
*
*/
/**
* This class implements Network Data processing.
*
*/
class NetworkData: public ThreadNetifLocator
{
public:
enum
{
kMaxSize = 255, ///< Maximum size of Thread Network Data in bytes.
};
/**
* This constructor initializes the object.
*
* @param[in] aThreadNetif A reference to the Thread network interface.
* @param[in] aLocal TRUE if this represents local network data, FALSE otherwise.
*
*/
NetworkData(ThreadNetif &aThreadNetif, bool aLocal);
/**
* This method clears the network data.
*
*/
void Clear(void);
/**
* This method provides a full or stable copy of the Thread Network Data.
*
* @param[in] aStable TRUE when copying the stable version, FALSE when copying the full version.
* @param[out] aData A pointer to the data buffer.
* @param[inout] aDataLength On entry, size of the data buffer pointed to by @p aData.
* On exit, number of copied bytes.
*
* @retval OT_ERROR_NONE Successfully copied full Thread Network Data.
* @retval OT_ERROR_NO_BUFS Not enough space to fully copy Thread Network Data.
*
*/
otError GetNetworkData(bool aStable, uint8_t *aData, uint8_t &aDataLength);
/**
* This method provides the next On Mesh prefix in the Thread Network Data.
*
* @param[inout] aIterator A pointer to the Network Data iterator context.
* @param[out] aConfig A pointer to where the On Mesh Prefix information will be placed.
*
* @retval OT_ERROR_NONE Successfully found the next On Mesh prefix.
* @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data.
*
*/
otError GetNextOnMeshPrefix(otNetworkDataIterator *aIterator, otBorderRouterConfig *aConfig);
/**
* This method provides the next On Mesh prefix in the Thread Network Data for a given RLOC16.
*
* @param[inout] aIterator A pointer to the Network Data iterator context.
* @param[in] aRloc16 The RLOC16 value.
* @param[out] aConfig A pointer to where the On Mesh Prefix information will be placed.
*
* @retval OT_ERROR_NONE Successfully found the next On Mesh prefix.
* @retval OT_ERROR_NOT_FOUND No subsequent On Mesh prefix exists in the Thread Network Data.
*
*/
otError GetNextOnMeshPrefix(otNetworkDataIterator *aIterator, uint16_t aRloc16, otBorderRouterConfig *aConfig);
/**
* This method provides the next external route in the Thread Network Data.
*
* @param[inout] aIterator A pointer to the Network Data iterator context.
* @param[out] aConfig A pointer to where the external route information will be placed.
*
* @retval OT_ERROR_NONE Successfully found the next external route.
* @retval OT_ERROR_NOT_FOUND No subsequent external route exists in the Thread Network Data.
*
*/
otError GetNextExternalRoute(otNetworkDataIterator *aIterator, otExternalRouteConfig *aConfig);
/**
* This method provides the next external route in the Thread Network Data for a given RLOC16.
*
* @param[inout] aIterator A pointer to the Network Data iterator context.
* @param[in] aRloc16 The RLOC16 value.
* @param[out] aConfig A pointer to where the external route information will be placed.
*
* @retval OT_ERROR_NONE Successfully found the next external route.
* @retval OT_ERROR_NOT_FOUND No subsequent external route exists in the Thread Network Data.
*
*/
otError GetNextExternalRoute(otNetworkDataIterator *aIterator, uint16_t aRloc16,
otExternalRouteConfig *aConfig);
/**
* This method indicates whether or not the Thread Network Data contains all of the on mesh prefix information
* in @p aCompare associated with @p aRloc16.
*
* @param[in] aCompare The Network Data to use for the query.
* @param[in] aRloc16 The RLOC16 to consider.
*
* @returns TRUE if this object contains all on mesh prefix information in @p aCompare associated with @p aRloc16,
* FALSE otherwise.
*
*/
bool ContainsOnMeshPrefixes(NetworkData &aCompare, uint16_t aRloc16);
/**
* This method indicates whether or not the Thread Network Data contains all of the external route information
* in @p aCompare associated with @p aRloc16.
*
* @param[in] aCompare The Network Data to use for the query.
* @param[in] aRloc16 The RLOC16 to consider.
*
* @returns TRUE if this object contains all external route information in @p aCompare associated with @p aRloc16,
* FALSE otherwise.
*
*/
bool ContainsExternalRoutes(NetworkData &aCompare, uint16_t aRloc16);
/**
* This method cancels the data resubmit delay timer.
*
*/
void ClearResubmitDelayTimer(void);
protected:
/**
* This method returns a pointer to the Border Router TLV within a given Prefix TLV.
*
* @param[in] aPrefix A reference to the Prefix TLV.
*
* @returns A pointer to the Border Router TLV if one is found or NULL if no Border Router TLV exists.
*
*/
BorderRouterTlv *FindBorderRouter(PrefixTlv &aPrefix);
/**
* This method returns a pointer to the stable or non-stable Border Router TLV within a given Prefix TLV.
*
* @param[in] aPrefix A reference to the Prefix TLV.
* @param[in] aStable TRUE if requesting a stable Border Router TLV, FALSE otherwise.
*
* @returns A pointer to the Border Router TLV if one is found or NULL if no Border Router TLV exists.
*
*/
BorderRouterTlv *FindBorderRouter(PrefixTlv &aPrefix, bool aStable);
/**
* This method returns a pointer to the Has Route TLV within a given Prefix TLV.
*
* @param[in] aPrefix A reference to the Prefix TLV.
*
* @returns A pointer to the Has Route TLV if one is found or NULL if no Has Route TLV exists.
*
*/
HasRouteTlv *FindHasRoute(PrefixTlv &aPrefix);
/**
* This method returns a pointer to the stable or non-stable Has Route TLV within a given Prefix TLV.
*
* @param[in] aPrefix A reference to the Prefix TLV.
* @param[in] aStable TRUE if requesting a stable Has Route TLV, FALSE otherwise.
*
* @returns A pointer to the Has Route TLV if one is found or NULL if no Has Route TLV exists.
*
*/
HasRouteTlv *FindHasRoute(PrefixTlv &aPrefix, bool aStable);
/**
* This method returns a pointer to the Context TLV within a given Prefix TLV.
*
* @param[in] aPrefix A reference to the Prefix TLV.
*
* @returns A pointer to the Context TLV is one is found or NULL if no Context TLV exists.
*
*/
ContextTlv *FindContext(PrefixTlv &aPrefix);
/**
* This method returns a pointer to a Prefix TLV.
*
* @param[in] aPrefix A pointer to an IPv6 prefix.
* @param[in] aPrefixLength The prefix length pointed to by @p aPrefix.
*
* @returns A pointer to the Prefix TLV is one is found or NULL if no matching Prefix TLV exists.
*
*/
PrefixTlv *FindPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength);
/**
* This method returns a pointer to a Prefix TLV in a specified tlvs buffer.
*
* @param[in] aPrefix A pointer to an IPv6 prefix.
* @param[in] aPrefixLength The prefix length pointed to by @p aPrefix.
* @param[in] aTlvs A pointer to a specified tlvs buffer.
* @param[in] aTlvsLength The specified tlvs buffer length pointed to by @p aTlvs.
*
* @returns A pointer to the Prefix TLV is one is found or NULL if no matching Prefix TLV exists.
*
*/
PrefixTlv *FindPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, uint8_t *aTlvs, uint8_t aTlvsLength);
/**
* This method inserts bytes into the Network Data.
*
* @param[in] aStart A pointer to the beginning of the insertion.
* @param[in] aLength The number of bytes to insert.
*
* @retval OT_ERROR_NONE Successfully inserted bytes.
* @retval OT_ERROR_NO_BUFS Insufficient buffer space to insert bytes.
*
*/
otError Insert(uint8_t *aStart, uint8_t aLength);
/**
* This method removes bytes from the Network Data.
*
* @param[in] aStart A pointer to the beginning of the removal.
* @param[in] aLength The number of bytes to remove.
*
* @retval OT_ERROR_NONE Successfully removed bytes.
*
*/
otError Remove(uint8_t *aStart, uint8_t aLength);
/**
* This method strips non-stable data from the Thread Network Data.
*
* @param[inout] aData A pointer to the Network Data to modify.
* @param[inout] aDataLength On entry, the size of the Network Data in bytes. On exit, the size of the
* resulting Network Data in bytes.
*
*/
void RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength);
/**
* This method strips non-stable Sub-TLVs from a Prefix TLV.
*
* @param[inout] aData A pointer to the Network Data to modify.
* @param[inout] aDataLength On entry, the size of the Network Data in bytes. On exit, the size of the
* resulting Network Data in bytes.
* @param[inout] aPrefix A reference to the Prefix TLV to modify.
*
*/
void RemoveTemporaryData(uint8_t *aData, uint8_t &aDataLength, PrefixTlv &aPrefix);
/**
* This method computes the number of IPv6 Prefix bits that match.
*
* @param[in] a A pointer to the first IPv6 Prefix.
* @param[in] b A pointer to the second IPv6 prefix.
* @param[in] aLength The maximum length in bits to compare.
*
* @returns The number of matching bits.
*
*/
int8_t PrefixMatch(const uint8_t *a, const uint8_t *b, uint8_t aLength);
/**
* This method sends a Server Data Notification message to the Leader.
*
* @param[in] aRloc16 The old RLOC16 value that was previously registered.
*
* @retval OT_ERROR_NONE Successfully enqueued the notification message.
* @retval OT_ERROR_NO_BUFS Insufficient message buffers to generate the notification message.
*
*/
otError SendServerDataNotification(uint16_t aRloc16);
uint8_t mTlvs[kMaxSize]; ///< The Network Data buffer.
uint8_t mLength; ///< The number of valid bytes in @var mTlvs.
private:
enum
{
kDataResubmitDelay = 300000, ///< DATA_RESUBMIT_DELAY (milliseconds)
};
class NetworkDataIterator
{
private:
enum
{
kTlvPoistion = 0,
kSubTlvPosition = 1,
kEntryPosition = 2,
};
public:
NetworkDataIterator(otNetworkDataIterator *aIterator):
mIteratorBuffer(reinterpret_cast<uint8_t *>(aIterator)) { }
uint8_t GetTlvOffset(void) const { return mIteratorBuffer[kTlvPoistion]; }
uint8_t GetSubTlvOffset(void) const { return mIteratorBuffer[kSubTlvPosition]; }
uint8_t GetEntryIndex(void) const { return mIteratorBuffer[kEntryPosition]; }
void SetTlvOffset(uint8_t aOffset) { mIteratorBuffer[kTlvPoistion] = aOffset; }
void SetSubTlvOffset(uint8_t aOffset) { mIteratorBuffer[kSubTlvPosition] = aOffset; }
void SetEntryIndex(uint8_t aIndex) { mIteratorBuffer[kEntryPosition] = aIndex; }
void SaveTlvOffset(const NetworkDataTlv *aTlv, const uint8_t *aTlvs) {
SetTlvOffset(static_cast<uint8_t>(reinterpret_cast<const uint8_t *>(aTlv) - aTlvs));
}
void SaveSubTlvOffset(const NetworkDataTlv *aSubTlv, const NetworkDataTlv *aSubTlvs) {
SetSubTlvOffset(static_cast<uint8_t>(reinterpret_cast<const uint8_t *>(aSubTlv) -
reinterpret_cast<const uint8_t *>(aSubTlvs)));
}
private:
uint8_t *mIteratorBuffer;
};
const bool mLocal;
bool mLastAttemptWait;
uint32_t mLastAttempt;
};
} // namespace NetworkData
/**
* @}
*/
} // namespace ot
#endif // NETWORK_DATA_HPP_
| 37.002451 | 118 | 0.660926 | [
"mesh",
"object"
] |
0e14dbd4a2349b5b86d8ff47801088676912ef5b | 1,943 | hpp | C++ | cpp/subprojects/common/include/common/indices/index_vector_full.hpp | mrapp-ke/SyndromeLearner | ed18c282949bebbc8e1dd5d2ddfb0b224ee71293 | [
"MIT"
] | null | null | null | cpp/subprojects/common/include/common/indices/index_vector_full.hpp | mrapp-ke/SyndromeLearner | ed18c282949bebbc8e1dd5d2ddfb0b224ee71293 | [
"MIT"
] | null | null | null | cpp/subprojects/common/include/common/indices/index_vector_full.hpp | mrapp-ke/SyndromeLearner | ed18c282949bebbc8e1dd5d2ddfb0b224ee71293 | [
"MIT"
] | 1 | 2022-03-08T22:06:56.000Z | 2022-03-08T22:06:56.000Z | /*
* @author Michael Rapp (mrapp@ke.tu-darmstadt.de)
*/
#pragma once
#include "common/indices/index_vector.hpp"
#include "common/indices/index_iterator.hpp"
/**
* Provides random access to all indices within a continuous range [0, numIndices).
*/
class FullIndexVector final : public IIndexVector {
private:
uint32 numElements_;
public:
/**
* @param numElements The number of indices, the vector provides access to
*/
FullIndexVector(uint32 numElements);
/**
* An iterator that provides read-only access to the indices in the vector.
*/
typedef IndexIterator const_iterator;
/**
* Returns a `const_iterator` to the beginning of the indices.
*
* @return A `const_iterator` to the beginning
*/
const_iterator cbegin() const;
/**
* Returns a `const_iterator` to the end of the indices.
*
* @return A `const_iterator` to the end
*/
const_iterator cend() const;
/**
* Sets the number of indices.
*
* @param numElements The number of indices to be set
* @param freeMemory True, if unused memory should be freed, if possible, false otherwise
*/
void setNumElements(uint32 numElements, bool freeMemory);
uint32 getNumElements() const override;
bool isPartial() const override;
uint32 getIndex(uint32 pos) const override;
std::unique_ptr<IStatisticsSubset> createSubset(const IImmutableStatistics& statistics) const override;
std::unique_ptr<IRuleRefinement> createRuleRefinement(IThresholdsSubset& thresholdsSubset,
uint32 featureIndex) const override;
std::unique_ptr<IHeadRefinement> createHeadRefinement(const IHeadRefinementFactory& factory) const override;
};
| 29 | 116 | 0.626866 | [
"vector"
] |
0e165ca7c29b87a3ed801eb3f58bc208e5c06135 | 12,729 | hpp | C++ | src/thread/worker.hpp | huangqundl/af_stream | 178d98feaf403b6947fb0fae3c2bbaedd91f9ab8 | [
"Apache-2.0"
] | 15 | 2017-03-28T13:15:53.000Z | 2022-03-01T08:16:48.000Z | src/thread/worker.hpp | huangqundl/af_stream | 178d98feaf403b6947fb0fae3c2bbaedd91f9ab8 | [
"Apache-2.0"
] | null | null | null | src/thread/worker.hpp | huangqundl/af_stream | 178d98feaf403b6947fb0fae3c2bbaedd91f9ab8 | [
"Apache-2.0"
] | 6 | 2017-10-17T14:10:23.000Z | 2022-03-01T08:16:29.000Z | #ifndef __AFS_WORKER_HPP_INCLUDED__
#define __AFS_WORKER_HPP_INCLUDED__
#include <stdint.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/shm.h>
#include <sys/mman.h>
#include <sys/stat.h> /* For mode constants */
#include <fcntl.h> /* For O_* constants */
#include <errno.h>
#include <map>
#include <vector>
#include <string>
#include <deque>
//#include <zookeeper.h>
#include "up_thread.hpp"
#include "up_thread_net.hpp"
#include "compute_thread.hpp"
#include "down_thread.hpp"
#include "../queues/zerocopy_ringbuffer.hpp"
#include "../util.hpp"
#include "../wrap_item.hpp"
#include "../fault_tolerance/operator_tracker.hpp"
#include "../fault_tolerance/backup_client.hpp"
//#include "fault_tolerance/data_manager.hpp"
//using namespace std;
#include "../controller/zk_worker_client.hpp"
//zhandle_t* ZkWorkerClient::zh = NULL;
//std::string ZkWorkerClient::server_name = "";
//clientid_t ZkWorkerClient::myid;
//set<string> ZookeeperClient::upstream_workers;
//deque<ControlMsg> ZookeeperClient::remoteCmd;
/**
* Parent process of a computation node, consisting of: one dispatcher,
* one collector, multiple compute_threads and one Zookeeper client
* @tparam T1 output class of dispatcher, input class of compute_threads
* @tparam T2 output class of compute_threads, input class of collector
* @tparam T3 output class of collector, input class of next-hop dispatcher
*/
namespace afs {
enum WindowType {WIN_NO = 0, WIN_HOP, WIN_SLIDE, WIN_DECAY};
template <class InT, class OutT, class RInT=NullClass, class ROutT=NullClass>
class Worker {
typedef WrapItem<InT> WInT;
typedef WrapItem<OutT> WOutT;
typedef WrapItem<RInT> WRInT;
typedef WrapItem<ROutT> WROutT;
private:
int worker_id_;
std::string worker_name_;
/**
* number of compute_threads (We supports multiple compute_threads within one worker)
*/
int num_compute_thread_;
/**
* references to the compute_threads
*/
//ComputeThread<InT, OutT, RInT, ROutT>** compute_threads_;
std::vector<ComputeThread<InT, OutT, RInT, ROutT>*> compute_threads_;
UpThread<InT, ROutT>* up_thread_;
DownThread<OutT, RInT>* down_thread_;
/*
void EnableInput(int i);
void EnableOutput(int i);
void ConnectComputeThreads(int i);
*/
// New PinCPU interface: from config file not function
void ParseCPUAffinity(char* str);
public:
/**
* Constructor
* @param worker_name The unique name of the worker
* @param addr The IP address of Zookeeper server
*/
Worker(string worker_name, int id, string zkAddr, int num_compute_thread);
/******************************************************************
*
* IMPORTANT Hint:
* The following three functions add threads to the Worker.
* DON'T initialize resources when creating the instances
* Allocate in their ThreadInitHandler() functions
*
****************************************************************/
void AddUpThread(UpThread<InT, ROutT>* up_thread);
void AddDownThread(DownThread<OutT, RInT>* down_thread);
void AddComputeThread(ComputeThread<InT, OutT, RInT, ROutT>* compute_thread);
void SetWindow(int type, int length);
/**
* execution all threads (upstream thread, compute_threads, downstream thread)
*/
void Start(int recovery = 0);
};
/*********************************************************************
*
* Implementation
*
********************************************************************/
template <class InT, class OutT, class RInT, class ROutT>
Worker<InT, OutT, RInT, ROutT>::Worker(string worker_name, int id, string zkAddr, int num_compute_thread) :
worker_id_(id),
worker_name_(worker_name),
num_compute_thread_(num_compute_thread),
//compute_threads_(NULL),
up_thread_(NULL),
down_thread_(NULL) {
/*
if (num_compute_thread > 0) {
compute_threads_ = (ComputeThread<InT, OutT, RInT, ROutT>**)calloc(num_compute_thread, sizeof(ComputeThread<InT, OutT, RInT, ROutT>*));
}
*/
/*
if (!addr.empty())
ZookeeperClient::server_name = addr;
zkClient = new ZookeeperClient(worker_name);
*/
}
template <class InT, class OutT, class RInT, class ROutT>
void Worker<InT, OutT, RInT, ROutT>::AddUpThread(UpThread<InT, ROutT>* up_thread) {
up_thread_ = up_thread;
}
template <class InT, class OutT, class RInT, class ROutT>
void Worker<InT, OutT, RInT, ROutT>::AddDownThread(DownThread<OutT, RInT>* down_thread) {
down_thread_ = down_thread;
}
template <class InT, class OutT, class RInT, class ROutT>
void Worker<InT, OutT, RInT, ROutT>::AddComputeThread(ComputeThread<InT, OutT, RInT, ROutT>* new_thread) {
/*
afs_assert((index>=0 && index<num_compute_thread_),
"Add ComputeThread: index error %d\n", index);
*/
compute_threads_.push_back(new_thread);
}
template <class InT, class OutT, class RInT, class ROutT>
void Worker<InT, OutT, RInT, ROutT>::ParseCPUAffinity(char* str) {
// worker; compute_thread; input; output
std::vector<std::string> strings;
char* tok = strtok(str, ";");
while (tok) {
strings.push_back(tok);
tok = strtok(NULL, ";");
}
int size = strings.size();
if (size > 0) {
// worker
int cpu = atoi(strings[0].c_str());
pin_to_cpu(cpu);
}
if (size > 1) {
size_t start = 0;
size_t found = strings[1].find(',', start);
int index = 0;
while (found != std::string::npos) {
int cpu = atoi(strings[1].substr(start, found-start).c_str());
compute_threads_[index++]->AssignCPU(cpu);
start = found+1;
found = strings[1].find(',', start);
}
}
if (size > 2) {
int cpu = atoi(strings[2].c_str());
up_thread_->AssignCPU(cpu);
}
if (size > 3) {
int cpu = atoi(strings[3].c_str());
down_thread_->AssignCPU(cpu);
}
}
template <class InT, class OutT, class RInT, class ROutT>
void Worker<InT, OutT, RInT, ROutT>::Start(int recovery) {
Config* config = Config::getInstance();
//ZeroQueueInit(1);
//DataManager::InitDataManagerContext(worker_name_);
char* zk_addr = config->getstring("sys.zookeeper_server", NULL);
ZkWorkerClient* zk_client = NULL;
if (zk_addr == NULL) {
LOG_WARN("No ZooKeeper server\n")
}
else {
zk_client = new ZkWorkerClient(worker_name_, zk_addr);
zk_client->initialize();
}
OperatorTracker::InitOperatorTracker(worker_name_, worker_id_);
char* backup_addr = config->getstring("sys.backup_server", NULL);
BackupClient* backup_client = NULL;
if (backup_addr == NULL) {
LOG_WARN("No backup server\n")
}
else {
backup_client = new BackupClient(worker_name_, worker_id_, backup_addr);
}
LOG_SYS(HLINE "[Worker] Setup inter-thread channels...\n");
LOG_MSG(" thread IDs...\n");
up_thread_->set_tid(num_compute_thread_);
up_thread_->set_wid(worker_id_);
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->set_tid(i);
compute_threads_[i]->set_wid(worker_id_);
}
if (down_thread_) {
down_thread_->set_tid(num_compute_thread_+1);
down_thread_->set_wid(worker_id_);
}
LOG_MSG(" CPU affinity...\n");
char* cpu_affinity = config->getstring("sys.cpu_affinity", NULL);
if (cpu_affinity) {
ParseCPUAffinity(cpu_affinity);
}
LOG_MSG(" inter-thread channels...\n");
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->ConnectUpThread(up_thread_);
}
if (down_thread_) {
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->ConnectDownThread(down_thread_);
}
}
LOG_SYS(HLINE "[Worker] Create threads...\n");
up_thread_->Create();
up_thread_->WaitThread(afs_zmq::command_t::ready);
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->Create();
compute_threads_[i]->WaitThread(afs_zmq::command_t::ready);
}
if (down_thread_) {
down_thread_->Create();
down_thread_->WaitThread(afs_zmq::command_t::ready);
}
if (recovery > 0) {
LOG_MSG(" Recovery mode...\n");
RecoveryItem* recovery_item = backup_client->RetriveBackups();
OperatorTracker::GetInstance()->RecoverOps(recovery_item);
backup_client->EndRecovery(recovery_item);
//up_thread_->EnableRecovery();
/*
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->ComputeThreadRecovery();
}
*/
}
LOG_SYS(HLINE "[Worker] Start running...\n");
up_thread_->NotifyThread(afs_zmq::command_t::type_t::ready);
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->NotifyThread(afs_zmq::command_t::type_t::ready);
}
if (down_thread_) {
down_thread_->NotifyThread(afs_zmq::command_t::type_t::ready);
}
size_t stop = 0, max_stop = num_compute_thread_ + 1;
afs_zmq::command_t cmd;
while (1) {
int rc = -1;
rc = up_thread_->WaitThread(&cmd, false);
if (rc == -1) {
}
else if (rc == afs_zmq::command_t::type_t::finish) {
stop++;
}
else if (rc == afs_zmq::command_t::type_t::backup) {
// data backup
if (backup_client) {
LOG_MSG("Data backup\n");
if (backup_client) {
backup_client->MakeBackup(cmd.args.backup_item);
}
}
}
else {
afs_assert(0, "In_Thread WaitThread unknown type %d\n", rc);
}
for (int i=0; i<num_compute_thread_; i++) {
rc = compute_threads_[i]->WaitThread(&cmd, false);
if (rc == -1) {
}
else if (rc == afs_zmq::command_t::type_t::finish) {
stop++;
}
else if (rc == afs_zmq::command_t::type_t::backup) {
// state backup
/*
unsigned char* start = cmd.data;
uint32_t wid = *(uint32_t*)start;
uint32_t tid = *(uint32_t*)(start+4);
uint32_t op = *(uint32_t*)(start+8);
uint64_t seq = *(uint64_t*)(start+12);
uint32_t len = *(uint32_t*)(start+20);
LOG_MSG("receive backup request from worker %u, thread %u, op %u, seq %lu, len %u:\n ", wid, tid, op, seq, len);
for (unsigned int i=0; i<cmd.len; i++) {
LOG_MSG("%02x ", *(start+24+i));
}
LOG_MSG("\n");
*/
if (backup_client) {
backup_client->MakeBackup(cmd.args.backup_item);
}
compute_threads_[i]->NotifyThread(afs_zmq::command_t::type_t::backup);
}
else {
afs_assert(0, "Analzyer WaitThread unknown type %d\n", rc);
}
}
if (stop == max_stop) {
break;
}
}
if (down_thread_) {
down_thread_->WaitThread(afs_zmq::command_t::finish);
}
/*
//up_thread_->WaitFinish1();
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->WaitFinish1();
}
if (down_thread_) {
down_thread_->WaitFinish1();
}
*/
LOG_SYS(HLINE "[Worker] Clean and output...\n");
up_thread_->NotifyThread(afs_zmq::command_t::type_t::clean);
up_thread_->WaitThread(afs_zmq::command_t::finish);
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->NotifyThread(afs_zmq::command_t::type_t::clean);
compute_threads_[i]->WaitThread(afs_zmq::command_t::finish);
}
if (down_thread_) {
down_thread_->NotifyThread(afs_zmq::command_t::type_t::clean);
down_thread_->WaitThread(afs_zmq::command_t::finish);
}
LOG_SYS(HLINE "[Worker] Finish...\n");
up_thread_->Destroy();
for (int i=0; i<num_compute_thread_; i++) {
compute_threads_[i]->Destroy();
}
if (down_thread_) {
down_thread_->Destroy();
}
if (zk_client) {
zk_client->finish();
}
if (backup_client) {
memset(&cmd.args.backup_item, 0, sizeof(struct BackupInfo) + sizeof(struct BackupMeta));
backup_client->MakeBackup(cmd.args.backup_item);
delete backup_client;
}
OperatorTracker::CleanOperatorTracker();
//DataManager::CleanDataManagerContext();
//ZeroQueueClean();
}
}
#endif // SAND_WORKER_HPP_
| 30.820823 | 143 | 0.605625 | [
"vector"
] |
0e1ac1fa51ea6b6d36d669c5869407d896d94ef3 | 22,731 | cpp | C++ | src/main.cpp | UnrealKaraulov/bspguy_alt | c55cc7fea671bb0d4df1cb193cb6348b694c4844 | [
"Unlicense"
] | 8 | 2022-01-25T07:54:29.000Z | 2022-01-29T06:52:25.000Z | src/main.cpp | UnrealKaraulov/bspguy_alt | c55cc7fea671bb0d4df1cb193cb6348b694c4844 | [
"Unlicense"
] | 10 | 2022-02-09T19:56:03.000Z | 2022-03-20T04:06:26.000Z | src/main.cpp | UnrealKaraulov/bspguy_alt | c55cc7fea671bb0d4df1cb193cb6348b694c4844 | [
"Unlicense"
] | 2 | 2022-01-21T13:52:59.000Z | 2022-02-20T17:12:56.000Z | #include "util.h"
#include "BspMerger.h"
#include <string>
#include <algorithm>
#include <iostream>
#include "CommandLine.h"
#include "remap.h"
#include "Renderer.h"
#include "winding.h"
// super todo:
// gui scale not accurate and mostly broken
// invalid solid undo not reverting plane vertex positions sometimes
// backwards mins/maxs when creating second teleport in scale mode and cant drag the handle
// dbm_14 invisible triggers not showing clipndoes.
// can't select by clipnodes when manually toggled on and rendering disabled for ents
// deleting ents breaks entity report list when filter is used
// update merge logic for v2 scripts
// abort scale/vertex edits if an overflow occurs
// 3d axes don't appear until moving mouse over 3D view sometimes
// "Hide" axes setting not loaded properly
// crash using 3d scale axes
// todo:
// add option to simplify clipnode hulls with QHull for shrinkwrap-style bounding volumes
// merge redundant submodels and duplicate structures
// no lightmap renders black faces if no lightmap data for face
// select overlapping entities by holding mouse down
// multi-select with ctrl
// recalculate lightmaps when scaling objects
// normalized clip type for clipnode regeneration (fixes broken collision around 90+ degree angle edges)
// lerp plane distance in regenerated clipnodes between bbox height and width
// uniform scaling
// highlight non-planar faces in vertex edit mode
// subdivided faces can't be transformed in verte edit mode
// auto-clean after a while? Unused data will pile up after a lot of face splitting
// scale fps overlay + toolbar offset with font size
// reference aaatrigger from wad instead of embedding it if it doesnt exist
// red highlight not working with lightmaps disabled
// undo history
// invalid solid log spam
// scaling allowing concave solids (merge0.bsp angled wedge)
// can't select faces sometimes
// make all commands available in the 3d editor
// transforms gradually waste more and more planes+clipnodes until the map overflows (need smarter updates)
// "Validate" doesn't return any response.. -Sparks (add a results window or something for that + clean/optimize)
// copy-paste ents from Jack -Outerbeast
// parse CFG and add bspguy_equip ents for each transition
// clipnode models sometimes missing faces or extending to infinity
// - floating point inaccuracies probably. Changing starting cube size also changes the model
// show tooltip when hovering over ent target/caller
// customize limits and remove auto-fgd logic so the editor isn't sven-specific in any way
// Add tooltips for everything
// first-time launch help window or something
// make .bsp extension optional when opening editor
// texture browser
// minor todo:
// warn about game_playerjoin and other special names
// dump model info for the rest of the data types
// delete all frames from unused animated textures
// moving maps can cause bad surface extents which could cause lightmap seams?
// see if balancing the BSP tree is possible and if helps performance at all
// - https://www.researchgate.net/publication/238348725_A_Tutorial_on_Binary_Space_Partitioning_Trees
// - "Balanced is optimal only when the geometry is uniformly distributed, which is rarely the case."
// delete all submodel leaves to save space. They're unused and waste space, yet the compiler includes them...?
// vertex editing + clipping (+ CSG?) for all BSP models. Basically reimplement all of Hammer... and hlbsp/vis/rad... kek
// delete embedded texture mipmaps to save space
// vertex manipulation: face inversions should be invalid
// vertex manipulation: max face extents should be invalid
// vertex manipulation: colplanar node planes should be invalid
// add command to check which ents are preventing hull 2 delete
// refactoring:
// stop mixing camel case and underscores
// parse vertors in util, not Keyvalue
// add class destructors and delete everything that's new'd
// render and bsp classes are way too big and doing too many things and render has too many state checks
// Ideas for commands:
// copymodel:
// - copies a model from the source map into the target map (for adding new perfectly shaped brush ents)
// addbox:
// - creates a new box-shaped brush model (faster than copymodel if you don't need anything fancy)
// extract:
// - extracts an isolated room from the BSP
// decompile:
// - to RMF. Try creating brushes from convex face connections?
// export:
// - export BSP models to MDL models.
// Notes:
// Removing HULL 0 from any model crashes when shooting unless it's EF_NODRAW or renderamt=0
// Removing HULL 0 from solid model crashes game when standing on it
char g_version_string[] = "bspguy v4 WIP (December, 2021)";
bool g_verbose = false;
#ifdef WIN32
#include <Windows.h>
#endif
void hideConsoleWindow() {
#ifdef WIN32
#ifdef NDEBUG
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
#endif
#endif
}
void start_viewer(const std::string & map) {
if (map.size() > 0 && !fileExists(map)) {
logf("ERROR: File not found: %s", map.c_str());
return;
}
Renderer renderer;
if (map.size())
renderer.addMap(new Bsp(map));
renderer.reloadBspModels();
hideConsoleWindow();
renderer.renderLoop();
}
int test() {
//start_viewer("hl_c09.bsp");
//return 0;
std::vector<Bsp*> maps;
for (int i = 1; i < 22; i++) {
Bsp* map = new Bsp("2nd/saving_the_2nd_amendment" + (i > 1 ? std::to_string(i) : "") + ".bsp");
maps.push_back(map);
}
//maps.push_back(new Bsp("op4/of1a1.bsp"));
//maps.push_back(new Bsp("op4/of1a2.bsp"));
//maps.push_back(new Bsp("op4/of1a3.bsp"));
//maps.push_back(new Bsp("op4/of1a4.bsp"));
STRUCTCOUNT removed;
memset(&removed, 0, sizeof(removed));
g_verbose = true;
for (int i = 0; i < maps.size(); i++) {
if (!maps[i]->valid) {
return 1;
}
if (!maps[i]->validate()) {
logf("");
}
logf("Preprocess %s\n", maps[i]->name.c_str());
maps[i]->delete_hull(2, 1);
//removed.add(maps[i]->delete_unused_hulls());
removed.add(maps[i]->remove_unused_model_structures());
if (!maps[i]->validate())
logf("");
}
removed.print_delete_stats(1);
BspMerger merger;
Bsp* result = merger.merge(maps, vec3(1, 1, 1), "yabma_move", false, false);
logf("\n");
if (result) {
result->write("yabma_move.bsp");
result->write("D:/Steam/steamapps/common/Sven Co-op/svencoop_addon/maps/yabma_move.bsp");
result->print_info(false, 0, false);
}
start_viewer("yabma_move.bsp");
return 0;
}
int merge_maps(CommandLine& cli) {
std::vector<std::string> input_maps = cli.getOptionList("-maps");
if (input_maps.size() < 2) {
logf("ERROR: at least 2 input maps are required\n");
return 1;
}
std::vector<Bsp*> maps;
for (int i = 0; i < input_maps.size(); i++) {
Bsp* map = new Bsp(input_maps[i]);
if (!map->valid)
{
delete map;
return 1;
}
maps.push_back(map);
}
for (int i = 0; i < maps.size(); i++) {
logf("Preprocessing %s:\n", maps[i]->name.c_str());
logf(" Deleting unused data...\n");
STRUCTCOUNT removed = maps[i]->remove_unused_model_structures();
g_progress.clear();
removed.print_delete_stats(2);
if (cli.hasOption("-nohull2") || (cli.hasOption("-optimize") && !maps[i]->has_hull2_ents())) {
logf(" Deleting hull 2...\n");
maps[i]->delete_hull(2, 1);
maps[i]->remove_unused_model_structures().print_delete_stats(2);
}
if (cli.hasOption("-optimize")) {
logf(" Optmizing...\n");
maps[i]->delete_unused_hulls().print_delete_stats(2);
}
logf("\n");
}
vec3 gap = cli.hasOption("-gap") ? cli.getOptionVector("-gap") : vec3(0, 0, 0);
std::string output_name = cli.hasOption("-o") ? cli.getOption("-o") : cli.bspfile;
BspMerger merger;
Bsp* result = merger.merge(maps, gap, output_name, cli.hasOption("-noripent"), cli.hasOption("-noscript"));
logf("\n");
if (result->isValid()) result->write(output_name);
logf("\n");
result->print_info(false, 0, 0);
for (int i = 0; i < maps.size(); i++) {
delete maps[i];
}
return 0;
}
int print_info(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
bool limitMode = false;
int listLength = 10;
int sortMode = SORT_CLIPNODES;
if (cli.hasOption("-limit")) {
std::string limitName = cli.getOption("-limit");
limitMode = true;
if (limitName == "clipnodes") {
sortMode = SORT_CLIPNODES;
}
else if (limitName == "nodes") {
sortMode = SORT_NODES;
}
else if (limitName == "faces") {
sortMode = SORT_FACES;
}
else if (limitName == "vertexes") {
sortMode = SORT_VERTS;
}
else {
logf("ERROR: invalid limit name: %s\n", limitName.c_str());
return 0;
}
}
if (cli.hasOption("-all")) {
listLength = 32768; // should be more than enough
}
map.print_info(limitMode, listLength, sortMode);
return 0;
}
int noclip(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
int model = -1;
int hull = -1;
int redirect = 0;
if (cli.hasOption("-hull")) {
hull = cli.getOptionInt("-hull");
if (hull < 0 || hull >= MAX_MAP_HULLS) {
logf("ERROR: hull number must be 0-3\n");
return 1;
}
}
if (cli.hasOption("-redirect")) {
if (!cli.hasOption("-hull")) {
logf("ERROR: -redirect must be used with -hull\n");
return 1;
}
redirect = cli.getOptionInt("-redirect");
if (redirect < 1 || redirect >= MAX_MAP_HULLS) {
logf("ERROR: redirect hull number must be 1-3\n");
return 1;
}
if (redirect == hull) {
logf("ERROR: Can't redirect hull to itself\n");
return 1;
}
}
STRUCTCOUNT removed = map.remove_unused_model_structures();
if (!removed.allZero()) {
logf("Deleting unused data:\n");
removed.print_delete_stats(1);
g_progress.clear();
logf("\n");
}
if (cli.hasOption("-model")) {
model = cli.getOptionInt("-model");
if (model < 0 || (unsigned int)model >= map.modelCount) {
logf("ERROR: model number must be 0 - %d\n", map.modelCount);
return 1;
}
if (hull != -1) {
if (redirect)
logf("Redirecting HULL %d to HULL %d in model %d:\n", hull, redirect, model);
else
logf("Deleting HULL %d from model %d:\n", hull, model);
map.delete_hull(hull, model, redirect);
}
else {
logf("Deleting HULL 1, 2, and 3 from model %d:\n", model);
for (int i = 1; i < MAX_MAP_HULLS; i++) {
map.delete_hull(i, model, redirect);
}
}
}
else {
if (hull == 0) {
logf("HULL 0 can't be stripped globally. The entire map would be invisible!\n");
return 0;
}
if (hull != -1) {
if (redirect)
logf("Redirecting HULL %d to HULL %d:\n", hull, redirect);
else
logf("Deleting HULL %d:\n", hull);
map.delete_hull(hull, redirect);
}
else {
logf("Deleting HULL 1, 2, and 3:\n", hull);
for (int i = 1; i < MAX_MAP_HULLS; i++) {
map.delete_hull(i, redirect);
}
}
}
removed = map.remove_unused_model_structures();
if (!removed.allZero())
removed.print_delete_stats(1);
else if (redirect == 0)
logf(" Model hull(s) was previously deleted or redirected.");
logf("\n");
if (map.isValid()) map.write(cli.hasOption("-o") ? cli.getOption("-o") : map.path);
logf("\n");
map.print_info(false, 0, 0);
return 0;
}
int simplify(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
int hull = 0;
if (!cli.hasOption("-model")) {
logf("ERROR: -model is required\n");
return 1;
}
if (cli.hasOption("-hull")) {
hull = cli.getOptionInt("-hull");
if (hull < 1 || hull >= MAX_MAP_HULLS) {
logf("ERROR: hull number must be 1-3\n");
return 1;
}
}
int modelIdx = cli.getOptionInt("-model");
STRUCTCOUNT removed = map.remove_unused_model_structures();
if (!removed.allZero()) {
logf("Deleting unused data:\n");
removed.print_delete_stats(1);
g_progress.clear();
logf("\n");
}
STRUCTCOUNT oldCounts(&map);
if (modelIdx < 0 || (unsigned int)modelIdx >= map.modelCount) {
logf("ERROR: model number must be 0 - %d\n", map.modelCount);
return 1;
}
if (hull != 0) {
logf("Simplifying HULL %d in model %d:\n", hull, modelIdx);
}
else {
logf("Simplifying collision hulls in model %d:\n", modelIdx);
}
map.simplify_model_collision(modelIdx, hull);
map.remove_unused_model_structures();
STRUCTCOUNT newCounts(&map);
STRUCTCOUNT change = oldCounts;
change.sub(newCounts);
if (!change.allZero())
change.print_delete_stats(1);
logf("\n");
if (map.isValid()) map.write(cli.hasOption("-o") ? cli.getOption("-o") : map.path);
logf("\n");
map.print_info(false, 0, 0);
return 0;
}
int deleteCmd(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
STRUCTCOUNT removed = map.remove_unused_model_structures();
if (!removed.allZero()) {
logf("Deleting unused data:\n");
removed.print_delete_stats(1);
g_progress.clear();
logf("\n");
}
if (cli.hasOption("-model")) {
int modelIdx = cli.getOptionInt("-model");
logf("Deleting model %d:\n", modelIdx);
map.delete_model(modelIdx);
map.update_ent_lump();
removed = map.remove_unused_model_structures();
if (!removed.allZero())
removed.print_delete_stats(1);
logf("\n");
}
if (map.isValid()) map.write(cli.hasOption("-o") ? cli.getOption("-o") : map.path);
logf("\n");
map.print_info(false, 0, 0);
return 0;
}
int transform(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
vec3 move;
if (cli.hasOptionVector("-move")) {
move = cli.getOptionVector("-move");
logf("Applying offset (%.2f, %.2f, %.2f)\n",
move.x, move.y, move.z);
map.move(move);
}
else {
logf("ERROR: at least one transformation option is required\n");
return 1;
}
if (map.isValid()) map.write(cli.hasOption("-o") ? cli.getOption("-o") : map.path);
logf("\n");
map.print_info(false, 0, 0);
return 0;
}
int unembed(CommandLine& cli) {
Bsp map = Bsp(cli.bspfile);
if (!map.valid)
{
return 1;
}
int deleted = map.delete_embedded_textures();
logf("Deleted %d embedded textures\n", deleted);
if (map.isValid()) map.write(cli.hasOption("-o") ? cli.getOption("-o") : map.path);
logf("\n");
return 0;
}
void print_help(const std::string & command) {
if (command == "merge") {
logf(
"merge - Merges two or more maps together\n\n"
"Usage: bspguy merge <mapname> -maps \"map1, map2, ... mapN\" [options]\n"
"Example: bspguy merge merged.bsp -maps \"svencoop1, svencoop2\"\n"
"\n[Options]\n"
" -optimize : Deletes unused model hulls before merging.\n"
" This can be risky and crash the game if assumptions about\n"
" entity visibility/solidity are wrong.\n"
" -nohull2 : Forces redirection of hull 2 to hull 1 in each map before merging.\n"
" This reduces clipnodes at the expense of less accurate collision\n"
" for large monsters and pushables.\n"
" -noripent : By default, the input maps are assumed to be part of a series.\n"
" Level changes and other things are updated so that the merged\n"
" maps can be played one after another. This flag prevents any\n"
" entity edits from being made (except for origins).\n"
" -noscript : By default, the output map is expected to run with the bspguy\n"
" map script loaded, which ensures only entities for the current\n"
" map section are active. This flag replaces that script with less\n"
" effective entity logic. This may cause lag in maps with lots of\n"
" entities, and some ents might not spawn properly. The benefit\n"
" to this flag is that you don't have deal with script setup.\n"
" -gap \"X,Y,Z\" : Amount of extra space to add between each map\n"
" -v\n"
" -verbose : Verbose console output.\n"
);
}
else if (command == "info") {
logf(
"info - Show BSP data summary\n\n"
"Usage: bspguy info <mapname> [options]\n"
"Example: bspguy info svencoop1.bsp -limit clipnodes -all\n"
"\n[Options]\n"
" -limit <name> : List the models contributing most to the named limit.\n"
" <name> can be one of: [clipnodes, nodes, faces, vertexes]\n"
" -all : Show the full list of models when using -limit.\n"
);
}
else if (command == "noclip") {
logf(
"noclip - Delete some clipnodes from the BSP\n\n"
"Usage: bspguy noclip <mapname> [options]\n"
"Example: bspguy noclip svencoop1.bsp -hull 2\n"
"\n[Options]\n"
" -model # : Model to strip collision from. By default, all models are stripped.\n"
" -hull # : Collision hull to delete (0-3). By default, hulls 1-3 are deleted.\n"
" 0 = Point-sized entities. Required for rendering\n"
" 1 = Human-sized monsters and standing players\n"
" 2 = Large monsters and pushables\n"
" 3 = Small monsters, crouching players, and melee attacks\n"
" -redirect # : Redirect to this hull after deleting the target hull's clipnodes.\n"
" For example, redirecting hull 2 to hull 1 would allow large\n"
" monsters to function normally instead of falling out of the world.\n"
" Must be used with the -hull option.\n"
" -o <file> : Output file. By default, <mapname> is overwritten.\n"
);
}
else if (command == "simplify") {
logf(
"simplify - Replaces model hulls with a simple bounding box\n\n"
"Usage: bspguy simplify <mapname> [options]\n"
"Example: bspguy simplify svencoop1.bsp -model 3\n"
"\n[Options]\n"
" -model # : Model to simplify. Required.\n"
" -hull # : Collision hull to simplify. By default, all hulls are simplified.\n"
" 1 = Human-sized monsters and standing players\n"
" 2 = Large monsters and pushables\n"
" 3 = Small monsters, crouching players, and melee attacks\n"
" -o <file> : Output file. By default, <mapname> is overwritten.\n"
);
}
else if (command == "delete") {
logf(
"delete - Delete BSP models.\n\n"
"Usage: bspguy delete <mapname> [options]\n"
"Example: bspguy delete svencoop1.bsp -model 3\n"
"\n[Options]\n"
" -model # : Model to delete. Entities that reference the deleted\n"
" model will be updated to use error.mdl instead.\n"
" -o <file> : Output file. By default, <mapname> is overwritten.\n"
);
}
else if (command == "transform") {
logf(
"transform - Apply 3D transformations\n\n"
"Usage: bspguy transform <mapname> [options]\n"
"Example: bspguy transform svencoop1.bsp -move \"0,0,1024\"\n"
"\n[Options]\n"
" -move \"X,Y,Z\" : Units to move the map on each axis.\n"
" -o <file> : Output file. By default, <mapname> is overwritten.\n"
);
}
else if (command == "unembed") {
logf(
"unembed - Deletes embedded texture data, so that they reference WADs instead.\n\n"
"Usage: bspguy unembed <mapname>\n"
"Example: bspguy unembed c1a0.bsp\n"
);
}
else if (command == "exportobj") {
logf(
"exportobj - Export bsp geometry to obj [WIP].\n\n"
"Usage: bspguy exportobj <mapname>\n"
"Example: bspguy exportobj c1a0.bsp\n"
);
}
else if (command == "editor" || command == "empty") {
logf(
"editor -\n"
"empty - Open bspguy editor window.\n\n"
"Usage: bspguy editor\n"
"Usage: bspguy empty\n"
);
}
else {
logf("%s\n\n", g_version_string);
logf(
"This tool modifies Sven Co-op BSPs without having to decompile them.\n\n"
"Usage: bspguy <command> <mapname> [options]\n"
"\n<Commands>\n"
" info : Show BSP data summary\n"
" merge : Merges two or more maps together\n"
" noclip : Delete some clipnodes/nodes from the BSP\n"
" delete : Delete BSP models\n"
" simplify : Simplify BSP models\n"
" transform : Apply 3D transformations to the BSP\n"
" unembed : Deletes embedded texture data\n"
" exportobj : Export bsp geometry to obj [WIP]\n"
" editor, empty : Open empty bspguy window\n"
"\nRun 'bspguy <command> help' to read about a specific command.\n"
"\nTo launch the 3D editor. Drag and drop a .bsp file onto the executable,\n"
"or run 'bspguy <mapname>'"
);
}
}
int main(int argc, char* argv[])
{
#ifdef WIN32
::ShowWindow(::GetConsoleWindow(), SW_SHOW);
#endif
#ifdef USE_FILESYSTEM
fs::path ph = argv[0];
fs::current_path(ph.parent_path());
#endif
g_settings_path = fileExists(GetCurrentWorkingDir() + "bspguy.cfg") ? GetCurrentWorkingDir() + "bspguy.cfg" : getConfigDir() + "bspguy.cfg";
g_config_dir = fileExists(GetCurrentWorkingDir() + "bspguy.cfg") ? GetCurrentWorkingDir() : getConfigDir();
//return test();
CommandLine cli(argc, argv);
if (cli.command == "help" || cli.command == "--help" || cli.command == "-help" ||
cli.command == "h" || cli.command == "--h" || cli.command == "-h"
|| cli.command == "/?") {
logf(g_version_string);
return 0;
}
if (cli.command == "version" || cli.command == "--version" || cli.command == "-version") {
logf(g_version_string);
return 0;
}
if (cli.command == "exportobj") {
Bsp* tmpBsp = new Bsp(cli.bspfile);
tmpBsp->ExportToObjWIP(cli.bspfile);
delete tmpBsp;
return 0;
}
if (cli.hasOption("-v") || cli.hasOption("-verbose")) {
g_verbose = true;
}
if (cli.command == "info") {
return print_info(cli);
}
else if (cli.command == "noclip") {
return noclip(cli);
}
else if (cli.command == "simplify") {
return simplify(cli);
}
else if (cli.command == "delete") {
return deleteCmd(cli);
}
else if (cli.command == "transform") {
return transform(cli);
}
else if (cli.command == "merge") {
return merge_maps(cli);
}
else if (cli.command == "unembed") {
return unembed(cli);
}
else {
logf("%s\n", ("Start bspguy editor with map: " + cli.bspfile).c_str());
logf("Load settings from : %s\n", g_settings_path.c_str());
start_viewer(cli.bspfile);
}
return 0;
}
| 29.830709 | 142 | 0.631252 | [
"geometry",
"render",
"vector",
"model",
"transform",
"3d",
"solid"
] |
0e20509baa4bcfcd681e9c3faa78ceb8bcaba575 | 426 | hpp | C++ | Overworld/TownSouth.hpp | NoahKittleson/RPG-Engine | e7ce30973b5d1eed09e3d5acfd89f549c2feffd8 | [
"MIT",
"Unlicense"
] | 4 | 2016-06-30T19:55:40.000Z | 2020-01-10T21:03:00.000Z | Overworld/TownSouth.hpp | NoahKittleson/RPG-Engine | e7ce30973b5d1eed09e3d5acfd89f549c2feffd8 | [
"MIT",
"Unlicense"
] | null | null | null | Overworld/TownSouth.hpp | NoahKittleson/RPG-Engine | e7ce30973b5d1eed09e3d5acfd89f549c2feffd8 | [
"MIT",
"Unlicense"
] | null | null | null | //
// TownSouth.hpp
// Overworld
//
// Created by Noah Kittleson on 7/8/18.
// Copyright © 2018 Noah. All rights reserved.
//
#pragma once
#include "MapSection.h"
#include "BattleState.h"
#include "DialogueMode.h"
class TownSouth: public MapSection
{
public:
TownSouth(const ResourceHolder& resources, const std::vector<Condition>& activeConds);
~TownSouth() { std::cout << "Town South deleted.\n"; }
private:
};
| 17.75 | 87 | 0.697183 | [
"vector"
] |
0e21b78bab1420a80ba69f646f51e84f4bd82c17 | 5,877 | hpp | C++ | Support/Modules/Pattern/SymbolFillDetails.hpp | graphisoft-python/TextEngine | 20c2ff53877b20fdfe2cd51ce7abdab1ff676a70 | [
"Apache-2.0"
] | 3 | 2019-07-15T10:54:54.000Z | 2020-01-25T08:24:51.000Z | Support/Modules/Pattern/SymbolFillDetails.hpp | graphisoft-python/GSRoot | 008fac2c6bf601ca96e7096705e25b10ba4d3e75 | [
"Apache-2.0"
] | null | null | null | Support/Modules/Pattern/SymbolFillDetails.hpp | graphisoft-python/GSRoot | 008fac2c6bf601ca96e7096705e25b10ba4d3e75 | [
"Apache-2.0"
] | 1 | 2020-09-26T03:17:22.000Z | 2020-09-26T03:17:22.000Z | /****************************************************************************
* Description: Basic data structures for symbol fill patterns *
* *
* Module: Pattern *
* Namespace: VBAttr (egyenlore) *
* Contact person: KiP *
****************************************************************************/
#ifndef SYMBOLFILLDETAILS_HPP
#define SYMBOLFILLDETAILS_HPP
#pragma once
// Pattern
#include "PatternExport.h"
// Geometry
#include "Point2D.hpp"
#include "Box2DData.h"
namespace GX {
namespace Pattern {
//============================ Class SFHotspot =============================
class PATTERN_DLL_EXPORT SFHotspot {
public:
// data members
Coord c; // coordinate of the hotspot
public:
// constructors
SFHotspot ();
~SFHotspot ();
// read / write methods
GSErrCode Read (GS::IChannel& ic);
GSErrCode Write (GS::OChannel& oc) const;
GSErrCode WriteXML (GS::XMLOChannel& oc) const;
GSErrCode ReadXML (GS::XMLIChannel& ic);
};
//============================= Class SFLine ===============================
class PATTERN_DLL_EXPORT SFLine {
public:
// data members
Coord begC; // begin coordinate of the line
Coord endC; // end coordinate of the line
public:
// constructors
SFLine ();
~SFLine ();
// read / write methods
GSErrCode Read (GS::IChannel& ic);
GSErrCode Write (GS::OChannel& oc) const;
GSErrCode WriteXML (GS::XMLOChannel& oc) const;
GSErrCode ReadXML (GS::XMLIChannel& ic);
};
//============================== Class SFArc ===============================
class PATTERN_DLL_EXPORT SFArc {
public:
// data members
Coord begC; // begin coordinate of the arc
Coord origC; // origin of the arc
double angle; // angle of the arc
public:
// constructors
SFArc ();
~SFArc ();
// read / write methods
GSErrCode Read (GS::IChannel& ic);
GSErrCode Write (GS::OChannel& oc) const;
GSErrCode WriteXML (GS::XMLOChannel& oc) const;
GSErrCode ReadXML (GS::XMLIChannel& ic);
};
//============================= Struct SFFill ==============================
struct SFFill {
Int32 nCoords; // number of coordinates in the hatch
Int32 nSubPolys; // number of subpolygons in the hatch
Int32 nArcs; // number of arcs in the hatch
Int32 dummy; // not used
};
//=========================== Struct SFPolyArc =============================
struct SFPolyArc {
Int32 begIndex; // begin index of the hatch arc in the coordinate array
Int32 endIndex; // end index of the hatch arc in the coordinate array
double arcAngle; // angle of hatch arc
};
//============================ Struct SFMotifs =============================
struct SFMotifs {
Int32 hotNumb; // number of hotspots in the motif
Int32 linNumb; // number of lines in the motif
Int32 arcNumb; // number of arcs in the motif
Int32 filNumb; // number of fills in the motif
GSHandle sfHotsRecs; // hotspots array
GSHandle sfLinRecs; // lines array
GSHandle sfArcRecs; // arcs array
GSHandle sfFillRecs; // fills array
Box2DData boundbox; // bounding box of the motif
Coord origo; // origin of the motif
};
//==================== Class SymbolFillDetailsIterator =====================
class SymbolFillDetails;
class PATTERN_DLL_EXPORT SymbolFillDetailsIterator {
private:
// data members
const SymbolFillDetails* symbolFillDetails;
short count;
Int32 nFills;
SFFill* fillPtr;
Coord* coordPtr;
Int32* subPoliesPtr;
SFPolyArc* polyArcsPtr;
public:
// constructors
SymbolFillDetailsIterator (const SymbolFillDetails& symbolFillDetails);
~SymbolFillDetailsIterator();
// get methods
bool HasNextFill () const;
SFFill* GetNextFill ();
// get methods (for the current fill)
Coord* const GetFillCoordsPtr () const;
Int32* const GetSubPoliesPtr () const;
SFPolyArc* const GetPolyArcsPtr () const;
};
//======================== Class SymbolFillDetails =========================
class PATTERN_DLL_EXPORT SymbolFillDetails {
static GS::ClassInfo classInfo;
private:
friend class SymbolFillDetailsIterator;
public:
// data members
SFHotspot** hotspots;
SFLine** lines;
SFArc** arcs;
SFFill** fills;
Coord** fillCoords;
Int32** subPolies;
SFPolyArc** polyArcs;
public:
// constructors
SymbolFillDetails ();
SymbolFillDetails (const SymbolFillDetails& source);
~SymbolFillDetails ();
// assigment
SymbolFillDetails& operator= (const SymbolFillDetails& source);
// compare
bool operator== (const SymbolFillDetails& rhs) const;
bool operator!= (const SymbolFillDetails& rhs) const;
// set methods
GSErrCode Set (SFMotifs& sfMotifsRec);
// get methods
Int32 GetHotSpots (const SFHotspot*& hotsArray) const;
Int32 GetLines (const SFLine*& linesArray) const;
Int32 GetArcs (const SFArc*& arcsArray) const;
Int32 GetFills (const SFFill*& fillsArray) const;
Int32 GetHotSpotNumber () const;
Int32 GetLineNumber () const;
Int32 GetArcNumber () const;
Int32 GetFillNumber () const;
// I/O
GSErrCode Write (GS::OChannel& oc) const;
GSErrCode Read (GS::IChannel& ic);
GSErrCode WriteXML (GS::XMLOChannel& oc) const;
GSErrCode ReadXML (GS::XMLIChannel& ic);
private:
void CopyData (const SymbolFillDetails& source);
void FreeMemory ();
GSErrCode ReadVersion1 (GS::IChannel& ic, const GS::InputFrame& frame);
GSErrCode WriteVersion1 (GS::OChannel& oc, const GS::OutputFrame& frame) const;
};
//==========================================================================
}
}
#endif
| 25.331897 | 82 | 0.581589 | [
"geometry"
] |
0e25deb20f05cf903d6e1c2311aecc53eaf6d133 | 5,848 | cpp | C++ | code/src/lib/Util/Clusterer.cpp | raphaelmenges/visual-stimuli-discovery | e02e9a0283a2d561165a39cf83fe85b8f687d884 | [
"MIT"
] | null | null | null | code/src/lib/Util/Clusterer.cpp | raphaelmenges/visual-stimuli-discovery | e02e9a0283a2d561165a39cf83fe85b8f687d884 | [
"MIT"
] | null | null | null | code/src/lib/Util/Clusterer.cpp | raphaelmenges/visual-stimuli-discovery | e02e9a0283a2d561165a39cf83fe85b8f687d884 | [
"MIT"
] | 2 | 2020-06-25T15:41:56.000Z | 2020-07-20T08:36:44.000Z | #include "Clusterer.hpp"
#include <Util/LayerComparator.hpp>
const float LAYER_CLUSTER_THRESHOLD = core::mt::get_config_value(0.75f, { "model", "layer_cluster_threshold" });
namespace util
{
namespace clusterer
{
template<typename T>
std::vector<
std::shared_ptr<std::vector<
std::shared_ptr<T> > > >
compute(std::vector<std::shared_ptr<T> > intras)
{
// Create empty output
std::vector<
std::shared_ptr<std::vector<
std::shared_ptr<T> > > > output;
// Count of intra-user states
unsigned int intras_size = (unsigned int)intras.size();
// Create similarity matrix between all intra-user states
cv::Mat layer_similarity_matrix = cv::Mat::zeros(intras_size, intras_size, CV_32F); // strictly upper triangle part is used, as similarity is symmetric
// Calculate layer similarity
for (unsigned int i = 0; i < intras_size; ++i) // rows of matrix
{
for (unsigned int j = i; j < intras_size; ++j) // columns of matrix
{
// Do not compare with itself
if (i == j)
{
layer_similarity_matrix.at<float>(cv::Point(i, i)) = -1.f;
continue;
}
// Go over all layers of both intra-user states
auto sp_intra_a = intras.at(i);
auto sp_intra_b = intras.at(j);
// Get containers
auto sp_intra_a_container = sp_intra_a->get_container().lock();
auto sp_intra_b_container = sp_intra_b->get_container().lock();
// Check whether weak pointer could be made shared
if (sp_intra_a_container && sp_intra_b_container)
{
// Get log dates
auto sp_log_dates_a = sp_intra_a_container->get_log_datum_container();
auto sp_log_dates_b = sp_intra_b_container->get_log_datum_container();
// Go over all frames of both intra-user states and compare layers
util::ScoreAcc<> score_acc;
for (
unsigned int idx_a = sp_intra_a->get_frame_idx_start();
idx_a <= sp_intra_a->get_frame_idx_end();
++idx_a)
{
auto sp_layer_a = sp_log_dates_a->get()->at(idx_a)->access_layer(sp_intra_a->get_layer_access(idx_a));
for (
unsigned int idx_b = sp_intra_b->get_frame_idx_start();
idx_b <= sp_intra_b->get_frame_idx_end();
++idx_b)
{
auto sp_layer_b = sp_log_dates_b->get()->at(idx_b)->access_layer(sp_intra_b->get_layer_access(idx_b));
// Compare both layers and accumulate score
score_acc.push_back(util::layer_comparator::compare(sp_layer_a, sp_layer_b));
}
}
layer_similarity_matrix.at<float>(cv::Point(j, i)) = score_acc.calc_average();
layer_similarity_matrix.at<float>(cv::Point(i, j)) = score_acc.calc_average();;
}
}
}
// Store the information which intra-user state has been put into which cluster, -1 if not yet put into a cluster
std::vector<int> intras_to_cluster(intras_size, -1);
// Find maximum value in layer-wise similarity of two intra-user states
double min_val, max_val;
cv::Point2i min_loc, max_loc;
cv::minMaxLoc(layer_similarity_matrix, &min_val, &max_val, &min_loc, &max_loc);
while (max_val >= LAYER_CLUSTER_THRESHOLD) // do it while there are still entries in the similarity matrix. But only to certain threshold
{
// Get the most similar intra-user states, layer-wise
int i = max_loc.y; // row
int j = max_loc.x; // column
// Set similiarity to -1 to avoid working on this pair of intra-user states again
layer_similarity_matrix.at<float>(cv::Point(j, i)) = -1.f;
layer_similarity_matrix.at<float>(cv::Point(i, j)) = -1.f;
// Check whether intra-user states have been already put into a cluster
bool i_clustered = intras_to_cluster.at(i) >= 0;
bool j_clustered = intras_to_cluster.at(j) >= 0;
// Act according to the configuration
if (i_clustered && j_clustered)
{
// Both are already clustered, do not bother
}
else if (i_clustered)
{
// i has been added to a cluster, push back also j to that cluster
int idx = intras_to_cluster.at(i);
output.at(idx)->push_back(intras.at(j));
intras_to_cluster.at(j) = idx;
}
else if (j_clustered)
{
// j has been added to a cluster, push back also i to that cluster
int idx = intras_to_cluster.at(j);
output.at(idx)->push_back(intras.at(i));
intras_to_cluster.at(i) = idx;
}
else
{
// None of the intra-user states has been added to a cluster, create a new cluster
int idx = (int)output.size();
output.push_back(
std::make_shared<std::vector<std::shared_ptr<T> > >());
output.at(idx)->push_back(intras.at(i));
output.at(idx)->push_back(intras.at(j));
intras_to_cluster.at(i) = idx;
intras_to_cluster.at(j) = idx;
}
// Update max value
cv::minMaxLoc(layer_similarity_matrix, &min_val, &max_val, &min_loc, &max_loc);
}
// Go over not yet clustered orphans who have not found a fitting partner to be clustered with
for (int i = 0; i < (int)intras_size; ++i)
{
if (intras_to_cluster.at(i) < 0)
{
output.push_back(
std::make_shared<std::vector<std::shared_ptr<T> > >());
output.back()->push_back(intras.at(i));
}
}
return output;
}
// Const version
template std::vector< // list of clusters
std::shared_ptr<std::vector< // list of intra-user states in a cluster
std::shared_ptr<const data::IntraUserState> > > > // intra-user states
compute<const data::IntraUserState>(std::vector<std::shared_ptr<const data::IntraUserState> > intras);
// Non-const version
template std::vector< // list of clusters
std::shared_ptr<std::vector< // list of intra-user states in a cluster
std::shared_ptr<data::IntraUserState> > > > // intra-user states
compute<data::IntraUserState>(std::vector<std::shared_ptr<data::IntraUserState> > intras);
}
}
| 35.442424 | 154 | 0.664501 | [
"vector",
"model"
] |
0e268a67eee4904f8ad770f57a42b77fb1e4bf68 | 33,060 | cpp | C++ | plugins/gui/src/configurator/Parameter.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | null | null | null | plugins/gui/src/configurator/Parameter.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | null | null | null | plugins/gui/src/configurator/Parameter.cpp | voei/megamol | 569b7b58c1f9bc5405b79549b86f84009329f668 | [
"BSD-3-Clause"
] | null | null | null | /*
* Parameter.cpp
*
* Copyright (C) 2019 by Universitaet Stuttgart (VIS).
* Alle Rechte vorbehalten.
*/
#include "stdafx.h"
#include "Parameter.h"
using namespace megamol;
using namespace megamol::gui;
using namespace megamol::gui::configurator;
megamol::gui::configurator::Parameter::Parameter(
ImGuiID uid, ParamType type, StroageType store, MinType min, MaxType max)
: uid(uid)
, type(type)
, full_name()
, description()
, minval(min)
, maxval(max)
, storage(store)
, value()
, default_value()
, default_value_mismatch(false)
, present() {
// Initialize variant types which should/can not be changed afterwards.
// Default ctor of variants initializes std::monostate.
switch (this->type) {
case (Parameter::ParamType::BOOL): {
this->value = bool(false);
} break;
case (Parameter::ParamType::BUTTON): {
// set_default_value_mismatch = true;
} break;
case (Parameter::ParamType::COLOR): {
this->value = megamol::core::param::ColorParam::ColorType();
} break;
case (Parameter::ParamType::ENUM): {
this->value = int(0);
} break;
case (Parameter::ParamType::FILEPATH): {
this->value = std::string();
} break;
case (Parameter::ParamType::FLEXENUM): {
this->value = std::string();
} break;
case (Parameter::ParamType::FLOAT): {
this->value = float(0.0f);
} break;
case (Parameter::ParamType::INT): {
this->value = int();
} break;
case (Parameter::ParamType::STRING): {
this->value = std::string();
} break;
case (Parameter::ParamType::TERNARY): {
this->value = vislib::math::Ternary();
} break;
case (Parameter::ParamType::TRANSFERFUNCTION): {
this->value = std::string();
} break;
case (Parameter::ParamType::VECTOR2F): {
this->value = glm::vec2();
} break;
case (Parameter::ParamType::VECTOR3F): {
this->value = glm::vec3();
} break;
case (Parameter::ParamType::VECTOR4F): {
this->value = glm::vec4();
} break;
default:
break;
}
this->default_value = this->value;
}
std::string megamol::gui::configurator::Parameter::GetValueString(void) {
std::string value_string = "UNKNOWN PARAMETER TYPE";
auto visitor = [this, &value_string](auto&& arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, bool>) {
auto param = megamol::core::param::BoolParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, megamol::core::param::ColorParam::ColorType>) {
auto param = megamol::core::param::ColorParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, float>) {
auto param = megamol::core::param::FloatParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, int>) {
switch (this->type) {
case (Parameter::ParamType::INT): {
auto param = megamol::core::param::IntParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} break;
case (Parameter::ParamType::ENUM): {
auto param = megamol::core::param::EnumParam(arg);
// Initialization of enum storage required
auto map = this->GetStorage<EnumStorageType>();
for (auto& pair : map) {
param.SetTypePair(pair.first, pair.second.c_str());
}
value_string = std::string(param.ValueString().PeekBuffer());
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, std::string>) {
switch (this->type) {
case (Parameter::ParamType::STRING): {
auto param = megamol::core::param::StringParam(arg.c_str());
value_string = std::string(param.ValueString().PeekBuffer());
} break;
case (Parameter::ParamType::TRANSFERFUNCTION): {
auto param = megamol::core::param::TransferFunctionParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} break;
case (Parameter::ParamType::FILEPATH): {
auto param = megamol::core::param::FilePathParam(arg.c_str());
value_string = std::string(param.ValueString().PeekBuffer());
} break;
case (Parameter::ParamType::FLEXENUM): {
auto param = megamol::core::param::FlexEnumParam(arg.c_str());
value_string = std::string(param.ValueString().PeekBuffer());
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, vislib::math::Ternary>) {
auto param = megamol::core::param::TernaryParam(arg);
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, glm::vec2>) {
auto param = megamol::core::param::Vector2fParam(vislib::math::Vector<float, 2>(arg.x, arg.y));
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, glm::vec3>) {
auto param = megamol::core::param::Vector3fParam(vislib::math::Vector<float, 3>(arg.x, arg.y, arg.z));
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, glm::vec4>) {
auto param =
megamol::core::param::Vector4fParam(vislib::math::Vector<float, 4>(arg.x, arg.y, arg.z, arg.w));
value_string = std::string(param.ValueString().PeekBuffer());
} else if constexpr (std::is_same_v<T, std::monostate>) {
switch (this->type) {
case (Parameter::ParamType::BUTTON): {
auto param = megamol::core::param::ButtonParam();
value_string = std::string(param.ValueString().PeekBuffer());
break;
}
default:
break;
}
}
};
std::visit(visitor, this->value);
return value_string;
}
bool megamol::gui::configurator::Parameter::SetValueString(const std::string& val_str, bool set_default_val) {
bool retval = false;
vislib::TString val_tstr(val_str.c_str());
switch (this->type) {
case (Parameter::ParamType::BOOL): {
megamol::core::param::BoolParam param(false);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::BUTTON): {
retval = true;
} break;
case (Parameter::ParamType::COLOR): {
megamol::core::param::ColorParam param(val_tstr);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::ENUM): {
megamol::core::param::EnumParam param(0);
// Initialization of enum storage required
auto map = this->GetStorage<EnumStorageType>();
for (auto& pair : map) {
param.SetTypePair(pair.first, pair.second.c_str());
}
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::FILEPATH): {
megamol::core::param::FilePathParam param(val_tstr.PeekBuffer());
retval = param.ParseValue(val_tstr);
this->SetValue(std::string(param.Value().PeekBuffer()), set_default_val);
} break;
case (Parameter::ParamType::FLEXENUM): {
megamol::core::param::FlexEnumParam param(val_str);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::FLOAT): {
megamol::core::param::FloatParam param(0.0f);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::INT): {
megamol::core::param::IntParam param(0);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::STRING): {
megamol::core::param::StringParam param(val_tstr.PeekBuffer());
retval = param.ParseValue(val_tstr);
this->SetValue(std::string(param.Value().PeekBuffer()), set_default_val);
} break;
case (Parameter::ParamType::TERNARY): {
megamol::core::param::TernaryParam param(vislib::math::Ternary::TRI_UNKNOWN);
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::TRANSFERFUNCTION): {
megamol::core::param::TransferFunctionParam param;
retval = param.ParseValue(val_tstr);
this->SetValue(param.Value(), set_default_val);
} break;
case (Parameter::ParamType::VECTOR2F): {
megamol::core::param::Vector2fParam param(vislib::math::Vector<float, 2>(0.0f, 0.0f));
retval = param.ParseValue(val_tstr);
auto val = param.Value();
this->SetValue(glm::vec2(val.X(), val.Y()), set_default_val);
} break;
case (Parameter::ParamType::VECTOR3F): {
megamol::core::param::Vector3fParam param(vislib::math::Vector<float, 3>(0.0f, 0.0f, 0.0f));
retval = param.ParseValue(val_tstr);
auto val = param.Value();
this->SetValue(glm::vec3(val.X(), val.Y(), val.Z()), set_default_val);
} break;
case (Parameter::ParamType::VECTOR4F): {
megamol::core::param::Vector4fParam param(vislib::math::Vector<float, 4>(0.0f, 0.0f, 0.0f, 0.0f));
retval = param.ParseValue(val_tstr);
auto val = param.Value();
this->SetValue(glm::vec4(val.X(), val.Y(), val.Z(), val.W()), set_default_val);
} break;
default:
break;
}
return retval;
}
// PARAMETER PRESENTATION ####################################################
megamol::gui::configurator::Parameter::Presentation::Presentation(void)
: read_only(false)
, visible(true)
, expert(false)
, presentations(Presentations::DEFAULT)
, help()
, utils()
, file_utils()
, show_tf_editor(false)
, tf_editor()
, widget_store()
, float_format("%.7f")
, height(0.0f) {}
megamol::gui::configurator::Parameter::Presentation::~Presentation(void) {}
bool megamol::gui::configurator::Parameter::Presentation::Present(megamol::gui::configurator::Parameter& inout_param) {
if (ImGui::GetCurrentContext() == nullptr) {
vislib::sys::Log::DefaultLog.WriteError(
"No ImGui context available. [%s, %s, line %d]\n", __FILE__, __FUNCTION__, __LINE__);
return false;
}
try {
// (Show all parameters in expert mode)
if (this->visible || this->expert) {
ImGui::BeginGroup();
ImGui::PushID(inout_param.uid);
if (this->expert) {
this->present_prefix();
ImGui::SameLine();
}
switch (this->presentations) {
case (Presentations::DEFAULT): {
this->present_value_DEFAULT(inout_param);
} break;
// case (Presentations::PIN_VALUE_TO_MOUSE): {
// this->present_value_DEFAULT(inout_param);
// ImGui::PopID();
// this->present_value_PIN_VALUE_TO_MOUSE(inout_param);
// ImGui::PushID(inout_param.uid);
// } break;
default:
break;
}
ImGui::SameLine();
this->present_postfix(inout_param);
ImGui::PopID();
ImGui::EndGroup();
}
} catch (std::exception e) {
vislib::sys::Log::DefaultLog.WriteError(
"Error: %s [%s, %s, line %d]\n", e.what(), __FILE__, __FUNCTION__, __LINE__);
return false;
} catch (...) {
vislib::sys::Log::DefaultLog.WriteError("Unknown Error. [%s, %s, line %d]\n", __FILE__, __FUNCTION__, __LINE__);
return false;
}
return true;
}
float megamol::gui::configurator::Parameter::Presentation::GetHeight(Parameter& inout_param) {
float height = (ImGui::GetFrameHeightWithSpacing() * 1.15f);
if (inout_param.type == Parameter::ParamType::TRANSFERFUNCTION) {
if (this->show_tf_editor) {
height = (ImGui::GetFrameHeightWithSpacing() * 18.5f);
} else {
height = (ImGui::GetFrameHeightWithSpacing() * 1.5f);
}
}
return height;
}
bool megamol::gui::configurator::Parameter::Presentation::presentation_button(void) {
bool retval = false;
this->utils.PointCircleButton();
if (ImGui::BeginPopupContextItem("param_present_button_context", 0)) { // 0 = left mouse button
for (int i = 0; i < static_cast<int>(Presentations::_COUNT_); i++) {
std::string presentation_str;
switch (static_cast<Presentations>(i)) {
case (Presentations::DEFAULT):
presentation_str = "Default";
break;
// case (Presentations::PIN_VALUE_TO_MOUSE):
// presentation_str = "Pin Value to Mouse";
// break;
default:
break;
}
if (presentation_str.empty()) break;
auto presentation_i = static_cast<Presentations>(i);
if (ImGui::MenuItem(presentation_str.c_str(), nullptr, (presentation_i == this->presentations))) {
this->presentations = presentation_i;
retval = true;
}
}
ImGui::EndPopup();
}
return retval;
}
void megamol::gui::configurator::Parameter::Presentation::present_prefix(void) {
// Visibility
if (ImGui::RadioButton("###visible", !this->visible)) {
this->visible = !this->visible;
}
this->utils.HoverToolTip("Visibility", ImGui::GetItemID(), 0.5f);
ImGui::SameLine();
// Read-only option
ImGui::Checkbox("###readonly", &this->read_only);
this->utils.HoverToolTip("Read-Only", ImGui::GetItemID(), 0.5f);
ImGui::SameLine();
// Presentation
this->presentation_button();
this->utils.HoverToolTip("Presentation", ImGui::GetItemID(), 0.5f);
}
void megamol::gui::configurator::Parameter::Presentation::present_value_DEFAULT(
megamol::gui::configurator::Parameter& inout_param) {
this->help.clear();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x * 0.65f); // set general proportional item width
if (this->read_only) {
GUIUtils::ReadOnlyWigetStyle(true);
}
std::string param_label = inout_param.GetName();
auto visitor = [&](auto&& arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, bool>) {
if (ImGui::Checkbox(param_label.c_str(), &arg)) {
inout_param.SetValue(arg);
}
} else if constexpr (std::is_same_v<T, megamol::core::param::ColorParam::ColorType>) {
auto color_flags = ImGuiColorEditFlags_AlphaPreview; // | ImGuiColorEditFlags_Float;
if (ImGui::ColorEdit4(param_label.c_str(), (float*)arg.data(), color_flags)) {
inout_param.SetValue(arg);
}
this->help = "[Click] on the colored square to open a color picker.\n"
"[CTRL+Click] on individual component to input value.\n"
"[Right-Click] on the individual color widget to show options.";
} else if constexpr (std::is_same_v<T, float>) {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputFloat(param_label.c_str(), &std::get<float>(this->widget_store), 1.0f, 10.0f,
this->float_format.c_str(), ImGuiInputTextFlags_None);
if (ImGui::IsItemDeactivatedAfterEdit()) {
this->widget_store = std::max(inout_param.GetMinValue<float>(),
std::min(std::get<float>(this->widget_store), inout_param.GetMaxValue<float>()));
inout_param.SetValue(std::get<float>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
this->widget_store = arg;
}
} else if constexpr (std::is_same_v<T, int>) {
switch (inout_param.type) {
case (Parameter::ParamType::INT): {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputInt(
param_label.c_str(), &std::get<int>(this->widget_store), 1, 10, ImGuiInputTextFlags_None);
if (ImGui::IsItemDeactivatedAfterEdit()) {
this->widget_store = std::max(inout_param.GetMinValue<int>(),
std::min(std::get<int>(this->widget_store), inout_param.GetMaxValue<int>()));
inout_param.SetValue(std::get<int>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
this->widget_store = arg;
}
} break;
case (Parameter::ParamType::ENUM): {
/// XXX: no UTF8 fanciness required here?
auto map = inout_param.GetStorage<EnumStorageType>();
if (ImGui::BeginCombo(param_label.c_str(), map[arg].c_str())) {
for (auto& pair : map) {
bool isSelected = (pair.first == arg);
if (ImGui::Selectable(pair.second.c_str(), isSelected)) {
inout_param.SetValue(pair.first);
}
if (isSelected) {
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, std::string>) {
switch (inout_param.type) {
case (Parameter::ParamType::STRING): {
if (!std::holds_alternative<T>(this->widget_store)) {
/// XXX: UTF8 conversion and allocation every frame is horrific inefficient.
std::string utf8Str = arg;
GUIUtils::Utf8Encode(utf8Str);
this->widget_store = utf8Str;
}
// Determine multi line count of string
int lcnt = static_cast<int>(std::count(std::get<std::string>(this->widget_store).begin(),
std::get<std::string>(this->widget_store).end(), '\n'));
lcnt = std::min(static_cast<int>(GUI_MAX_MULITLINE), lcnt);
ImVec2 ml_dim = ImVec2(ImGui::CalcItemWidth(),
ImGui::GetFrameHeight() + (ImGui::GetFontSize() * static_cast<float>(lcnt)));
std::string hidden_label = "###" + param_label;
ImGui::InputTextMultiline(hidden_label.c_str(), &std::get<std::string>(this->widget_store), ml_dim,
ImGuiInputTextFlags_CtrlEnterForNewLine);
if (ImGui::IsItemDeactivatedAfterEdit()) {
std::string utf8Str = std::get<std::string>(this->widget_store);
GUIUtils::Utf8Decode(utf8Str);
inout_param.SetValue(utf8Str);
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
std::string utf8Str = arg;
GUIUtils::Utf8Encode(utf8Str);
this->widget_store = utf8Str;
}
ImGui::SameLine();
ImGui::TextUnformatted(param_label.c_str());
this->help = "[Ctrl + Enter] for new line.\nPress [Return] to confirm changes.";
} break;
case (Parameter::ParamType::TRANSFERFUNCTION): {
this->transfer_function_edit(inout_param);
} break;
case (Parameter::ParamType::FILEPATH): {
if (!std::holds_alternative<T>(this->widget_store)) {
/// XXX: UTF8 conversion and allocation every frame is horrific inefficient.
std::string utf8Str = arg;
GUIUtils::Utf8Encode(utf8Str);
this->widget_store = utf8Str;
}
ImGuiStyle& style = ImGui::GetStyle();
ImGui::PushItemWidth(
ImGui::GetContentRegionAvail().x * 0.65f - ImGui::GetFrameHeight() - style.ItemSpacing.x);
bool button_edit = this->file_utils.FileBrowserButton(std::get<std::string>(this->widget_store));
ImGui::SameLine();
ImGui::InputText(
param_label.c_str(), &std::get<std::string>(this->widget_store), ImGuiInputTextFlags_None);
if (button_edit || ImGui::IsItemDeactivatedAfterEdit()) {
GUIUtils::Utf8Decode(std::get<std::string>(this->widget_store));
inout_param.SetValue(std::get<std::string>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
std::string utf8Str = arg;
GUIUtils::Utf8Encode(utf8Str);
this->widget_store = utf8Str;
}
ImGui::PopItemWidth();
} break;
case (Parameter::ParamType::FLEXENUM): {
/// XXX: no UTF8 fanciness required here?
if (ImGui::BeginCombo(param_label.c_str(), arg.c_str())) {
for (auto valueOption : inout_param.GetStorage<megamol::core::param::FlexEnumParam::Storage_t>()) {
bool isSelected = (valueOption == arg);
if (ImGui::Selectable(valueOption.c_str(), isSelected)) {
inout_param.SetValue(valueOption);
}
if (isSelected) {
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, vislib::math::Ternary>) {
if (ImGui::RadioButton("True", arg.IsTrue())) {
inout_param.SetValue(vislib::math::Ternary::TRI_TRUE);
}
ImGui::SameLine();
if (ImGui::RadioButton("False", arg.IsFalse())) {
inout_param.SetValue(vislib::math::Ternary::TRI_FALSE);
}
ImGui::SameLine();
if (ImGui::RadioButton("Unknown", arg.IsUnknown())) {
inout_param.SetValue(vislib::math::Ternary::TRI_UNKNOWN);
}
ImGui::SameLine();
ImGui::TextDisabled("|");
ImGui::SameLine();
ImGui::TextUnformatted(param_label.c_str());
} else if constexpr (std::is_same_v<T, glm::vec2>) {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputFloat2(param_label.c_str(), glm::value_ptr(std::get<glm::vec2>(this->widget_store)),
this->float_format.c_str(), ImGuiInputTextFlags_None);
if (ImGui::IsItemDeactivatedAfterEdit()) {
auto max = inout_param.GetMaxValue<glm::vec2>();
auto min = inout_param.GetMinValue<glm::vec2>();
auto x = std::max(min.x, std::min(std::get<glm::vec2>(this->widget_store).x, max.x));
auto y = std::max(min.y, std::min(std::get<glm::vec2>(this->widget_store).y, max.y));
this->widget_store = glm::vec2(x, y);
inout_param.SetValue(std::get<glm::vec2>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
this->widget_store = arg;
}
} else if constexpr (std::is_same_v<T, glm::vec3>) {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputFloat3(param_label.c_str(), glm::value_ptr(std::get<glm::vec3>(this->widget_store)),
this->float_format.c_str(), ImGuiInputTextFlags_None);
if (ImGui::IsItemDeactivatedAfterEdit()) {
auto max = inout_param.GetMaxValue<glm::vec3>();
auto min = inout_param.GetMinValue<glm::vec3>();
auto x = std::max(min.x, std::min(std::get<glm::vec3>(this->widget_store).x, max.x));
auto y = std::max(min.y, std::min(std::get<glm::vec3>(this->widget_store).y, max.y));
auto z = std::max(min.z, std::min(std::get<glm::vec3>(this->widget_store).z, max.z));
this->widget_store = glm::vec3(x, y, z);
inout_param.SetValue(std::get<glm::vec3>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
this->widget_store = arg;
}
} else if constexpr (std::is_same_v<T, glm::vec4>) {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputFloat4(param_label.c_str(), glm::value_ptr(std::get<glm::vec4>(this->widget_store)),
this->float_format.c_str(), ImGuiInputTextFlags_None);
if (ImGui::IsItemDeactivatedAfterEdit()) {
auto max = inout_param.GetMaxValue<glm::vec4>();
auto min = inout_param.GetMinValue<glm::vec4>();
auto x = std::max(min.x, std::min(std::get<glm::vec4>(this->widget_store).x, max.x));
auto y = std::max(min.y, std::min(std::get<glm::vec4>(this->widget_store).y, max.y));
auto z = std::max(min.z, std::min(std::get<glm::vec4>(this->widget_store).z, max.z));
auto w = std::max(min.w, std::min(std::get<glm::vec4>(this->widget_store).w, max.w));
this->widget_store = glm::vec4(x, y, z, w);
inout_param.SetValue(std::get<glm::vec4>(this->widget_store));
} else if (!ImGui::IsItemActive() && !ImGui::IsItemEdited()) {
this->widget_store = arg;
}
} else if constexpr (std::is_same_v<T, std::monostate>) {
switch (inout_param.type) {
case (Parameter::ParamType::BUTTON): {
std::string hotkey = "";
auto keycode = inout_param.GetStorage<megamol::core::view::KeyCode>();
std::string button_hotkey = keycode.ToString();
if (!button_hotkey.empty()) {
hotkey = " (" + button_hotkey + ")";
}
param_label += hotkey;
if (ImGui::Button(param_label.c_str())) {
// inout_param.setDirty();
}
} break;
default:
break;
}
}
};
std::visit(visitor, inout_param.GetValue());
if (this->read_only) {
GUIUtils::ReadOnlyWigetStyle(false);
}
ImGui::PopItemWidth();
}
/*
void megamol::gui::configurator::Parameter::Presentation::present_value_PIN_VALUE_TO_MOUSE(
megamol::gui::configurator::Parameter& inout_param) {
ImGuiIO& io = ImGui::GetIO();
ImGuiStyle& style = ImGui::GetStyle();
std::string param_label = inout_param.GetName();
ImGui::BeginTooltip();
auto visitor = [&](auto&& arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, bool>) {
} else if constexpr (std::is_same_v<T, megamol::core::param::ColorParam::ColorType>) {
} else if constexpr (std::is_same_v<T, float>) {
ImGui::TextDisabled(inout_param.GetValueString().c_str());
} else if constexpr (std::is_same_v<T, int>) {
switch (inout_param.type) {
case (Parameter::ParamType::INT): {
if (!std::holds_alternative<T>(this->widget_store)) {
this->widget_store = arg;
}
ImGui::InputInt(
param_label.c_str(), &std::get<int>(this->widget_store), ImGuiInputTextFlags_ReadOnly);
} break;
case (Parameter::ParamType::ENUM): {
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, std::string>) {
switch (inout_param.type) {
case (Parameter::ParamType::STRING): {
} break;
case (Parameter::ParamType::TRANSFERFUNCTION): {
} break;
case (Parameter::ParamType::FILEPATH): {
} break;
case (Parameter::ParamType::FLEXENUM): {
} break;
default:
break;
}
} else if constexpr (std::is_same_v<T, vislib::math::Ternary>) {
} else if constexpr (std::is_same_v<T, glm::vec2>) {
} else if constexpr (std::is_same_v<T, glm::vec3>) {
} else if constexpr (std::is_same_v<T, glm::vec4>) {
} else if constexpr (std::is_same_v<T, std::monostate>) {
switch (inout_param.type) {
case (Parameter::ParamType::BUTTON): {
} break;
default:
break;
}
}
};
std::visit(visitor, inout_param.GetValue());
ImGui::EndTooltip();
}
*/
void megamol::gui::configurator::Parameter::Presentation::present_postfix(
megamol::gui::configurator::Parameter& inout_param) {
this->utils.HoverToolTip(inout_param.description, ImGui::GetItemID(), 0.5f);
this->utils.HelpMarkerToolTip(this->help);
}
void megamol::gui::configurator::Parameter::Presentation::transfer_function_edit(
megamol::gui::configurator::Parameter& inout_param) {
if ((inout_param.type != Parameter::ParamType::TRANSFERFUNCTION) ||
(!std::holds_alternative<std::string>(inout_param.GetValue()))) {
vislib::sys::Log::DefaultLog.WriteError(
"Transfer Function Editor is called for incompatible parameter type. [%s, %s, line %d]\n", __FILE__,
__FUNCTION__, __LINE__);
return;
}
auto value = std::get<std::string>(inout_param.GetValue());
ImGui::BeginGroup();
// Reduced display of value and editor state.
if (value.empty()) {
ImGui::TextDisabled("{ (empty) }");
} else {
/// XXX: A gradient texture would be nice here (sharing some editor code?)
ImGui::TextUnformatted("{ ............. }");
}
ImGui::SameLine();
bool updateEditor = false;
// Edit transfer function.
if (ImGui::Checkbox("Editor", &this->show_tf_editor)) {
// Set once
if (this->show_tf_editor) {
updateEditor = true;
}
}
ImGui::SameLine();
// Copy transfer function.
if (ImGui::Button("Copy")) {
#ifdef GUI_USE_GLFW
auto glfw_win = ::glfwGetCurrentContext();
::glfwSetClipboardString(glfw_win, value.c_str());
#elif _WIN32
ImGui::SetClipboardText(value.c_str());
#else // LINUX
vislib::sys::Log::DefaultLog.WriteWarn(
"No clipboard use provided. [%s, %s, line %d]\n", __FILE__, __FUNCTION__, __LINE__);
vislib::sys::Log::DefaultLog.WriteInfo("Transfer Function JSON String:\n%s", value.c_str());
#endif
}
ImGui::SameLine();
// Paste transfer function.
if (ImGui::Button("Paste")) {
#ifdef GUI_USE_GLFW
auto glfw_win = ::glfwGetCurrentContext();
inout_param.SetValue(std::string(::glfwGetClipboardString(glfw_win)));
#elif _WIN32
inout_param.SetValue(std::string(ImGui::GetClipboardText()));
#else // LINUX
vislib::sys::Log::DefaultLog.WriteWarn(
"No clipboard use provided. [%s, %s, line %d]\n", __FILE__, __FUNCTION__, __LINE__);
#endif
updateEditor = true;
}
ImGui::SameLine();
std::string label = inout_param.full_name;
ImGui::TextUnformatted(label.c_str(), ImGui::FindRenderedTextEnd(label.c_str()));
ImGui::EndGroup();
// Propagate the transfer function to the editor.
if (updateEditor) {
this->tf_editor.SetTransferFunction(value, false);
}
// Draw transfer function editor
if (this->show_tf_editor) {
if (this->tf_editor.DrawTransferFunctionEditor(false)) {
std::string value;
if (this->tf_editor.GetTransferFunction(value)) {
inout_param.SetValue(value);
}
}
ImGui::Separator();
}
}
| 40.514706 | 120 | 0.561373 | [
"vector"
] |
0e26ef576eab3d23322b39fec48b60d2a91bea65 | 9,531 | cpp | C++ | SDK/Plugin/Block/SidechainMerkleBlock.cpp | hejianhui/Elastos.ELA.SPV.Cpp | 6c3337d091e4cfa9f6dbabaa18526565ccee4e0b | [
"MIT"
] | null | null | null | SDK/Plugin/Block/SidechainMerkleBlock.cpp | hejianhui/Elastos.ELA.SPV.Cpp | 6c3337d091e4cfa9f6dbabaa18526565ccee4e0b | [
"MIT"
] | null | null | null | SDK/Plugin/Block/SidechainMerkleBlock.cpp | hejianhui/Elastos.ELA.SPV.Cpp | 6c3337d091e4cfa9f6dbabaa18526565ccee4e0b | [
"MIT"
] | null | null | null | // Copyright (c) 2012-2018 The Elastos Open Source Project
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <sstream>
#include <Core/BRMerkleBlock.h>
#include <SDK/Common/Log.h>
#include "Utils.h"
#include "MerkleBlock.h"
#include "SidechainMerkleBlock.h"
#define MAX_PROOF_OF_WORK 0xff7fffff // highest value for difficulty target
namespace Elastos {
namespace ElaWallet {
SidechainMerkleBlock::SidechainMerkleBlock() :
_manageRaw(true) {
_merkleBlock = IdMerkleBlockNew();
}
SidechainMerkleBlock::SidechainMerkleBlock(IdMerkleBlock *merkleBlock, bool manageRaw) :
_merkleBlock(merkleBlock),
_manageRaw(manageRaw) {
}
SidechainMerkleBlock::~SidechainMerkleBlock() {
if (_merkleBlock != nullptr && _manageRaw)
IdMerkleBlockFree(_merkleBlock);
}
std::string SidechainMerkleBlock::toString() const {
//todo complete me
return "";
}
BRMerkleBlock *SidechainMerkleBlock::getRaw() const {
return (BRMerkleBlock *)_merkleBlock;
}
IMerkleBlock *SidechainMerkleBlock::CreateMerkleBlock(bool manageRaw) {
return new SidechainMerkleBlock(IdMerkleBlockNew(), manageRaw);
}
IMerkleBlock *SidechainMerkleBlock::CreateFromRaw(BRMerkleBlock *block, bool manageRaw) {
return new SidechainMerkleBlock((IdMerkleBlock *)block, manageRaw);
}
IMerkleBlock *SidechainMerkleBlock::Clone(const BRMerkleBlock *block, bool manageRaw) const {
return new SidechainMerkleBlock(IdMerkleBlockCopy((const IdMerkleBlock *)block), manageRaw);
}
void SidechainMerkleBlock::Serialize(ByteStream &ostream) const {
MerkleBlock::serializeNoAux(ostream, _merkleBlock->raw);
_merkleBlock->idAuxPow.Serialize(ostream);
ostream.put(1);
ostream.put(1);
ostream.writeUint32(_merkleBlock->raw.totalTx);
ostream.writeUint32((uint32_t)_merkleBlock->raw.hashesCount);
for (size_t i = 0; i < _merkleBlock->raw.hashesCount; ++i) {
ostream.writeBytes(_merkleBlock->raw.hashes[i].u8, sizeof(_merkleBlock->raw.hashes[i].u8));
}
ostream.writeVarBytes(_merkleBlock->raw.flags, _merkleBlock->raw.flagsLen);
}
bool SidechainMerkleBlock::Deserialize(ByteStream &istream) {
if (!istream.readUint32(_merkleBlock->raw.version))
return false;
if (!istream.readBytes(_merkleBlock->raw.prevBlock.u8, sizeof(_merkleBlock->raw.prevBlock.u8)))
return false;
if (!istream.readBytes(_merkleBlock->raw.merkleRoot.u8, sizeof(_merkleBlock->raw.merkleRoot.u8)))
return false;
if (!istream.readUint32(_merkleBlock->raw.timestamp))
return false;
if (!istream.readUint32(_merkleBlock->raw.target))
return false;
if (!istream.readUint32(_merkleBlock->raw.nonce))
return false;
if (!istream.readUint32(_merkleBlock->raw.height))
return false;
if (!_merkleBlock->idAuxPow.Deserialize(istream))
return false;
// TODO fix me later
istream.get();
istream.get();
if (!istream.readUint32(_merkleBlock->raw.totalTx))
return false;
uint32_t hashesCount = 0;
if (!istream.readUint32(hashesCount))
return false;
_merkleBlock->raw.hashesCount = hashesCount;
std::vector<UInt256> hashes;
for (size_t i = 0; i < _merkleBlock->raw.hashesCount; ++i) {
UInt256 hash;
if (!istream.readBytes(hash.u8, sizeof(UInt256)))
return false;
hashes.push_back(hash);
}
CMBlock flags;
if (!istream.readVarBytes(flags))
return false;
_merkleBlock->raw.flagsLen = flags.GetSize();
BRMerkleBlockSetTxHashes(&_merkleBlock->raw, hashes.data(), hashesCount, flags, flags.GetSize());
getBlockHash();
return true;
}
nlohmann::json SidechainMerkleBlock::toJson() const {
nlohmann::json j;
if (_merkleBlock == nullptr)
return j;
std::vector<std::string> hashes;
for (int i = 0; i < _merkleBlock->raw.hashesCount; ++i) {
hashes.push_back(Utils::UInt256ToString(_merkleBlock->raw.hashes[i], true));
}
std::vector<uint8_t> flags;
for (int i = 0; i < _merkleBlock->raw.flagsLen; ++i) {
flags.push_back(_merkleBlock->raw.flags[i]);
}
j["BlockHash"] = Utils::UInt256ToString(_merkleBlock->raw.blockHash, true);
j["Version"] = _merkleBlock->raw.version;
j["PrevBlock"] = Utils::UInt256ToString(_merkleBlock->raw.prevBlock, true);
j["MerkleRoot"] = Utils::UInt256ToString(_merkleBlock->raw.merkleRoot, true);
j["Timestamp"] = _merkleBlock->raw.timestamp;
j["Target"] = _merkleBlock->raw.target;
j["Nonce"] = _merkleBlock->raw.nonce;
j["TotalTx"] = _merkleBlock->raw.totalTx;
j["Hashes"] = hashes;
j["Flags"] = flags;
j["Height"] = _merkleBlock->raw.height;
j["IdAuxPow"] = _merkleBlock->idAuxPow.toJson();
return j;
}
void SidechainMerkleBlock::fromJson(const nlohmann::json &j) {
assert(_merkleBlock != nullptr);
if (_merkleBlock == nullptr) {
return;
}
_merkleBlock->raw.blockHash = Utils::UInt256FromString(j["BlockHash"].get<std::string>(), true);
_merkleBlock->raw.version = j["Version"].get<uint32_t>();
_merkleBlock->raw.prevBlock = Utils::UInt256FromString(j["PrevBlock"].get<std::string>(), true);
_merkleBlock->raw.merkleRoot = Utils::UInt256FromString(j["MerkleRoot"].get<std::string>(), true);
_merkleBlock->raw.timestamp = j["Timestamp"].get<uint32_t>();
_merkleBlock->raw.target = j["Target"].get<uint32_t>();
_merkleBlock->raw.nonce = j["Nonce"].get<uint32_t>();
_merkleBlock->raw.totalTx = j["TotalTx"].get<uint32_t>();
if (_merkleBlock->raw.hashes != nullptr) {
free(_merkleBlock->raw.hashes);
_merkleBlock->raw.hashes = nullptr;
}
std::vector<std::string> hashes = j["Hashes"].get<std::vector<std::string>>();
_merkleBlock->raw.hashesCount = hashes.size();
_merkleBlock->raw.hashes = (_merkleBlock->raw.hashesCount > 0) ?
(UInt256 *) malloc(sizeof(UInt256) * _merkleBlock->raw.hashesCount) : nullptr;
for (int i = 0; i < _merkleBlock->raw.hashesCount; ++i) {
UInt256 hash = Utils::UInt256FromString(hashes[i], true);
memcpy(&_merkleBlock->raw.hashes[i], &hash, sizeof(hash));
}
if (_merkleBlock->raw.flags != nullptr) {
free(_merkleBlock->raw.flags);
_merkleBlock->raw.flags = nullptr;
}
std::vector<uint8_t> flags = j["Flags"].get<std::vector<uint8_t>>();
_merkleBlock->raw.flagsLen = flags.size();
_merkleBlock->raw.flags = (_merkleBlock->raw.flagsLen > 0) ?
(uint8_t *) malloc(_merkleBlock->raw.flagsLen) : nullptr;
for (int i = 0; i < _merkleBlock->raw.flagsLen; ++i) {
_merkleBlock->raw.flags[i] = flags[i];
}
_merkleBlock->raw.height = j["Height"].get<uint32_t>();
nlohmann::json auxPowJson = j["IdAuxPow"];
_merkleBlock->idAuxPow.fromJson(auxPowJson);
}
BRMerkleBlock *SidechainMerkleBlock::getRawBlock() const {
return getRaw();
}
void SidechainMerkleBlock::deleteRawBlock() {
if (_merkleBlock)
IdMerkleBlockFree(_merkleBlock);
_merkleBlock = nullptr;
}
void SidechainMerkleBlock::initFromRaw(BRMerkleBlock *block, bool manageRaw) {
if (_merkleBlock) {
IdMerkleBlockFree((IdMerkleBlock *)block);
}
_merkleBlock = (IdMerkleBlock *)block;
_manageRaw = manageRaw;
}
UInt256 SidechainMerkleBlock::getBlockHash() const {
UInt256 zero = UINT256_ZERO;
if (UInt256Eq(&_merkleBlock->raw.blockHash, &zero)) {
ByteStream ostream;
MerkleBlock::serializeNoAux(ostream, _merkleBlock->raw);
UInt256 hash = UINT256_ZERO;
CMBlock buf = ostream.getBuffer();
BRSHA256_2(&hash, buf, buf.GetSize());
UInt256Set(&_merkleBlock->raw.blockHash, hash);
}
return _merkleBlock->raw.blockHash;
}
uint32_t SidechainMerkleBlock::getHeight() const {
return _merkleBlock->raw.height;
}
void SidechainMerkleBlock::setHeight(uint32_t height) {
_merkleBlock->raw.height = height;
}
bool SidechainMerkleBlock::isValid(uint32_t currentTime) const {
// target is in "compact" format, where the most significant byte is the size of resulting value in bytes, the next
// bit is the sign, and the remaining 23bits is the value after having been right shifted by (size - 3)*8 bits
static const uint32_t maxsize = MAX_PROOF_OF_WORK >> 24, maxtarget = MAX_PROOF_OF_WORK & 0x00ffffff;
const uint32_t size = _merkleBlock->raw.target >> 24, target = _merkleBlock->raw.target & 0x00ffffff;
size_t hashIdx = 0, flagIdx = 0;
UInt256 merkleRoot = MerkleBlock::MerkleBlockRootR(&hashIdx, &flagIdx, 0, _merkleBlock->raw), t = UINT256_ZERO;
int r = 1;
// check if merkle root is correct
if (_merkleBlock->raw.totalTx > 0 && ! UInt256Eq(&(merkleRoot), &(_merkleBlock->raw.merkleRoot))) r = 0;
// check if timestamp is too far in future
if (_merkleBlock->raw.timestamp > currentTime + BLOCK_MAX_TIME_DRIFT) r = 0;
// check if proof-of-work target is out of range
if (target == 0 || target & 0x00800000 || size > maxsize || (size == maxsize && target > maxtarget)) r = 0;
if (size > 3) UInt32SetLE(&t.u8[size - 3], target);
else UInt32SetLE(t.u8, target >> (3 - size)*8);
//todo verify block hash
// UInt256 auxBlockHash = _merkleBlock->auxPow.getParBlockHeaderHash();
// for (int i = sizeof(t) - 1; r && i >= 0; i--) { // check proof-of-work
// if (auxBlockHash.u8[i] < t.u8[i]) break;
// if (auxBlockHash.u8[i] > t.u8[i]) r = 0;
// }
return r;
}
std::string SidechainMerkleBlock::getBlockType() const {
return "SideStandard";
}
REGISTER_MERKLEBLOCKPLUGIN(SidechainMerkleBlock);
}
} | 32.865517 | 118 | 0.696359 | [
"vector"
] |
0e279112a6cf75b7a279ff6278895cda3e08e595 | 1,202 | cpp | C++ | leetcode/0438_find_all_anagrams_in_a_string.cpp | jacquerie/leetcode | a05e6b832eb0e0740aaff7b2eb3109038ad404bf | [
"MIT"
] | 3 | 2018-05-10T09:56:49.000Z | 2020-11-07T18:09:42.000Z | leetcode/0438_find_all_anagrams_in_a_string.cpp | jacquerie/leetcode | a05e6b832eb0e0740aaff7b2eb3109038ad404bf | [
"MIT"
] | null | null | null | leetcode/0438_find_all_anagrams_in_a_string.cpp | jacquerie/leetcode | a05e6b832eb0e0740aaff7b2eb3109038ad404bf | [
"MIT"
] | null | null | null | // Copyright (c) 2018 Jacopo Notarstefano
#include <algorithm>
#include <cassert>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> findAnagrams(string s, string p) {
vector<int> result;
if (s.length() < p.length()) {
return result;
}
vector<int> counts(26);
for (auto c : p) {
++counts[c - 'a'];
}
for (int i = 0; i < p.length(); ++i) {
--counts[s[i] - 'a'];
}
for (int i = p.length(); i < s.length(); ++i) {
if (all_of(counts.begin(), counts.end(), [](int count) { return count == 0; })) {
result.emplace_back(i - p.length());
}
--counts[s[i] - 'a'];
++counts[s[i - p.length()] - 'a'];
}
if (all_of(counts.begin(), counts.end(), [](int count) { return count == 0; })) {
result.emplace_back(s.length() - p.length());
}
return result;
}
};
int main() {
auto solution = Solution();
vector<int> expected = {0, 6};
vector<int> result = solution.findAnagrams("cbaebabacd", "abc");
assert(expected == result);
}
| 24.04 | 93 | 0.490849 | [
"vector"
] |
0e2841d6f3d717c8ecdbf8172d12473f6798dd0c | 869 | hpp | C++ | p3iv_types/include/p3iv_types/scene_object.hpp | fzi-forschungszentrum-informatik/P3IV | 51784e6dc03dcaa0ad58a5078475fa4daec774bd | [
"BSD-3-Clause"
] | 4 | 2021-07-27T06:56:22.000Z | 2022-03-22T11:21:30.000Z | p3iv_types/include/p3iv_types/scene_object.hpp | fzi-forschungszentrum-informatik/P3IV | 51784e6dc03dcaa0ad58a5078475fa4daec774bd | [
"BSD-3-Clause"
] | null | null | null | p3iv_types/include/p3iv_types/scene_object.hpp | fzi-forschungszentrum-informatik/P3IV | 51784e6dc03dcaa0ad58a5078475fa4daec774bd | [
"BSD-3-Clause"
] | 1 | 2021-10-10T01:56:44.000Z | 2021-10-10T01:56:44.000Z | #pragma once
#include <memory>
#include "motion_state.hpp"
#include "tracked_object.hpp"
namespace p3iv_types {
class SceneModel;
class RouteOption;
struct SceneObject : TrackedVehicle {
public:
SceneObject(const int id, const double width, const double length);
SceneObject(const int id,
const double width,
const double length,
const MotionState& motionState,
const double progress,
std::vector<int> currentLanelets,
const bool hasRightOfWay);
void setMotionState(const MotionState& motionState);
MotionState state;
double progress;
std::vector<int> currentLanelets;
std::vector<std::shared_ptr<RouteOption>> routeOptions;
std::vector<std::shared_ptr<SceneModel>> routeScenes;
bool hasRightOfWay;
};
} // namespace p3iv_types | 24.138889 | 71 | 0.673188 | [
"vector"
] |
0e2e9f366e785c307aab4f92e60163c8dfc394af | 4,627 | cpp | C++ | xmlcc/xmlccSysUnitFrame.cpp | cscheiblich/XMLCC | efda13ae7261b22304907432d1298a865d14bcdc | [
"MIT"
] | 1 | 2020-02-07T09:12:50.000Z | 2020-02-07T09:12:50.000Z | xmlcc/xmlccSysUnitFrame.cpp | cscheiblich/XMLCC | efda13ae7261b22304907432d1298a865d14bcdc | [
"MIT"
] | null | null | null | xmlcc/xmlccSysUnitFrame.cpp | cscheiblich/XMLCC | efda13ae7261b22304907432d1298a865d14bcdc | [
"MIT"
] | null | null | null | /**
* @file xmlccSysUnitFrame.cpp
* @author Christian (graetz23@gmail.com)
*
* XMLCC is distributed under the MIT License (MIT); this file is part of.
*
* Copyright (c) 2008-2022 Christian (graetz23@gmail.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <cstdlib> // std::exit( 0 )
#include "./xmlccSysUnitFrame.h" // header
/******************************************************************************/
namespace XMLCC {
namespace SYS {
/******************************************************************************/
/// constructor
UnitFrame::UnitFrame( void ) {
_unitTestList = new List< UnitTest* >( 100 );
} // UnitFrame
/// destructor
UnitFrame::~UnitFrame( void ) {
int noOfUnitTests = _unitTestList->size( );
for( int u = 0; u < noOfUnitTests; u++ ) {
UnitTest* unitTest = _unitTestList->get( u );
if( unitTest != 0 )
delete unitTest; // delete objects
} // loop and delete all registered unit tests
delete _unitTestList;
} // ~UnitFrame
/******************************************************************************/
void // register a unit test object
UnitFrame::add( UnitTest* unitTest ) {
if( unitTest != 0 )
_unitTestList->add( unitTest );
} // UnitFrame::add
/******************************************************************************/
void // run all registered unit tests; UnitTest objects
UnitFrame::run( void ) {
UnitTest* unitTest = 0;
try { // run all registered unit tests and tell about console
int noOfUnitTests = _unitTestList->size( );
for( int u = 0; u < noOfUnitTests; u++ ) {
std::cout << "SYS::UnitFrame:: testing => " << std::flush;
unitTest = _unitTestList->get( u );
std::cout << unitTest->tell( ) << " .. " << std::flush;
unitTest->run( ); // inherit unit test method
std::cout << "done!" << std::endl << std::flush;
} // loop and run all registered unit tests
std::cout << std::endl << std::flush;
} catch( Error& e ) {
std::cout << "not passed - caught Error!" << std::endl << std::flush;
std::cout << unitTest->tell( ) << std::endl << std::flush;
std::cout << e.declare( ) << std::endl << std::flush;
std::exit( 0 ); // break down program
} catch( Failure& f ) {
std::cout << "not passed - caught Failure!" << std::endl << std::flush;
std::cout << unitTest->tell( ) << std::endl << std::flush;
std::cout << f.declare( ) << std::endl << std::flush;
std::exit( 0 ); // break down program
} catch( Exception& e ) {
std::cout << "not passed - caught Exception!" << std::endl << std::flush;
std::cout << unitTest->tell( ) << std::endl << std::flush;
std::cout << e.declare( ) << std::endl << std::flush;
std::exit( 0 ); // break down program
} catch( std::exception& e ) { // standard exception class
std::cout << "not passed - caught std:exception!" << std::endl
<< std::flush;
std::cout << unitTest->tell( ) << " == " << std::endl << std::flush;
std::cout << e.what( ) << std::endl << std::flush;
std::exit( 0 ); // break down program
} catch( ... ) { // any other exception thrown
std::cout << "not passed - caught unknown exception!" << std::endl
<< std::flush;
std::cout << "SYS::UnitFrame - unknown exception caught:" << std::endl
<< std::flush;
std::exit( 0 ); // break down program
} // try
} // UnitFrame::run
/******************************************************************************/
} // namespace SYS
} // namespace XMLCC
/******************************************************************************/
| 35.592308 | 80 | 0.571429 | [
"object"
] |
0e2fea906c007a26ebba143d7eeb5f6398dc4d67 | 9,348 | hpp | C++ | applications/PfemFluidDynamicsApplication/custom_processes/free_scalar_pfem_dof_process.hpp | lkusch/Kratos | e8072d8e24ab6f312765185b19d439f01ab7b27b | [
"BSD-4-Clause"
] | 778 | 2017-01-27T16:29:17.000Z | 2022-03-30T03:01:51.000Z | applications/PfemFluidDynamicsApplication/custom_processes/free_scalar_pfem_dof_process.hpp | lkusch/Kratos | e8072d8e24ab6f312765185b19d439f01ab7b27b | [
"BSD-4-Clause"
] | 6,634 | 2017-01-15T22:56:13.000Z | 2022-03-31T15:03:36.000Z | applications/PfemFluidDynamicsApplication/custom_processes/free_scalar_pfem_dof_process.hpp | lkusch/Kratos | e8072d8e24ab6f312765185b19d439f01ab7b27b | [
"BSD-4-Clause"
] | 224 | 2017-02-07T14:12:49.000Z | 2022-03-06T23:09:34.000Z | //
// Project Name: KratosPfemFluidDynamicsApplication $
// Created by: $Author: JMCarbonell $
// Last modified by: $Co-Author: $
// Date: $Date: August 2016 $
// Revision: $Revision: 0.0 $
//
//
#if !defined(KRATOS_FREE_SCALAR_PFEM_DOF_PROCESS_H_INCLUDED)
#define KRATOS_FREE_SCALAR_PFEM_DOF_PROCESS_H_INCLUDED
// System includes
// External includes
// Project includes
#include "includes/model_part.h"
#include "includes/kratos_parameters.h"
#include "processes/process.h"
namespace Kratos
{
///@name Kratos Classes
///@{
/// The base class for freeing scalar variable Dof or array_1d component Dof processes in Kratos.
/** This function free the variable dof belonging to all of the nodes in a given mesh
*/
class FreeScalarPfemDofProcess : public Process
{
public:
///@name Type Definitions
///@{
/// Pointer definition of FreeScalarPfemDofProcess
KRATOS_CLASS_POINTER_DEFINITION(FreeScalarPfemDofProcess);
///@}
///@name Life Cycle
///@{
FreeScalarPfemDofProcess(ModelPart &model_part,
Parameters rParameters) : Process(), mrModelPart(model_part)
{
KRATOS_TRY
Parameters default_parameters(R"(
{
"model_part_name":"PLEASE_CHOOSE_MODEL_PART_NAME",
"variable_name": "PLEASE_PRESCRIBE_VARIABLE_NAME"
} )");
// Validate against defaults -- this ensures no type mismatch
rParameters.ValidateAndAssignDefaults(default_parameters);
mvariable_name = rParameters["variable_name"].GetString();
if (KratosComponents<Variable<double>>::Has(mvariable_name)) //case of double variable
{
if (model_part.GetNodalSolutionStepVariablesList().Has(KratosComponents<Variable<double>>::Get(mvariable_name)) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "trying to set a variable that is not in the model_part - variable name is ", mvariable_name);
}
}
else if (KratosComponents<Variable<int>>::Has(mvariable_name)) //case of int variable
{
if (model_part.GetNodalSolutionStepVariablesList().Has(KratosComponents<Variable<int>>::Get(mvariable_name)) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "trying to set a variable that is not in the model_part - variable name is ", mvariable_name);
}
}
else if (KratosComponents<Variable<bool>>::Has(mvariable_name)) //case of bool variable
{
if (model_part.GetNodalSolutionStepVariablesList().Has(KratosComponents<Variable<bool>>::Get(mvariable_name)) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "trying to set a variable that is not in the model_part - variable name is ", mvariable_name);
}
}
KRATOS_CATCH("");
}
FreeScalarPfemDofProcess(ModelPart &model_part,
const Variable<double> &rVariable) : Process(), mrModelPart(model_part)
{
KRATOS_TRY;
if (model_part.GetNodalSolutionStepVariablesList().Has(rVariable) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "trying to set a variable that is not in the model_part - variable name is ", rVariable);
}
mvariable_name = rVariable.Name();
KRATOS_CATCH("");
}
FreeScalarPfemDofProcess(ModelPart &model_part,
const Variable<int> &rVariable) : Process(), mrModelPart(model_part)
{
KRATOS_TRY;
if (model_part.GetNodalSolutionStepVariablesList().Has(rVariable) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "Trying to set a variable that is not in the model_part - variable name is ", rVariable);
}
mvariable_name = rVariable.Name();
KRATOS_CATCH("");
}
FreeScalarPfemDofProcess(ModelPart &model_part,
const Variable<bool> &rVariable) : Process(), mrModelPart(model_part)
{
KRATOS_TRY;
if (model_part.GetNodalSolutionStepVariablesList().Has(rVariable) == false)
{
KRATOS_THROW_ERROR(std::runtime_error, "Trying to set a variable that is not in the model_part - variable name is ", rVariable);
}
mvariable_name = rVariable.Name();
KRATOS_CATCH("");
}
/// Destructor.
~FreeScalarPfemDofProcess() override {}
///@}
///@name Operators
///@{
/// This operator is provided to call the process as a function and simply calls the Execute method.
void operator()()
{
Execute();
}
///@}
///@name Operations
///@{
/// Execute method is used to execute the FreeScalarPfemDofProcess algorithms.
void Execute() override
{
KRATOS_TRY;
if (KratosComponents<Variable<double>>::Has(mvariable_name)) //case of double variable
{
InternalFreeDof<>(KratosComponents<Variable<double>>::Get(mvariable_name));
}
else
{
KRATOS_THROW_ERROR(std::logic_error, "Not able to set the variable. Attempting to set variable:", mvariable_name);
}
KRATOS_CATCH("");
}
/// this function is designed for being called at the beginning of the computations
/// right after reading the model and the groups
void ExecuteInitialize() override
{
}
/// this function is designed for being execute once before the solution loop but after all of the
/// solvers where built
void ExecuteBeforeSolutionLoop() override
{
}
/// this function will be executed at every time step BEFORE performing the solve phase
void ExecuteInitializeSolutionStep() override
{
}
/// this function will be executed at every time step AFTER performing the solve phase
void ExecuteFinalizeSolutionStep() override
{
}
/// this function will be executed at every time step BEFORE writing the output
void ExecuteBeforeOutputStep() override
{
}
/// this function will be executed at every time step AFTER writing the output
void ExecuteAfterOutputStep() override
{
}
/// this function is designed for being called at the end of the computations
/// right after reading the model and the groups
void ExecuteFinalize() override
{
}
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
/// Turn back information as a string.
std::string Info() const override
{
return "FreeScalarPfemDofProcess";
}
/// Print information about this object.
void PrintInfo(std::ostream &rOStream) const override
{
rOStream << "FreeScalarPfemDofProcess";
}
/// Print object's data.
void PrintData(std::ostream &rOStream) const override
{
}
///@}
///@name Friends
///@{
///@}
protected:
///@name Protected static Member Variables
///@{
///@}
///@name Protected member Variables
///@{
///@}
///@name Protected Operators
///@{
/// Copy constructor.
FreeScalarPfemDofProcess(FreeScalarPfemDofProcess const &rOther);
///@}
///@name Protected Operations
///@{
///@}
///@name Protected Access
///@{
///@}
///@name Protected Inquiry
///@{
///@}
///@name Protected LifeCycle
///@{
///@}
private:
///@name Static Member Variables
///@{
///@}
///@name Member Variables
///@{
ModelPart &mrModelPart;
std::string mvariable_name;
///@}
///@name Private Operators
///@{
template <class TVarType>
void InternalFreeDof(TVarType &rVar)
{
const int nnodes = mrModelPart.GetMesh().Nodes().size();
if (nnodes != 0)
{
ModelPart::NodesContainerType::iterator it_begin = mrModelPart.NodesBegin();
#pragma omp parallel for
for (int i = 0; i < nnodes; i++)
{
ModelPart::NodesContainerType::iterator it = it_begin + i;
//it->pAddDof(rVar)->FreeDof();
it->Free(rVar);
}
}
}
///@}
///@name Private Operations
///@{
///@}
///@name Private Access
///@{
/// Assignment operator.
FreeScalarPfemDofProcess &operator=(FreeScalarPfemDofProcess const &rOther);
///@}
///@name Serialization
///@{
///@name Private Inquiry
///@{
///@}
///@name Un accessible methods
///@{
///@}
}; // Class FreeScalarPfemDofProcess
///@}
///@name Type Definitions
///@{
///@}
///@name Input and output
///@{
/// input stream function
inline std::istream &operator>>(std::istream &rIStream,
FreeScalarPfemDofProcess &rThis);
/// output stream function
inline std::ostream &operator<<(std::ostream &rOStream,
const FreeScalarPfemDofProcess &rThis)
{
rThis.PrintInfo(rOStream);
rOStream << std::endl;
rThis.PrintData(rOStream);
return rOStream;
}
///@}
} // namespace Kratos.
#endif // KRATOS_FREE_SCALAR_PFEM_DOF_PROCESS_H_INCLUDED defined
| 27.017341 | 149 | 0.60644 | [
"mesh",
"object",
"model"
] |
0e314b6de2076cc29f22014ff93ace9be40fa994 | 111,724 | cxx | C++ | PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRevEA.cxx | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | 1 | 2022-03-11T20:14:11.000Z | 2022-03-11T20:14:11.000Z | PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRevEA.cxx | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | null | null | null | PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRevEA.cxx | maroozm/AliPhysics | 22ec256928cfdf8f800e05bfc1a6e124d90b6eaf | [
"BSD-3-Clause"
] | 1 | 2022-03-11T20:14:12.000Z | 2022-03-11T20:14:12.000Z | #ifndef ALIANALYSISTASKSE_H
#include <Riostream.h>
#include <TROOT.h>
#include <TChain.h>
#include <TTree.h>
#include <TKey.h>
#include <TProfile.h>
#include <TProfile2D.h>
#include <TH1.h>
#include <TH1F.h>
#include <TF1.h>
#include <TH2F.h>
#include <TH1D.h>
#include <TH2D.h>
#include <TH3D.h>
#include <TH1I.h>
#include <TArrayF.h>
#include <TArrayD.h>
#include <TVector2.h>
#include <THnSparse.h>
#include <TCanvas.h>
#include <TList.h>
#include <TClonesArray.h>
#include <TObject.h>
#include <TMath.h>
#include <TSystem.h>
#include <TInterpreter.h>
#include "AliAnalysisTask.h"
#include "AliCentrality.h"
#include "AliStack.h"
#include "AliESDEvent.h"
#include "AliESDInputHandler.h"
#include "AliAODEvent.h"
#include "AliAODHandler.h"
#include "AliAnalysisManager.h"
#include "AliAnalysisTaskSE.h"
#include "AliAnalysisHelperJetTasks.h"
#include "AliParticleContainer.h"
#include "AliInputEventHandler.h"
#include "AliEMCALGeometry.h"
#include "AliEMCALGeoParams.h"
#endif
#include <string>
#include <time.h>
#include <TRandom3.h>
#include "AliGenEventHeader.h"
#include "AliGenPythiaEventHeader.h"
#include "AliGenHijingEventHeader.h"
#include "AliAODMCHeader.h"
#include "AliMCEvent.h"
#include "AliLog.h"
#include <AliEmcalJet.h>
#include <AliPicoTrack.h>
#include "AliVEventHandler.h"
#include "AliVParticle.h"
#include "AliAODMCParticle.h"
#include "AliAnalysisUtils.h"
#include "AliRhoParameter.h"
#include "TVector3.h"
#include "AliVVertex.h"
#include "AliExternalTrackParam.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "AliGenDPMjetEventHeader.h"
#include "AliJetContainer.h"
#include "AliAnalysisTaskEmcal.h"
#include "AliAnalysisTaskEmcalJet.h"
#include "AliAnalysisTaskRevEA.h"
#include "AliHeader.h"
#include "AliRunLoader.h"
#include "AliVVZERO.h"
#include "AliAODZDC.h"
#include "AliVZDC.h"
#include "AliMultSelection.h"
//#include "AliEmcalDownscaleFactorsOCDB.h"
//#include "AliEmcalAnalysisFactory.h"
ClassImp(PWGJE::EMCALJetTasks::AliAnalysisTaskRevEA)
using namespace PWGJE::EMCALJetTasks;
using namespace std;
// ANALYSIS OF HIGH PT HADRON TRIGGER ASSOCIATED SPECTRUM OF RECOIL JETS IN PP 13 TeV
// Author Filip Krizek (8.Aug. 2019)
//________________________________________________________________________________________
AliAnalysisTaskRevEA::AliAnalysisTaskRevEA():
AliAnalysisTaskEmcalJet("AliAnalysisTaskRevEA", kTRUE),
fUseDefaultVertexCut(1),
fUsePileUpCut(1),
fMyTrackContainerName(""),
fMyParticleContainerName(""),
fMyDetLevelContainerName(""),
fMyJetContainerName(""),
fMyJetParticleContainerName(""),
fMyKTJetContainerName(""),
fMyKTJetParticleContainerName(""),
fTrkContainerDetLevel(0x0),
fParticleContainerPartLevel(0x0),
fJetContainerDetLevel(0x0),
fJetContainerPartLevel(0x0),
fKTJetContainerDetLevel(0x0),
fKTJetContainerPartLevel(0x0),
fMultSelection(0x0),
fIsMinBiasTrig(0),
fIsHighMultTrig(0),
fCentralityV0M(-1),
fMultV0Mnorm(0.),
fTrackEtaWindow(0.9),
fMinTrackPt(0.150),
fHelperClass(0),
fInitializedLocal(0),
fHistEvtSelection(0x0),
fhVertexZall(0x0),
fhVertexZ(0x0),
fhRhoMBpart(0x0),
fhJetPtPartLevelCorr(0x0),
fhJetPtPartLevelZero(0x0),
fhJetPtPartLevelVsJetPtDetLevelCorr(0x0), //1D unfolding
fhJetPtZeroPartLevelVsJetPtZeroDetLevel(0x0), //1D unfolding
fhJetPtZeroPartLevel_Vs_JetPtDetLevelCorr(0x0), //1D unfolding (added by KA)
fhPhi_JetPtPartLevel_InclusiveJets(0x0), //2D unfolding
fhPhi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets(0x0), //2D unfolding
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhJetPtResolutionVsPtPartLevel(0x0),
fZVertexCut(10.0),
fnHadronTTBins(0),
fMode(AliAnalysisTaskRevEA::kNormal),
fFillSigTT(1),
fPhiCut(TMath::Pi()-0.6),
fRandom(0),
fJetR(0.4),
fJetAcut(0.),
fRho(0.),
fRhoMC(0.),
fMaxFacPtHard(0)
{
//default constructor
//1D respnse matrix from recoil jets //FF
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
fhRecoilJetPtPartLevelCorr[itt] = NULL;
fhRecoilJetPtZeroPartLevel[itt] = NULL;
fhRecoilJetPtPartLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtPartLevelVsJetPtDetLevelCorr[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtDetLevelCorr[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevelCorr[itt] = NULL; // Modified by KA
fhRecoilJetPtPartLevelVsJetPtDetLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtDetLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_CorrespTT[itt] = NULL; // Modified by KA
}
//2D unfolding
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
fhDeltaPhi_JetPtPartLevel[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZero_PartLevel[itt] = NULL; //2D unfolding (added by KA)
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = NULL; //2D unfolding (added by KA)
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = NULL; //2D unfolding (added by KA)
}
for(Int_t iq = 0; iq < 4; ++iq){
fArray_for_filling[iq] = 0.;
}
/////////////////
for(Int_t itg=kMB; itg<=kHM; itg++){
fhTrackPhiIncl[itg]=0x0;
fhTrackEtaIncl[itg]=0x0;
fhJetPhiIncl[itg]=0x0;
fhJetEtaIncl[itg]=0x0;
fhRho[itg] = 0x0;
for(Int_t i=0; i<fkTTbins; i++){
fhRhoTTH[itg][i]=0x0;
}
}
for(Int_t i=0; i<fkTTbins; i++){
fHadronTT_Labels[i].resize(0); //Modified by KA
//TT
for(Int_t itg=kMB; itg<=kHM; itg++){
fhMultTTH[itg][i] = 0x0;
fhTTH_V0Mnorm[itg][i] = 0x0;
}
fhTTH_V0Mnorm_PartLevel[i] = 0x0;
fhTT_Corresp[i] = 0x0; //KA
//RECOIL JET SPECTRA
for(Int_t itg=kMB; itg<=kHM; itg++){
fhRecoilJetPtTTH_V0Mnorm[itg][i] = 0x0;
fhRecoilJetPhiTTH_V0Mnorm[itg][i] = 0x0;
}
fhRecoilJetPtTTH_V0Mnorm_PartLevel[i] = 0x0;
fhRecoilJetPtZero_TTH_V0Mnorm_PartLevel[i] = NULL; //added by KA
fhRecoilJetPhiTTH_V0Mnorm_PartLevel[i] = 0x0;
fhRecoilJetPtZero_DeltaPhi_TTH_V0Mnorm_PartLevel[i] = NULL; //added by KA
for(Int_t itg=kMB; itg<=kHM; itg++){
fhDeltaPtTTH_RC_V0Mnorm[itg][i] = 0x0;
}
}
for(Int_t i=0; i<fkTTbins;i++){
fHadronTTLowPt[i]=-1;
fHadronTTHighPt[i]=-1;
}
for(Int_t itg=kMB; itg<=kHM; itg++){
fhCentrality[itg]= 0x0;
for(Int_t ic=0; ic<fkCE;ic++){
fhSignal[itg][ic] = 0x0;
for(Int_t i=0; i<fkTTbins;i++){
fhSignalTTH[itg][ic][i] = 0x0;
}
}
}
//particle level
for(Int_t ic=0; ic<fkCE;ic++){
fhSignal_PartLevel[ic] = 0x0;
for(Int_t i=0; i<fkTTbins;i++){
fhSignalTTH_PartLevel[ic][i] = 0x0;
}
}
for(Int_t i=0; i<fkTTbins;i++){
fhRhoTTHinMBpart[i]=0x0;
}
for(Int_t i=0; i<fkTTbins; i++){
fIndexTTH[i] = -1;
fIndexTTH_PartLevel[i] = -1;
fTTH[i].resize(0);
fTTH_PartLevel[i].resize(0);
fdeltapT[i] = 0.;
}
for(Int_t i=0; i<999; i++){
frhovec[i] = 0.;
}
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
for(Int_t itg=kMB; itg<=kHM; itg++){
fhNumberOfHighPtJetsRecoil[itg][itt] = NULL;
}
fhRecoilJetPtEvtByEvent[itt] = NULL;
fhNumberOfHighPtJetsRecoilPartLevel[itt] = NULL;
fhRecoilJetPtEvtByEventPartLevel[itt] = NULL;
}
}
//________________________________________________________________________
AliAnalysisTaskRevEA::AliAnalysisTaskRevEA(const char *name):
AliAnalysisTaskEmcalJet(name,kTRUE),
fUseDefaultVertexCut(1),
fUsePileUpCut(1),
fMyTrackContainerName(""),
fMyParticleContainerName(""),
fMyDetLevelContainerName(""),
fMyJetContainerName(""),
fMyJetParticleContainerName(""),
fMyKTJetContainerName(""),
fMyKTJetParticleContainerName(""),
fTrkContainerDetLevel(0x0),
fParticleContainerPartLevel(0x0),
fJetContainerDetLevel(0x0),
fJetContainerPartLevel(0x0),
fKTJetContainerDetLevel(0x0),
fKTJetContainerPartLevel(0x0),
fMultSelection(0x0),
fIsMinBiasTrig(0),
fIsHighMultTrig(0),
fCentralityV0M(-1),
fMultV0Mnorm(0.),
fTrackEtaWindow(0.9),
fMinTrackPt(0.150),
fHelperClass(0),
fInitializedLocal(0),
fHistEvtSelection(0x0),
fhVertexZall(0x0),
fhVertexZ(0x0),
fhRhoMBpart(0x0),
fhJetPtPartLevelCorr(0x0),
fhJetPtPartLevelZero(0x0),
fhJetPtPartLevelVsJetPtDetLevelCorr(0x0), //1D unfolding
fhJetPtZeroPartLevelVsJetPtZeroDetLevel(0x0), //1D unfolding
fhJetPtZeroPartLevel_Vs_JetPtDetLevelCorr(0x0), //1D unfolding (added by KA)
fhPhi_JetPtPartLevel_InclusiveJets(0x0), //2D unfolding
fhPhi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets(0x0), //2D unfolding
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets(0x0), //2D unfolding (added by KA)
fhJetPtResolutionVsPtPartLevel(0x0),
fZVertexCut(10.0),
fnHadronTTBins(0),
fMode(AliAnalysisTaskRevEA::kNormal),
fFillSigTT(1),
fPhiCut(TMath::Pi()-0.6),
fRandom(0),
fJetR(0.4),
fJetAcut(0.),
fRho(0.),
fRhoMC(0.),
fMaxFacPtHard(0)
{
//Constructor
//1D respnse matrix from recoil jets //FF
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
fhRecoilJetPtPartLevelCorr[itt] = NULL;
fhRecoilJetPtZeroPartLevel[itt] = NULL;
fhRecoilJetPtPartLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtPartLevelVsJetPtDetLevelCorr[itt] = NULL;
fhRecoilJetPtZeroPartLevelVsJetPtDetLevelCorr[itt] = NULL;
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevelCorr[itt] = NULL;
fhRecoilJetPtPartLevelVsJetPtDetLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtDetLevel_CorrespTT[itt] = NULL; // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_CorrespTT[itt] = NULL; // Modified by KA
}
//2D unfolding
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
fhDeltaPhi_JetPtPartLevel[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZero_PartLevel[itt] = NULL; //2D unfolding (added by KA)
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = NULL; //2D unfolding
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = NULL; //2D unfolding (added by KA)
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = NULL; //2D unfolding (added by KA)
}
for(Int_t iq = 0; iq < 4; ++iq){
fArray_for_filling[iq] = 0.;
}
/////////////////
for(Int_t itg=kMB; itg<=kHM; itg++){
fhTrackPhiIncl[itg]=0x0;
fhTrackEtaIncl[itg]=0x0;
fhJetPhiIncl[itg]=0x0;
fhJetEtaIncl[itg]=0x0;
fhRho[itg] = 0x0;
for(Int_t i=0; i<fkTTbins; i++){
fhRhoTTH[itg][i]=0x0;
}
}
for(Int_t i=0; i<fkTTbins; i++){
fHadronTT_Labels[i].resize(0); // Modified by KA
fHadronTT_Labels_PartLevel[i].resize(0); // Modified by KA
//TT
for(Int_t itg=kMB; itg<=kHM; itg++){
fhMultTTH[itg][i] = 0x0;
fhTTH_V0Mnorm[itg][i] = 0x0;
}
fhTTH_V0Mnorm_PartLevel[i] = 0x0;
fhTT_Corresp[i] = 0x0; //KA
//RECOIL JET SPECTRA
for(Int_t itg=kMB; itg<=kHM; itg++){
fhRecoilJetPtTTH_V0Mnorm[itg][i] = 0x0;
fhRecoilJetPhiTTH_V0Mnorm[itg][i] = 0x0;
}
fhRecoilJetPtTTH_V0Mnorm_PartLevel[i] = 0x0;
fhRecoilJetPtZero_TTH_V0Mnorm_PartLevel[i] = NULL; //added by KA
fhRecoilJetPhiTTH_V0Mnorm_PartLevel[i] = 0x0;
fhRecoilJetPtZero_DeltaPhi_TTH_V0Mnorm_PartLevel[i] = NULL; //added by KA
for(Int_t itg=kMB; itg<=kHM; itg++){
fhDeltaPtTTH_RC_V0Mnorm[itg][i] = 0x0;
}
}
for(Int_t i=0; i<fkTTbins;i++){
fHadronTTLowPt[i]=-1;
fHadronTTHighPt[i]=-1;
}
for(Int_t itg=kMB; itg<=kHM; itg++){
fhCentrality[itg] = 0x0;
for(Int_t ic=0; ic<fkCE;ic++){
fhSignal[itg][ic] = 0x0;
for(Int_t i=0; i<fkTTbins;i++){
fhSignalTTH[itg][ic][i] = 0x0;
}
}
}
//particle level
for(Int_t ic=0; ic<fkCE;ic++){
fhSignal_PartLevel[ic] = 0x0;
for(Int_t i=0; i<fkTTbins;i++){
fhSignalTTH_PartLevel[ic][i] = 0x0;
}
}
for(Int_t i=0; i<fkTTbins;i++){
fhRhoTTHinMBpart[i]=0x0;
}
for(Int_t i=0; i<fkTTbins; i++){
fIndexTTH[i] = -1;
fIndexTTH_PartLevel[i] = -1;
fTTH[i].resize(0);
fTTH_PartLevel[i].resize(0);
fdeltapT[i] = 0.;
}
for(Int_t i=0; i<999; i++){
frhovec[i] = 0.;
}
//JET AND TRACK PT ASYMMETRY
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
for(Int_t itg=kMB; itg<=kHM; itg++){
fhNumberOfHighPtJetsRecoil[itg][itt] = NULL;
}
fhRecoilJetPtEvtByEvent[itt] = NULL;
fhNumberOfHighPtJetsRecoilPartLevel[itt] = NULL;
fhRecoilJetPtEvtByEventPartLevel[itt] = NULL;
}
DefineOutput(1, TList::Class());
}
/**
* This function adds the task to the analysis manager. Often, this function is called
* by an AddTask C macro. However, by compiling the code, it ensures that we do not
* have to deal with difficulties caused by CINT.
*/
//_____________________________________________________________________________________
AliAnalysisTaskRevEA* AliAnalysisTaskRevEA::AddTaskRevEA(
Int_t mode,
const char* jetarrayname,
const char* jetarraynamePartMC,
const char* trackarrayname,
const char* mcpariclearraynamePartMC,
const char* ktjetarrayname,
const char* ktjetarraynamePartMC,
Double_t jetRadius,
UInt_t trigger,
Double_t trackEtaWindow,
Bool_t useVertexCut,
Bool_t usePileUpCut,
Double_t acut,
const char* suffix
){
// Get the pointer to the existing analysis manager via the static access method.
//==============================================================================
Double_t jetEtaRange = TMath::Abs(trackEtaWindow - jetRadius);
Double_t jetRadiuskt = 0.4; //for all kt jets use fixed jet radius
Double_t jetEtaRangekt = TMath::Abs(trackEtaWindow - jetRadiuskt);
// #### DEFINE MANAGER AND DATA CONTAINER NAMES
AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
if(!manager){
::Error("AliAnalysisTaskRevEA.cxx", "No analysis manager to connect to.");
return NULL;
}
//__________________________________________________________________________________
// #### DEFINE MY ANALYSIS TASK
TString myContName("");
myContName = Form("JetAnalysisR%02d_Acut%02d", TMath::Nint(jetRadius*10), TMath::Nint(acut*10));
myContName.Append(suffix);
AliAnalysisTaskRevEA *task = new AliAnalysisTaskRevEA(myContName.Data());
if(mode == AliAnalysisTaskRevEA::kMC){
//for PYTHIA
task->SetIsPythia(kTRUE); //NECESSARY IN ORDER TO FILL XSEC AND TRIALS
task->SetMakeGeneralHistograms(kTRUE); //NECESSARY IN ORDER TO FILL XSEC AND TRIALS
}
//inspired by AliAnalysisTaskEmcalQGTagging
//_____________________________________________
//TRACK/PARTICLE CONTAINTERS
AliTrackContainer *trackCont = 0x0; // detector level track container (or tracks in combined events when embedding )
AliParticleContainer *trackContTrue = 0x0; //mc particle container on particle level for jets
AliTrackContainer *trackContDet = 0x0; //mc particle container on detector level for jets (for embedding)
trackCont = task->AddTrackContainer(trackarrayname); //detector level tracks (or combined tracks if embedding)
trackCont->SetMinPt(0.15);
trackCont->SetEtaLimits(-trackEtaWindow, trackEtaWindow);
if(mode == AliAnalysisTaskRevEA::kMC){
trackContTrue = task->AddMCParticleContainer(mcpariclearraynamePartMC); //particle level MC particles
trackContTrue->SetClassName("AliAODMCParticle");
trackContTrue->SetMinPt(1e-3); // KA: old value was 0.15 GeV/c
trackContTrue->SetEtaLimits(-5.1,5.1); //V0 eta range
}
//_____________________________________________
//JET CONTAINERS
AliJetContainer *jetContRec = 0x0; //AKT jet container with detector level tracks or combined event jets after embedding
AliJetContainer *jetContTrue = 0x0; //AKT jet container with mc particle level jets pythia
AliJetContainer *jetContRecKT = 0x0; //KT jet container with detector level tracks or combined event jets after embedding
AliJetContainer *jetContTrueKT = 0x0; //KT jet container with mc particle level jets pythia
//AKT DETECTOR LEVEL JET (or combined event jet container when embedding)
jetContRec = task->AddJetContainer(jetarrayname,"TPC",jetRadius);
if(jetContRec){
jetContRec->ConnectParticleContainer(trackCont);
jetContRec->SetPercAreaCut(acut);
jetContRec->SetMinPt(0.150);
jetContRec->SetMaxTrackPt(100.0);
jetContRec->SetJetAcceptanceType(AliEmcalJet::kUser);
jetContRec->SetJetEtaLimits(-jetEtaRange,jetEtaRange);
}
//KT DETECTOR LEVEL JET (or combined event jet container when embedding)
jetContRecKT = task->AddJetContainer(ktjetarrayname,"TPC",jetRadiuskt);
if(jetContRecKT){
jetContRecKT->ConnectParticleContainer(trackCont);
jetContRecKT->SetMinPt(0.);
jetContRecKT->SetMaxTrackPt(100.0);
jetContRecKT->SetJetAcceptanceType(AliEmcalJet::kUser);
jetContRecKT->SetJetEtaLimits(-jetEtaRangekt,jetEtaRangekt);
}
if(mode == AliAnalysisTaskRevEA::kMC){
//AKT JETS PARTICLE LEVEL
jetContTrue = task->AddJetContainer(jetarraynamePartMC,"TPC",jetRadius);
if(jetContTrue){
jetContTrue->ConnectParticleContainer(trackContTrue);
jetContTrue->SetPercAreaCut(acut);
jetContTrue->SetMinPt(1e-3); // KA: old value is 0.15 GeV/c
jetContTrue->SetMaxTrackPt(1000.0); // added by K.A.
jetContTrue->SetJetAcceptanceType(AliEmcalJet::kUser);
jetContTrue->SetJetEtaLimits(-jetEtaRange,jetEtaRange);
}
//KT JETS PARTICLE LEVEL
jetContTrueKT = task->AddJetContainer(ktjetarraynamePartMC,"TPC",jetRadiuskt);
if(jetContTrueKT){
jetContTrueKT->ConnectParticleContainer(trackContTrue);
jetContTrueKT->SetMinPt(0.);
jetContTrueKT->SetMaxTrackPt(1000.0);
jetContTrueKT->SetJetAcceptanceType(AliEmcalJet::kUser);
jetContTrueKT->SetJetEtaLimits(-jetEtaRangekt,jetEtaRangekt);
}
}
// #### Task configuration
task->SetUsePileUpCut(usePileUpCut);
task->SetUseDefaultVertexCut(useVertexCut);
task->SetAcceptanceWindows(trackEtaWindow);
task->SelectCollisionCandidates(trigger);
task->SetMode(mode);
task->SetTrackContainerName(trackarrayname);
task->SetMCParticleContainerName(mcpariclearraynamePartMC);
task->SetJetContainerName(jetarrayname);
task->SetMCPartJetContainerName(jetarraynamePartMC);
task->SetKTJetContainerName(ktjetarrayname);
task->SetKTMCPartJetContainerName(ktjetarraynamePartMC);
task->SetJetRadius(jetRadius);
task->SetJetAcut(acut);
task->SetUseNewCentralityEstimation(kTRUE); //CENTRALITY
task->SetDebugLevel(0); //No debug messages 0
// output container
AliAnalysisDataContainer *contHistos = manager->CreateContainer(myContName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer, Form("%s:ChJetSpectra%s", AliAnalysisManager::GetCommonFileName(), myContName.Data()));
// #### ADD ANALYSIS TASK
manager->AddTask(task);
manager->ConnectInput(task, 0, manager->GetCommonInputContainer());
manager->ConnectOutput(task, 1, contHistos);
return task;
}
//_____________________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::PassedMinBiasTrigger(){
//minimum bias trigger
bool passedTrigger = kFALSE;
if(fMode == AliAnalysisTaskRevEA::kMC){
//mc simulation emulate V0 coincidence trigger
passedTrigger = kTRUE;
}else{
//real data and embedding take trigger decission from data
UInt_t triggerMask = fInputHandler->IsEventSelected();
if(triggerMask & AliVEvent::kINT7){
passedTrigger = kTRUE;
}
}
return passedTrigger;
}
//_____________________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::PassedHighMultTrigger(){
//high multiplicity V0M trigger
if(fMode == AliAnalysisTaskRevEA::kMC) return kFALSE; //MC
bool passedTrigger = kFALSE;
UInt_t triggerMask = fInputHandler->IsEventSelected();
if(triggerMask & AliVEvent::kHighMultV0){
passedTrigger = kTRUE;
}
return passedTrigger;
}
//_____________________________________________________________________________________
Double_t AliAnalysisTaskRevEA::GetMyRho(AliJetContainer* ktjets){
// Get rho from event
Double_t myrho = 0.;
Double_t ptLJ=-1;
Double_t ptSJ=-1;
AliEmcalJet* jetLJ = 0x0;
AliEmcalJet* jetSJ = 0x0;
AliEmcalJet* jet = 0x0;
//Exclude 2 leading jets
for(auto jetIterator : ktjets->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
if(jet->Pt() > ptLJ){
ptSJ = ptLJ;
jetSJ = jetLJ;
ptLJ = jet->Pt();
jetLJ = jet;
}else if(jet->Pt() > ptSJ){
ptSJ = jet->Pt();
jetSJ = jet;
}
}
Int_t nJetAcckt = 0;
for(auto jetIterator : ktjets->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
if(jet==jetLJ) continue; //skip two leading kT jets
if(jet==jetSJ) continue;
//standard area based approach
if(jet->Area() > 0.2){
frhovec[nJetAcckt] = jet->Pt()/jet->Area();
nJetAcckt++;
}
}
if(nJetAcckt>0){
myrho = TMath::Median(nJetAcckt, frhovec);
}
return myrho;
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::IsEventInAcceptance(AliVEvent* event){
//EVENT SELECTION RECONSTRUCTED DATA
if(!event) return kFALSE;
//incomplete DAQ events rejection Run2 data 2015
// https://twiki.cern.ch/twiki/bin/view/ALICE/PWGPPEvSelRun2pp
Bool_t bIncompleteDAQ = event->IsIncompleteDAQ();
if(bIncompleteDAQ){
fHistEvtSelection->Fill(1.5); // count events with incomplete DAQ
return kFALSE;
}
//___________________________________________________
//TEST PILE UP
if(fUsePileUpCut){
if(!fHelperClass || fHelperClass->IsPileUpEvent(event)){
fHistEvtSelection->Fill(2.5); //count events rejected by pileup
return kFALSE;
}
if(!fHelperClass || fHelperClass->IsSPDClusterVsTrackletBG(event)){
fHistEvtSelection->Fill(2.5); //count events rejected by pileup
return kFALSE;
}
if(event->IsPileupFromSPDInMultBins()){
fHistEvtSelection->Fill(2.5); //count events rejected by pileup
return kFALSE;
}
}
//___________________________________________________
//MULTIPLICITY SELECTIONS
if(fMode == AliAnalysisTaskRevEA::kNormal){
fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
if(!fMultSelection ||
//!fMultSelection->IsEventSelected() ||
!fMultSelection->GetThisEventIsNotPileup() ||
!fMultSelection->GetThisEventIsNotPileupInMultBins() ||
!fMultSelection->GetThisEventHasNoInconsistentVertices() ||
!fMultSelection->GetThisEventPassesTrackletVsCluster()){
fHistEvtSelection->Fill(7.5); //count events rejected by multiplicity selection
return kFALSE;
}
}
//BEFORE VERTEX CUT
fhVertexZall->Fill(event->GetPrimaryVertex()->GetZ());
//___________________________________________________
//VERTEX CUT
if(fUseDefaultVertexCut){
if(!fHelperClass || !fHelperClass->IsVertexSelected2013pA(event)){ //??? USE THIS OR SOMETHING ELSE
fHistEvtSelection->Fill(3.5); //count events rejected by vertex cut
return kFALSE;
}
}
if(TMath::Abs(event->GetPrimaryVertex()->GetZ()) > fZVertexCut){
fHistEvtSelection->Fill(3.5); //count events rejected by vertex cut
return kFALSE;
}
//___________________________________________________
//AFTER VERTEX CUT
fhVertexZ->Fill(event->GetPrimaryVertex()->GetZ());
return kTRUE;
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::IsTrackInAcceptance(AliVParticle* track, Bool_t isGen){
// Check if the track pt and eta range
if(!track) return kFALSE;
if(isGen == kPartLevel){ //particle level MC: select charged physical primary tracks
//Apply only for kine level or MC containers
if(!track->Charge()) return kFALSE;
if(!(static_cast<AliAODMCParticle*>(track))->IsPhysicalPrimary()) return kFALSE;
}
if(TMath::Abs(track->Eta()) < fTrackEtaWindow){ //APPLY TRACK ETA CUT
if(track->Pt() > fMinTrackPt){ //APPLY TRACK PT CUT
return kTRUE;
}
}
return kFALSE;
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::ExecOnceLocal(){
// Initialization of jet containers done in AliAnalysisTaskEmcalJet::ExecOnce()
//Read arrays of jets and tracks
fInitializedLocal = kTRUE;
// Initialize helper class (for vertex selection & pile up correction)
fHelperClass = new AliAnalysisUtils();
fHelperClass->SetCutOnZVertexSPD(kFALSE); // kFALSE: no cut; kTRUE: |zvtx-SPD - zvtx-TPC|<0.5cm
return;
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::IsOutlier(){ //FK// whole function
//Checks that this event is pthard bin outlier
//inspired by Bool_t AliConvEventCuts::IsJetJetMCEventAccepted
if(TMath::Abs(fMaxFacPtHard) < 1e-6) return kFALSE; //FK// skip
TList *genHeaders = 0x0;
AliGenEventHeader* gh = 0;
Float_t ptHard;
AliEmcalJet* jetMC = 0x0;
Bool_t bPythiaHeader = 0; // flag whether pythia header was found
if(MCEvent()){
genHeaders = MCEvent()->GetCocktailList(); //get list of MC cocktail headers
}
if(genHeaders){
for(Int_t i = 0; i<genHeaders->GetEntries(); i++){
gh = (AliGenEventHeader*)genHeaders->At(i);
AliGenPythiaEventHeader* pyhead= dynamic_cast<AliGenPythiaEventHeader*>(gh); //identify pythia header
if(pyhead){
bPythiaHeader = 1;
ptHard = pyhead->GetPtHard();
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jetMC = jetIterator.second; // Get the pointer to jet object
if(!jetMC) continue;
//Compare jet pT and pt Hard
if(jetMC->Pt() > fMaxFacPtHard * ptHard){
fHistEvtSelection->Fill(9.5); // I think idea of that was the following: to count outliers (to show total number of rejected events)
return kTRUE;
}
}
}
}
if(!bPythiaHeader){ //ptyhia header was not found
AliWarning("AliAnalysisTaskRevEA MC header not found");
fHistEvtSelection->Fill(9.5);
return kTRUE; //skip the event
}
return kFALSE; //there was not outlier all jets have pT below fMaxFacPtHard * ptHard
} else {
fHistEvtSelection->Fill(9.5);
AliWarning("AliAnalysisTaskRevEA MC header not found");
return kTRUE; //MC header not found
}
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::FillHistograms(){
// executed in each event
//called in AliAnalysisTaskEmcal::UserExec(Option_t *)
// Analyze the event and Fill histograms
if(!InputEvent()){
AliError("??? Event pointer == 0 ???");
return kFALSE;
}
//Execute only once: Get tracks, jets from arrays if not already given
if(!fInitializedLocal) ExecOnceLocal();
fRho = 0.;
fRhoMC = 0.;
AliGenEventHeader* mcHeader = NULL;
AliAODMCHeader* aodMCH = NULL;
//+++++++++++++++++++++++++++++ check MC z vertex position ++++++++++++++++++++++++++
if(fMode == AliAnalysisTaskRevEA::kMC){
if(MCEvent()){
mcHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
if(!mcHeader){
// Check if AOD
aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
if(aodMCH){
for(UInt_t i = 0; i<aodMCH->GetNCocktailHeaders(); i++){
mcHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
if(mcHeader) break;
}
}
}
}
}
//cut on vertex z in particle level
if(mcHeader){
TArrayF pyVtx;
mcHeader->PrimaryVertex(pyVtx);
if(TMath::Abs(pyVtx[2]) > fZVertexCut) return kTRUE; //skip events with particle level vertex out of +-10 cm
}
//cut on vertex z in detector level
if(!IsEventInAcceptance(InputEvent())) return kFALSE; //post data is in UserExec
//_________________________________________________________________
// GET V0M/<V0M> from centrality framework use the same number for detector and particle level
fCentralityV0M = -1;
fMultV0Mnorm = -1;
fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
if(fMultSelection){
fCentralityV0M = fMultSelection->GetMultiplicityPercentile("V0M");
fMultV0Mnorm = fMultSelection->GetZ("V0M");
}else{
return kFALSE;
}
//_________________________________________________________________
// INITIALIZATION
for(Int_t i=0; i<fkTTbins; i++){
fIndexTTH[i] = -1;
fIndexTTH_PartLevel[i] = -1;
fTTH[i].resize(0);
fTTH_PartLevel[i].resize(0);
fdeltapT[i] = 0.;
}
//_________________________________________________________________
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
fhRecoilJetPtEvtByEvent[itt]->Reset();
}
if(fMode == AliAnalysisTaskRevEA::kMC){
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
fhRecoilJetPtEvtByEventPartLevel[itt]->Reset();
}
}
//_________________________________________________________________
// EVENT SELECTION
fHistEvtSelection->Fill(0.5); //Count input event
//_________________________________________________________
//READ TRACK AND JET CONTAINERS
//Container operations http://alidoc.cern.ch/AliPhysics/master/READMEcontainers.html#emcalContainerIterateTechniques
if(fMode == AliAnalysisTaskRevEA::kNormal || fMode == AliAnalysisTaskRevEA::kMC){
//fTrkContainerDetLevel = static_cast<AliTrackContainer*> (GetTrackContainer(fMyTrackContainerName.Data())); //track container detector-level real data only
fTrkContainerDetLevel = static_cast<AliTrackContainer*> (GetTrackContainer(0)); //track container detector-level real data only
fJetContainerDetLevel = static_cast<AliJetContainer*> (GetJetContainer(fMyJetContainerName.Data())); //detector-level AKT jets real data or hybrid event
fKTJetContainerDetLevel = static_cast<AliJetContainer*> (GetJetContainer(fMyKTJetContainerName.Data())); //detector-level KT jets real data or hybrid event
fRho = GetMyRho(fKTJetContainerDetLevel); //estimated backround pt density
}
if( fMode == AliAnalysisTaskRevEA::kMC){ //particle level particles and jets for MC and embedding
//fParticleContainerPartLevel = GetParticleContainer(fMyParticleContainerName.Data()); //pythia particle level particles
fParticleContainerPartLevel = GetParticleContainer(1); //pythia particle level particles
fJetContainerPartLevel = static_cast<AliJetContainer*> (GetJetContainer(fMyJetParticleContainerName.Data())); //pythia particle level AKT jets
fKTJetContainerPartLevel = static_cast<AliJetContainer*> (GetJetContainer(fMyKTJetParticleContainerName.Data())); //pythia particle level KT jets
fRhoMC = GetMyRho(fKTJetContainerPartLevel); //estimated backround pt density
}
if(fMode == AliAnalysisTaskRevEA::kMC){
if(IsOutlier()) return kFALSE;
}
//_________________________________________________________________
// DECIDE WHETHER TO FILL SIGNAL TT OR REFERENCE TT DEPENDING ON RANDOM NUMBER
fFillSigTT = kTRUE;
if(fRandom->Integer(100) < 5) fFillSigTT = kFALSE;
//________________________________________________________________
//DATA ANALYSIS PARTICLE LEVEL
if(fMode == AliAnalysisTaskRevEA::kMC){
FindParticleLevelTT();
AnalyzeParticleLevel();
}
//________________________________________________________________
//DATA ANALYSIS DETECTOR LEVEL
//Check Reconstructed event vertex and pileup
fIsMinBiasTrig = kFALSE; //Minimum bias event flag
if(PassedMinBiasTrigger()){
fIsMinBiasTrig = kTRUE;
fHistEvtSelection->Fill(4.5); //Count Accepted input event
}
fIsHighMultTrig = kFALSE; //high multiplicity trigger flag
if(PassedHighMultTrigger()){
fIsHighMultTrig = kTRUE; //Count Accepted input event
fHistEvtSelection->Fill(6.5); //Count Accepted input event
}
//_________________________________________________________________
fTrigflag[0] = fIsMinBiasTrig;
fTrigflag[1] = fIsHighMultTrig;
//_________________________________________________________________
InitEventProperties();
FindDetectorLevelTT(); //fk Find detector level TT
if(fMode == AliAnalysisTaskRevEA::kMC){
FillResponseMatrix();
FillResponseMatrix2D();
}
GeneralTrackProperties();
AnalyzeRawData();
return kTRUE;
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::FindDetectorLevelTT(){
//fk Find Detector Level TT
TLorentzVector myTT;
AliVParticle *track = NULL;
for(Int_t i=0; i<fkTTbins; i++){
fIndexTTH[i] = -1;
fTTH[i].resize(0);
}
for(Int_t i=0; i < fnHadronTTBins; i++){
fHadronTT_Labels[i].resize(0); // Modified by KA
}
if(fIsMinBiasTrig || fIsHighMultTrig){
if(fTrkContainerDetLevel){
for(auto trackIterator : fTrkContainerDetLevel->accepted_momentum()){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
track = trackIterator.second; // Get the full track
if(!track) continue;
if(IsTrackInAcceptance(track, kDetLevel)){
for(Int_t itt=0; itt < fnHadronTTBins; itt++){
if(fHadronTTLowPt[itt] < track->Pt() && track->Pt() < fHadronTTHighPt[itt]){
fHadronTT_Labels[itt].push_back(TMath::Abs(track->GetLabel())); // Modified by KA
myTT.SetPtEtaPhiM(track->Pt(),track->Eta(),track->Phi(),0.);
fTTH[itt].push_back(myTT);
}
}
}
}
//chose trigger hadron TT
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
if(fTTH[itt].size()>0){
fIndexTTH[itt] = fRandom->Integer((Int_t) (fTTH[itt].size()));
}
}
}
}
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::FindParticleLevelTT(){ // Modified by KA
//inspired by "FindDetectorLevelTT" function
// Find Particle Level TT
TLorentzVector myTT;
AliVParticle *mcParticle = NULL;
for(Int_t i = 0; i < fkTTbins; i++){
fIndexTTH_PartLevel[i] = -1;
fTTH_PartLevel[i].resize(0);
}
for(Int_t i = 0; i < fnHadronTTBins; i++){
fHadronTT_Labels_PartLevel[i].resize(0); // Modified by KA
}
if(fMode == AliAnalysisTaskRevEA::kMC){
if(fParticleContainerPartLevel){
for(auto mcPartIterator : fParticleContainerPartLevel->accepted_momentum()){
mcParticle = mcPartIterator.second; // Get the pointer to mc particle object
if(!mcParticle) continue;
if(IsTrackInAcceptance(mcParticle, kPartLevel)){
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
if(fHadronTTLowPt[itt] < mcParticle->Pt() && mcParticle->Pt() < fHadronTTHighPt[itt]){
fHadronTT_Labels_PartLevel[itt].push_back(TMath::Abs(mcParticle->GetLabel())); // Modified by KA
myTT.SetPtEtaPhiM(mcParticle->Pt(), mcParticle->Eta(), mcParticle->Phi(), 0.);
fTTH_PartLevel[itt].push_back(myTT);
}
}
}
}
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
if(fTTH_PartLevel[itt].size() > 0){
fIndexTTH_PartLevel[itt] = fRandom->Integer((Int_t) (fTTH_PartLevel[itt].size()));
}
}
}
}
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::AnalyzeRawData(){
//Analyze raw data
AliEmcalJet *jet = NULL; //jet pointer real jet
Double_t ptLJ=-1, etaLJ=999, phiLJ=0; //leading jet
Double_t ptSJ=-1, etaSJ=999, phiSJ=0; //subleading jet
Int_t b1,b2;
Double_t tmparr3[3];
Int_t idx;
Double_t dphi = 999.;
Double_t deltaPhi_Angle_Abs_0Pi = 0.0;
Double_t jetPtCorrDet = 0.; //detector level jet pt corrected for rho
// Find the leading and subleading jets for estimates of Delta pt and Exclude 2 leading jets
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
if(jet->Pt() > ptLJ){
ptSJ = ptLJ;
etaSJ = etaLJ;
phiSJ = phiLJ;
ptLJ = jet->Pt();
etaLJ = jet->Eta();
phiLJ = jet->Phi();
}else if(jet->Pt() > ptSJ){
ptSJ = jet->Pt();
etaSJ = jet->Eta();
phiSJ = jet->Phi();
}
}
//______________________________________________________________
// TTH ANALYSIS
//______________________________________________________________
if(fIsMinBiasTrig || fIsHighMultTrig){
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//chose trigger hadron TT
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
fdeltapT[itt] = 0.;
if(fTTH[itt].size()>0){
idx = fIndexTTH[itt];
fdeltapT[itt] = GetDeltaPt(fTTH[itt][idx].Phi(), fTTH[itt][idx].Eta(), phiLJ, etaLJ, phiSJ, etaSJ, fRho, kDetLevel);
}
}
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
fhMultTTH[itg][itt]->Fill(fTTH[itt].size());
if(fTTH[itt].size()==0) continue; //check whether there was hadron TT
fhRhoTTH[itg][itt]->Fill(fRho);
}
}
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
if(fTTH[itt].size()==0) continue; //analyze events with hadron TT only
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhSignalTTH[itg][fkV0Mnorm][itt]->Fill(fMultV0Mnorm);
}
//pick up TTH hadron accoding to the index
idx = fIndexTTH[itt];
if(idx>-1){
//
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhDeltaPtTTH_RC_V0Mnorm[itg][itt]->Fill(fMultV0Mnorm, fdeltapT[itt]);
}
if(fFillSigTT && itt==0) continue; // Do not fill reference
if(!fFillSigTT && itt>0) continue; // Do not fill signal
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhTTH_V0Mnorm[itg][itt]->Fill(fMultV0Mnorm, fTTH[itt][idx].Pt()); //fill trigger track pT for given V0Mnorm
}
//recoil jets
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
dphi = TVector2::Phi_0_2pi(jet->Phi()-fTTH[itt][idx].Phi());
deltaPhi_Angle_Abs_0Pi = TMath::Abs(TVector2::Phi_mpi_pi(dphi)); // Modified by KA.
jetPtCorrDet = jet->Pt() - fRho*jet->Area();
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhRecoilJetPhiTTH_V0Mnorm[itg][itt]->Fill(fMultV0Mnorm, jetPtCorrDet, deltaPhi_Angle_Abs_0Pi); // Modified by KA.
}
if(TMath::Abs(TVector2::Phi_mpi_pi(dphi)) > TMath::Pi()/2){ //select recoil hemisphere and count jets
fhRecoilJetPtEvtByEvent[itt]->Fill(jet->Pt());
}
if(TMath::Abs(TVector2::Phi_mpi_pi(dphi)) > fPhiCut){ //select recoil jet
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhRecoilJetPtTTH_V0Mnorm[itg][itt]->Fill(fMultV0Mnorm, jetPtCorrDet);
}
}
}
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
//count number of jets with pT larger than something in recoil region
tmparr3[2] = fMultV0Mnorm;
for(Int_t ii = 1; ii<=fhNumberOfHighPtJetsRecoil[itg][itt]->GetAxis(0)->GetNbins(); ii++){
tmparr3[0] = fhNumberOfHighPtJetsRecoil[itg][itt]->GetAxis(0)->GetBinLowEdge(ii);
b1 = fhRecoilJetPtEvtByEvent[itt]->GetXaxis()->FindBin(tmparr3[0] + 1e-5);
b2 = fhRecoilJetPtEvtByEvent[itt]->GetXaxis()->GetNbins()+1; //include overflow bin
tmparr3[1] = fhRecoilJetPtEvtByEvent[itt]->Integral(b1,b2);
fhNumberOfHighPtJetsRecoil[itg][itt]->Fill(tmparr3);
}
}
}
}
}
//_________________________________________________________
// LOOP OVER JETS DETECTOR LEVEL TTJ
//_________________________________________________________
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
//
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue; //check which trigger fired
fhJetPhiIncl[itg]->Fill(jet->Pt(), jet->Phi());
fhJetEtaIncl[itg]->Fill(jet->Pt(), jet->Eta());
}
}
return;
}
//_________________________________________________________________
void AliAnalysisTaskRevEA::InitEventProperties(){
// EVENT PROPERTIES
if((fIsMinBiasTrig || fIsHighMultTrig)){ //real data + mc det level
//___________________________________________
// INCLUSIVE EVENTS (WITHOUT TT REQUIREMENT)
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue;
//events without TT requirement
fhRho[itg]->Fill(fRho);
fhCentrality[itg]->Fill(fCentralityV0M, fMultV0Mnorm);
fhSignal[itg][fkV0Mnorm]->Fill(fMultV0Mnorm);
}
}
}
//_________________________________________________________________
void AliAnalysisTaskRevEA::AnalyzeParticleLevel(){
TLorentzVector myTT;
AliEmcalJet *jetPartMC = NULL; //jet pointer particle level MC jet
AliVParticle *mcParticle = NULL; //mc particle
Int_t b1,b2;
Int_t idx;
Double_t tmparr3[3];
Double_t jetPtCorrPart = 0.;
Double_t dphi = 999.;
Double_t deltaPhi_Angle_Abs_0Pi = 0.0; // Modified by KA
if(fMode == AliAnalysisTaskRevEA::kMC){
fHistEvtSelection->Fill(8.5); //Count Accepted input event
fhRhoMBpart->Fill(fRhoMC);
fhSignal_PartLevel[fkV0Mnorm]->Fill(fMultV0Mnorm);
if(fParticleContainerPartLevel){
//chose trigger hadron TT particle level
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
if(fTTH_PartLevel[itt].size()>0){
idx = fIndexTTH_PartLevel[itt]; // Initialize at FindParticleLevelTT, KA
//signal in events with hadron TT particle level
fhSignalTTH_PartLevel[fkV0Mnorm][itt]->Fill(fMultV0Mnorm);
//hadron trigger particle level
if(idx>-1){
fhRhoTTHinMBpart[itt]->Fill(fRhoMC);
if(fFillSigTT && itt==0) continue; // Do not fill reference
if(!fFillSigTT && itt>0) continue; // Do not fill signal
fhTTH_V0Mnorm_PartLevel[itt]->Fill(fMultV0Mnorm, fTTH_PartLevel[itt][idx].Pt()); //fill trigger track pT for given V0Mnorm
//recoil jets PARTICLE LEVEL
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jetPartMC = jetIterator.second; // Get the pointer to jet object
if(!jetPartMC) continue;
dphi = TVector2::Phi_0_2pi(jetPartMC->Phi()-fTTH_PartLevel[itt][idx].Phi());
deltaPhi_Angle_Abs_0Pi = TMath::Abs(TVector2::Phi_mpi_pi(dphi)); // Modified by KA.
jetPtCorrPart = jetPartMC->Pt() - fRhoMC*jetPartMC->Area();
fhRecoilJetPhiTTH_V0Mnorm_PartLevel[itt]->Fill(fMultV0Mnorm, jetPtCorrPart, deltaPhi_Angle_Abs_0Pi); // Modified by KA
fhRecoilJetPtZero_DeltaPhi_TTH_V0Mnorm_PartLevel[itt]->Fill(fMultV0Mnorm, jetPartMC->Pt(), deltaPhi_Angle_Abs_0Pi); // Modified by KA
if(deltaPhi_Angle_Abs_0Pi > TMath::Pi()/2){ //select recoil hemisphere and count jets
fhRecoilJetPtEvtByEventPartLevel[itt]->Fill(jetPartMC->Pt());
}
if(TMath::Abs(TVector2::Phi_mpi_pi(dphi)) > fPhiCut){
//recoil jet hadron trigger
fhRecoilJetPtTTH_V0Mnorm_PartLevel[itt]->Fill(fMultV0Mnorm, jetPtCorrPart);
fhRecoilJetPtZero_TTH_V0Mnorm_PartLevel[itt]->Fill(fMultV0Mnorm, jetPartMC->Pt());
}
}
}
//count number of jets with pT larger than something in recoil region
tmparr3[2] = fMultV0Mnorm;
for(Int_t ii = 1; ii<=fhNumberOfHighPtJetsRecoilPartLevel[itt]->GetAxis(0)->GetNbins(); ii++){
tmparr3[0] = fhNumberOfHighPtJetsRecoilPartLevel[itt]->GetAxis(0)->GetBinLowEdge(ii);
b1 = fhRecoilJetPtEvtByEventPartLevel[itt]->GetXaxis()->FindBin(tmparr3[0] + 1e-5);
b2 = fhRecoilJetPtEvtByEventPartLevel[itt]->GetXaxis()->GetNbins()+1; //include overflow bin
tmparr3[1] = fhRecoilJetPtEvtByEventPartLevel[itt]->Integral(b1,b2);
fhNumberOfHighPtJetsRecoilPartLevel[itt]->Fill(tmparr3);
}
}
}
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Response matrix normalization - spectrum of all generator level jets in acceptance
if(fJetContainerPartLevel){
for(auto jetPartIterator : fJetContainerPartLevel->accepted_momentum() ){
jetPartMC = jetPartIterator.second; // Get the pointer to mc particle object
if(!jetPartMC) continue;
jetPtCorrPart = jetPartMC->Pt() - jetPartMC->Area()*fRhoMC;
fhJetPtPartLevelCorr->Fill(jetPtCorrPart);
fhJetPtPartLevelZero->Fill(jetPartMC->Pt());
}
}
}
}
//_________________________________________________________________
void AliAnalysisTaskRevEA::FillResponseMatrix(){
if(fIsMinBiasTrig){
//EVALUATE SINGLE PARTICLE EFFICIENCY + FILL RESPONSE MATRIX
AliEmcalJet *jetPartMC = NULL; //jet pointer particle level MC jet
AliEmcalJet *jetDetMC = NULL; //jet pointed detector level MC jet
AliVParticle *track = NULL; //jet constituent
AliVParticle *mcParticle = NULL; //mc particle
Bool_t bRecPrim = kFALSE;
Double_t jetPtCorrDet = 0.; //detector level jet pt corrected for rho
Double_t jetPtCorrPart = 0.;
Double_t array[5];
Double_t xphi;
//__________________________________________________________
// FILL JET RESPONSE MATRIX
//__________________________________________________________
//1) Find closest particle level and detector level jets
if(fJetContainerDetLevel){
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum() ){
jetDetMC = jetIterator.second; // Get the pointer to jet object
if(!jetDetMC) continue;
//Fill Response matrix
jetPartMC = jetDetMC->ClosestJet();
if(!jetPartMC) continue;
// KA: Set new relax condition "5e-4" because we consider particle level jets with pT > 1 MeV
if(jetPartMC->Pt() < 5e-4) continue; //prevents matching with a ghost
jetPtCorrPart = jetPartMC->Pt() - jetPartMC->Area()*fRhoMC;
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
fhJetPtPartLevelVsJetPtDetLevelCorr->Fill(jetPtCorrDet,jetPtCorrPart); //response matrix
fhJetPtZeroPartLevel_Vs_JetPtDetLevelCorr->Fill(jetPtCorrDet, jetPartMC->Pt()); //response matrix (added by KA)
fhJetPtZeroPartLevelVsJetPtZeroDetLevel->Fill(jetDetMC->Pt(),jetPartMC->Pt()); //response matrix
fhJetPtResolutionVsPtPartLevel->Fill(jetPartMC->Pt(),(jetDetMC->Pt()-jetPartMC->Pt())/jetPartMC->Pt()); //jet pT resolution
}
}
//FF fill response matrix from recoil jets
//Search for TT candidates in particle level physical primary mc particles
//++++++++++++++++++++++++++++++++++++++++++++++++++
Int_t idx;
Int_t idx_PartLevel; // Modified by KA
//chose trigger hadron TT particle level
for(Int_t itt=0; itt < fnHadronTTBins; itt++){
if(fFillSigTT && itt == 0) continue; //fk
if(!fFillSigTT && itt > 0) continue; //fk
if(fTTH[itt].size() > 0){
idx = fIndexTTH[itt]; //fk initialized in FindDetectorLevelTT
//recoil jets PARTICLE LEVEL
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
jetPartMC = jetIterator.second; // Get the pointer to jet object
if(!jetPartMC) continue;
jetDetMC = jetPartMC->ClosestJet();
xphi = (jetDetMC) ? jetDetMC->Phi() : jetPartMC->Phi(); //for those cases where there is detector level phi use detectro level phi, else use particle level phi
if(TMath::Abs(TVector2::Phi_mpi_pi(xphi - fTTH[itt][idx].Phi())) > fPhiCut){ //fk
jetPtCorrPart = jetPartMC->Pt() - fRhoMC*jetPartMC->Area();
fhRecoilJetPtPartLevelCorr[itt]->Fill(jetPtCorrPart);
fhRecoilJetPtZeroPartLevel[itt]->Fill(jetPartMC->Pt());
}
}
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum()){
jetDetMC = jetIterator.second; // Get the pointer to jet object
if(!jetDetMC) continue;
jetPartMC = jetDetMC->ClosestJet();
if(!jetPartMC){
continue;
}
if(jetPartMC->Pt() < 5e-4) continue; //prevents matching with a ghost
jetPtCorrPart = jetPartMC->Pt() - jetPartMC->Area()*fRhoMC;
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
if(TMath::Abs(TVector2::Phi_mpi_pi(jetDetMC->Phi()-fTTH[itt][idx].Phi())) > fPhiCut){ //fk
fhRecoilJetPtPartLevelVsJetPtDetLevelCorr[itt]->Fill(jetPtCorrDet,jetPtCorrPart);
fhRecoilJetPtZeroPartLevelVsJetPtDetLevelCorr[itt]->Fill(jetPtCorrDet,jetPartMC->Pt());
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevelCorr[itt]->Fill(jetDetMC->Pt(),jetPartMC->Pt());
}
}
}
}
// KA: fill response matrix with jets on particle and detector levels recoiling from corresponding TT
//Important: TT labels must be the same!!!
Int_t Label_Det_TT, Label_Part_TT; // Modified by KA
for(Int_t iTT = 0; iTT < fnHadronTTBins; iTT++){
if(fFillSigTT && iTT == 0) continue; //fk
if(!fFillSigTT && iTT > 0) continue; //fk
if(fTTH[iTT].size() > 0 && fTTH_PartLevel[iTT].size() > 0){ // presence of TT on both levels
Label_Part_TT = -1;
idx = fIndexTTH[iTT]; //fk initialized in FindDetectorLevelTT
Label_Det_TT = TMath::Abs(fHadronTT_Labels[iTT][idx]); // Label of selected TT on detector level
for(Int_t k = 0; k < (Int_t)(fHadronTT_Labels_PartLevel[iTT].size()); k++){
if(Label_Det_TT == fHadronTT_Labels_PartLevel[iTT][k]){ // Look for TT on particle level with same label
idx_PartLevel = k;
Label_Part_TT = fHadronTT_Labels_PartLevel[iTT][k];
break;
}
}
if(Label_Part_TT<0) continue;
fhTT_Corresp[iTT]->Fill(fTTH[iTT][idx].Pt(), fTTH_PartLevel[iTT][idx_PartLevel].Pt()); // Modified by KA
//recoil jets PARTICLE LEVEL
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
jetPartMC = jetIterator.second; // Get the pointer to jet object
if(!jetPartMC) continue;
if(TMath::Abs(TVector2::Phi_mpi_pi(jetPartMC->Phi() - fTTH_PartLevel[iTT][idx_PartLevel].Phi())) > fPhiCut){ // KA
jetPtCorrPart = jetPartMC->Pt() - fRhoMC*jetPartMC->Area();
fhRecoilJetPtPartLevel_CorrespTT[iTT]->Fill(jetPtCorrPart); // Modified by KA
fhRecoilJetPtZeroPartLevel_CorrespTT[iTT]->Fill(jetPartMC->Pt()); // Modified by KA
}
}
for(auto jetIterator : fJetContainerDetLevel->accepted_momentum()){
jetDetMC = jetIterator.second; // Get the pointer to jet object
if(!jetDetMC) continue;
jetPartMC = jetDetMC->ClosestJet();
if(!jetPartMC) continue; // IMPORTANT TO ADD
if(jetPartMC->Pt() < 5e-4) continue; //prevents matching with a ghost
jetPtCorrPart = jetPartMC->Pt() - jetPartMC->Area()*fRhoMC;
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
if(TMath::Abs(TVector2::Phi_mpi_pi(jetDetMC->Phi()-fTTH[iTT][idx].Phi())) > fPhiCut && TMath::Abs(TVector2::Phi_mpi_pi(jetPartMC->Phi()-fTTH_PartLevel[iTT][idx_PartLevel].Phi())) > fPhiCut){ // KA: look for events when both matched jets are in the recoil
fhRecoilJetPtPartLevelVsJetPtDetLevel_CorrespTT[iTT]->Fill(jetPtCorrDet, jetPtCorrPart); // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtDetLevel_CorrespTT[iTT]->Fill(jetPtCorrDet, jetPartMC->Pt()); // Modified by KA
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_CorrespTT[iTT]->Fill(jetDetMC->Pt(), jetPartMC->Pt()); // Modified by KA
}
}
}
}
}
return;
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::FillResponseMatrix2D(){
//Fill 4D response matrix
if(fIsMinBiasTrig && fMode == AliAnalysisTaskRevEA::kMC){
//EVALUATE SINGLE PARTICLE EFFICIENCY + FILL RESPONSE MATRIX
AliEmcalJet *jet = NULL; //jet pointer real jet
AliEmcalJet *jetDetMC = NULL; //jet pointed detector level MC jet
AliVParticle *track_PartLevel = NULL; //jet constituent
AliVParticle *track_DetLevel = NULL; //mc particle
Int_t iterationStep = 0;
Double_t smearing_Of_PhiAngle = 0;
Double_t random_PhiAnglePartLevel = 0;
Double_t random_PhiAngleDetLevel = 0;
Double_t jetPtCorrDet = 0.; //detector level jet pt corrected for rho
Double_t jetPtCorrPart = 0.;
Double_t deltaPhi_angle_ParticleLevel = 0.;
Double_t deltaPhi_angle_DetLevel = 0.;
Double_t phi_Angle_Of_TT = 0.; //fk
Int_t idx = 0; //fk
Int_t idx_PartLevel; // Modified by KA
//FILL JET RESPONSE MATRIX
if(fJetContainerPartLevel){
//Inclusive jets
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
jet = jetIterator.second; // Get the pointer to particle level jet object
if(!jet) continue;
// Matching
jetDetMC = jet->ClosestJet();
//Averaging over phi angle by random generation of phi angle PartLvl. Phi angle DetLvl is obtained by adding smearing to PartLvl phi angle
random_PhiAnglePartLevel = TMath::Pi()*fRandom->Uniform(-1,1); //(-pi,pi)
jetPtCorrPart = jet->Pt() - jet->Area()*fRhoMC;
if(jet->Pt() > 5e-4){
if(!jetDetMC){ //No associated MC detector level jet -> Fill input for the miss function
fhPhi_JetPtPartLevel_InclusiveJets->Fill(TMath::Abs(random_PhiAnglePartLevel), jetPtCorrPart);
fhPhi_JetPtZeroPartLevel_InclusiveJets->Fill(TMath::Abs(random_PhiAnglePartLevel), jet->Pt()); // (added by KA)
} else if(jetDetMC->Pt() < 1e-10){ //associated MC detector level jet is a ghost jet -> Fill input for the miss function
fhPhi_JetPtPartLevel_InclusiveJets->Fill(TMath::Abs(random_PhiAnglePartLevel), jetPtCorrPart);
fhPhi_JetPtZeroPartLevel_InclusiveJets->Fill(TMath::Abs(random_PhiAnglePartLevel), jet->Pt()); // (added by KA)
} else { //Associated Detector level jet is a physical jet -> fill response matrix
smearing_Of_PhiAngle = jetDetMC->Phi() - jet->Phi(); //Smearing of phi angle
random_PhiAngleDetLevel = TMath::Abs(TVector2::Phi_mpi_pi(random_PhiAnglePartLevel + smearing_Of_PhiAngle)); //TVector2::Phi_mpi_pi
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
fArray_for_filling[0] = random_PhiAngleDetLevel;
fArray_for_filling[1] = jetPtCorrDet;
fArray_for_filling[2] = TMath::Abs(random_PhiAnglePartLevel);
fArray_for_filling[3] = jetPtCorrPart;
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets->Fill(fArray_for_filling);
//Particle level jet pT is not corrected by RhokT
fArray_for_filling[3] = jet->Pt();
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->Fill(fArray_for_filling); // added by KA
//Jet pT is not corrected by RhokT
fArray_for_filling[1] = jetDetMC->Pt();
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->Fill(fArray_for_filling); // added by KA
}
}
}//end inclusive jets
//TT events
for(Int_t iTT = 0; iTT < fnHadronTTBins; iTT++){
if(fTTH[iTT].size() == 0) continue; //fk skip event, since no TT on detector level
if(fFillSigTT && iTT == 0) continue; //fk
if(!fFillSigTT && iTT > 0) continue; //fk
idx = fIndexTTH[iTT]; //fk initialized in FindDetectorLevelTT
phi_Angle_Of_TT = fTTH[iTT][idx].Phi(); //fk
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
jetDetMC = jet->ClosestJet(); // Matched detector level jet
//For TT events we take Delta phi angle = TT phi angle - Jet phi angle
deltaPhi_angle_ParticleLevel = TMath::Abs(TVector2::Phi_mpi_pi(jet->Phi() - phi_Angle_Of_TT)); // changed DeltaPhi angle (previous range 0,2*Pi)
jetPtCorrPart = jet->Pt() - jet->Area()*fRhoMC;
if(jet->Pt() > 5e-4){
if(!jetDetMC){ //no matched detector level jet
fhDeltaPhi_JetPtPartLevel[iTT]->Fill(deltaPhi_angle_ParticleLevel, jetPtCorrPart);
fhDeltaPhi_JetPtZero_PartLevel[iTT]->Fill(deltaPhi_angle_ParticleLevel, jet->Pt()); // added by KA
}else if(jetDetMC->Pt() < 1e-10) { //matched to a ghost
fhDeltaPhi_JetPtPartLevel[iTT]->Fill(deltaPhi_angle_ParticleLevel, jetPtCorrPart);
fhDeltaPhi_JetPtZero_PartLevel[iTT]->Fill(deltaPhi_angle_ParticleLevel, jet->Pt()); // added by KA
}else{
deltaPhi_angle_DetLevel = TMath::Abs(TVector2::Phi_mpi_pi(jetDetMC->Phi() - phi_Angle_Of_TT)); //fk
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
fArray_for_filling[0] = deltaPhi_angle_DetLevel;
fArray_for_filling[1] = jetPtCorrDet;
fArray_for_filling[2] = deltaPhi_angle_ParticleLevel;
fArray_for_filling[3] = jetPtCorrPart;
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[iTT]->Fill(fArray_for_filling);
//Particle level jet pT is NOT corrected for RhokT
fArray_for_filling[3] = jet->Pt();
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[iTT]->Fill(fArray_for_filling); // added by KA
//Particle level jet pT is NOT corrected for RhokT
fArray_for_filling[1] = jetDetMC->Pt();
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[iTT]->Fill(fArray_for_filling); // added by KA
}
}
}//end recoil jets
}
// KA: fill response matrix with jets on particle and detector levels recoiling from corresponding TT
Int_t Label_Det_TT, Label_Part_TT; // Modified by KA
for(Int_t iTT = 0; iTT < fnHadronTTBins; iTT++){
if(fFillSigTT && iTT == 0) continue; //fk
if(!fFillSigTT && iTT > 0) continue; //fk
if(fTTH[iTT].size() > 0 && fTTH_PartLevel[iTT].size() > 0){ // presence of TT on both levels
Label_Part_TT = 0;
idx = fIndexTTH[iTT]; //fk initialized in FindDetectorLevelTT
// idx_PartLevel = fIndexTTH_PartLevel[iTT]; //KA initialized in FindParticleLevelTT
Label_Det_TT = TMath::Abs(fHadronTT_Labels[iTT][idx]); // Label of selected TT on detector level
for(Int_t k = 0; k < (Int_t) (fHadronTT_Labels_PartLevel[iTT].size()); k++){
if(Label_Det_TT == fHadronTT_Labels_PartLevel[iTT][k]){ // Look for TT on particle level with same label
idx_PartLevel = k;
Label_Part_TT = fHadronTT_Labels_PartLevel[iTT][k];
break;
}
}
if(!Label_Part_TT) continue;
for(auto jetIterator : fJetContainerPartLevel->accepted_momentum()){
jet = jetIterator.second; // Get the pointer to jet object
if(!jet) continue;
jetDetMC = jet->ClosestJet(); // Matched detector level jet
//For TT events we take Delta phi angle = TT phi angle - Jet phi angle
deltaPhi_angle_ParticleLevel = TMath::Abs(TVector2::Phi_mpi_pi(jet->Phi() - fTTH_PartLevel[iTT][idx_PartLevel].Phi())); // changed DeltaPhi angle (previous range 0,2*Pi)
jetPtCorrPart = jet->Pt() - jet->Area()*fRhoMC;
if(jet->Pt() > 5e-4){
if(!jetDetMC){ //no matched detector level jet
fhDeltaPhi_JetPtPartLevel_CorrespTT[iTT]->Fill(deltaPhi_angle_ParticleLevel, jetPtCorrPart); // Modified by KA
fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[iTT]->Fill(deltaPhi_angle_ParticleLevel, jet->Pt()); // Modified by KA
}else if(jetDetMC->Pt() < 1e-10) { //matched to a ghost
fhDeltaPhi_JetPtPartLevel_CorrespTT[iTT]->Fill(deltaPhi_angle_ParticleLevel, jetPtCorrPart); // Modified by KA
fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[iTT]->Fill(deltaPhi_angle_ParticleLevel, jet->Pt()); // Modified by KA
}else{
deltaPhi_angle_DetLevel = TMath::Abs(TVector2::Phi_mpi_pi(jetDetMC->Phi() - fTTH[iTT][idx].Phi())); //fk
jetPtCorrDet = jetDetMC->Pt() - jetDetMC->Area()*fRho;
fArray_for_filling[0] = deltaPhi_angle_DetLevel;
fArray_for_filling[1] = jetPtCorrDet;
fArray_for_filling[2] = deltaPhi_angle_ParticleLevel;
fArray_for_filling[3] = jetPtCorrPart;
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[iTT]->Fill(fArray_for_filling); // Modified by KA
//Particle level jet pT is NOT corrected for RhokT
fArray_for_filling[3] = jet->Pt();
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[iTT]->Fill(fArray_for_filling); // added by KA
//Particle level jet pT is NOT corrected for RhokT
fArray_for_filling[1] = jetDetMC->Pt();
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[iTT]->Fill(fArray_for_filling); // added by KA
}
}
}//end recoil jets
}
}
}
}
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::GeneralTrackProperties(){
//basic properties of tracks
AliVParticle *track = NULL; //jet constituent
//_________________________________________________________
//LOOP OVER TRACKS DETECTOR LEVEL
for(auto trackIterator : fTrkContainerDetLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
track = trackIterator.second; // Get the full track
if(!track) continue;
if(IsTrackInAcceptance(track, kDetLevel)){
for(Int_t itg=kMB; itg<=kHM; itg++){ //@@@
if(!fTrigflag[itg]) continue;
fhTrackPhiIncl[itg]->Fill(track->Pt(), track->Phi());
fhTrackEtaIncl[itg]->Fill(track->Pt(), track->Eta());
}
}
}
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::Terminate(Option_t *){
//Treminate
PostData(1, fOutput);
// Mandatory
fOutput = dynamic_cast<AliEmcalList*> (GetOutputData(1)); // '1' refers to the output slot
if(!fOutput) {
printf("ERROR: Output list not available\n");
return;
}
}
//________________________________________________________________________
AliAnalysisTaskRevEA::~AliAnalysisTaskRevEA(){
// Destructor. Clean-up the output list, but not the histograms that are put inside
// (the list is owner and will clean-up these histograms). Protect in PROOF case.
if(fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
delete fOutput;
}
delete fRandom;
delete fHelperClass;
}
//________________________________________________________________________
void AliAnalysisTaskRevEA::UserCreateOutputObjects(){
// called once to create user defined output objects like histograms, plots etc.
// and to put it on the output list.
// Note: Saving to file with e.g. OpenFile(0) is must be before creating other objects.
//fOutput TList defined in the mother class
AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
Bool_t oldStatus = TH1::AddDirectoryStatus();
TH1::AddDirectory(kFALSE);
TString name, object;
fRandom = new TRandom3(0);
//__________________________________________________________
// Event statistics
fHistEvtSelection = new TH1D("fHistEvtSelection", "event selection", 10, 0, 10);
fHistEvtSelection->GetXaxis()->SetBinLabel(1,"events IN"); //0-1
fHistEvtSelection->GetXaxis()->SetBinLabel(2,"incomplete DAQ (rejected)"); //1-2
fHistEvtSelection->GetXaxis()->SetBinLabel(3,"pile up (rejected)"); //2-3
fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)"); //3-4
fHistEvtSelection->GetXaxis()->SetBinLabel(5,"MB"); //4-5
fHistEvtSelection->GetXaxis()->SetBinLabel(6,""); //5-6
fHistEvtSelection->GetXaxis()->SetBinLabel(7,"High Mult"); //6-7
fHistEvtSelection->GetXaxis()->SetBinLabel(8,"IsEventSelected"); //7-8
fHistEvtSelection->GetXaxis()->SetBinLabel(9,"MC MB events"); //8-9
fHistEvtSelection->GetXaxis()->SetBinLabel(10,"IsOutlier"); //9-10
fOutput->Add(fHistEvtSelection);
//Trigger track pT spectrum single inclusive for MB versus V0M
Int_t nbinsV0M = 100;
Double_t maxV0M = 1000.;
Int_t nbinsV0Mnorm = 200;
Double_t maxV0Mnorm = 20.;
//_______________________________________________________________________
//inclusive azimuthal and pseudorapidity histograms
fhVertexZall = new TH1D("fhVertexZall","z vertex without cut",40,-20,20);
fOutput->Add(fhVertexZall);
fhVertexZ = new TH1D("fhVertexZ","z vertex",40,-20,20);
fOutput->Add(fhVertexZ);
//-------------------------
TString trig[]={"MB","HM"};
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
name = Form("fhTrackEtaIncl%s",trig[itg].Data());
object = Form("Eta dist inclusive track vs pT %s",trig[itg].Data());
fhTrackEtaIncl[itg] = new TH2D(name.Data(), object.Data(), 200, 0, 200, 60, -0.9, 0.9); // Modified by KA (old value: 50,0,100)
fOutput->Add((TH2D*) fhTrackEtaIncl[itg]);
name = Form("fhTrackPhiIncl%s",trig[itg].Data());
object = Form("Azim dist tracks vs pT %s",trig[itg].Data());
fhTrackPhiIncl[itg] = new TH2D(name.Data(), object.Data(), 200, 0, 200, 50, 0, 2*TMath::Pi()); // Modified by KA (old value: 50,0,100)
fOutput->Add((TH2D*) fhTrackPhiIncl[itg]);
}
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
name = Form("fhJetEtaIncl%s",trig[itg].Data());
object = Form("Eta dist inclusive jets vs pTjet %s",trig[itg].Data());
fhJetEtaIncl[itg] = new TH2D(name.Data(),object.Data(), 100, 0, 100, 60, -0.9, 0.9); // Modified by KA (old value: 40,-0.9,0.9)
fOutput->Add((TH2D*) fhJetEtaIncl[itg]);
name = Form("fhJetPhiIncl%s",trig[itg].Data());
object = Form("Azim dist jets vs pTjet %s",trig[itg].Data());
fhJetPhiIncl[itg] = new TH2D(name.Data(),object.Data(), 100, 0, 100, 50, 0, 2*TMath::Pi());
fOutput->Add((TH2D*) fhJetPhiIncl[itg]);
}
//RHO
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
name = Form("hRhokt_%s",trig[itg].Data());
object = Form("Rho kt det level %s",trig[itg].Data());
fhRho[itg] = new TH1D( name.Data(), object.Data(),1000,0,100);
fOutput->Add((TH1D*) fhRho[itg]);
}
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins;itt++){ //HADRON TT
name = Form("hRhokt_%s_TTH%d_%d", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRhoTTH[itg][itt] = (TH1D*) fhRho[itg]->Clone(name.Data()); //! in events MB with hadron TT
fOutput->Add((TH1D*) fhRhoTTH[itg][itt]);
}
}
if(fMode == AliAnalysisTaskRevEA::kMC){
name = Form("hRhokt_MB_part");
fhRhoMBpart = new TH1D( name.Data(), name.Data(),1000,0,100);
fhRhoMBpart->SetTitle(Form("Rho kt min bias part level"));
fOutput->Add((TH1D*) fhRhoMBpart);
for(Int_t itt=0; itt<fnHadronTTBins;itt++){
name = Form("hRhokt_MB_TTH%d_%d_part", fHadronTTLowPt[itt],fHadronTTHighPt[itt]);
fhRhoTTHinMBpart[itt] = (TH1D*) fhRhoMBpart->Clone(name.Data()); //! in events MB with hadron TT
fOutput->Add((TH1D*) fhRhoTTHinMBpart[itt]);
}
}
Double_t arrcent[] = {
0., 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09,
0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19,
0.2, 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29,
0.3, 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39,
0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49,
0.5,0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95,
1.,
2.,
3.,
4.,
5.,
6.,
7.,
8.,
9.,
10,11,12,13,14,15,16,17,18,19,20,
25,30,35,40,45,50,55,60,65,70,75,80,85,90,100};
Int_t narrcent = sizeof(arrcent)/sizeof(Double_t)-1;
//CENTRALITY
for(Int_t itg=kMB; itg<=kHM;itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
name = Form("hCentrality_%s_V0Mnorm", trig[itg].Data());
fhCentrality[itg] = new TH2D(name.Data(), name.Data(), narrcent, arrcent, 400,0,20);
fOutput->Add((TH2D*) fhCentrality[itg]);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//SIGNAL
TString signal[]={"V0Mnorm"};
Float_t signalL[]={0};
Float_t signalH[]={15};
Int_t signalN[]={150};
for(Int_t itg=kMB; itg<=kHM;itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t ic=0; ic<fkCE;ic++){ //MB
name = Form("hSignal_%s_%s", trig[itg].Data(), signal[ic].Data());
fhSignal[itg][ic] = new TH1D(name.Data(), name.Data(), signalN[ic], signalL[ic], signalH[ic]);
fOutput->Add((TH1D*) fhSignal[itg][ic]);
}
}
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t ic=0; ic<fkCE; ic++){ //TT hadron
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("hSignal_%s_%s_TTH%d_%d", trig[itg].Data(), signal[ic].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhSignalTTH[itg][ic][itt] = new TH1D(name.Data(), name.Data(), signalN[ic], signalL[ic], signalH[ic]);
fOutput->Add((TH1D*) fhSignalTTH[itg][ic][itt]);
}
}
}
if(fMode == AliAnalysisTaskRevEA::kMC){ //PARTICLE LEVEL SIGNAL DISTRIBUTIONS
TString signalmc[]={"V0Mnorm"};
Float_t signalLmc[]={0};
Float_t signalHmc[]={20};
Int_t signalNmc[]={200};
for(Int_t ic=0; ic<fkCE;ic++){ //MB
name = Form("hSignal_MB_%s_PartLevel", signalmc[ic].Data());
fhSignal_PartLevel[ic] = new TH1D(name.Data(), name.Data(), signalNmc[ic], signalLmc[ic], signalHmc[ic]);
fOutput->Add((TH1D*) fhSignal_PartLevel[ic]);
}
//TT hadron
for(Int_t ic=0; ic<fkCE;ic++){ //MB
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("hSignal_MB_%s_TTH%d_%d_PartLevel", signalmc[ic].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhSignalTTH_PartLevel[ic][itt] = new TH1D(name.Data(),name.Data(),signalNmc[ic], signalLmc[ic], signalHmc[ic]);
fOutput->Add((TH1D*) fhSignalTTH_PartLevel[ic][itt]);
}
}
}
//+++++++++++++++++++++++++++++++
//Trigger track candidate multiplicity
for(Int_t itg=kMB; itg<=kHM; itg++){ //TTH
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("hMultTT_%s_TTH%d_%d", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhMultTTH[itg][itt] = new TH1D(name.Data(),name.Data(),100,0,100);
fOutput->Add((TH1D*) fhMultTTH[itg][itt]);
}
}
for(Int_t itg=kMB; itg<=kHM; itg++){ //TTH
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
//Trigger track pT spectrum single inclusive for MB versus V0Mnorm
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("hTT_%s_TTH%d_%d_V0Mnorm", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhTTH_V0Mnorm[itg][itt] = new TH2D(name.Data(),name.Data(), nbinsV0Mnorm, 0, maxV0Mnorm, 100, 0, 100);
fOutput->Add((TH2D*) fhTTH_V0Mnorm[itg][itt]);
}
}
if(fMode == AliAnalysisTaskRevEA::kMC){
//Trigger track pT spectrum single inclusive for MB versus V0Mnorm
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("hTT_MB_TTH%d_%d_V0Mnorm_PartLevel", fHadronTTLowPt[itt],fHadronTTHighPt[itt]);
fhTTH_V0Mnorm_PartLevel[itt] = new TH2D(name.Data(),name.Data(), nbinsV0Mnorm, 0, maxV0Mnorm, 100, 0, 100);
fOutput->Add((TH2D*) fhTTH_V0Mnorm_PartLevel[itt]);
}
//Trigger track pT spectrum single inclusive for MB versus V0Mnorm without V0 coincidence
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("NumberOf_Corresp_TT%d_%d", fHadronTTLowPt[itt],fHadronTTHighPt[itt]);
fhTT_Corresp[itt] = new TH2D(name.Data(),name.Data(), 100, 0, 100, 100, 0, 100);
fOutput->Add((TH2D*) fhTT_Corresp[itt]);
}
}
// ++++++++++++++++++++++++++++++++++ Binning ++++++++++++++++++++++++++++++++++++
//Jet pT corrected on RhokT
const Int_t numberBins_jetpT_RhokT = 270;
Double_t jetPtRhokT_Bins[numberBins_jetpT_RhokT + 1];
for(Int_t i = 0; i <= numberBins_jetpT_RhokT; i++) jetPtRhokT_Bins[i] = i - 20; //(-20,250)
//Jet pT not corrected on RhokT
const Int_t numberBins_jetpT_Zero = 250;
Double_t jetPtZero_Bins[numberBins_jetpT_Zero + 1];
for(Int_t i = 0; i <= numberBins_jetpT_Zero; i++) jetPtZero_Bins[i] = i; //(0,250)
//Phi angle
const Int_t ndeltaPhiBins = 40;
Double_t deltaPhiBins[ndeltaPhiBins+1];
Double_t p = TMath::Pi()/ndeltaPhiBins;
for(Int_t i = 0; i <= ndeltaPhiBins; i++) deltaPhiBins[i] = i*p;
//Phi angle: Inclusive jets
Double_t deltaPhiBins_InclusiveJets[2*ndeltaPhiBins+1];
Double_t step = 0.5*TMath::TwoPi()/ndeltaPhiBins;
for(Int_t i = 0; i <= 2*ndeltaPhiBins; i++) deltaPhiBins_InclusiveJets[i] = i*step;
//V0M normalized
Double_t arrV0Mnorm[nbinsV0Mnorm+1];
p = maxV0Mnorm/nbinsV0Mnorm;
for(Int_t i = 0; i<=nbinsV0Mnorm; i++){
arrV0Mnorm[i] = i*p; //(0,20.0)
}
//dphi of recoil jets associated to semi-inclusive hadron TT in MB with V0Mnorm (fMultV0Mnorm, jetPtCorrDet, dphi);
for(Int_t itg=kMB; itg<=kHM; itg++){ //TTH
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
name = Form("RecoilJetPhi_%s_TTH%d_%d_Rhokt_V0Mnorm", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPhiTTH_V0Mnorm[itg][itt] = new TH3D(name.Data(), name.Data(), nbinsV0Mnorm, arrV0Mnorm, numberBins_jetpT_RhokT, jetPtRhokT_Bins, ndeltaPhiBins, deltaPhiBins);
fOutput->Add((TH3D*) fhRecoilJetPhiTTH_V0Mnorm[itg][itt]);
}
}
//RECOIL JET SPECTRA
for(Int_t itg=kMB; itg<=kHM; itg++){ //TTH
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //! recoil jets associated to semi-inclusive hadron TT in MB with V0Mnorm
name = Form("fhRecoilJetPt_%s_TTH%d_%d_V0Mnorm_Rhokt", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtTTH_V0Mnorm[itg][itt] = new TH2D(name.Data(), name.Data(), nbinsV0Mnorm, 0, maxV0Mnorm, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtTTH_V0Mnorm[itg][itt]);
}
}
//TTH recoil jet distributions for MC
if(fMode == AliAnalysisTaskRevEA::kMC){
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //! recoil jets associated to semi-inclusive hadron TT in MB with V0Mnorm
// Jet pT is CORRECTED on RhokT
name = Form("RecoilJetPt_MB_TTH%d_%d_V0Mnorm_Rhokt_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtTTH_V0Mnorm_PartLevel[itt] = new TH2D(name.Data(), name.Data(), nbinsV0Mnorm, 0., maxV0Mnorm, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtTTH_V0Mnorm_PartLevel[itt]);
// Jet pT is NOT CORRECTED on RhokT
name = Form("RecoilJetPtZero_MB_TTH%d_%d_V0Mnorm_Rhokt_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZero_TTH_V0Mnorm_PartLevel[itt] = new TH2D(name.Data(), name.Data(), nbinsV0Mnorm, 0., maxV0Mnorm, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtZero_TTH_V0Mnorm_PartLevel[itt]);
}
// dphi of recoil jets associated to semi-inclusive hadron TT in MB with V0Mnorm (fMultV0Mnorm, jetPtCorrDet, dphi);
for(Int_t itt=0; itt<fnHadronTTBins; itt++){
// Jet pT is CORRECTED on RhokT
name = Form("RecoilJetPhi_MB_TTH%d_%d_V0Mnorm_Rhokt_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPhiTTH_V0Mnorm_PartLevel[itt] = new TH3D(name.Data(), name.Data(), nbinsV0Mnorm, arrV0Mnorm, numberBins_jetpT_RhokT, jetPtRhokT_Bins, ndeltaPhiBins, deltaPhiBins); // added by KA
fOutput->Add((TH3D*) fhRecoilJetPhiTTH_V0Mnorm_PartLevel[itt]);
// Jet pT is NOT CORRECTED on RhokT
name = Form("RecoilJetPtZero_DeltaPhi_TTH%d_%d_V0Mnorm_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZero_DeltaPhi_TTH_V0Mnorm_PartLevel[itt] = new TH3D(name.Data(), name.Data(), nbinsV0Mnorm, arrV0Mnorm, numberBins_jetpT_Zero, jetPtZero_Bins, ndeltaPhiBins, deltaPhiBins); // added by KA
fOutput->Add((TH3D*) fhRecoilJetPtZero_DeltaPhi_TTH_V0Mnorm_PartLevel[itt]);
}
}
//+++++++++++++++++++++++++++ RECOIL JETS WITH TTC ++++++++++++++++++++++++++++++++++++++++++
//delta pT distributions versus V0Mnorm = V0M/mean V0M
for(Int_t itg=kMB; itg<=kHM; itg++){ //TTH
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //! recoil jets associated to semi-inclusive hadron TT in MB with V0Mnorm
name = Form("fhDeltaPtTTH_%s_RC_V0Mnorm_TTH%d_%d_Rhokt", trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhDeltaPtTTH_RC_V0Mnorm[itg][itt] = new TH2D(name.Data(), name.Data(), nbinsV0Mnorm, 0, maxV0Mnorm, numberBins_jetpT_RhokT, jetPtRhokT_Bins); // changed range: old-> (200, -20, 180) (added by KA)
fOutput->Add((TH2D*) fhDeltaPtTTH_RC_V0Mnorm[itg][itt]);
}
}
if(fMode == AliAnalysisTaskRevEA::kMC){
name = Form("JetPtPartLevel_Rhokt");
fhJetPtPartLevelCorr = new TH1D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH1D*) fhJetPtPartLevelCorr);
fhJetPtPartLevelZero = new TH1D("JetPtZeroPartLevel","JetPtZeroPartLevel", numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH1D*) fhJetPtPartLevelZero);
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
//Normalization of response matrix filled from recoil jets
name = Form("RecoilJetPtPartLevel_Rhokt_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtPartLevelCorr[itt] = new TH1D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH1D*) fhRecoilJetPtPartLevelCorr[itt]);
//Jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevel_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevel[itt] = new TH1D(name.Data(), name.Data(), numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH1D*) fhRecoilJetPtZeroPartLevel[itt]);
//______________________________________________________
//Normalization of response matrix filled from recoil jets on PARTICLE level
name = Form("RecoilJetPt_Rhokt_PartLevel_Corresp_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtPartLevel_CorrespTT[itt] = new TH1D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH1D*) fhRecoilJetPtPartLevel_CorrespTT[itt]);
//Jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevel_Corresp_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevel_CorrespTT[itt] = new TH1D(name.Data(), name.Data(), numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH1D*) fhRecoilJetPtZeroPartLevel_CorrespTT[itt]);
}
//1D unfolding
name = Form("JetPtPartLevelVsJetPtDetLevel_Rhokt");
fhJetPtPartLevelVsJetPtDetLevelCorr = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhJetPtPartLevelVsJetPtDetLevelCorr);
fhJetPtZeroPartLevelVsJetPtZeroDetLevel = new TH2D("JetPtZeroPartLevel_Vs_JetPtZeroDetLevel","JetPtZeroPartLevel_Vs_JetPtZeroDetLevel", numberBins_jetpT_Zero, jetPtZero_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhJetPtZeroPartLevelVsJetPtZeroDetLevel);
name = Form("JetPtZeroPartLevel_Vs_JetPtDetLevel_Rhokt");
fhJetPtZeroPartLevel_Vs_JetPtDetLevelCorr = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhJetPtZeroPartLevel_Vs_JetPtDetLevelCorr);
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
//FF Response matrix filled from recoil jets
name = Form("RecoilJetPtPartLevelVsJetPtDetLevel_Rhokt_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtPartLevelVsJetPtDetLevelCorr[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtPartLevelVsJetPtDetLevelCorr[itt]);
// Part level jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevelVsJetPtDetLevel_Rhokt_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevelVsJetPtDetLevelCorr[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtZeroPartLevelVsJetPtDetLevelCorr[itt]);
// Jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevelCorr[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_Zero, jetPtZero_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevelCorr[itt]);
//____________________________________________________________
//KA Reponse matrix filled from recoil jets wrt corresponding TT
name = Form("RecoilJetPtPartLevelVsJetPtDetLevel_Rhokt_Corresp_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtPartLevelVsJetPtDetLevel_CorrespTT[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtPartLevelVsJetPtDetLevel_CorrespTT[itt]);
// Part level jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevelVsJetPtDetLevel_Rhokt_Corresp_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevelVsJetPtDetLevel_CorrespTT[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_RhokT, jetPtRhokT_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtZeroPartLevelVsJetPtDetLevel_CorrespTT[itt]);
// Jet pT not corrected on RhokT
name = Form("RecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_Corresp_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_CorrespTT[itt] = new TH2D(name.Data(), name.Data(), numberBins_jetpT_Zero, jetPtZero_Bins, numberBins_jetpT_Zero, jetPtZero_Bins);
fOutput->Add((TH2D*) fhRecoilJetPtZeroPartLevelVsJetPtZeroDetLevel_CorrespTT[itt]);
}
name = Form("fhJetPtResolutionVsPtPartLevel_Rhokt");
fhJetPtResolutionVsPtPartLevel = new TH2D(name.Data(), name.Data(),100,0,100,50,0,2);
fOutput->Add((TH2D*) fhJetPtResolutionVsPtPartLevel);
}
//2D unfolding -------------------------------
if(fMode == AliAnalysisTaskRevEA::kMC){
//Auxiliary variables for Sparse object
// Particle Level jet pT is CORRECTED on Rhokt
const Int_t fNumberOfDimensions = 4;
const Int_t fSparseBinsNumber_JetPtRhokT[fNumberOfDimensions] = {ndeltaPhiBins, numberBins_jetpT_RhokT, ndeltaPhiBins, numberBins_jetpT_RhokT};
//Inclusive jets
// Missed events
name = Form("MissedEvents_Phi_JetPt_Rhokt_PartLevel_InclusiveJets_%s", trig[kMB].Data());
fhPhi_JetPtPartLevel_InclusiveJets = new TH2D (name.Data(), "Missed events phi vs inclusive jet pT RhokT part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhPhi_JetPtPartLevel_InclusiveJets);
//Sparse object as basis for RooUnfoldResponse object
name = Form("Phi_JetPtRhokT_DetLevel_Vs_Phi_JetPt_Rhokt_PartLevel_InclusiveJets_%s", trig[kMB].Data());
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets = new THnSparseD (name.Data(), "Phi vs Jet pT RhokT for filling response matrix with inclusive jets", fNumberOfDimensions, fSparseBinsNumber_JetPtRhokT, NULL, NULL);
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets->SetBinEdges(3, jetPtRhokT_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhPhi_JetPtDetLevel_Vs_Phi_JetPtPartLevel_InclusiveJets);
//Jets from events with TT
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
//Missed events for RM initialization, K.A.
name = Form("MissedEvents_DeltaPhi_JetPt_Rhokt_PartLevel_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data()); // first-> event trigger; second-> TT bin
fhDeltaPhi_JetPtPartLevel[itt] = new TH2D (name.Data(), "Missed events delta phi vs jet pT RhokT part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhDeltaPhi_JetPtPartLevel[itt]);
// Modified by KA
name = Form("MissedEvents_DeltaPhi_JetPt_Rhokt_PartLevel_Corresp_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data()); // first-> event trigger; second-> TT bin
fhDeltaPhi_JetPtPartLevel_CorrespTT[itt] = new TH2D (name.Data(), "Missed events delta phi vs jet pT RhokT part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_RhokT, jetPtRhokT_Bins);
fOutput->Add((TH2D*) fhDeltaPhi_JetPtPartLevel_CorrespTT[itt]);
//Sparse object as basis for RooUnfoldResponse object
name = Form("DeltaPhi_JetPt_Rhokt_DetLevel_Vs_DeltaPhi_JetPt_Rhokt_PartLevel_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT RhokT for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_JetPtRhokT, NULL, NULL);
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt]->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt]->SetBinEdges(3, jetPtRhokT_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel[itt]);
// Modified by KA
name = Form("DeltaPhi_JetPt_Rhokt_DetLevel_Vs_DeltaPhi_JetPt_Rhokt_PartLevel_Corresp_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT RhokT for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_JetPtRhokT, NULL, NULL);
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt]->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt]->SetBinEdges(3, jetPtRhokT_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtPartLevel_CorrespTT[itt]);
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Particle Level jet pT is NOT CORRECTED on Rhokt (added by KA)
const Int_t fSparseBinsNumber_PartLevel_JetPtZero[fNumberOfDimensions] = {ndeltaPhiBins, numberBins_jetpT_RhokT, ndeltaPhiBins, numberBins_jetpT_Zero};
const Int_t fSparseBinsNumber_JetPtZero[fNumberOfDimensions] = {ndeltaPhiBins, numberBins_jetpT_Zero, ndeltaPhiBins, numberBins_jetpT_Zero};
//Inclusive jets
//Missed events
name = Form("MissedEvents_Phi_JetPtZeroPartLevel_InclusiveJets_%s", trig[kMB].Data());
fhPhi_JetPtZeroPartLevel_InclusiveJets = new TH2D (name.Data(), "Missed events phi vs inclusive jet pT zero part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_Zero, jetPtZero_Bins); // added by KA
fOutput->Add((TH2D*) fhPhi_JetPtZeroPartLevel_InclusiveJets);
// Sparse object as basis for RooUnfoldResponse object. Part level jet pT is not corrected on Rhokt
name = Form("Phi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets_%s", trig[kMB].Data());
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets = new THnSparseD (name.Data(), "Phi vs Jet pT zero for filling response matrix with inclusive jets", fNumberOfDimensions, fSparseBinsNumber_PartLevel_JetPtZero, NULL, NULL); // added by KA
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhPhi_JetPtDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets);
// Sparse object as basis for RooUnfoldResponse object. Jet pT is not corrected on Rhokt
name = Form("Phi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets_%s", trig[kMB].Data());
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets = new THnSparseD (name.Data(), "Phi vs Jet pT zero for filling response matrix with inclusive jets", fNumberOfDimensions, fSparseBinsNumber_JetPtZero, NULL, NULL); // added by KA
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(1, jetPtZero_Bins); //Jet pT detector level
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhPhi_JetPtZeroDetLevel_Vs_Phi_JetPtZeroPartLevel_InclusiveJets);
for(Int_t itt = 0; itt < fnHadronTTBins; itt++){
//Missed events for RM initialization, K.A. Part level jet pT is not corrected on RhokT
name = Form("MissedEvents_DeltaPhi_JetPtZero_PartLevel_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data()); // first-> event trigger; second-> TT bin
fhDeltaPhi_JetPtZero_PartLevel[itt] = new TH2D (name.Data(), "Missed events delta phi vs jet pT zero part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_Zero, jetPtZero_Bins); // added by KA
fOutput->Add((TH2D*) fhDeltaPhi_JetPtZero_PartLevel[itt]);
//Sparse object as basis for RooUnfoldResponse object. Part level jet pT is NOT corrected on RhokT
name = Form("DeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT zero for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_PartLevel_JetPtZero, NULL, NULL); // added by KA
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]);
//Sparse object as basis for RooUnfoldResponse object. Jet pT is NOT corrected on RhokT
name = Form("DeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT zero for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_JetPtZero, NULL, NULL); // added by KA
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(1, jetPtZero_Bins); //Jet pT detector level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel[itt]);
//_________________________________________________________
// Response matrix constructed w.r.t. corresponding TT
//Missed events for RM initialization, K.A. Part level jet pT is not corrected on RhokT
name = Form("MissedEvents_DeltaPhi_JetPtZero_PartLevel_Corresp_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data()); // first-> event trigger; second-> TT bin
fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = new TH2D (name.Data(), "Missed events delta phi vs jet pT zero part level", ndeltaPhiBins, deltaPhiBins, numberBins_jetpT_Zero, jetPtZero_Bins); // added by KA
fOutput->Add((TH2D*) fhDeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]);
//Sparse object as basis for RooUnfoldResponse object. Part level jet pT is NOT corrected on RhokT
name = Form("DeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_Corresp_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT zero for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_PartLevel_JetPtZero, NULL, NULL); // added by KA
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(1, jetPtRhokT_Bins); //Jet pT detector level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]);
//Sparse object as basis for RooUnfoldResponse object. Jet pT is NOT corrected on RhokT
name = Form("DeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_Corresp_TTH%d_%d_%s", fHadronTTLowPt[itt], fHadronTTHighPt[itt], trig[kMB].Data());
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt] = new THnSparseD (name.Data(), "Delta phi vs jet pT zero for filling response matrix", fNumberOfDimensions, fSparseBinsNumber_JetPtZero, NULL, NULL); // added by KA
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(0, deltaPhiBins); //Delta phi detector level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(1, jetPtZero_Bins); //Jet pT detector level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(2, deltaPhiBins); //Delta phi particle level
fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]->SetBinEdges(3, jetPtZero_Bins); //Jet pT particle level
fOutput->Add((THnSparse*) fhDeltaPhi_JetPtZeroDetLevel_Vs_DeltaPhi_JetPtZeroPartLevel_CorrespTT[itt]);
}
}
//end of 2D unfolding -------------------------------
//Auxiliary jet pT spectra filled event by event which will not go to output
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
name = Form("fhRecoilJetPtEvtByEvent_TTH%d_%d", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtEvtByEvent[itt] = new TH1D(name.Data(),name.Data(),100,0,100);
}
if(fMode == AliAnalysisTaskRevEA::kMC){
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
name = Form("fhRecoilJetPtEvtByEvent_TTH%d_%d_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhRecoilJetPtEvtByEventPartLevel[itt] = new TH1D(name.Data(),name.Data(),100,0,100);
}
}
//Count multiplicity of high-pT jets per event
const Int_t khighptjetdim = 3;
Int_t highptjetbins[khighptjetdim] = {40, 50, 10};
Double_t highptjetxmin[khighptjetdim] = { 0., 0, 0.};
Double_t highptjetxmax[khighptjetdim] = {40., 50, 10.};
//Count multiplicity of recoil high-pT jets per event
for(Int_t itg=kMB; itg<=kHM; itg++){
if((fMode == AliAnalysisTaskRevEA::kMC) && itg == kHM) continue;
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
name = Form("fhNumberOfHighPtJetsRecoil_%s_TTH%d_%d",trig[itg].Data(), fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhNumberOfHighPtJetsRecoil[itg][itt] = new THnSparseF(name.Data(),"Number of recoil jets with pt above X", khighptjetdim, highptjetbins, highptjetxmin, highptjetxmax);
fOutput->Add((THnSparse*) fhNumberOfHighPtJetsRecoil[itg][itt]);
}
}
if(fMode == AliAnalysisTaskRevEA::kMC){
for(Int_t itt=0; itt<fnHadronTTBins; itt++){ //response matrix in events with TTH
name = Form("fhNumberOfHighPtJetsRecoil_MB_TTH%d_%d_PartLevel", fHadronTTLowPt[itt], fHadronTTHighPt[itt]);
fhNumberOfHighPtJetsRecoilPartLevel[itt] = new THnSparseF(name.Data(),"Number of recoil jets with pt above X particle level", khighptjetdim, highptjetbins, highptjetxmin, highptjetxmax);
fOutput->Add((THnSparse*) fhNumberOfHighPtJetsRecoilPartLevel[itt]);
}
}
// =========== Switch on Sumw2 for all histos ===========
for(Int_t i=0; i<fOutput->GetEntries(); i++){
TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
if(h1){
h1->Sumw2();
continue;
}
THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
if(hn){
hn->Sumw2();
}
}
TH1::AddDirectory(oldStatus);
PostData(1, fOutput);
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::RetrieveEventObjects() {
//
// retrieve event objects
//
if(!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) return kFALSE;
return kTRUE;
}
//________________________________________________________________________
Bool_t AliAnalysisTaskRevEA::Run(){
// Run analysis code here, if needed. It will be executed before FillHistograms().
return kTRUE;
}
//________________________________________________________________________
Double_t AliAnalysisTaskRevEA::GetDeltaPt(Double_t phiTT, Double_t etaTT, Double_t phiLJ, Double_t etaLJ, Double_t phiSJ, Double_t etaSJ, Double_t rho, Int_t level){
Double_t rcEta = fRandom->Uniform( fJetContainerDetLevel->GetJetEtaMin(), fJetContainerDetLevel->GetJetEtaMax());
Double_t rcPhi = fRandom->Uniform(0, TMath::TwoPi());
Double_t jetR = fJetContainerDetLevel->GetJetRadius();
Double_t jetR2 = jetR*jetR; //square of jet R
Double_t exclR2 = 4*jetR2; //rc axis has to be 2R far away from the LJ and SJ jet axis
Double_t dphirc=0, detarc=0; //distance of jet from the random cone
Int_t irc=0;
Bool_t isCloseLJ = kTRUE;
Bool_t isCloseSJ = kTRUE;
Bool_t isCloseTT = kTRUE;
while(irc<1000){
isCloseLJ = kTRUE;
isCloseSJ = kTRUE;
isCloseTT = kTRUE;
if(etaLJ<10){
dphirc = TVector2::Phi_mpi_pi(phiLJ - rcPhi);
detarc = etaLJ - rcEta;
if( dphirc*dphirc + detarc*detarc > exclR2 ) isCloseLJ = kFALSE;
}else{
isCloseLJ = kFALSE;
}
if(etaSJ<10){
dphirc = TVector2::Phi_mpi_pi(phiSJ - rcPhi);
detarc = etaSJ - rcEta;
if( dphirc*dphirc + detarc*detarc > exclR2 ) isCloseSJ = kFALSE;
}else{
isCloseSJ = kFALSE;
}
dphirc = TVector2::Phi_mpi_pi(phiTT - rcPhi);
detarc = etaTT - rcEta;
if( dphirc*dphirc + detarc*detarc > exclR2 ) isCloseTT = kFALSE;
if(!isCloseSJ && !isCloseLJ && !isCloseTT){
//this random cone is far away from leading and subleading jet
break;
}else{ //generate a new random cone position
rcEta = fRandom->Uniform( fJetContainerDetLevel->GetJetEtaMin(), fJetContainerDetLevel->GetJetEtaMax());
rcPhi = fRandom->Uniform(0, TMath::TwoPi());
}
irc++;
}
Double_t sumptrc = 0.;
AliVParticle *track = NULL; //jet constituent
if(level == kDetLevel){
for(auto trackIterator : fTrkContainerDetLevel->accepted_momentum() ){
// trackIterator is a std::map of AliTLorentzVector and AliVTrack
track = trackIterator.second; // Get the full track
if(!track) continue;
if(IsTrackInAcceptance(track, kDetLevel)){
dphirc = TVector2::Phi_mpi_pi(track->Phi() - rcPhi);
detarc = track->Eta() - rcEta;
if( dphirc*dphirc + detarc*detarc < jetR2 ){
sumptrc += track->Pt();
}
}
}
//Delta pT sum of momenta in the cone
}else{
for(auto mcPartIterator : fParticleContainerPartLevel->accepted_momentum() ){
track = mcPartIterator.second; // Get the pointer to mc particle object
if(!track) continue;
if(IsTrackInAcceptance(track, kPartLevel)){
dphirc = TVector2::Phi_mpi_pi(track->Phi() - rcPhi);
detarc = track->Eta() - rcEta;
if( dphirc*dphirc + detarc*detarc < jetR2 ){
sumptrc += track->Pt();
}
}
}
}
return ( sumptrc - TMath::Pi()*jetR2*rho);
}
| 43.120031 | 271 | 0.666679 | [
"object",
"vector"
] |
0e32844ba012b0aaa7a7c34d4b2b51e973e22266 | 8,420 | cc | C++ | src/snapshot/builtin-deserializer.cc | mtk-watch/android_external_v8 | 29eb30806a59123b1f9faf9083a12d26fa418fad | [
"BSD-3-Clause"
] | 3 | 2015-11-15T05:58:32.000Z | 2019-03-19T11:29:44.000Z | src/snapshot/builtin-deserializer.cc | mtk-watch/android_external_v8 | 29eb30806a59123b1f9faf9083a12d26fa418fad | [
"BSD-3-Clause"
] | null | null | null | src/snapshot/builtin-deserializer.cc | mtk-watch/android_external_v8 | 29eb30806a59123b1f9faf9083a12d26fa418fad | [
"BSD-3-Clause"
] | 10 | 2015-10-15T06:16:55.000Z | 2019-06-23T18:52:25.000Z | // Copyright 2017 the V8 project 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 "src/snapshot/builtin-deserializer.h"
#include "src/assembler-inl.h"
#include "src/interpreter/interpreter.h"
#include "src/objects-inl.h"
#include "src/snapshot/snapshot.h"
namespace v8 {
namespace internal {
using interpreter::Bytecodes;
using interpreter::Interpreter;
// Tracks the code object currently being deserialized (required for
// allocation).
class DeserializingCodeObjectScope {
public:
DeserializingCodeObjectScope(BuiltinDeserializer* builtin_deserializer,
int code_object_id)
: builtin_deserializer_(builtin_deserializer) {
DCHECK_EQ(BuiltinDeserializer::kNoCodeObjectId,
builtin_deserializer->current_code_object_id_);
builtin_deserializer->current_code_object_id_ = code_object_id;
}
~DeserializingCodeObjectScope() {
builtin_deserializer_->current_code_object_id_ =
BuiltinDeserializer::kNoCodeObjectId;
}
private:
BuiltinDeserializer* builtin_deserializer_;
DISALLOW_COPY_AND_ASSIGN(DeserializingCodeObjectScope)
};
BuiltinDeserializer::BuiltinDeserializer(Isolate* isolate,
const BuiltinSnapshotData* data)
: Deserializer(data, false) {
code_offsets_ = data->BuiltinOffsets();
DCHECK_EQ(BSU::kNumberOfCodeObjects, code_offsets_.length());
DCHECK(std::is_sorted(code_offsets_.begin(), code_offsets_.end()));
Initialize(isolate);
}
void BuiltinDeserializer::DeserializeEagerBuiltinsAndHandlers() {
DCHECK(!AllowHeapAllocation::IsAllowed());
DCHECK_EQ(0, source()->position());
// Deserialize builtins.
Builtins* builtins = isolate()->builtins();
for (int i = 0; i < BSU::kNumberOfBuiltins; i++) {
if (IsLazyDeserializationEnabled() && Builtins::IsLazy(i)) {
// Do nothing. These builtins have been replaced by DeserializeLazy in
// InitializeFromReservations.
DCHECK_EQ(builtins->builtin(Builtins::kDeserializeLazy),
builtins->builtin(i));
} else {
builtins->set_builtin(i, DeserializeBuiltinRaw(i));
}
}
#ifdef DEBUG
for (int i = 0; i < BSU::kNumberOfBuiltins; i++) {
Object* o = builtins->builtin(i);
DCHECK(o->IsCode() && Code::cast(o)->is_builtin());
}
#endif
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_builtin_code) {
// We can't print builtins during deserialization because they may refer
// to not yet deserialized builtins.
for (int i = 0; i < BSU::kNumberOfBuiltins; i++) {
if (!IsLazyDeserializationEnabled() || !Builtins::IsLazy(i)) {
Code* code = builtins->builtin(i);
const char* name = Builtins::name(i);
code->PrintBuiltinCode(isolate(), name);
}
}
}
#endif
// Deserialize bytecode handlers.
Interpreter* interpreter = isolate()->interpreter();
DCHECK(!isolate()->interpreter()->IsDispatchTableInitialized());
BSU::ForEachBytecode([=](Bytecode bytecode, OperandScale operand_scale) {
// Bytecodes without a dedicated handler are patched up in a second pass.
if (!Bytecodes::BytecodeHasHandler(bytecode, operand_scale)) return;
// If lazy-deserialization is enabled and the current bytecode is lazy,
// we write the generic LazyDeserialization handler into the dispatch table
// and deserialize later upon first use.
Code* code = (FLAG_lazy_handler_deserialization &&
IsLazyDeserializationEnabled() && Bytecodes::IsLazy(bytecode))
? GetDeserializeLazyHandler(operand_scale)
: DeserializeHandlerRaw(bytecode, operand_scale);
interpreter->SetBytecodeHandler(bytecode, operand_scale, code);
});
// Patch up holes in the dispatch table.
Code* illegal_handler = interpreter->GetBytecodeHandler(
Bytecode::kIllegal, OperandScale::kSingle);
BSU::ForEachBytecode([=](Bytecode bytecode, OperandScale operand_scale) {
if (Bytecodes::BytecodeHasHandler(bytecode, operand_scale)) return;
interpreter->SetBytecodeHandler(bytecode, operand_scale, illegal_handler);
});
DCHECK(isolate()->interpreter()->IsDispatchTableInitialized());
}
Code* BuiltinDeserializer::DeserializeBuiltin(int builtin_id) {
allocator()->ReserveAndInitializeBuiltinsTableForBuiltin(builtin_id);
DisallowHeapAllocation no_gc;
Code* code = DeserializeBuiltinRaw(builtin_id);
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_builtin_code) {
const char* name = Builtins::name(builtin_id);
code->PrintBuiltinCode(isolate(), name);
}
#endif // ENABLE_DISASSEMBLER
return code;
}
Code* BuiltinDeserializer::DeserializeHandler(Bytecode bytecode,
OperandScale operand_scale) {
allocator()->ReserveForHandler(bytecode, operand_scale);
DisallowHeapAllocation no_gc;
return DeserializeHandlerRaw(bytecode, operand_scale);
}
Code* BuiltinDeserializer::DeserializeBuiltinRaw(int builtin_id) {
DCHECK(!AllowHeapAllocation::IsAllowed());
DCHECK(Builtins::IsBuiltinId(builtin_id));
DeserializingCodeObjectScope scope(this, builtin_id);
const int initial_position = source()->position();
source()->set_position(code_offsets_[builtin_id]);
Object* o = ReadDataSingle();
DCHECK(o->IsCode() && Code::cast(o)->is_builtin());
// Rewind.
source()->set_position(initial_position);
// Flush the instruction cache.
Code* code = Code::cast(o);
Assembler::FlushICache(code->raw_instruction_start(),
code->raw_instruction_size());
PROFILE(isolate(), CodeCreateEvent(CodeEventListener::BUILTIN_TAG,
AbstractCode::cast(code),
Builtins::name(builtin_id)));
LOG_CODE_EVENT(isolate(),
CodeLinePosInfoRecordEvent(
code->raw_instruction_start(),
ByteArray::cast(code->source_position_table())));
return code;
}
Code* BuiltinDeserializer::DeserializeHandlerRaw(Bytecode bytecode,
OperandScale operand_scale) {
DCHECK(!AllowHeapAllocation::IsAllowed());
DCHECK(Bytecodes::BytecodeHasHandler(bytecode, operand_scale));
const int code_object_id = BSU::BytecodeToIndex(bytecode, operand_scale);
DeserializingCodeObjectScope scope(this, code_object_id);
const int initial_position = source()->position();
source()->set_position(code_offsets_[code_object_id]);
Object* o = ReadDataSingle();
DCHECK(o->IsCode() && Code::cast(o)->kind() == Code::BYTECODE_HANDLER);
// Rewind.
source()->set_position(initial_position);
// Flush the instruction cache.
Code* code = Code::cast(o);
Assembler::FlushICache(code->raw_instruction_start(),
code->raw_instruction_size());
std::string name = Bytecodes::ToString(bytecode, operand_scale);
PROFILE(isolate(), CodeCreateEvent(CodeEventListener::HANDLER_TAG,
AbstractCode::cast(code), name.c_str()));
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_builtin_code) {
code->PrintBuiltinCode(isolate(), name.c_str());
}
#endif // ENABLE_DISASSEMBLER
return code;
}
uint32_t BuiltinDeserializer::ExtractCodeObjectSize(int code_object_id) {
DCHECK_LT(code_object_id, BSU::kNumberOfCodeObjects);
const int initial_position = source()->position();
// Grab the size of the code object.
source()->set_position(code_offsets_[code_object_id]);
byte data = source()->Get();
USE(data);
DCHECK_EQ(kNewObject | kPlain | kStartOfObject | CODE_SPACE, data);
const uint32_t result = source()->GetInt() << kObjectAlignmentBits;
// Rewind.
source()->set_position(initial_position);
return result;
}
Code* BuiltinDeserializer::GetDeserializeLazyHandler(
interpreter::OperandScale operand_scale) const {
STATIC_ASSERT(interpreter::BytecodeOperands::kOperandScaleCount == 3);
switch (operand_scale) {
case OperandScale::kSingle:
return Code::cast(isolate()->heap()->deserialize_lazy_handler());
case OperandScale::kDouble:
return Code::cast(isolate()->heap()->deserialize_lazy_handler_wide());
case OperandScale::kQuadruple:
return Code::cast(
isolate()->heap()->deserialize_lazy_handler_extra_wide());
}
UNREACHABLE();
}
} // namespace internal
} // namespace v8
| 34.367347 | 80 | 0.7019 | [
"object"
] |
0e33eae70403f33774af6c3198c19544d8265ff8 | 121,402 | cpp | C++ | accera/value/src/MLIREmitterContext.cpp | microsoft/Accera | 4ec583857853cfb318634aef9e671f73cedba662 | [
"MIT"
] | 19 | 2022-01-26T18:12:54.000Z | 2022-03-25T10:37:21.000Z | accera/value/src/MLIREmitterContext.cpp | microsoft/Accera | 4ec583857853cfb318634aef9e671f73cedba662 | [
"MIT"
] | 4 | 2022-01-28T00:31:48.000Z | 2022-02-25T14:28:32.000Z | accera/value/src/MLIREmitterContext.cpp | microsoft/Accera | 4ec583857853cfb318634aef9e671f73cedba662 | [
"MIT"
] | 2 | 2022-01-26T14:14:45.000Z | 2022-02-01T06:08:17.000Z | ////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// Authors: Kern Handa
////////////////////////////////////////////////////////////////////////////////////////////////////
#include "MLIREmitterContext.h"
#include "CompilerOptions.h"
#include <ir/include/DialectRegistry.h>
#include <ir/include/IRUtil.h>
#include <ir/include/InitializeAccera.h>
#include <ir/include/TranslateToHeader.h>
#include <ir/include/exec/ExecutionPlanAttributes.h>
#include <ir/include/exec/VectorizationInfo.h>
#include <ir/include/nest/LoopNestOps.h>
#include <ir/include/value/ValueAttributes.h>
#include <ir/include/value/ValueFuncOp.h>
#include <transforms/include/value/ValueToStandardLoweringPass.h>
#include <utilities/include/Exception.h>
#include <utilities/include/MemoryLayout.h>
#include <utilities/include/ZipIterator.h>
#include <value/include/Debugging.h>
#include <value/include/MatrixFragment.h>
#include <mlir/Conversion/LLVMCommon/TypeConverter.h>
#include <mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h>
#include <mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h>
#include <mlir/Dialect/Affine/IR/AffineOps.h>
#include <mlir/Dialect/GPU/GPUDialect.h>
#include <mlir/Dialect/LLVMIR/LLVMDialect.h>
#include <mlir/Dialect/LLVMIR/LLVMTypes.h>
#include <mlir/Dialect/Linalg/IR/LinalgOps.h>
#include <mlir/Dialect/MemRef/IR/MemRef.h>
#include <mlir/Dialect/SCF/SCF.h>
#include <mlir/Dialect/SPIRV/IR/SPIRVOps.h>
#include <mlir/Dialect/SPIRV/IR/SPIRVTypes.h>
#include <mlir/Dialect/SPIRV/IR/TargetAndABI.h>
#include <mlir/Dialect/StandardOps/IR/Ops.h>
#include <mlir/IR/Attributes.h>
#include <mlir/IR/Builders.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/BuiltinTypes.h>
#include <mlir/IR/Diagnostics.h>
#include <mlir/IR/Location.h>
#include <mlir/IR/MLIRContext.h>
#include <mlir/IR/SymbolTable.h>
#include <mlir/IR/Types.h>
#include <mlir/Pass/Pass.h>
#include <mlir/Pass/PassManager.h>
#include <mlir/Support/LLVM.h>
#include <mlir/Support/LogicalResult.h>
#include <llvm/ADT/SmallVector.h>
#include <llvm/ADT/StringRef.h>
#include <llvm/ADT/TypeSwitch.h>
#include <llvm/Support/Debug.h>
#include <llvm/Support/ErrorHandling.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/Support/raw_os_ostream.h>
using namespace accera;
using namespace accera::utilities;
using namespace accera::value;
using ConstantData = accera::value::detail::ConstantData;
namespace
{
mlir::Type ToLLVMMemrefDescriptorType(mlir::OpBuilder& builder, ::accera::value::Value value); // Forward declare
struct InitAccera
{
InitAccera(::mlir::MLIRContext* ctx) :
_ownedContext(ctx ? nullptr : new mlir::MLIRContext),
_context(ctx ? ctx : _ownedContext.get())
{
accera::ir::InitializeAccera();
// By default, eagerly load all of our registered dialects in our owned MLIRContext
// Eventually we may want to instead lazily load dialects once we have more
// dialects to deal with
_context->appendDialectRegistry(ir::GetDialectRegistry());
_context->loadAllAvailableDialects();
}
protected:
mlir::MLIRContext& context() { return *_context; }
private:
std::unique_ptr<mlir::MLIRContext> _ownedContext;
mlir::MLIRContext* _context;
};
mlir::Type ToMLIRType(mlir::OpBuilder& builder, ValueType type)
{
switch (type)
{
// Signed ints are treated as "signless" (i.e. represented without a sign).
// Unsigned ints are treated as "non-signless" (i.e. represented with a sign)
// Non-signless ints must to be converted to signless ints (preserving their
// underlying values) before calling standard / arithmetic ops
case ValueType::Boolean:
return builder.getIntegerType(1);
case ValueType::Byte: // = Uint8
return builder.getIntegerType(8, /*isSigned=*/false);
case ValueType::Int8:
return builder.getIntegerType(8);
case ValueType::Int16:
return builder.getIntegerType(16);
case ValueType::Int32:
return builder.getIntegerType(32);
case ValueType::Int64:
return builder.getIntegerType(64);
case ValueType::Uint16:
return builder.getIntegerType(16, /*isSigned=*/false);
case ValueType::Uint32:
return builder.getIntegerType(32, /*isSigned=*/false);
case ValueType::Uint64:
return builder.getIntegerType(64, /*isSigned=*/false);
case ValueType::Index:
return builder.getIndexType();
case ValueType::Float16:
return builder.getF16Type();
case ValueType::Float:
return builder.getF32Type();
case ValueType::Double:
return builder.getF64Type();
case ValueType::Void:
[[fallthrough]];
case ValueType::Undefined:
[[fallthrough]];
default:
throw LogicException(LogicExceptionErrors::illegalState, "Unknown type conversion");
}
}
MemoryLayout GetSubArrayLayout(const MemoryLayout& originalLayout, const MemoryShape& shape, const std::vector<int64_t>& stridesValue)
{
return { originalLayout, shape, stridesValue };
}
MemoryLayout GetSliceLayout(const MemoryLayout& originalLayout, std::vector<int64_t> slicedDimensions)
{
std::sort(slicedDimensions.begin(), slicedDimensions.end(), std::greater<int64_t>());
MemoryLayout result = originalLayout;
for (auto dim : slicedDimensions)
{
result = result.GetSliceLayout(dim);
}
return result;
}
MemoryLayout GetMergeDimLayout(const MemoryLayout& originalLayout, int64_t dim1, int64_t dim2)
{
return originalLayout.GetMergedDimensionsLayout(dim1, dim2);
}
MemoryLayout GetSplitDimLayout(const MemoryLayout& originalLayout, int64_t dim, int64_t size)
{
return originalLayout.GetSplitDimensionLayout(dim, size);
}
mlir::MemRefType MemoryLayoutToMemRefType(mlir::OpBuilder& builder, const MemoryLayout& layout, ValueType valueType, bool useDynamicOffset)
{
auto mlirElemType = ToMLIRType(builder, valueType);
if (layout == ScalarLayout)
{
return mlir::MemRefType::get({}, mlirElemType);
}
auto size = layout.GetActiveSize().ToVector();
auto strides = layout.GetIncrement().ToVector();
int64_t offset = useDynamicOffset ? mlir::MemRefType::getDynamicStrideOrOffset() : static_cast<int64_t>(layout.GetFirstEntryOffset());
auto context = builder.getContext();
auto stridedMap = mlir::makeStridedLinearLayoutMap(strides, offset, context);
auto type = mlir::MemRefType::get(size, mlirElemType, stridedMap, (unsigned)layout.GetMemorySpace());
return type;
}
mlir::MemRefType MemoryLayoutToMemRefType(mlir::OpBuilder& builder, const MemoryLayout& layout, ValueType valueType)
{
return MemoryLayoutToMemRefType(builder, layout, valueType, false);
}
auto MemoryLayoutToTensorType(mlir::OpBuilder& builder, const MemoryLayout& layout, ValueType valueType)
{
// TODO: Figure out whether this assert needs to be active
// assert(layout.IsCanonicalOrder() && "Can only get a tensor type from a canonically-ordered layout");
auto mlirElemType = ToMLIRType(builder, valueType);
llvm::SmallVector<int64_t, 4> extents;
extents.append(layout.GetExtent().begin(), layout.GetExtent().end());
auto type = mlir::RankedTensorType::get(extents, mlirElemType);
return type;
}
mlir::Type ToMLIRType(mlir::OpBuilder& builder, Value value)
{
if (value.IsConstrained())
{
auto& layout = value.GetLayout();
if (layout == ScalarLayout)
{
return ToMLIRType(builder, value.GetBaseType());
}
else
{
return MemoryLayoutToMemRefType(builder, layout, value.GetBaseType());
}
}
else
{
auto mlirElemType = ToMLIRType(builder, value.GetBaseType());
auto type = mlir::UnrankedMemRefType::get(mlirElemType, 0);
return type;
}
}
mlir::FunctionType ToMLIRType(mlir::OpBuilder& builder, const FunctionDeclaration& decl)
{
const auto& argValues = decl.GetParameterTypes();
const auto& returnValue = decl.GetReturnType();
std::vector<mlir::Type> variableArgTypes(argValues.size());
if (decl.UseMemRefDescriptorArgs())
{
std::transform(argValues.begin(), argValues.end(), variableArgTypes.begin(), [&builder](Value value) {
return ToLLVMMemrefDescriptorType(builder, value);
});
}
else
{
std::transform(argValues.begin(), argValues.end(), variableArgTypes.begin(), [&builder](Value value) {
return ToMLIRType(builder, value);
});
}
auto fnType = builder.getFunctionType(variableArgTypes, [&returnValue, &builder]() -> llvm::ArrayRef<mlir::Type> {
if (!returnValue)
{
return llvm::None;
}
else
{
return ToMLIRType(builder, *returnValue);
}
}());
return fnType;
}
[[nodiscard]] mlir::Value ResolveMLIRScalar(mlir::OpBuilder& builder, mlir::Value v)
{
if (auto type = v.getType(); type.isIntOrIndexOrFloat())
{
return v;
}
else if (auto shapedType = type.dyn_cast<mlir::ShapedType>();
shapedType &&
shapedType.hasStaticShape() &&
shapedType.getNumElements() == 1 &&
shapedType.hasRank() &&
shapedType.getRank() == 0)
{
auto loc = builder.getUnknownLoc();
return builder.create<accera::ir::value::GetElementOp>(loc, v);
}
return v;
}
[[nodiscard]] mlir::Value ResolveMLIRIndex(mlir::OpBuilder& builder, mlir::Value v)
{
v = ResolveMLIRScalar(builder, v);
auto type = v.getType();
if (type.isa<mlir::IntegerType>())
{
auto loc = builder.getUnknownLoc();
return builder.create<mlir::IndexCastOp>(loc, v, mlir::IndexType::get(v.getContext()));
}
// Index types fall through
return v;
}
[[nodiscard]] mlir::Value ToMLIRValue(mlir::OpBuilder& builder, const ViewAdapter& view)
{
auto value = view.GetValue();
if (value.IsEmpty() || value.IsUndefined() || value.IsConstant())
{
return {};
}
else
{
if (auto emittable = value.Get<Emittable>().GetDataAs<MLIRContext::EmittableInfo*>())
{
if (!emittable->isGlobal)
{
return mlir::Value::getFromOpaquePointer(emittable->data);
}
else
{
auto op = ir::value::GlobalOp::getFromOpaquePointer(emittable->data);
auto insertionBlock = builder.getInsertionBlock();
auto it = insertionBlock->begin();
auto end = insertionBlock->end();
while (it != end && llvm::isa<mlir::ConstantOp,
ir::value::ReferenceGlobalOp>(it))
{
++it;
}
auto loc = builder.getUnknownLoc();
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPoint(insertionBlock, it);
return builder.create<ir::value::ReferenceGlobalOp>(loc, op);
}
}
}
return {};
}
[[nodiscard]] mlir::Value ResolveMLIRIndex(mlir::OpBuilder& builder, Scalar s)
{
return ResolveMLIRIndex(builder, ResolveMLIRScalar(builder, ToMLIRValue(builder, s)));
}
std::vector<mlir::Value> ToMLIRValue(mlir::OpBuilder& builder, std::vector<Value> values)
{
std::vector<mlir::Value> mlirValues;
mlirValues.reserve(values.size());
std::transform(
values.begin(),
values.end(),
std::back_inserter(mlirValues),
[&builder](Value value) { return ToMLIRValue(builder, value); });
return mlirValues;
}
[[nodiscard]] mlir::Value ToMLIRIndex(mlir::OpBuilder& builder, Scalar index)
{
auto mlirValue = ResolveMLIRScalar(builder, ToMLIRValue(builder, index));
auto indexType = builder.getIndexType();
if (mlirValue.getType().isIndex())
{
return mlirValue;
}
else
{
auto loc = builder.getUnknownLoc();
return builder.create<mlir::IndexCastOp>(loc, mlirValue, indexType);
}
}
mlir::Type ToLLVMMemrefDescriptorType(mlir::OpBuilder& builder, ::accera::value::Value value)
{
// MemRefDescriptor structs have the following structure:
// struct MemRefDescriptor
// {
// T* allocated;
// T* aligned;
// int64_t offset;
// int64_t sizes[N];
// int64_t strides[N];
// };
using namespace mlir;
auto context = builder.getContext();
mlir::LLVMTypeConverter llvmTypeConverter(context);
auto mlirElementType = ToMLIRType(builder, value.GetBaseType());
auto llvmElementType = llvmTypeConverter.convertType(mlirElementType);
auto rank = value.GetLayout().NumDimensions();
auto llvmPtrToElementType = LLVM::LLVMPointerType::get(llvmElementType);
auto int64Type = IntegerType::get(context, 64);
auto llvmArrayRankElementSizeType = LLVM::LLVMArrayType::get(int64Type, rank);
auto memRefTy = LLVM::LLVMStructType::getLiteral(context,
{ llvmPtrToElementType, llvmPtrToElementType, int64Type, llvmArrayRankElementSizeType, llvmArrayRankElementSizeType });
return LLVM::LLVMPointerType::get(memRefTy);
}
void SetOpNameAttr(mlir::Operation* op, std::string name)
{
if (!name.empty())
{
assert(op);
if (auto symTableOp = mlir::SymbolTable::getNearestSymbolTable(op); !symTableOp)
{
llvm::errs() << "Could not find symbol table for operation " << *op << "\n";
}
else if (mlir::SymbolTable::lookupSymbolIn(symTableOp, name))
{
name += "_" + std::to_string(ir::util::GetUniqueId());
}
mlir::SymbolTable::setSymbolName(op, name);
}
}
auto GetConstantDataElementType(const ConstantData& data)
{
return std::visit(
[](auto&& data_) {
using DataType = std::decay_t<decltype(data_)>;
using ElementType = typename DataType::value_type;
return GetValueType<ElementType>();
},
data);
}
auto ConstantDataToDenseElementAttr(mlir::ShapedType shape, const ConstantData& data)
{
return std::visit(
[shape](auto&& data_) -> mlir::DenseElementsAttr {
using DataType = std::decay_t<decltype(data_)>;
using ElementType = typename DataType::value_type;
if constexpr (std::is_same_v<ElementType, Boolean>)
{
std::vector<int8_t> boolData(data_.size());
std::transform(data_.begin(), data_.end(), boolData.begin(), [](Boolean b) { return b ? 1 : 0; });
return mlir::DenseElementsAttr::get(shape, llvm::makeArrayRef(boolData));
}
else if constexpr (std::is_same_v<ElementType, index_t>)
{
throw InputException(InputExceptionErrors::invalidArgument, "Can't store an array of index type");
}
else if constexpr (std::is_same_v<ElementType, float16_t>)
{
using float16_underlying_type = typename float16_t::underlying_type;
std::vector<float16_underlying_type> fp16Data(data_.size());
std::transform(data_.begin(), data_.end(), fp16Data.begin(), [](float16_t value) { return value.data; });
return mlir::DenseElementsAttr::get(shape, llvm::makeArrayRef(fp16Data));
}
else
{
return mlir::DenseElementsAttr::get(shape, llvm::makeArrayRef(data_));
}
},
data);
}
MemoryLayout InferLayoutFromMLIRValue(mlir::Value value)
{
auto type = value.getType();
if (type.isIntOrIndexOrFloat())
{
return ScalarLayout;
}
else if (auto memRefType = type.dyn_cast<mlir::MemRefType>())
{
// bail early for the simple case
if (memRefType.getNumElements() == 1)
{
return ScalarLayout;
}
llvm::SmallVector<int64_t, 4> strides;
int64_t globalOffset;
if (failed(getStridesAndOffset(memRefType, strides, globalOffset)))
{
throw std::logic_error{ "Resource to be filled in must be valid memory" };
}
auto rank = memRefType.getRank();
std::vector<int64_t> offset(rank, 0);
// Need to sort strides to get permutation order
std::vector<int64_t> order(rank);
std::iota(order.begin(), order.end(), 0);
auto zip1 = llvm::zip(strides, order);
std::vector<std::tuple<int64_t, int64_t>> stridesAndOrder(zip1.begin(), zip1.end());
std::sort(stridesAndOrder.begin(), stridesAndOrder.end(), [](auto a, auto b) { return std::get<0>(a) > std::get<0>(b); });
std::transform(stridesAndOrder.begin(), stridesAndOrder.end(), strides.begin(), [](auto el) { return std::get<0>(el); });
std::transform(stridesAndOrder.begin(), stridesAndOrder.end(), order.begin(), [](auto el) { return std::get<1>(el); });
auto shape = memRefType.getShape();
auto memorySize = strides.front() * shape[order[0]];
// Compute extents by dividing previous stride by stride (except for the largest dimension, where we just use the size)
std::vector<int64_t> extent(strides.begin(), strides.end());
int64_t prevStride = memorySize;
for (auto& e : extent)
{
auto temp = e;
e = prevStride / e;
prevStride = temp;
}
auto zip2 = llvm::zip(order, extent);
std::vector<std::tuple<int64_t, int64_t>> permAndExtent(zip2.begin(), zip2.end());
std::sort(permAndExtent.begin(), permAndExtent.end(), [](auto a, auto b) { return std::get<0>(a) < std::get<0>(b); });
std::transform(permAndExtent.begin(), permAndExtent.end(), extent.begin(), [](auto el) { return std::get<1>(el); });
auto result = MemoryLayout{ MemoryShape{ shape.vec() }, MemoryShape{ extent }, MemoryShape{ offset }, DimensionOrder{ order } };
return result;
}
else if (auto shapedType = type.dyn_cast<mlir::ShapedType>())
{
auto shape = shapedType.getShape();
return MemoryLayout{ shape.vec() };
}
else
{
throw std::logic_error("Unknown value type");
}
}
} // namespace
namespace accera::value
{
GPUIndex::GPUIndex(std::function<Scalar(const std::string&)> fn) :
_fn(std::move(fn))
{}
Scalar GPUIndex::X()
{
return _fn("x");
}
Scalar GPUIndex::Y()
{
return _fn("y");
}
Scalar GPUIndex::Z()
{
return _fn("z");
}
struct MLIRContextBase::Impl : private InitAccera
{
friend class MLIRContext;
Impl(const std::string& moduleName) :
InitAccera(nullptr),
_ownedModule(mlir::ModuleOp::create(
mlir::UnknownLoc::get(&context()),
llvm::StringRef(moduleName))),
_mlirModule(*_ownedModule),
builder(&context()),
sourceMgrHandler(sourceMgr, &context()),
_valueModuleOp(CreateValueModuleOp(*_ownedModule))
{
builder.setInsertionPoint(module().getBody(), module().getBody()->begin());
}
Impl(mlir::ModuleOp moduleOp) :
InitAccera(moduleOp.getContext()),
_mlirModule(moduleOp),
builder(&context()),
sourceMgrHandler(sourceMgr, &context()),
_valueModuleOp(CreateValueModuleOp(moduleOp))
{
builder.setInsertionPoint(module().getBody(), module().getBody()->begin());
}
/// Globals are inserted before the first function, if any.
mlir::OpBuilder::InsertPoint getGlobalInsertPt()
{
return ir::util::GetTerminalInsertPoint<
ir::value::ValueModuleOp,
ir::value::ModuleTerminatorOp,
ir::value::ValueFuncOp>(module());
}
/// Funcs are inserted before the module terminator
mlir::OpBuilder::InsertPoint getFunctionInsertPt()
{
return ir::util::GetTerminalInsertPoint<
ir::value::ValueModuleOp,
ir::value::ModuleTerminatorOp>(module());
}
mlir::OpBuilder::InsertionGuard CreateNewScope(mlir::OpBuilder::InsertPoint insertionPoint = {})
{
mlir::OpBuilder::InsertionGuard guard(builder);
if (insertionPoint.isSet())
{
builder.restoreInsertionPoint(insertionPoint);
}
return guard;
}
ir::value::ValueModuleOp CreateValueModuleOp(mlir::ModuleOp moduleOp)
{
auto possibleModules = moduleOp.getOps<ir::value::ValueModuleOp>();
assert((possibleModules.empty() || llvm::hasSingleElement(possibleModules)) && "Multiple value modules is untested");
ir::value::ValueModuleOp valueModuleOp;
if (possibleModules.empty())
{
auto moduleBody = moduleOp.getBody();
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPoint(moduleBody, moduleBody->end());
valueModuleOp = builder.create<ir::value::ValueModuleOp>(moduleOp.getLoc(), moduleOp.getName().getValueOr("value_module"));
assert(valueModuleOp.getOperation()->getNumRegions() == 1);
}
else
{
valueModuleOp = *possibleModules.begin();
}
return valueModuleOp;
}
ir::value::ValueModuleOp module() const { return _valueModuleOp; }
void setDataLayout(const std::string& layout)
{
_mlirModule->setAttr(mlir::LLVM::LLVMDialect::getDataLayoutAttrName(), builder.getStringAttr(layout));
}
protected:
mlir::OwningModuleRef _ownedModule;
mlir::ModuleOp _mlirModule;
public:
mlir::OpBuilder builder;
private:
llvm::SourceMgr sourceMgr;
mlir::SourceMgrDiagnosticHandler sourceMgrHandler;
mlir::gpu::GPUModuleOp _gpuModuleOp = nullptr;
ir::value::ValueModuleOp _valueModuleOp;
};
MLIRContextBase::MLIRContextBase(const std::string& moduleName) :
_impl(std::make_unique<MLIRContextBase::Impl>(moduleName))
{
}
MLIRContextBase::MLIRContextBase(mlir::ModuleOp& existingModule) :
_impl(std::make_unique<MLIRContextBase::Impl>(existingModule))
{
}
MLIRContext::EmittableInfo& MLIRContext::StoreGlobalEmittable(EmittableInfo emittable)
{
emittable.isGlobal = true;
std::lock_guard lock{ _mutex };
_globalEmittables.push_front(emittable);
return _globalEmittables.front();
}
MLIRContext::EmittableInfo& MLIRContext::StoreLocalEmittable(EmittableInfo emittable)
{
std::lock_guard lock{ _mutex };
assert(!_localEmittables.empty());
_localEmittables.top().push_front(emittable);
return _localEmittables.top().front();
}
MLIRContext::MLIRContext(const std::string& moduleName, const CompilerOptions& options) :
MLIRContextBase(moduleName),
EmitterContext(options)
{
setDataLayout(options);
setDebugMode(options.debug);
_localEmittables.push({});
}
MLIRContext::MLIRContext(mlir::ModuleOp& existingModule, const CompilerOptions& options) :
MLIRContextBase(existingModule),
EmitterContext(options)
{
setDataLayout(options);
setDebugMode(options.debug);
_localEmittables.push({});
}
MLIRContext::~MLIRContext() = default;
void MLIRContext::save(std::string filename) const
{
std::error_code ec;
llvm::raw_fd_ostream s(filename, ec);
mlir::OwningModuleRef cloned = _impl->_mlirModule.clone();
SaveModule(filename, cloned.get());
}
void MLIRContext::print() const
{
llvm::raw_os_ostream s(std::cout);
_impl->_mlirModule.print(s);
}
void MLIRContext::verify() const
{
(void)_impl->_mlirModule.verify();
}
mlir::OwningModuleRef MLIRContext::cloneModule() const
{
return _impl->_mlirModule.clone();
}
void MLIRContext::writeHeader(std::optional<std::string> filename) const
{
using llvm::raw_fd_ostream;
using llvm::raw_ostream;
std::unique_ptr<raw_fd_ostream> fstream;
if (filename)
{
std::error_code ec;
fstream = std::make_unique<raw_fd_ostream>(*filename, ec);
}
raw_ostream& stream = [&]() -> raw_ostream& {
if (fstream)
{
return *fstream;
}
else
return llvm::outs();
}();
(void)ir::TranslateToHeader(_impl->_mlirModule, stream);
}
void MLIRContext::setMetadata(const std::string& key, const accera::ir::MetadataValueType& value)
{
auto context = _impl->_valueModuleOp.getContext();
auto newKeyId = mlir::Identifier::get(key, context);
auto valueAttr = ir::GetMetadataAttr(value, context);
auto metadataKeyId = mlir::Identifier::get(accera::ir::value::ValueDialect::getAcceraMetadataAttrName(), context);
auto metadataDict = _impl->_valueModuleOp->getAttrOfType<mlir::DictionaryAttr>(accera::ir::value::ValueDialect::getAcceraMetadataAttrName());
if (metadataDict == nullptr)
{
mlir::NamedAttrList mutableDict;
mutableDict.set(newKeyId, valueAttr);
_impl->_valueModuleOp->setAttr(metadataKeyId, mutableDict.getDictionary(context));
}
else
{
mlir::NamedAttrList mutableDict(metadataDict);
mutableDict.set(newKeyId, valueAttr);
_impl->_valueModuleOp->setAttr(metadataKeyId, mutableDict.getDictionary(context));
}
}
accera::ir::Metadata MLIRContext::getFullMetadata()
{
return ir::ParseFullMetadata(_impl->_valueModuleOp->getAttrOfType<mlir::DictionaryAttr>(accera::ir::value::ValueDialect::getAcceraMetadataAttrName()));
}
void MLIRContext::setDataLayout(const CompilerOptions& options)
{
if (const auto& layout = options.targetDevice.dataLayout; !layout.empty())
{
_impl->setDataLayout(layout);
}
}
void MLIRContext::setDebugMode(bool enable)
{
auto& builder = _impl->builder;
auto context = _impl->_valueModuleOp.getContext();
auto debugModeId = mlir::Identifier::get(accera::ir::GetDebugModeAttrName(), context);
if (enable)
{
_impl->_valueModuleOp->setAttr(debugModeId, builder.getUnitAttr());
}
else
{
_impl->_valueModuleOp->removeAttr(debugModeId);
}
}
void MLIRContext::EmitDebugFunction(const std::string& functionName, const std::vector<std::string>& utilityFunctionNames)
{
for (const auto& fn : _definedFunctions)
{
// Attempt to do a basename comparison instead of the the full name
if (fn.first.GetFunctionName().compare(0, functionName.length(), functionName) == 0)
{
// Do a best effort emitting of the debug function
EmitNestDebugFunction(fn.first, utilityFunctionNames);
}
}
}
template <typename Op>
Scalar CreateGPUIndexOp(mlir::OpBuilder& builder, const std::string& dim)
{
auto loc = builder.getUnknownLoc();
return Wrap(
builder.create<mlir::IndexCastOp>(loc,
builder.create<Op>(
loc,
builder.getIndexType(),
builder.getStringAttr(dim)),
builder.getI64Type()));
}
GPUIndex MLIRContext::GetGPUIndex(GPUIndexType type)
{
switch (type)
{
case GPUIndexType::BlockDim:
return GPUIndex{ [this](const std::string& dim) { return CreateGPUIndexOp<mlir::gpu::BlockDimOp>(_impl->builder, dim); } };
case GPUIndexType::BlockId:
return GPUIndex{ [this](const std::string& dim) { return CreateGPUIndexOp<mlir::gpu::BlockIdOp>(_impl->builder, dim); } };
case GPUIndexType::GridDim:
return GPUIndex{ [this](const std::string& dim) { return CreateGPUIndexOp<mlir::gpu::GridDimOp>(_impl->builder, dim); } };
case GPUIndexType::ThreadId:
return GPUIndex{ [this](const std::string& dim) { return CreateGPUIndexOp<mlir::gpu::ThreadIdOp>(_impl->builder, dim); } };
}
llvm_unreachable("Unknown GPU index type");
}
Value MLIRContext::AllocateImpl(ValueType valueType, MemoryLayout layout, size_t alignment, AllocateFlags flags)
{
auto& b = _impl->builder;
if (layout.GetMemorySpace() == MemorySpace::None)
{
layout = layout.SetMemorySpace(MemorySpace::Shared);
}
auto memrefTy = MemoryLayoutToMemRefType(b, layout, valueType);
auto insertionBlock = b.getInsertionBlock();
auto it = insertionBlock->begin();
auto end = insertionBlock->end();
while (it != end && llvm::isa<mlir::ConstantOp,
mlir::memref::AllocOp,
mlir::memref::AllocaOp,
ir::value::ReferenceGlobalOp,
ir::value::AllocOp>(it))
{
++it;
}
mlir::OpBuilder::InsertionGuard guard(b);
b.setInsertionPoint(insertionBlock, it);
auto loc = b.getUnknownLoc();
mlir::Value result = b.create<ir::value::AllocOp>(loc,
memrefTy,
alignment
? llvm::Optional{ (int64_t)alignment }
: llvm::None,
static_cast<bool>(flags & AllocateFlags::Stack)
? llvm::Optional{ accera::ir::value::MemoryAllocType::Stack }
: llvm::None);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { valueType, 1 } });
Emittable emittable{ &emittableInfo };
return Value(emittable, layout);
}
std::optional<Value> MLIRContext::GetGlobalValue(GlobalAllocationScope scope, std::string name)
{
std::string adjustedName = GetScopeAdjustedName(scope, name);
if (auto it = _globals.find(adjustedName); it != _globals.end())
{
return Value(it->second.first, it->second.second);
}
return std::nullopt;
}
Value MLIRContext::GlobalAllocateImpl(GlobalAllocationScope allocScope, std::string name, ConstantData data, MemoryLayout layout, AllocateFlags flags)
{
std::string adjustedName = GetScopeAdjustedName(allocScope, name);
if (_globals.find(adjustedName) != _globals.end())
{
throw InputException(InputExceptionErrors::invalidArgument,
"Unexpected collision in global data allocation");
}
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto scope = _impl->CreateNewScope(_impl->getGlobalInsertPt());
auto valueElemType = GetConstantDataElementType(data);
auto memrefType = MemoryLayoutToMemRefType(builder, layout, valueElemType);
auto dataType = MemoryLayoutToTensorType(builder, layout, valueElemType);
auto dataAttribute = ConstantDataToDenseElementAttr(dataType, data);
auto global = builder.create<ir::value::GlobalOp>(loc, memrefType, /*isConstant=*/true, adjustedName, dataAttribute);
EmittableInfo& emittableInfo = StoreGlobalEmittable({ global, { valueElemType, 1 } });
Emittable emittable(&emittableInfo);
_globals[adjustedName] = { emittable, layout };
return Value(emittable, layout);
}
Value MLIRContext::GlobalAllocateImpl(GlobalAllocationScope allocScope, std::string name, ValueType type, MemoryLayout layout, AllocateFlags flags)
{
std::string adjustedName = GetScopeAdjustedName(allocScope, name);
if (_globals.find(adjustedName) != _globals.end())
{
throw InputException(InputExceptionErrors::invalidArgument,
"Unexpected collision in global data allocation");
}
auto scope = _impl->CreateNewScope(_impl->getGlobalInsertPt());
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto memrefType = MemoryLayoutToMemRefType(builder, layout, type);
auto global = builder.create<ir::value::GlobalOp>(loc, memrefType, /*isConstant=*/false, adjustedName, mlir::Attribute{});
EmittableInfo& emittableInfo = StoreGlobalEmittable({ global, { type, 1 } });
Emittable emittable(&emittableInfo);
{
std::lock_guard lock{ _mutex };
_globals[adjustedName] = { emittable, layout };
}
return Value(emittable, layout);
}
detail::ValueTypeDescription MLIRContext::GetTypeImpl(Emittable emittable)
{
auto info = emittable.GetDataAs<EmittableInfo*>();
return info->desc;
}
EmitterContext::DefinedFunction MLIRContext::CreateFunctionImpl(FunctionDeclaration decl, DefinedFunction fn)
{
{
std::lock_guard lock{ _mutex };
if (auto it = _definedFunctions.find(decl); it != _definedFunctions.end())
{
return it->second;
}
}
auto& b = _impl->builder;
auto loc = b.getUnknownLoc();
auto isPublic = decl.IsPublic();
auto funcTarget = decl.Target();
auto funcRuntime = decl.Runtime();
auto isGpu = std::holds_alternative<targets::GPU>(funcTarget);
const auto& argValues = decl.GetParameterTypes();
const auto& returnValue = decl.GetReturnType();
const auto& fnName = decl.GetFunctionName();
auto argValuesCopy = argValues;
auto fnType = ToMLIRType(b, decl);
auto [fnOp, entryBlock] = std::visit(
[&](auto target) {
ir::value::ExecutionTarget executionTarget;
if constexpr (std::is_same_v<decltype(target), targets::CPU>)
{
executionTarget = ir::value::ExecutionTarget::CPU;
}
else if constexpr (std::is_same_v<decltype(target), targets::GPU>)
{
executionTarget = ir::value::ExecutionTarget::GPU;
}
mlir::OpBuilder::InsertionGuard guard(b);
b.restoreInsertionPoint(_impl->getFunctionInsertPt());
ir::value::ValueFuncOp fnOp = b.create<ir::value::ValueFuncOp>(loc,
fnName,
fnType,
executionTarget);
mlir::SymbolTable::setSymbolVisibility(fnOp, isPublic ? mlir::SymbolTable::Visibility::Public : mlir::SymbolTable::Visibility::Nested);
if (decl.EmitsCWrapper())
{
// Emit C wrappers for any functions defined in this module
fnOp->setAttr(ir::CInterfaceAttrName, b.getUnitAttr());
}
if (decl.UseRawPointerAPI())
{
fnOp->setAttr(ir::RawPointerAPIAttrName, b.getUnitAttr());
}
if (decl.EmitsHeaderDecl())
{
fnOp->setAttr(ir::HeaderDeclAttrName, b.getUnitAttr());
}
if (decl.InlineState() == FunctionInlining::never)
{
fnOp->setAttr(ir::NoInlineAttrName, b.getUnitAttr());
}
// Collect function tags into a dictionary
auto tags = decl.GetTags();
std::vector<mlir::NamedAttribute> tagAttrs;
if (!tags.empty())
{
for (const auto& tag : tags)
{
tagAttrs.emplace_back(b.getIdentifier(tag), b.getUnitAttr());
}
fnOp->setAttr(ir::FunctionTagsAttrName, b.getDictionaryAttr(tagAttrs));
}
auto baseName = decl.GetBaseName();
if (!baseName.empty())
{
fnOp->setAttr(ir::BaseNameAttrName, b.getStringAttr(baseName));
}
if constexpr (std::is_same_v<decltype(target), targets::GPU>)
{
if (funcRuntime != ExecutionRuntime::DEFAULT)
{
auto execRuntimeAttrName = ir::value::ValueModuleOp::getExecRuntimeAttrName();
auto execRuntimeAttrValue = ir::value::ExecutionRuntimeAttr::get(b.getContext(), (ir::value::ExecutionRuntime)funcRuntime);
if (auto mod = fnOp->getParentOfType<mlir::ModuleOp>())
{
mod->setAttr(execRuntimeAttrName, execRuntimeAttrValue);
}
if (auto mod = fnOp->getParentOfType<ir::value::ValueModuleOp>())
{
mod->setAttr(execRuntimeAttrName, execRuntimeAttrValue);
}
}
fnOp->setAttr(
fnOp.getGPULaunchAttrName(),
target.ToArrayAttr(b.getContext()));
}
return std::pair{ fnOp.getOperation(), &fnOp.body().back() };
},
funcTarget);
{
auto fnContext = _impl->CreateNewScope({ entryBlock, entryBlock->begin() });
mlir::OpBuilder::InsertionGuard guard(b);
b.restoreInsertionPoint({ entryBlock, entryBlock->begin() });
{
std::lock_guard lock{ _mutex };
_localEmittables.push({});
}
for (auto zipped : llvm::zip(argValuesCopy, entryBlock->getArguments()))
{
Value& value = std::get<0>(zipped);
EmittableInfo& emittableInfo = StoreLocalEmittable({ std::get<1>(zipped).getAsOpaquePointer(), value.GetType() });
Emittable emittable(&emittableInfo);
value.SetData(emittable);
}
auto returnValueCopy = returnValue;
try
{
returnValueCopy = fn(argValuesCopy);
if (returnValueCopy)
{
assert(!isGpu);
(void)b.create<accera::ir::value::ReturnOp>(loc, ToMLIRValue(b, *returnValueCopy));
}
else
{
(void)b.create<accera::ir::value::ReturnOp>(loc);
}
}
catch (...)
{
llvm::errs() << "Error when building function " << fnName << "\n";
(void)b.create<accera::ir::value::ReturnOp>(loc);
throw;
}
{
std::lock_guard lock{ _mutex };
_localEmittables.pop();
}
}
DefinedFunction returnFn = [this, fnOp = fnOp, decl, mlirExpectedValues = argValuesCopy, isGpu](std::vector<Value> args) -> std::optional<Value> {
const auto& argValues = decl.GetParameterTypes();
const auto& returnValue = decl.GetReturnType();
if (!std::equal(args.begin(),
args.end(),
argValues.begin(),
argValues.end(),
[](Value suppliedValue, Value fnValue) {
return suppliedValue.GetBaseType() == fnValue.GetBaseType();
}))
{
throw InputException(InputExceptionErrors::invalidArgument, __FILE__ " : " + std::to_string(__LINE__));
}
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
std::vector<mlir::Value> mlirArgs = ToMLIRValue(builder, args);
auto returnValueCopy = returnValue;
mlir::Operation* callOp = builder.create<ir::value::LaunchFuncOp>(loc, mlir::cast<ir::value::ValueFuncOp>(fnOp), mlirArgs);
if (returnValueCopy)
{
assert(callOp->getNumResults() == 1);
assert(!isGpu);
EmittableInfo& emittableInfo = StoreLocalEmittable({ callOp->getResult(0).getAsOpaquePointer(), returnValueCopy->GetType() });
returnValueCopy->SetData(Emittable{ &emittableInfo });
}
else
{
assert(callOp->getNumResults() == 0);
}
return returnValueCopy;
};
{
std::lock_guard lock{ _mutex };
_definedFunctions[decl] = returnFn;
}
return returnFn;
}
EmitterContext::DefinedFunction MLIRContext::DeclareExternalFunctionImpl(FunctionDeclaration decl)
{
{
std::lock_guard lock{ _mutex };
if (auto it = _definedFunctions.find(decl); it != _definedFunctions.end())
{
return it->second;
}
}
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto name = decl.GetFunctionName();
auto fnTy = ToMLIRType(builder, decl);
auto isPublic = decl.IsPublic();
auto insertionBlock = builder.getBlock();
auto parentOp = insertionBlock->getParentOp();
auto mod = accera::ir::util::CastOrGetParentOfType<mlir::ModuleOp>(parentOp);
assert(mod);
if (auto fnOp = mod.lookupSymbol<ir::value::ValueFuncOp>(name); fnOp)
{
throw InputException(InputExceptionErrors::invalidArgument, "Cannot emit an extern decl for a function that is defined in this module");
}
mlir::OpBuilder::InsertionGuard guard(builder);
builder.restoreInsertionPoint(_impl->getGlobalInsertPt());
// insert this in the mlir::ModuleOp outside of the ValueModuleOp
ir::value::ValueFuncOp fnOp = builder.create<ir::value::ValueFuncOp>(loc,
name,
fnTy,
ir::value::ExecutionTarget::CPU,
ir::value::ValueFuncOp::ExternalFuncTag{});
mlir::SymbolTable::setSymbolVisibility(fnOp, isPublic ? mlir::SymbolTable::Visibility::Public : mlir::SymbolTable::Visibility::Private);
if (decl.EmitsCWrapper())
{
// Emit C wrappers for any functions defined in this module
fnOp->setAttr(ir::CInterfaceAttrName, builder.getUnitAttr());
}
// Add to _definedFunctions so we can call it the normal way
DefinedFunction returnFn = [this, fnOp = fnOp, decl](std::vector<Value> args) -> std::optional<Value> {
const auto& argValues = decl.GetParameterTypes();
const auto& returnValue = decl.GetReturnType();
if (!std::equal(args.begin(),
args.end(),
argValues.begin(),
argValues.end(),
[](Value suppliedValue, Value fnValue) {
return suppliedValue.GetBaseType() == fnValue.GetBaseType();
}))
{
throw InputException(InputExceptionErrors::invalidArgument, __FILE__ " : " + std::to_string(__LINE__));
}
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
std::vector<mlir::Value> mlirArgs = ToMLIRValue(builder, args);
auto returnValueCopy = returnValue;
mlir::Operation* callOp = builder.create<ir::value::LaunchFuncOp>(loc, mlir::cast<ir::value::ValueFuncOp>(fnOp), mlirArgs);
if (returnValueCopy)
{
assert(callOp->getNumResults() == 1);
EmittableInfo& emittableInfo = StoreLocalEmittable({ callOp->getResult(0).getAsOpaquePointer(), returnValueCopy->GetType() });
returnValueCopy->SetData(Emittable{ &emittableInfo });
}
else
{
assert(callOp->getNumResults() == 0);
}
return returnValueCopy;
};
{
std::lock_guard lock{ _mutex };
_definedFunctions[decl] = returnFn;
}
return returnFn;
}
bool MLIRContext::IsFunctionDefinedImpl(FunctionDeclaration decl) const
{
if (std::lock_guard lock{ _mutex }; _definedFunctions.find(decl) != _definedFunctions.end())
{
return true;
}
return false;
}
Value MLIRContext::StoreConstantDataImpl(ConstantData data, MemoryLayout layout, const std::string& name)
{
EmittableInfo& emittableInfo = std::visit(
[this, &layout, name](auto&& data) -> EmittableInfo& {
assert(!data.empty());
using DataType = std::decay_t<decltype(data)>;
using ElementType = typename DataType::value_type;
auto& b = _impl->builder;
auto loc = b.getUnknownLoc();
ValueType valueElemTy = GetValueType<ElementType>();
auto mlirElemTy = ToMLIRType(b, valueElemTy);
mlir::Value op;
auto insertionBlock = b.getInsertionBlock();
auto it = insertionBlock->begin();
auto end = insertionBlock->end();
while (it != end && llvm::isa<mlir::ConstantOp>(it))
{
++it;
}
mlir::OpBuilder::InsertionGuard guard(b);
b.setInsertionPoint(insertionBlock, it);
// if we have one value and we weren't explicitly asked for a higher-ranked layout
if (data.size() == 1 && layout == ScalarLayout)
{
if constexpr (std::is_same_v<ElementType, index_t>)
{
op = b.create<mlir::ConstantIndexOp>(loc, static_cast<int64_t>(data[0]));
}
else if constexpr (std::is_same_v<ElementType, float16_t>)
{
bool losesInfo = false;
auto f = llvm::APFloat(data[0].data);
f.convert(llvm::APFloat::IEEEhalf(), llvm::APFloat::rmNearestTiesToEven, &losesInfo);
op = b.create<mlir::ConstantFloatOp>(loc, f, mlirElemTy.cast<mlir::Float16Type>());
}
else if constexpr (std::is_integral_v<ElementType> || std::is_same_v<ElementType, Boolean>)
{
auto elem = static_cast<int64_t>(data[0]);
if (std::is_unsigned_v<ElementType>)
{
// ConstantIntOp only can only have signless integer type
mlirElemTy = accera::ir::util::ToSignlessMLIRType(b, mlirElemTy);
}
op = b.create<mlir::ConstantIntOp>(loc, elem, mlirElemTy);
}
else if constexpr (std::is_floating_point_v<ElementType>)
{
op = b.create<mlir::ConstantFloatOp>(loc, llvm::APFloat(data[0]), mlirElemTy.cast<mlir::FloatType>());
}
else
{
assert(false);
}
// TODO: do these need to be marked external as well?
}
else
{
auto memrefShapeTy = MemoryLayoutToMemRefType(b, layout, valueElemTy);
auto mlirElemType = ToMLIRType(b, valueElemTy);
auto extents = layout.GetExtent().ToVector();
// Our usage of the constant data behaves like raw pointer access rather than tensor index access from LLVM's point of view
// So flatten this buffer shape to enable lowering without raising errors
auto flattenedTensorShapeTy = mlir::RankedTensorType::get(extents, mlirElemType);
mlir::DenseElementsAttr dataAttribute;
if constexpr (std::is_same_v<ElementType, Boolean>)
{
std::vector<int8_t> boolData(data.size());
std::transform(data.begin(), data.end(), boolData.begin(), [](Boolean b) { return b ? 1 : 0; });
dataAttribute = mlir::DenseElementsAttr::get(flattenedTensorShapeTy, llvm::makeArrayRef(boolData));
}
else if constexpr (std::is_same_v<ElementType, index_t>)
{
std::vector<int8_t> indexData(data.size());
std::transform(data.begin(), data.end(), indexData.begin(), [](index_t value) { return static_cast<int64_t>(value); });
dataAttribute = mlir::DenseElementsAttr::get(flattenedTensorShapeTy, llvm::makeArrayRef(indexData));
}
else if constexpr (std::is_same_v<ElementType, float16_t>)
{
using float16_underlying_type = typename float16_t::underlying_type;
std::vector<float16_underlying_type> fp16Data(data.size());
std::transform(data.begin(), data.end(), fp16Data.begin(), [](float16_t value) { return value.data; });
dataAttribute = mlir::DenseElementsAttr::get(flattenedTensorShapeTy, llvm::makeArrayRef(fp16Data));
}
else
{
dataAttribute = mlir::DenseElementsAttr::get(flattenedTensorShapeTy, llvm::makeArrayRef(data));
}
std::string uniquedName = name + "_" + std::to_string(ir::util::GetUniqueId());
mlir::MemRefType globalMemrefTy = mlir::MemRefType::Builder{ memrefShapeTy }.setAffineMaps({}); // remove affine maps
[[maybe_unused]] auto globalOp = b.create<ir::value::GlobalOp>(loc, globalMemrefTy, /* isConstant= */ true, uniquedName, dataAttribute, /*addrSpace*/ 0, /*isExternal*/ true);
op = b.create<ir::value::ReferenceGlobalOp>(loc, memrefShapeTy, uniquedName);
}
return StoreLocalEmittable({ op.getAsOpaquePointer(), { valueElemTy, 1 } });
},
data);
Emittable emittable(&emittableInfo);
return Value(emittable, layout);
}
Value MLIRContext::ResolveConstantDataReferenceImpl(Value constantDataSource)
{
auto sourceRefGlobalOp = mlir::Value::getFromOpaquePointer(constantDataSource.Get<Emittable>().GetDataAs<EmittableInfo*>()->data).getDefiningOp();
auto& builder = _impl->builder;
auto valueModuleOp = _impl->module();
auto searchSymName = mlir::dyn_cast<ir::value::ReferenceGlobalOp>(sourceRefGlobalOp).getGlobal().sym_name();
// TODO: valueModuleOp.lookupSymbol() should be called here to look for an existing symbol, but so far,
// it doesn't work as expected. So manually walk the top level ops inside the ValueModuleOp to look for the symbol.
// Replace this workaround with a ValueModuleOp SymbolTable lookup once issues with comparing mlir::Identifiers is resolved.
bool foundMatch = false;
for (auto globalOp : valueModuleOp.getOps<ir::value::GlobalOp>())
{
if (globalOp.sym_name() == searchSymName)
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
// Clone the GlobalOp at the top of this module and mark it as external
mlir::OpBuilder::InsertionGuard guard(builder);
builder.restoreInsertionPoint(_impl->getGlobalInsertPt());
auto sourceGlobalOp = mlir::dyn_cast<ir::value::ReferenceGlobalOp>(sourceRefGlobalOp).getGlobal();
auto globalOp = mlir::dyn_cast<ir::value::GlobalOp>(builder.clone(*sourceGlobalOp));
globalOp->setAttr("external", builder.getUnitAttr());
globalOp->removeAttr("value"); // can't set null attribute (mlir::Attribute()) if existing
}
// Clone a ReferenceGlobalOp to refer to the GlobalOp. Since this is a clone, the reference *should* "carry over" without
// explicitly wrapping globalOp from above
mlir::OpBuilder::InsertionGuard guard(builder);
auto insertionBlock = builder.getInsertionBlock();
auto vFuncOp = ir::util::CastOrGetParentOfType<ir::value::ValueFuncOp>(insertionBlock->getParentOp());
if (vFuncOp)
{
// ensure that the ReferenceGlobalOp is within a function scope, if any
builder.setInsertionPointToStart(&vFuncOp.body().front());
}
auto clonedRefGlobalOp = builder.clone(*sourceRefGlobalOp);
auto refGlobalOp = mlir::dyn_cast<ir::value::ReferenceGlobalOp>(clonedRefGlobalOp);
EmittableInfo& emittableInfo = StoreLocalEmittable({ const_cast<void*>(
refGlobalOp
.getResult()
.getAsOpaquePointer()),
{ constantDataSource.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
return Value(emittable, constantDataSource.GetLayout());
}
void MLIRContext::ForImpl(MemoryLayout layout, std::function<void(std::vector<Scalar>)> fn, const std::string& name)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto dim = static_cast<unsigned>(layout.NumDimensions());
std::vector<mlir::Value>
LBs(dim, builder.create<mlir::ConstantIndexOp>(loc, 0)),
UBs;
std::vector<int64_t> steps(dim, 1);
for (unsigned i = 0; i < dim; ++i)
{
UBs.emplace_back(builder.create<mlir::ConstantIndexOp>(loc, layout.GetActiveSize(i)));
}
auto loopSymName = std::string{ "value_loop" };
if (!name.empty())
{
loopSymName += "_" + name;
}
mlir::buildAffineLoopNest(
builder,
loc,
mlir::ValueRange{ LBs },
mlir::ValueRange{ UBs },
steps,
[&](mlir::OpBuilder&, mlir::Location, mlir::ValueRange IVs) {
std::vector<Scalar> logicalIndices(dim);
for (unsigned i = 0; i < dim; ++i)
{
EmittableInfo& emittableInfo = StoreLocalEmittable({ IVs[i].getAsOpaquePointer(), { ValueType::Index, 1 } });
Emittable emittable{ &emittableInfo };
logicalIndices[i] = Scalar(Value(emittable, ScalarLayout));
}
fn(logicalIndices);
});
}
void MLIRContext::ForImpl(Scalar start, Scalar stop, Scalar step, std::function<void(Scalar)> fn, const std::string& name)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto mlirStart = ToMLIRIndex(builder, start);
auto mlirStop = ToMLIRIndex(builder, stop);
auto mlirStep = ToMLIRIndex(builder, step);
auto loopSymName = std::string{ "value_loop" };
if (!name.empty())
{
loopSymName += "_" + name;
}
mlir::scf::buildLoopNest(builder, loc, mlirStart, mlirStop, mlirStep, [&](mlir::OpBuilder&, mlir::Location, mlir::ValueRange IVs) {
auto iv = IVs[0];
SetOpNameAttr(iv.getParentRegion()->getParentOp(), loopSymName);
EmittableInfo& emittableInfo = StoreLocalEmittable({ iv.getAsOpaquePointer(), { ValueType::Index, 1 } });
Emittable emittable{ &emittableInfo };
Scalar index(Value(emittable, ScalarLayout));
fn(index);
});
}
ViewAdapter MLIRContext::ReduceN(Scalar start, Scalar stop, Scalar step, std::vector<ViewAdapter> initArgs, std::function<ViewAdapter(Scalar, std::vector<ViewAdapter>)> loopFn)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto mlirStart = ToMLIRIndex(builder, start);
auto mlirStop = ToMLIRIndex(builder, stop);
auto mlirStep = ToMLIRIndex(builder, step);
auto mlirInitArgs = llvm::to_vector<2>(
llvm::map_range(
initArgs,
[&builder](ViewAdapter view) { return ResolveMLIRScalar(builder, ToMLIRValue(builder, view)); }));
auto forOp = builder.create<mlir::scf::ForOp>(
loc,
mlirStart,
mlirStop,
mlirStep,
mlirInitArgs,
[&](mlir::OpBuilder& builder, mlir::Location loc, mlir::Value iv, mlir::ValueRange iterValues) {
loc = builder.getFusedLoc({ loc, ir::util::GetLocation(builder, __FILE__, __LINE__) });
auto wrappedIV = Wrap(iv);
std::vector<ViewAdapter> iterWrappedValues = Wrap(std::vector<mlir::Value>(iterValues.begin(), iterValues.end()));
auto result = loopFn(wrappedIV, iterWrappedValues);
builder.create<mlir::scf::YieldOp>(loc, ToMLIRValue(builder, result));
});
assert(forOp.getNumResults() == 1 && "Can't handle multiple results yet");
return Wrap(forOp.getResult(0));
}
ViewAdapter MLIRContext::Reduce(Array a, std::vector<ViewAdapter> initArgs, std::function<ViewAdapter(ViewAdapter, std::vector<ViewAdapter>)> reduceFn)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
assert(initArgs.size() == 1 && "Can't handle multiple results yet");
auto mlirInitArgs = llvm::to_vector<2>(llvm::map_range(initArgs, [&builder](ViewAdapter view) { return ResolveMLIRScalar(builder, ToMLIRValue(builder, view)); }));
auto reduceOp = builder.create<ir::value::ReduceOp>(
loc,
ToMLIRValue(builder, a.GetValue()),
mlirInitArgs[0],
[&](mlir::OpBuilder& builder, mlir::Location loc, mlir::Value val, mlir::ValueRange iterValues) {
loc = builder.getFusedLoc({ loc, ir::util::GetLocation(builder, __FILE__, __LINE__) });
auto wrappedVal = Wrap(val);
std::vector<ViewAdapter> iterWrappedValues = Wrap(std::vector<mlir::Value>(iterValues.begin(), iterValues.end()));
auto result = reduceFn(wrappedVal, iterWrappedValues);
builder.create<ir::value::YieldOp>(loc, ToMLIRValue(builder, result));
});
ir::executionPlan::VectorizationInfo vecInfo{ 8, 16 };
auto vectorizationInfoIdentifier = builder.getIdentifier(ir::executionPlan::VectorizationInfoAttr::getKeyName());
reduceOp->setAttr(vectorizationInfoIdentifier, ir::executionPlan::VectorizationInfoAttr::get(vecInfo, builder.getContext()));
return Wrap(reduceOp.getResult());
}
ViewAdapter MLIRContext::MapReduce(Array a, std::vector<ViewAdapter> initArgs, std::function<ViewAdapter(ViewAdapter)> mapFn, std::function<ViewAdapter(ViewAdapter, std::vector<ViewAdapter>)> reduceFn)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
assert(initArgs.size() == 1 && "Can't handle multiple results yet");
auto mlirInitArgs = llvm::to_vector<2>(llvm::map_range(initArgs, [&builder](ViewAdapter view) { return ResolveMLIRScalar(builder, ToMLIRValue(builder, view)); }));
auto mapReduceOp = builder.create<ir::value::MapReduceOp>(
loc,
ToMLIRValue(builder, a.GetValue()),
mlirInitArgs[0],
[&](mlir::OpBuilder& builder, mlir::Location loc, mlir::Value val) {
loc = builder.getFusedLoc({ loc, ir::util::GetLocation(builder, __FILE__, __LINE__) });
auto wrappedVal = Wrap(val);
auto result = mapFn(wrappedVal);
builder.create<ir::value::YieldOp>(loc, ToMLIRValue(builder, result));
},
[&](mlir::OpBuilder& builder, mlir::Location loc, mlir::Value val, mlir::ValueRange iterValues) {
loc = builder.getFusedLoc({ loc, ir::util::GetLocation(builder, __FILE__, __LINE__) });
auto wrappedVal = Wrap(val);
std::vector<ViewAdapter> iterWrappedValues = Wrap(std::vector<mlir::Value>(iterValues.begin(), iterValues.end()));
auto result = reduceFn(wrappedVal, iterWrappedValues);
builder.create<ir::value::YieldOp>(loc, ToMLIRValue(builder, result));
});
ir::executionPlan::VectorizationInfo vecInfo{ 8, 16 };
auto vectorizationInfoIdentifier = builder.getIdentifier(ir::executionPlan::VectorizationInfoAttr::getKeyName());
mapReduceOp->setAttr(vectorizationInfoIdentifier, ir::executionPlan::VectorizationInfoAttr::get(vecInfo, builder.getContext()));
return Wrap(mapReduceOp.getResult());
}
void MLIRContext::MoveDataImpl(Value& source, Value& destination)
{
// we treat a move the same as a copy, except we clear out the source
CopyDataImpl(source, destination);
// data has been "moved", so clear the source
source.Reset();
}
void MLIRContext::CopyDataImpl(const Value& source, Value& destination)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto src = ToMLIRValue(builder, source);
auto dst = ToMLIRValue(builder, destination);
if (!dst)
{
// the destination was empty
assert(source.GetLayout() == ScalarLayout && "Unexpected empty destination for non-Scalar value");
auto result = ResolveMLIRScalar(builder, src);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { source.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
destination.SetData({ emittable, ScalarLayout });
}
else if (dst.getType().isIntOrIndexOrFloat() && dst.getType() == src.getType())
{
assert(source.GetLayout() == ScalarLayout && destination.GetLayout() == ScalarLayout);
destination.SetData(source);
}
else if (src.getType().isa<mlir::ShapedType>() && source.GetLayout() == ScalarLayout)
{
(void)builder.create<accera::ir::value::CopyOp>(loc, ResolveMLIRScalar(builder, src), dst);
}
else
{
(void)builder.create<accera::ir::value::CopyOp>(loc, src, dst);
}
}
Value MLIRContext::ViewImpl(Value sourceValue, const std::vector<Scalar>& offsetsValue, const MemoryShape& shape, const std::vector<int64_t>& stridesValue)
{
const MemoryLayout& currentLayout = sourceValue.GetLayout();
auto destLayout = GetSubArrayLayout(currentLayout, shape, stridesValue);
llvm::SmallVector<mlir::Value, 4> linalgRanges;
auto ranges = utilities::MakeZipRange(offsetsValue, shape, stridesValue);
std::transform(
begin(ranges),
end(ranges),
std::back_inserter(linalgRanges),
[this](std::tuple<Scalar, Scalar, Scalar> s) -> mlir::Value {
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto offset = Cast(std::get<0>(s), ValueType::Index);
auto size = Cast(std::get<1>(s), ValueType::Index);
auto stride = Cast(std::get<2>(s), ValueType::Index);
auto lowerBound = ResolveMLIRIndex(builder, offset);
auto upperBound = ResolveMLIRIndex(builder, size);
auto step = ResolveMLIRIndex(builder, stride);
return builder.create<mlir::linalg::RangeOp>(loc, lowerBound, upperBound, step);
});
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto resultMemRefType = MemoryLayoutToMemRefType(builder, destLayout, sourceValue.GetBaseType(), true);
auto source = ToMLIRValue(builder, sourceValue);
mlir::Value result = builder.create<ir::value::ViewOp>(loc, source, linalgRanges, resultMemRefType);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { sourceValue.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
return { emittable, destLayout };
}
Value MLIRContext::SliceImpl(Value sourceValue, std::vector<int64_t> slicedDimensions, std::vector<Scalar> sliceOffsets)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
const MemoryLayout& currentLayout = sourceValue.GetLayout();
auto destLayout = GetSliceLayout(currentLayout, slicedDimensions);
llvm::SmallVector<mlir::Value, 4> offsets;
std::transform(
sliceOffsets.begin(),
sliceOffsets.end(),
std::back_inserter(offsets),
[&builder](Scalar s) { return ResolveMLIRIndex(builder, ResolveMLIRScalar(builder, ToMLIRValue(builder, s))); });
auto resultMemRefType = MemoryLayoutToMemRefType(builder, destLayout, sourceValue.GetBaseType(), true);
auto source = ToMLIRValue(builder, sourceValue);
mlir::Value result = builder.create<ir::value::SliceOp>(loc, source, slicedDimensions, offsets, resultMemRefType);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { sourceValue.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
return { emittable, destLayout };
}
Value MLIRContext::MergeDimensionsImpl(Value sourceValue, int64_t dim1, int64_t dim2)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
const MemoryLayout& currentLayout = sourceValue.GetLayout();
ThrowIfNot(currentLayout.IsCanonicalOrder(), InputExceptionErrors::invalidArgument, "MergeDimension requires a canonically-ordered operand");
auto destLayout = GetMergeDimLayout(currentLayout, dim1, dim2);
auto resultMemRefType = MemoryLayoutToMemRefType(builder, destLayout, sourceValue.GetBaseType(), false);
auto source = ToMLIRValue(builder, sourceValue);
return Wrap(builder.create<ir::value::MergeDimOp>(loc, resultMemRefType, source, dim1, dim2));
}
Value MLIRContext::SplitDimensionImpl(Value sourceValue, int64_t dim, int64_t size)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
// TODO: assert there's no offset
const MemoryLayout& currentLayout = sourceValue.GetLayout();
auto destLayout = GetSplitDimLayout(currentLayout, dim, size);
auto resultMemRefType = MemoryLayoutToMemRefType(builder, destLayout, sourceValue.GetBaseType(), false);
auto source = ToMLIRValue(builder, sourceValue);
return Wrap(builder.create<ir::value::SplitDimOp>(loc, resultMemRefType, source, dim, size));
}
Value MLIRContext::ReshapeImpl(Value sourceValue, const MemoryLayout& destLayout)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
// TODO: assert there's no offset
auto resultMemRefType = MemoryLayoutToMemRefType(builder, destLayout, sourceValue.GetBaseType(), false);
auto source = ToMLIRValue(builder, sourceValue);
return Wrap(builder.create<ir::value::ReshapeOp>(loc, resultMemRefType, source));
}
Value MLIRContext::ReorderImpl(Value sourceValue, const DimensionOrder& order)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
// TODO: assert there's no offset
auto source = ToMLIRValue(builder, sourceValue);
return Wrap(builder.create<ir::value::ReorderOp>(loc, source, order.ToVector()));
}
namespace
{
auto Convert(ValueUnaryOperation op)
{
using namespace accera::ir::value;
switch (op)
{
case ValueUnaryOperation::LogicalNot:
return UnaryOpPredicate::NOT;
}
llvm_unreachable("Unknown unary operation");
}
} // namespace
Value MLIRContext::UnaryOperationImpl(ValueUnaryOperation op, Value source)
{
using namespace accera::ir::value;
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto srcValue = ToMLIRValue(builder, source);
mlir::Value loadedSrcValue = ResolveMLIRScalar(builder, srcValue);
mlir::Value result = builder.create<ir::value::UnaryOp>(loc, Convert(op), loadedSrcValue);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { source.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
return { emittable, ScalarLayout };
}
namespace
{
auto Convert(ValueBinaryOperation op)
{
using namespace accera::ir::value;
switch (op)
{
case ValueBinaryOperation::add:
return BinaryOpPredicate::ADD;
case ValueBinaryOperation::divide:
return BinaryOpPredicate::DIV;
case ValueBinaryOperation::logicalAnd:
return BinaryOpPredicate::LOGICAL_AND;
case ValueBinaryOperation::logicalOr:
return BinaryOpPredicate::LOGICAL_OR;
case ValueBinaryOperation::modulus:
return BinaryOpPredicate::MOD;
case ValueBinaryOperation::multiply:
return BinaryOpPredicate::MUL;
case ValueBinaryOperation::subtract:
return BinaryOpPredicate::SUB;
}
llvm_unreachable("Unknown binary operation");
}
} // namespace
Value MLIRContext::BinaryOperationImpl(ValueBinaryOperation op, Value source1, Value source2)
{
using namespace accera::ir::value;
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto srcValue1 = ToMLIRValue(builder, source1);
auto srcValue2 = ToMLIRValue(builder, source2);
auto pred = Convert(op);
mlir::Value loadedSrcValue1 = ResolveMLIRScalar(builder, srcValue1);
mlir::Value loadedSrcValue2 = ResolveMLIRScalar(builder, srcValue2);
mlir::Value result = builder.create<ir::value::BinOp>(loc, pred, loadedSrcValue1, loadedSrcValue2);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { source1.GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
return { emittable, ScalarLayout };
}
namespace
{
auto Convert(ValueLogicalOperation op)
{
using namespace accera::ir::value;
switch (op)
{
case ValueLogicalOperation::equality:
return CmpOpPredicate::EQ;
case ValueLogicalOperation::greaterthan:
return CmpOpPredicate::GT;
case ValueLogicalOperation::greaterthanorequal:
return CmpOpPredicate::GE;
case ValueLogicalOperation::inequality:
return CmpOpPredicate::NE;
case ValueLogicalOperation::lessthan:
return CmpOpPredicate::LT;
case ValueLogicalOperation::lessthanorequal:
return CmpOpPredicate::LE;
}
llvm_unreachable("Unknown logical operation");
}
std::pair<mlir::Value, mlir::Value> GetCompatibleValueHandles(mlir::OpBuilder& builder, Value val1, Value val2)
{
auto val1Handle = ToMLIRValue(builder, val1);
auto val2Handle = ToMLIRValue(builder, val2);
auto type1 = val1Handle.getType();
auto type2 = val2Handle.getType();
if (type1.isa<mlir::MemRefType>() && type2.isa<mlir::TensorType>())
{
Value val2New = Allocate(val2.GetBaseType(), val2.GetLayout());
val2New = val2;
auto val2HandleNew = ToMLIRValue(builder, val2New);
std::swap(val2Handle, val2HandleNew);
}
else if (type1.isa<mlir::MemRefType>() && type2.isa<mlir::TensorType>())
{
Value val1New = Allocate(val1.GetBaseType(), val1.GetLayout());
val1New = val1;
auto val1HandleNew = ToMLIRValue(builder, val1New);
std::swap(val1Handle, val1HandleNew);
}
return { val1Handle, val2Handle };
}
} // namespace
Value MLIRContext::LogicalOperationImpl(ValueLogicalOperation op, Value source1, Value source2)
{
using namespace accera::ir::value;
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto [src1Handle, src2Handle] = GetCompatibleValueHandles(builder, source1, source2);
mlir::Value loadedSrc1Handle = ResolveMLIRScalar(builder, src1Handle);
mlir::Value loadedSrc2Handle = ResolveMLIRScalar(builder, src2Handle);
mlir::Value result = builder.create<ir::value::CmpOp>(loc, Convert(op), loadedSrc1Handle, loadedSrc2Handle);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { ValueType::Boolean, 1 } });
Emittable emittable{ &emittableInfo };
return { emittable, ScalarLayout };
}
Value MLIRContext::MMALoadSyncImpl(const Matrix& source, const int64_t rowOffset, const int64_t colOffset, const MatrixFragment& target)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto matValue = ToMLIRValue(builder, source);
const auto mmaShape = static_cast<ir::value::MMAShape>(target.GetFragmentShape());
const ir::value::MMAOp mmaType(mmaShape);
auto rowOff = builder.create<mlir::ConstantIndexOp>(loc, rowOffset);
auto colOff = builder.create<mlir::ConstantIndexOp>(loc, colOffset);
const ir::value::MMAOperandType operandType{ static_cast<ir::value::MMAOperandType>(target.GetFragmentType()) };
const auto isAcc = operandType == ir::value::MMAOperandType::Acc;
auto elementType = (source.GetValue().IsFloat32() || isAcc) ? builder.getF32Type() : builder.getF16Type();
auto [warpSizeX, warpSizeY] = ir::util::ResolveWarpSize(ir::value::ExecutionRuntime::ROCM).value();
// Its correct to use getOutElementsPerThread() for input matrices here since we are going to schedule all the passes.
// Therefore, getOutElementsPerThread() == getInElementsPerThread() * numPasses()
const auto vecSize = mmaType.getOutElementsPerThread(warpSizeX * warpSizeY) / (isAcc ? mmaType.getNumBlocks() : 1);
auto vecTy = mlir::MemRefType::get({ vecSize }, elementType);
mlir::Value result = builder.create<ir::value::MMALoadSyncOp>(loc, vecTy, matValue, mmaShape, operandType, mlir::ValueRange{ rowOff, colOff });
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { source.GetValue().GetBaseType(), 1 } });
Emittable emittable{ &emittableInfo };
auto&& mmaMatShape = mmaType.getTileShape(warpSizeX, warpSizeY);
auto mmaMatLayout = MemoryLayout(mmaMatShape.first, mmaMatShape.second);
return Value(emittable, mmaMatLayout);
}
void MLIRContext::MMAStoreSyncImpl(const MatrixFragment& source, Matrix& target, const int64_t rowOffset, const int64_t colOffset)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto sourceValue = ToMLIRValue(builder, source);
auto targetValue = ToMLIRValue(builder, target);
auto rowOff = builder.create<mlir::ConstantIndexOp>(loc, rowOffset);
auto colOff = builder.create<mlir::ConstantIndexOp>(loc, colOffset);
const auto mmaShape = static_cast<ir::value::MMAShape>(source.GetFragmentShape());
const ir::value::MMAOp mmaType(mmaShape);
builder.create<ir::value::MMAStoreSyncOp>(loc, sourceValue, targetValue, mmaShape, mlir::ValueRange{ rowOff, colOff });
}
Value MLIRContext::MMAComputeSyncImpl(const MatrixFragment& A, const MatrixFragment& B, const MatrixFragment& C, const uint32_t cbsz, const uint32_t abid, const uint32_t blgp)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto aValue = ToMLIRValue(builder, A);
auto bValue = ToMLIRValue(builder, B);
auto cValue = ToMLIRValue(builder, C);
mlir::Value result = builder.create<ir::value::MMAComputeSyncOp>(loc, cValue.getType(), aValue, bValue, cValue, uint32_t(A.GetFragmentShape()), cbsz, abid, blgp);
EmittableInfo& emittableInfo = StoreLocalEmittable({ result.getAsOpaquePointer(), { C.GetType(), 1 } });
Emittable emittable{ &emittableInfo };
return Value(emittable, C.GetValue().GetLayout());
}
Scalar MLIRContext::CastImpl(Scalar value, ValueType type, bool doSignedCast)
{
auto& builder = _impl->builder;
mlir::Value mlirValue = ResolveMLIRScalar(builder, ToMLIRValue(builder, value));
auto loc = mlirValue.getLoc();
auto fromType = mlirValue.getType();
auto toType = ToMLIRType(builder, type);
if (fromType == toType)
{
return Wrap(mlirValue);
}
return mlir::TypeSwitch<mlir::Type, Scalar>(fromType)
.Case([&](mlir::IntegerType fromIntType) {
auto signlessMlirValue = accera::ir::util::ToSignlessMLIRValue(builder, mlirValue);
return mlir::TypeSwitch<mlir::Type, Scalar>(toType)
.Case([&](mlir::IntegerType toIntType) {
auto toIntTypeSignless = accera::ir::util::ToSignlessMLIRType(builder, toIntType);
if (fromIntType.getWidth() == toIntType.getWidth())
{
return Wrap(signlessMlirValue);
}
else if (fromIntType.getWidth() > toIntType.getWidth())
{
return Wrap(builder.create<mlir::TruncateIOp>(loc, signlessMlirValue, toIntTypeSignless));
}
else if (doSignedCast || !fromIntType.isUnsigned())
{
return Wrap(builder.create<mlir::SignExtendIOp>(loc, signlessMlirValue, toIntTypeSignless));
}
else
{
return Wrap(builder.create<mlir::ZeroExtendIOp>(loc, signlessMlirValue, toIntTypeSignless));
}
})
.Case([&](mlir::IndexType) {
return Wrap(builder.create<mlir::IndexCastOp>(loc, signlessMlirValue, toType));
})
.Case([&](mlir::FloatType) {
return fromIntType.isUnsigned() ? Wrap(builder.create<mlir::UIToFPOp>(loc, signlessMlirValue, toType)) : Wrap(builder.create<mlir::SIToFPOp>(loc, signlessMlirValue, toType));
})
.Default([&](mlir::Type) {
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
llvm_unreachable("unexpected");
return Scalar();
});
})
.Case([&](mlir::IndexType) {
return mlir::TypeSwitch<mlir::Type, Scalar>(toType)
.Case([&](mlir::IntegerType toIntType) {
auto toIntTypeSignless = accera::ir::util::ToSignlessMLIRType(builder, toIntType);
return Wrap(builder.create<mlir::IndexCastOp>(loc, mlirValue, toIntTypeSignless));
})
.Case([&](mlir::FloatType) {
auto int64Value = builder.create<mlir::IndexCastOp>(loc, mlirValue, builder.getI64Type()); // index->int64
return Wrap(builder.create<mlir::SIToFPOp>(loc, int64Value, toType)); // int64->fp
})
.Default([&](mlir::Type) {
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
llvm_unreachable("unexpected");
return Scalar();
});
})
.Case([&](mlir::FloatType fromFloatType) {
return mlir::TypeSwitch<mlir::Type, Scalar>(toType)
.Case([&](mlir::IntegerType toIntType) {
auto toIntTypeSignless = accera::ir::util::ToSignlessMLIRType(builder, toIntType);
return toIntType.isUnsigned() ? Wrap(builder.create<mlir::FPToUIOp>(loc, mlirValue, toIntTypeSignless)) : Wrap(builder.create<mlir::FPToSIOp>(loc, mlirValue, toIntTypeSignless));
})
.Case([&](mlir::FloatType toFloatType) {
return fromFloatType.getWidth() > toFloatType.getWidth() ? Wrap(builder.create<mlir::FPTruncOp>(loc, mlirValue, toType)) : Wrap(builder.create<mlir::FPExtOp>(loc, mlirValue, toType));
})
.Default([&](mlir::Type) {
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
llvm_unreachable("unexpected");
return Scalar();
});
})
.Default([&](mlir::Type) {
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
llvm_unreachable("unexpected");
return Scalar();
});
}
Scalar MLIRContext::CastImpl(Scalar value, ValueType type)
{
return CastImpl(value, type, /*doSignedCast=*/true);
}
Scalar MLIRContext::UnsignedCastImpl(Scalar value, ValueType type)
{
return CastImpl(value, type, /*doSignedCast=*/false);
}
Scalar MLIRContext::BitcastImpl(Scalar value, ValueType type)
{
auto& builder = _impl->builder;
mlir::Value mlirValue = ResolveMLIRScalar(builder, ToMLIRValue(builder, value));
auto loc = mlirValue.getLoc();
auto fromType = mlirValue.getType();
auto toType = ToMLIRType(builder, type);
if (fromType == toType)
{
return Wrap(mlirValue);
}
if (fromType.isIntOrIndexOrFloat() && toType.isIntOrIndexOrFloat() && fromType.getIntOrFloatBitWidth() == toType.getIntOrFloatBitWidth())
{
using namespace accera::ir::value;
return Wrap(builder.create<BitcastOp>(loc, toType, mlirValue));
}
throw utilities::InputException(utilities::InputExceptionErrors::invalidArgument, "Can only bitcast between types of the same size");
}
namespace
{
mlir::ValueRange CascadingConditionBuilder(
mlir::OpBuilder& builder,
mlir::Location loc,
std::pair<mlir::Value, std::function<void(mlir::OpBuilder&, mlir::Location)>> testCase,
std::function<void(mlir::OpBuilder&, mlir::Location)> elseCase = nullptr,
llvm::ArrayRef<std::pair<mlir::Value, std::function<void(mlir::OpBuilder&, mlir::Location)>>> alternates = llvm::None)
{
// base case (forward to conditionBuilder)
if (alternates.empty())
{
auto ifOp = builder.create<mlir::scf::IfOp>(
loc,
testCase.first,
testCase.second,
elseCase
? mlir::function_ref<void(mlir::OpBuilder&, mlir::Location)>{ elseCase }
: mlir::function_ref<void(mlir::OpBuilder&, mlir::Location)>{});
mlir::scf::IfOp::ensureTerminator(ifOp.thenRegion(), builder, loc);
if (auto& elseRegion = ifOp.elseRegion(); !elseRegion.empty())
{
mlir::scf::IfOp::ensureTerminator(elseRegion, builder, loc);
}
return ifOp.results();
}
else
{
auto ifOp = builder.create<mlir::scf::IfOp>(
loc,
testCase.first,
testCase.second,
[else_ = std::move(elseCase), alts = std::move(alternates)](mlir::OpBuilder& builder, mlir::Location loc) {
auto firstAlt = alts[0];
(void)CascadingConditionBuilder(builder, loc, firstAlt, else_, alts.drop_front());
});
mlir::scf::IfOp::ensureTerminator(ifOp.thenRegion(), builder, loc);
if (auto& elseRegion = ifOp.elseRegion(); !elseRegion.empty())
{
mlir::scf::IfOp::ensureTerminator(elseRegion, builder, loc);
}
return ifOp.results();
}
}
} // namespace
class MLIRContext::IfContextImpl : public EmitterContext::IfContextImpl
{
public:
IfContextImpl(MLIRContext::Impl& impl, Scalar test, std::function<void()> fn) :
builder(impl.builder),
thenPair(ResolveMLIRScalar(builder, ToMLIRValue(builder, test)), [fn = std::move(fn)](mlir::OpBuilder&, mlir::Location) { fn(); })
{
}
~IfContextImpl() override
{
(void)CascadingConditionBuilder(builder, builder.getUnknownLoc(), thenPair, elseFn, elseIfs);
}
void ElseIf(Scalar test, std::function<void()> fn) override
{
auto testValue = ResolveMLIRScalar(builder, ToMLIRValue(builder, test));
elseIfs.emplace_back(testValue, [fn = std::move(fn)](mlir::OpBuilder&, mlir::Location) { fn(); });
}
void Else(std::function<void()> fn) override
{
if (elseFn)
{
throw utilities::LogicException(
utilities::LogicExceptionErrors::illegalState, "There can only be one else clause");
}
elseFn = [fn = std::move(fn)](mlir::OpBuilder&, mlir::Location) { fn(); };
}
private:
using Fn = std::function<void(mlir::OpBuilder&, mlir::Location)>;
using CondFnPair = std::pair<mlir::Value, Fn>;
using CondFnVector = mlir::SmallVector<CondFnPair, 3>;
mlir::OpBuilder& builder;
CondFnPair thenPair;
CondFnVector elseIfs;
Fn elseFn;
};
EmitterContext::IfContext MLIRContext::IfImpl(Scalar test, std::function<void()> fn)
{
return { std::make_unique<MLIRContext::IfContextImpl>(*_impl, test, fn) };
}
void MLIRContext::WhileImpl(Scalar test, std::function<void()> fn)
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
std::optional<Value> MLIRContext::CallImpl(FunctionDeclaration func, std::vector<Value> args)
{
if (std::any_of(args.begin(), args.end(), [](const auto& value) { return value.IsEmpty(); }))
{
throw InputException(InputExceptionErrors::invalidArgument, __FILE__ " : " + std::to_string(__LINE__));
}
{
std::lock_guard lock{ _mutex };
if (auto it = _definedFunctions.find(func); it != _definedFunctions.end())
{
return it->second(args);
}
}
return EmitExternalCall(func, args);
}
std::optional<Value> MLIRContext::EmitExternalCall(FunctionDeclaration func, std::vector<Value> args)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
std::vector<mlir::Value> mlirValueCallArgs = ToMLIRValue(builder, args);
auto DeclareFn = [&](const std::string& name, mlir::FunctionType fnTy) -> ir::value::ValueFuncOp {
auto insertionBlock = builder.getBlock();
auto parentOp = insertionBlock->getParentOp();
auto mod = accera::ir::util::CastOrGetParentOfType<mlir::ModuleOp>(parentOp);
assert(mod);
if (auto fnOp = mod.lookupSymbol<ir::value::ValueFuncOp>(name); fnOp) return fnOp;
mlir::OpBuilder::InsertionGuard guard(builder);
builder.restoreInsertionPoint(_impl->getGlobalInsertPt());
return builder.create<ir::value::ValueFuncOp>(
loc,
name,
fnTy,
ir::value::ExecutionTarget::CPU);
};
accera::ir::value::CallOp callResult = builder.create<ir::value::CallOp>(
loc,
DeclareFn(func.GetFunctionName(), ToMLIRType(builder, func)),
mlir::ValueRange{ mlirValueCallArgs });
if (callResult.getNumResults() > 0)
{
// TODO : support multiple returns from an external function
return Wrap(callResult.getResult(0));
}
else
{
return std::nullopt;
}
}
void MLIRContext::ReturnValue(ViewAdapter view)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto mlirValue = ToMLIRValue(builder, view);
(void)builder.create<ir::value::EarlyReturnOp>(loc, mlirValue ? mlir::ValueRange{ mlirValue } : mlir::ValueRange{});
}
Scalar MLIRContext::GetTime()
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
mlir::Value time = builder.create<ir::value::GetTimeOp>(loc);
return Wrap(time);
}
void MLIRContext::EnterProfileRegion(const std::string& regionName)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
(void)builder.create<accera::ir::value::EnterProfileRegionOp>(loc, regionName);
}
void MLIRContext::ExitProfileRegion(const std::string& regionName)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
(void)builder.create<accera::ir::value::ExitProfileRegionOp>(loc, regionName);
}
void MLIRContext::PrintProfileResults()
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
(void)builder.create<accera::ir::value::PrintProfileResultsOp>(loc);
}
void MLIRContext::PrefetchImpl(Value data, PrefetchType type, PrefetchLocality locality)
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
void MLIRContext::PrintImpl(ViewAdapter value, bool toStderr)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto mlirValue = ToMLIRValue(builder, value);
assert(mlirValue);
[[maybe_unused]] auto op = builder.create<accera::ir::value::PrintOp>(loc, mlirValue, toStderr);
}
void MLIRContext::PrintRawMemoryImpl(ViewAdapter value)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto mem = ToMLIRValue(builder, value);
assert(mem);
auto type = mem.getType();
auto memType = type.dyn_cast<mlir::MemRefType>();
if (!memType)
{
throw std::runtime_error{ "Value must have a memref type" };
}
// compute the total size
auto shape = memType.getShape();
llvm::SmallVector<int64_t, 4> strides;
int64_t offset;
if (failed(getStridesAndOffset(memType, strides, offset)))
{
throw std::logic_error{ "Resource to be filled in must be valid memory" };
}
auto maxStride = std::max_element(strides.begin(), strides.end());
auto size = (*maxStride) * (shape[maxStride - strides.begin()]);
auto elemTy = memType.getElementType();
// cast to a value with type `memref<total_size x elem_type>` (via `memref<* x elem_type>`)
mlir::Value ptr = builder.create<mlir::memref::CastOp>(loc, mem, mlir::UnrankedMemRefType::get(elemTy, memType.getMemorySpace()));
mlir::Value mlirValue = builder.create<mlir::memref::CastOp>(loc, ptr, mlir::MemRefType::get({ size }, elemTy, {}, memType.getMemorySpace()));
[[maybe_unused]] auto op = builder.create<ir::value::PrintOp>(loc, mlirValue, /*toStderr=*/false);
}
void MLIRContext::PrintImpl(const std::string& message, bool toStderr)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
[[maybe_unused]] auto op = builder.create<accera::ir::value::PrintFOp>(loc, message, toStderr);
}
void MLIRContext::DebugBreakImpl()
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
void MLIRContext::DebugDumpImpl(Value value, std::string tag, std::ostream& stream) const
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
void MLIRContext::DebugDumpImpl(FunctionDeclaration fn, std::string tag, std::ostream& stream) const
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
void MLIRContext::DebugPrintImpl(std::string message)
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
void MLIRContext::SetNameImpl(const Value& value, const std::string& name)
{
auto& builder = _impl->builder;
auto mlirValue = ToMLIRValue(builder, value);
assert(mlirValue);
if (auto op = mlirValue.getDefiningOp())
SetOpNameAttr(op, name);
}
std::string MLIRContext::GetNameImpl(const Value& value) const
{
auto& builder = _impl->builder;
auto mlirValue = ToMLIRValue(builder, value);
if (auto nameAttr = mlirValue.getDefiningOp()->getAttr(mlir::SymbolTable::getSymbolAttrName()))
{
if (auto stringAttr = nameAttr.dyn_cast_or_null<mlir::StringAttr>())
{
return stringAttr.getValue().str();
}
}
return "";
}
void MLIRContext::ImportCodeFileImpl(std::string)
{
throw utilities::LogicException(utilities::LogicExceptionErrors::notImplemented, __FILE__ " : " + std::to_string(__LINE__));
}
Scalar MLIRContext::MaxImpl(Vector input)
{
auto& builder = _impl->builder;
auto mlirValue = ToMLIRValue(builder, input);
assert(mlirValue);
auto inputType = mlirValue.getType();
assert(inputType.isa<mlir::MemRefType>() && "Vector input must be a memref");
auto memRefType = inputType.cast<mlir::MemRefType>();
auto resultType = memRefType.getElementType();
auto loc = mlirValue.getLoc();
auto max = builder.create<ir::value::ReduceMaxOp>(loc, resultType, mlirValue);
return Wrap(max, ScalarLayout);
}
Scalar MLIRContext::SumImpl(Vector input)
{
auto& builder = _impl->builder;
auto mlirValue = ToMLIRValue(builder, input);
assert(mlirValue);
auto inputType = mlirValue.getType();
assert(inputType.isa<mlir::MemRefType>() && "Vector input must be a memref");
auto memRefType = inputType.cast<mlir::MemRefType>();
auto resultType = memRefType.getElementType();
auto loc = mlirValue.getLoc();
auto sum = builder.create<ir::value::ReduceSumOp>(loc, resultType, mlirValue);
return Wrap(sum, ScalarLayout);
}
std::string MLIRContext::GetScopeAdjustedName(GlobalAllocationScope scope, std::string name) const
{
switch (scope)
{
case GlobalAllocationScope::Global:
return GetGlobalScopedName(name);
case GlobalAllocationScope::Function:
return GetCurrentFunctionScopedName(name);
}
throw LogicException(LogicExceptionErrors::illegalState, __FILE__ " : " + std::to_string(__LINE__));
}
std::string MLIRContext::GetGlobalScopedName(std::string name) const
{
return _impl->module().getName().str() + "_" + name;
}
std::string MLIRContext::GetCurrentFunctionScopedName(std::string name) const
{
auto& b = GetMLIRContext().GetOpBuilder();
auto fnOp = b.getBlock()->getParent()->getParentOfType<ir::value::ValueFuncOp>();
assert(fnOp);
return GetGlobalScopedName(fnOp.getName().str() + "_" + name);
}
void MLIRContext::SetLayoutImpl(Value& value, const MemoryLayout& layout)
{}
mlir::OpBuilder& MLIRContext::GetOpBuilder()
{
return _impl->builder;
}
// Finds a ValueFuncOp matching the given name
ir::value::ValueFuncOp FindValueFuncOp(mlir::ModuleOp mod, const std::string& name)
{
ir::value::ValueFuncOp fnOp;
mod->walk([&fnOp, name](ir::value::ValueFuncOp op) {
if (name == op.sym_name())
{
fnOp = op;
return mlir::WalkResult::interrupt();
}
return mlir::WalkResult::advance();
});
return fnOp;
}
// Emit a wrapper function that will invoke the target function with debugging checks
// This is best effort. If there is no ScheduleOp, we will skip the function.
void MLIRContext::EmitNestDebugFunction(FunctionDeclaration targetFunc, const std::vector<std::string>& utilityFunctionNames)
{
auto& builder = _impl->builder;
auto loc = builder.getUnknownLoc();
auto parentOp = builder.getBlock()->getParentOp();
auto moduleOp = accera::ir::util::CastOrGetParentOfType<mlir::ModuleOp>(parentOp);
assert(moduleOp);
auto targetFuncName = targetFunc.GetFunctionName();
// Find a ValueFuncOp matching the target function name
if (auto targetFnOp = FindValueFuncOp(moduleOp, targetFuncName))
{
// Find the ScheduleOp
ir::loopnest::ScheduleOp scheduleOp;
if (auto region = &targetFnOp.body())
{
region->walk([&scheduleOp](ir::loopnest::ScheduleOp op) {
scheduleOp = op;
return mlir::WalkResult::interrupt();
});
}
if (scheduleOp)
{
// Find the LaunchFuncOp that calls target function. This will be used for the debug function name prefix
// and also for replacement with a new LaunchFuncOp that calls the debug wrapper function.
// If no LaunchFuncOp exists (because this does not have a raw pointer API wrapper function), fallback to
// the target function name as the debug function name prefix.
ir::value::ValueFuncOp targetLaunchFnOp;
auto dbgFnName = [&targetLaunchFnOp, moduleOp, targetFuncName]() -> std::string {
moduleOp->walk([&targetLaunchFnOp, targetFuncName](ir::value::LaunchFuncOp op) {
if (targetFuncName == op.callee().getLeafReference())
{
targetLaunchFnOp = accera::ir::util::CastOrGetParentOfType<ir::value::ValueFuncOp>(op);
return mlir::WalkResult::interrupt();
}
return mlir::WalkResult::advance();
});
std::string namePrefix = targetLaunchFnOp ? std::string(targetLaunchFnOp.sym_name()) : targetFuncName;
return std::string("_debug_") + namePrefix;
}();
// Create a new function op with the same arguments and return value as the target function
// void dbgFnOp(args, ...)
// {
// Copy output args to output targetFnArgs
// Call targetFnOp(targetFnArgs, ...)
// Run default schedule impl using (args, ...)
// Call utility function to check output args vs output targetFnArgs
// Copy output targetFnArgs to output args
// }
// TODO: The last copy can be avoided if we wrap the default schedule impl within its own ValueFuncOp
auto dbgFnOp = [this, &builder, loc, &targetFnOp, &scheduleOp, dbgFnName]() -> ir::value::ValueFuncOp {
mlir::OpBuilder::InsertionGuard guard(builder);
builder.restoreInsertionPoint(_impl->getFunctionInsertPt());
auto argTypes = targetFnOp.getType().getInputs().vec();
auto callingFnType = builder.getFunctionType(argTypes, targetFnOp.getType().getResults());
auto wrapperFnOp = builder.create<ir::value::ValueFuncOp>(loc, dbgFnName + "_internal", callingFnType, targetFnOp.exec_target());
builder.setInsertionPointToStart(&wrapperFnOp.body().front());
// Map target function args to debug function args
mlir::BlockAndValueMapping valueMap;
for (auto [fromValue, toValue] : llvm::zip(targetFnOp.getArguments(), wrapperFnOp.getArguments()))
{
valueMap.map(fromValue, toValue);
}
targetFnOp->walk([&builder, &valueMap](mlir::Operation* op) {
mlir::TypeSwitch<mlir::Operation*>(op)
.Case([&](ir::value::AllocOp allocOp) {
// Replicate local allocations (e.g. TEMP arrays)
auto newOp = mlir::cast<ir::value::AllocOp>(builder.clone(*allocOp.getOperation()));
valueMap.map(allocOp.getResult(), newOp.getResult());
})
.Case([&](ir::value::ReferenceGlobalOp refGlobalOp) {
// Replicate references to globals (e.g. CONST arrays)
auto newOp = mlir::cast<ir::value::ReferenceGlobalOp>(builder.clone(*refGlobalOp.getOperation()));
valueMap.map(refGlobalOp.getResult(), newOp.getResult());
});
});
// Create the reference schedule(s)
auto targetNestOp = scheduleOp.getNest();
if (auto fusedDomains = scheduleOp.getFusedDomains(); !fusedDomains.empty())
{
// Fusing case: split into multiple schedules (one per kernel), in kernel order
auto kernels = targetNestOp.getKernels();
// We currently only support 1 kernel per domain (corresponds to a "never-fused-before" schedule)
// TODO: remove this limitation when the Python DSL supports adding multiple kernels to a schedule
assert(fusedDomains.size() == kernels.size() && "Number of unfused domains != number of unfused kernels");
for (auto [targetKernel, fusedDomain] : llvm::zip(kernels, fusedDomains))
{
auto nest = ir::loopnest::MakeNest(builder, fusedDomain);
auto nestBuilder = nest.getBodyBuilder();
// Map target symbolic indices to debug symbolic indices
auto dims = fusedDomain.GetDimensions();
std::unordered_set<ir::loopnest::Index> fusedDomainIndices(dims.begin(), dims.end());
targetNestOp.walk([&](ir::loopnest::SymbolicIndexOp fromIndex) {
if (!fromIndex.use_empty())
{
auto sourceIndex = fromIndex.getValue();
for (auto fusedIndex : scheduleOp.getFusedIndices(sourceIndex))
{
// A reverse mapping of fused index to original index exists AND the original index
// belongs in the unfused domain
if (fusedDomainIndices.find(fusedIndex) != fusedDomainIndices.end())
{
sourceIndex = fusedIndex;
break;
}
}
auto toIndex = nest.getOrCreateSymbolicIndex(nestBuilder, sourceIndex);
valueMap.map(fromIndex.getResult(), toIndex.getResult());
}
});
// Clone the kernel, referencing the re-mapped Values (this creates the symbolic indices)
auto kernel = mlir::cast<ir::loopnest::KernelOp>(nestBuilder.clone(*targetKernel.getOperation(), valueMap));
// Create the schedule and add the kernels (after the symbolic indices have been inserted into the IR)
auto defaultSchedule = nest.getOrCreateSchedule();
defaultSchedule.addKernel(kernel);
}
}
else
{
// Non-fusing case: duplicate the nest with its kernel(s)
auto domain = targetNestOp.getDomain().getValue();
auto nest = ir::loopnest::MakeNest(builder, domain);
auto nestBuilder = nest.getBodyBuilder();
// Map target symbolic indices to debug symbolic indices
targetNestOp.walk([&nestBuilder, &nest, &valueMap](ir::loopnest::SymbolicIndexOp fromIndex) {
if (!fromIndex.use_empty())
{
auto toIndex = nest.getOrCreateSymbolicIndex(nestBuilder, fromIndex.getValue());
valueMap.map(fromIndex.getResult(), toIndex.getResult());
}
});
// Clone the kernels, referencing the re-mapped Values (this creates the symbolic indices)
std::vector<ir::loopnest::KernelOp> kernels;
auto targetKernels = targetNestOp.getKernels();
std::transform(targetKernels.cbegin(), targetKernels.cend(), std::back_inserter(kernels), [&nestBuilder, &valueMap](auto knl) {
return mlir::cast<ir::loopnest::KernelOp>(nestBuilder.clone(*knl.getOperation(), valueMap));
});
// Create the schedule and add the kernels (after the symbolic indices have been inserted into the IR)
auto defaultSchedule = nest.getOrCreateSchedule();
for (auto& kernel : kernels)
{
defaultSchedule.addKernel(kernel);
}
}
return wrapperFnOp;
}();
{
// Collect arguments for calling the target function, then inject a call to the target function
// Output arguments will be duplicated so that we can compare the results with the reference implementation
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPointToStart(&dbgFnOp.body().front());
// Replicate output args at the top of the function and copy the data
auto targetFnArgs = [this, &builder, loc, targetFunc, &dbgFnOp]() -> std::vector<mlir::Value> {
std::string name = GetGlobalScopedName(dbgFnOp.getName().str() + "_target_output_arg");
std::vector<mlir::Value> fnArgs;
for (auto [blockArg, usage] : llvm::zip(dbgFnOp.getArguments(), targetFunc.GetParameterUsages()))
{
if (usage == FunctionParameterUsage::inputOutput)
{
if (auto memrefType = blockArg.getType().dyn_cast<mlir::MemRefType>())
{
// Simplify any identity affine maps, e.g. (d0, d1) -> (d0 * 256 + d1) can become (d0, d1) -> (d0, d1)
// Required by ConvertToLLVMPattern::isConvertibleAndHasIdentityMaps() in GlobalMemrefOpLowering
// First, try simplifying the layout as it is
memrefType = mlir::canonicalizeStridedLayout(memrefType);
if (!memrefType.getAffineMaps().empty())
{
// The layout could not be simplified (e.g. SubArrays) - force an identity map
// The logical access indices will still work but there is a potential performance tradeoff with
// a change in the physical layout (acceptable for Debug mode)
memrefType = mlir::MemRefType::Builder(memrefType).setAffineMaps({});
}
auto argCopy = ir::util::CreateGlobalBuffer(builder, dbgFnOp, memrefType, name);
// Replace the global-scoped ReferenceGlobalOp with one within the function context
auto globalScopeGlobalRef = mlir::dyn_cast_or_null<ir::value::ReferenceGlobalOp>(argCopy.getDefiningOp());
auto localScopeGlobalRef = builder.create<accera::ir::value::ReferenceGlobalOp>(loc, globalScopeGlobalRef.getGlobal());
CopyData(Wrap(blockArg), Wrap(localScopeGlobalRef));
fnArgs.push_back(localScopeGlobalRef);
globalScopeGlobalRef.erase();
}
else
{
throw std::logic_error{ "Argument is not a memRefType" }; // TODO: support additional function arg types as needed
}
}
else
{
fnArgs.push_back(blockArg); // pass-through any input args
}
}
return fnArgs;
}();
// Make a call to targetFnOp with the collected arguments
auto msg = std::string("Checking " + targetFuncName + " ...\n");
Print(msg);
(void)builder.create<ir::value::LaunchFuncOp>(loc, targetFnOp, targetFnArgs);
{
// Set insertion point past the debug nest
mlir::OpBuilder::InsertionGuard guard(builder);
builder.setInsertionPointToEnd(&dbgFnOp.body().front());
// For each output arg, call its designated utility function to check that the expected values match
unsigned utilityFnIndex = 0;
for (auto [targetArg, debugArg, usage] : llvm::zip(targetFnArgs, dbgFnOp.getArguments(), targetFunc.GetParameterUsages()))
{
if (usage == FunctionParameterUsage::inputOutput)
{
// Expect the number of utility functions to match the number of outputs
assert(utilityFnIndex < utilityFunctionNames.size() && "Too few debug utility functions were generated");
if (auto utilityFnOp = FindValueFuncOp(moduleOp, utilityFunctionNames[utilityFnIndex++]))
{
(void)builder.create<ir::value::LaunchFuncOp>(loc, utilityFnOp, mlir::ValueRange{ targetArg, debugArg });
}
// Set the output arguments of this function so that the caller gets the target result
// TODO: This last copy can be avoided if we wrap the default schedule impl within its own ValueFuncOp
CopyData(Wrap(targetArg), Wrap(debugArg));
}
}
// Finally, add the terminator
assert(dbgFnOp.getNumResults() == 0 && "Nest functions must return no results"); // future work?
builder.create<ir::value::ReturnOp>(loc);
}
}
if (targetLaunchFnOp)
{
// Replace the original launcher with one that calls the debug wrapper function
auto newLaunchFnOp = ir::value::CreateRawPointerAPIWrapperFunction(builder, dbgFnOp, targetLaunchFnOp.sym_name());
// Propagate the base name so that aliases can be created
if (auto baseName = targetLaunchFnOp->getAttrOfType<mlir::StringAttr>(ir::BaseNameAttrName))
{
newLaunchFnOp->setAttr(ir::BaseNameAttrName, baseName);
}
targetLaunchFnOp.erase();
}
}
}
}
mlir::Value Unwrap(ViewAdapter view)
{
Value v = view;
auto emittable = v.Get<Emittable>().GetDataAs<MLIRContext::EmittableInfo*>();
return mlir::Value::getFromOpaquePointer(emittable->data);
}
mlir::Value UnwrapScalar(Scalar s)
{
auto mlirVal = Unwrap(s);
return ResolveMLIRScalar(GetMLIRContext().GetOpBuilder(), mlirVal);
}
ValueType MLIRTypeToValueType(mlir::Type ty)
{
assert(ty.isIntOrIndexOrFloat());
return llvm::TypeSwitch<mlir::Type, ValueType>(ty)
.Case<mlir::IndexType>([](mlir::IndexType) {
return ValueType::Index;
})
.Case<mlir::IntegerType>([](mlir::IntegerType iTy) {
if (iTy.isSigned() || iTy.isSignless())
{
switch (iTy.getWidth())
{
case 1:
return ValueType::Boolean;
case 8:
return ValueType::Int8;
case 16:
return ValueType::Int16;
case 32:
return ValueType::Int32;
case 64:
return ValueType::Int64;
default:
return ValueType::Undefined;
}
}
else
{
switch (iTy.getWidth())
{
case 1:
return ValueType::Boolean;
case 8:
return ValueType::Byte;
case 16:
return ValueType::Uint16;
case 32:
return ValueType::Uint32;
case 64:
return ValueType::Uint64;
default:
return ValueType::Undefined;
}
}
})
.Case<mlir::IndexType>([](mlir::IndexType idxTy) {
return ValueType::Index;
})
.Case<mlir::FloatType>([](mlir::FloatType fTy) {
if (fTy.isF16())
return ValueType::Float16;
else if (fTy.isF32())
return ValueType::Float;
else if (fTy.isF64())
return ValueType::Double;
else
return ValueType::Undefined;
})
.Default([](mlir::Type) {
return ValueType::Undefined;
});
}
using accera::utilities::MemoryLayout;
ViewAdapter Wrap(mlir::Value v, std::optional<MemoryLayout> layout /*= std::nullopt*/)
{
auto& ctx = GetMLIRContext();
auto type = v.getType();
if (!layout)
{
layout = InferLayoutFromMLIRValue(v);
}
if (auto shapedType = type.dyn_cast<mlir::ShapedType>())
{
assert(shapedType.hasStaticShape());
auto eltType = shapedType.getElementType();
auto eltValueType = MLIRTypeToValueType(eltType);
assert(eltValueType != ValueType::Undefined);
MLIRContext::EmittableInfo& emittableInfo =
ctx.StoreLocalEmittable(
{ v.getAsOpaquePointer(), { eltValueType, 1 } });
Emittable emittable{ &emittableInfo };
return Value{ emittable, layout };
}
else if (type.isIntOrIndexOrFloat())
{
auto eltValueType = MLIRTypeToValueType(type);
assert(eltValueType != ValueType::Undefined);
MLIRContext::EmittableInfo& emittableInfo =
ctx.StoreLocalEmittable(
{ v.getAsOpaquePointer(), { eltValueType, 1 } });
Emittable emittable{ &emittableInfo };
return Value{ emittable, layout };
}
else
{
throw std::logic_error("Unsupported type");
}
}
std::vector<ViewAdapter> Wrap(std::vector<mlir::Value> values, std::function<MemoryLayout(mlir::Value)> layoutFn /*= nullptr*/)
{
if (!layoutFn)
{
layoutFn = InferLayoutFromMLIRValue;
}
std::vector<ViewAdapter> wrappedValues;
wrappedValues.reserve(values.size());
llvm::transform(values, std::back_inserter(wrappedValues), [&](mlir::Value v) {
return Wrap(v, layoutFn(v));
});
return wrappedValues;
}
Value ResolveConstantDataReference(Value constantDataSource)
{
return GetContext().ResolveConstantDataReference(constantDataSource);
}
/*static*/ GPUIndex GPU::BlockDim()
{
return GetMLIRContext().GetGPUIndex(GPUIndexType::BlockDim);
}
/*static*/ GPUIndex GPU::BlockId()
{
return GetMLIRContext().GetGPUIndex(GPUIndexType::BlockId);
}
/*static*/ GPUIndex GPU::GridDim()
{
return GetMLIRContext().GetGPUIndex(GPUIndexType::GridDim);
}
/*static*/ GPUIndex GPU::ThreadId()
{
return GetMLIRContext().GetGPUIndex(GPUIndexType::ThreadId);
}
static std::string GPUBarrierScopeToValueIRBarrierScope(GPU::BarrierScope scope)
{
switch (scope)
{
case GPU::BarrierScope::Block:
return "Block";
case GPU::BarrierScope::Warp:
return "Warp";
case GPU::BarrierScope::Threadfence:
return "Threadfence";
default:
llvm_unreachable("Unhandled case");
}
}
/*static*/ void GPU::Barrier(GPU::BarrierScope scope)
{
auto& b = GetMLIRContext().GetOpBuilder();
auto loc = b.getUnknownLoc();
(void)ir::util::CreateGPUControlBarrier(b, GPUBarrierScopeToValueIRBarrierScope(scope), loc);
}
// this is declaring externs to reference the fillResource fn's in
// mlir/tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp and then proceeds
// to emit calls to these functions
void FillResource(ViewAdapter resourceView, Scalar fillValue)
{
auto res = Unwrap(resourceView);
auto resType = res.getType();
if (auto shapedType = resType.dyn_cast<mlir::MemRefType>(); !shapedType)
{
throw std::logic_error{ "Resource to be filled in must be valid memory" };
}
else
{
auto fill = Unwrap(fillValue);
auto elemTy = shapedType.getElementType();
if (elemTy != fill.getType())
{
throw std::logic_error{ "Fill value must have same type as resource element type" };
}
auto rank = shapedType.getRank();
if (rank < 1 || rank > 3)
{
throw std::logic_error{ "Cannot fill resource with rank less than 1 or greater than 3" };
}
auto memorySpace = shapedType.getMemorySpace();
auto castType = mlir::MemRefType::get(llvm::makeArrayRef(llvm::SmallVector<int64_t, 3>((size_t)rank, -1)), elemTy, {}, memorySpace);
auto& b = GetMLIRContext().GetOpBuilder();
auto loc = b.getUnknownLoc();
mlir::Value memrefCasted = b.create<mlir::memref::CastOp>(
loc,
res,
castType);
auto DeclareFn = [&](const std::string& name, mlir::FunctionType fnTy) -> ir::value::ValueFuncOp {
auto mod = res.getParentRegion()->getParentOfType<ir::value::ValueModuleOp>();
assert(mod);
if (auto fnOp = mod.lookupSymbol<ir::value::ValueFuncOp>(name); fnOp) return fnOp;
auto insertPt = ir::util::GetTerminalInsertPoint<
ir::value::ValueModuleOp,
ir::value::ModuleTerminatorOp,
ir::value::ValueFuncOp>(mod);
mlir::OpBuilder::InsertionGuard guard(b);
b.restoreInsertionPoint(insertPt);
ir::value::ValueFuncOp fnOp = b.create<ir::value::ValueFuncOp>(
loc,
name,
fnTy,
ir::value::ExecutionTarget::CPU,
ir::value::ValueFuncOp::ExternalFuncTag{});
fnOp.setPrivate();
fnOp->setAttr(ir::CInterfaceAttrName, b.getUnitAttr());
return fnOp;
};
auto callSuffix = [&]() -> std::string {
if (elemTy.isIntOrIndex()) return "DInt";
if (elemTy.isF32()) return "DFloat";
throw LogicException(LogicExceptionErrors::illegalState, __FILE__ " : " + std::to_string(__LINE__));
}();
(void)b.create<ir::value::LaunchFuncOp>(
loc,
DeclareFn(std::string{ "fillResource" } + std::to_string(rank) + callSuffix,
b.getFunctionType({ castType, elemTy }, {})),
mlir::ValueRange{ memrefCasted,
fill });
}
}
// this is declaring externs to reference the fillResource fn's in
// mlir/include/mlir/ExecutionEngine/RunnerUtils.h and then proceeds
// to emit calls to these functions
void PrintMemref(ViewAdapter memView)
{
auto mem = Unwrap(memView);
auto memType = mem.getType();
if (auto shapedType = memType.dyn_cast<mlir::MemRefType>(); !shapedType)
{
throw std::logic_error{ "Resource to be filled in must be valid memory" };
}
else
{
auto& b = GetMLIRContext().GetOpBuilder();
auto loc = b.getUnknownLoc();
auto elemTy = shapedType.getElementType();
if (!(elemTy == b.getI32Type() || elemTy == b.getF32Type()))
{
throw std::logic_error{ "Memref to be printed must either have i32 or f32 element type" };
}
mlir::Value memrefCasted = b.create<mlir::memref::CastOp>(
loc,
mem,
mlir::UnrankedMemRefType::get(elemTy, shapedType.getMemorySpace()));
auto DeclareFn = [&](const std::string& name, mlir::FunctionType fnTy) -> ir::value::ValueFuncOp {
auto mod = mem.getParentRegion()->getParentOfType<ir::value::ValueModuleOp>();
assert(mod);
if (auto fnOp = mod.lookupSymbol<ir::value::ValueFuncOp>(name); fnOp) return fnOp;
auto insertPt = ir::util::GetTerminalInsertPoint<
ir::value::ValueModuleOp,
ir::value::ModuleTerminatorOp,
ir::value::ValueFuncOp>(mod);
mlir::OpBuilder::InsertionGuard guard(b);
b.restoreInsertionPoint(insertPt);
ir::value::ValueFuncOp fnOp = b.create<ir::value::ValueFuncOp>(
loc,
name,
fnTy,
ir::value::ExecutionTarget::CPU,
ir::value::ValueFuncOp::ExternalFuncTag{});
fnOp->setAttr(ir::CInterfaceAttrName, b.getUnitAttr());
fnOp.setPrivate();
return fnOp;
};
if (elemTy.isF32())
{
(void)b.create<ir::value::LaunchFuncOp>(
loc,
DeclareFn("print_memref_f32",
b.getFunctionType({ memrefCasted.getType() }, {})),
mlir::ValueRange{ memrefCasted });
}
else if (elemTy == b.getI32Type())
{
(void)b.create<ir::value::LaunchFuncOp>(
loc,
DeclareFn("print_memref_i32",
b.getFunctionType({ memrefCasted.getType() }, {})),
mlir::ValueRange{ memrefCasted });
}
}
}
mlir::OwningModuleRef GatherModules(const std::string& name, const std::vector<value::MLIRContext*>& contexts, mlir::MLIRContext* context)
{
auto topLevelModule = mlir::ModuleOp::create(mlir::UnknownLoc::get(context), llvm::StringRef(name));
mlir::OpBuilder builder(context);
builder.restoreInsertionPoint(ir::util::GetTerminalInsertPoint<mlir::ModuleOp, mlir::FuncOp>(topLevelModule));
for (const auto& contextPtr : contexts)
{
auto moduleCopy = contextPtr->cloneModule();
mlir::ModuleOp op = moduleCopy.get();
builder.clone(*op.getOperation());
}
return topLevelModule;
}
void SaveModule(const std::string& filename, mlir::ModuleOp moduleOp)
{
std::error_code ec;
llvm::raw_fd_ostream s(filename, ec);
moduleOp.print(s, mlir::OpPrintingFlags{}.enableDebugInfo(false));
}
void WriteHeaderForModule(const std::string& filename, mlir::ModuleOp moduleOp)
{
std::error_code ec;
llvm::raw_fd_ostream fstream(filename, ec);
(void)ir::TranslateToHeader(moduleOp, fstream);
}
void WriteHeaderForModules(const std::string& filename,
const std::string& libraryName,
const std::vector<value::MLIRContext*>& contexts)
{
std::error_code ec;
llvm::raw_fd_ostream fstream(filename, ec);
std::vector<mlir::OwningModuleRef> owningModuleRefs;
std::vector<mlir::ModuleOp> moduleOps;
owningModuleRefs.reserve(contexts.size());
moduleOps.reserve(contexts.size());
for (const auto& contextPtr : contexts)
{
auto moduleCopy = contextPtr->cloneModule();
moduleOps.push_back(moduleCopy.get());
owningModuleRefs.push_back(std::move(moduleCopy));
}
(void)ir::TranslateToHeader(moduleOps, libraryName, fstream);
}
} // namespace accera::value
| 39.46749 | 203 | 0.616991 | [
"shape",
"vector",
"transform"
] |
0e34d0c9ea82532147a49f8d80c2b1c693e0ee53 | 22,473 | cc | C++ | open_spiel/games/backgammon_test.cc | ajain-23/open_spiel | a6a0f0129571bb6f0e6832e870e299663fb7cdd5 | [
"Apache-2.0"
] | 3,167 | 2019-08-27T06:50:30.000Z | 2022-03-31T22:33:48.000Z | open_spiel/games/backgammon_test.cc | AliBeikmohammadi/open_spiel | 38941dee3beb52ffdb134b66f420a758634d9a20 | [
"Apache-2.0"
] | 650 | 2019-08-27T16:24:09.000Z | 2022-03-30T19:41:09.000Z | open_spiel/games/backgammon_test.cc | AliBeikmohammadi/open_spiel | 38941dee3beb52ffdb134b66f420a758634d9a20 | [
"Apache-2.0"
] | 774 | 2019-08-27T10:36:04.000Z | 2022-03-29T15:44:42.000Z | // Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// 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 "open_spiel/games/backgammon.h"
#include <algorithm>
#include <random>
#include "open_spiel/spiel.h"
#include "open_spiel/tests/basic_tests.h"
namespace open_spiel {
namespace backgammon {
namespace {
namespace testing = open_spiel::testing;
bool ActionsContains(const std::vector<Action>& legal_actions, Action action) {
return std::find(legal_actions.begin(), legal_actions.end(), action) !=
legal_actions.end();
}
void CheckHits(const State &state) {
if (state.IsChanceNode() || state.IsTerminal()) {
return;
}
Player player = state.CurrentPlayer();
const auto &bstate = down_cast<const BackgammonState &>(state);
for (Action action : bstate.LegalActions()) {
std::vector<CheckerMove> cmoves = bstate.AugmentWithHitInfo(
player, bstate.SpielMoveToCheckerMoves(player, action));
std::cout << bstate.ActionToString(player, action) << std::endl;
for (CheckerMove cmove : cmoves) {
const int to_pos = bstate.GetToPos(player, cmove.pos, cmove.num);
// If the to position is on the board and there is only 1 checker, this
// has to be a hit.
if (cmove.pos != kPassPos && !bstate.IsOff(player, to_pos) &&
bstate.board(bstate.Opponent(player), to_pos) == 1) {
SPIEL_CHECK_TRUE(cmove.hit);
}
// Now, check the converse.
if (cmove.hit) {
SPIEL_CHECK_TRUE(cmove.pos != kPassPos &&
!bstate.IsOff(player, to_pos) &&
bstate.board(bstate.Opponent(player), to_pos) == 1);
}
// No need to apply the intermediate checker move, as it does not make
// any difference for what we're checking.
}
}
}
void BasicBackgammonTestsCheckHits() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
testing::RandomSimTest(*game, 10, true, true, &CheckHits);
}
void BasicBackgammonTestsVaryScoring() {
for (std::string scoring :
{"winloss_scoring", "enable_gammons", "full_scoring"}) {
auto game =
LoadGame("backgammon", {{"scoring_type", GameParameter(scoring)}});
testing::ChanceOutcomesTest(*game);
testing::RandomSimTestWithUndo(*game, 10);
testing::RandomSimTest(*game, 10);
}
}
void BasicHyperBackgammonTestsVaryScoring() {
for (std::string scoring :
{"winloss_scoring", "enable_gammons", "full_scoring"}) {
auto game =
LoadGame("backgammon", {{"scoring_type", GameParameter(scoring)},
{"hyper_backgammon", GameParameter(true)}});
testing::ChanceOutcomesTest(*game);
testing::RandomSimTestWithUndo(*game, 10);
testing::RandomSimTest(*game, 10);
}
}
void BasicBackgammonTestsDoNotStartWithDoubles() {
std::mt19937 rng;
for (int i = 0; i < 100; ++i) {
auto game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
while (state->IsChanceNode()) {
Action outcome =
SampleAction(state->ChanceOutcomes(),
std::uniform_real_distribution<double>(0.0, 1.0)(rng))
.first;
state->ApplyAction(outcome);
}
BackgammonState* backgammon_state =
dynamic_cast<BackgammonState*>(state.get());
// The dice should contain two different numbers,
// because a tie would not select a starting player.
SPIEL_CHECK_NE(backgammon_state->dice(0), backgammon_state->dice(1));
}
}
// Must bear-off furthest checker first.
// Should have exactly one legal move here (since double moves are
// two separate turns): 1-5, 0-5
// +------|------+
// |..xx..|..x6x.|
// |...x..|...xx.|
// |......|...x..|
// |......|...x..|
// |......|...x..|
// | | |
// |......|......|
// |......|......|
// |......|......|
// |......|x....o|
// |..x...|x...oo|
// +------|------+
// Turn: o
// Dice: 55
// Bar:
// Scores, X: 0, O: 12
void BearOffFurthestFirstTest() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
bstate->SetState(
kOPlayerId, false, {5, 5}, {0, 0}, {0, 12},
{{0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 6, 2, 0},
{2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
// Check for exactly one legal move.
std::vector<Action> legal_actions = bstate->LegalActions();
SPIEL_CHECK_EQ(legal_actions.size(), 1);
// Check that it's 1-5 0-5
std::vector<open_spiel::backgammon::CheckerMove> checker_moves =
bstate->SpielMoveToCheckerMoves(kOPlayerId, legal_actions[0]);
SPIEL_CHECK_EQ(checker_moves[0].pos, 1);
SPIEL_CHECK_EQ(checker_moves[0].num, 5);
SPIEL_CHECK_EQ(checker_moves[1].pos, 0);
SPIEL_CHECK_EQ(checker_moves[1].num, 5);
}
// +------|------+
// |......|x.xxx9|
// |......|..xx.x|
// |......|.....x|
// |......|.....x|
// |......|.....x|
// | | |
// |......|.....o|
// |......|.....o|
// |......|.....o|
// |......|.....o|
// |......|.....7|
// +------|------+
// Turn: x
// Dice: 16
// Bar:
// Scores, X: 0, O: 8
void NormalBearOffSituation() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
bstate->SetState(
kXPlayerId, false, {1, 6}, {0, 0}, {0, 8},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 9},
{7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
std::vector<Action> legal_actions = bstate->LegalActions();
std::cout << "Legal actions:" << std::endl;
for (Action action : legal_actions) {
std::cout << bstate->ActionToString(kXPlayerId, action) << std::endl;
}
// Legal actions here are:
// (18-1 19-6)
// (18-6 20-1)
// (18-6 21-1)
// (18-6 22-1)
// (18-6 23-1)
// (20-1 18-6)
// (21-1 18-6)
// (22-1 18-6)
// (23-1 18-6)
SPIEL_CHECK_EQ(legal_actions.size(), 9);
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 1, false}, {19, 6, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 6, false}, {20, 1, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 6, false}, {21, 1, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 6, false}, {22, 1, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 6, false}, {23, 1, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{20, 1, false}, {18, 6, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{21, 1, false}, {18, 6, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{22, 1, false}, {18, 6, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{23, 1, false}, {18, 6, false}})));
}
// +------|------+
// |.....o|x.xx9o|
// |......|..xxx.|
// |......|..x.x.|
// |......|....x.|
// |......|....x.|
// | | |
// |......|.....o|
// |......|.....o|
// |......|.....o|
// |......|..o.oo|
// |o.....|..o.o8|
// +------|------+
// Turn: x
// Dice: 44
// Bar:
// Scores, X: 0, O: 0
void NormalBearOffSituation2() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
bstate->SetState(
kXPlayerId, false, {4, 4}, {0, 0}, {0, 0},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 3, 2, 9, 0},
{8, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}});
std::cout << bstate->ToString();
std::vector<Action> legal_actions = bstate->LegalActions();
std::cout << "Legal actions:" << std::endl;
for (Action action : legal_actions) {
std::cout << bstate->ActionToString(kXPlayerId, action) << std::endl;
}
// Legal actions here are:
// (18-4 20-4)
// (20-4 18-4)
// (20-4 20-4)
SPIEL_CHECK_EQ(legal_actions.size(), 3);
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{18, 4, false}, {20, 4, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{20, 4, false}, {18, 4, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{20, 4, false}, {20, 4, false}})));
}
// +------|------+
// |.....x|x.xx9o|
// |......|..xxx.|
// |......|....x.|
// |......|....x.|
// |......|....x.|
// | | |
// |......|.....o|
// |......|.....o|
// |......|..o..o|
// |......|..o.oo|
// |o.....|..o.o8|
// +------|------+
// Turn: x
// Dice: 16
// Bar:
// Scores, X: 0, O: 0
void BearOffOutsideHome() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
bstate->SetState(
kXPlayerId, false, {1, 6}, {0, 0}, {0, 0},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 2, 9, 0},
{8, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}});
std::cout << bstate->ToString();
std::vector<Action> legal_actions = bstate->LegalActions();
std::cout << "Legal actions:" << std::endl;
for (Action action : legal_actions) {
std::cout << bstate->ActionToString(kXPlayerId, action) << std::endl;
}
// Check that the one outside can be born off with this roll.
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{17, 6, true}, {23, 1, false}})));
SPIEL_CHECK_TRUE(ActionsContains(
legal_actions,
bstate->CheckerMovesToSpielMove({{17, 1, false}, {18, 6, false}})));
}
// +------|------+
// |o...x.|xxxxox|
// |....x.|xxxxox|
// |......|x.xx..|
// |......|......|
// |......|......|
// | | |
// |......|......|
// |......|......|
// |......|......|
// |......|o.o.oo|
// |oo..o.|ooo.oo|
// +------|------+
// Turn: x
// Dice: 44
// Bar:
// Scores, X: 0, O: 0
void DoublesBearOffOutsideHome() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
bstate->SetState(
kXPlayerId, false, {4, 4}, {0, 0}, {0, 0},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 2, 3, 3, 0, 2},
{2, 2, 0, 2, 1, 2, 0, 1, 0, 0, 1, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0}});
std::cout << bstate->ToString();
// First part of double turn.
SPIEL_CHECK_FALSE(bstate->double_turn());
std::vector<Action> legal_actions = bstate->LegalActions();
std::cout << "Legal actions:" << std::endl;
for (Action action : legal_actions) {
std::cout << bstate->ActionToString(kXPlayerId, action) << std::endl;
}
// Check that we can bear off the two X checkers outside the home area (using
// two turns.
Action action =
bstate->CheckerMovesToSpielMove({{16, 4, false}, {16, 4, false}});
SPIEL_CHECK_TRUE(ActionsContains(legal_actions, action));
bstate->ApplyAction(action);
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "Legal actions:" << std::endl;
for (Action action : legal_actions) {
std::cout << bstate->ActionToString(kXPlayerId, action) << std::endl;
}
// Second part of double turn, so make sure the same player goes again.
SPIEL_CHECK_TRUE(bstate->double_turn());
SPIEL_CHECK_EQ(bstate->CurrentPlayer(), kXPlayerId);
// Now, bearing off from 20 should be allowed.
action = bstate->CheckerMovesToSpielMove({{20, 4, false}, {20, 4, false}});
SPIEL_CHECK_TRUE(ActionsContains(legal_actions, action));
}
void HumanReadableNotation() {
std::shared_ptr<const Game> game = LoadGame("backgammon");
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
// Check double repeated move and moving on from Bar displayed correctly
bstate->SetState(
kXPlayerId, false, {1, 1}, {13, 5}, {0, 0},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
std::vector<Action> legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
std::string notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - Bar/24(2)"));
// Check hits displayed correctly
bstate->SetState(
kXPlayerId, false, {2, 1}, {13, 5}, {0, 0},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
{1, 1, 1, 1, 1, 5, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation,
absl::StrCat(legal_actions[0], " - Bar/24* Bar/23*"));
// Check moving off displayed correctly
bstate->SetState(
kXPlayerId, false, {2, 1}, {0, 0}, {13, 5},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 2/Off 1/Off"));
// Check die order doesnt impact narrative
bstate->SetState(
kXPlayerId, false, {1, 2}, {0, 0}, {13, 5},
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1},
{0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 2/Off 1/Off"));
// Check double move
bstate->SetState(
kXPlayerId, false, {6, 5}, {0, 0}, {13, 5},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/18/13"));
// Check double move with hit
bstate->SetState(
kXPlayerId, false, {6, 5}, {0, 0}, {13, 4},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/18*/13"));
// Check double move with double hit
bstate->SetState(
kXPlayerId, false, {6, 5}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/18*/13*"));
// Check ordinary move!
bstate->SetState(
kXPlayerId, false, {6, 5}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/19 24/18"));
// Check ordinary move with die reversed
bstate->SetState(
kXPlayerId, false, {5, 6}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 4, 0, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal actions:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/19 24/18"));
// Check ordinary move with 1st hit
bstate->SetState(
kXPlayerId, false, {6, 5}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 3, 1, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/19* 24/18"));
// Check ordinary move with 2nd hit
bstate->SetState(
kXPlayerId, false, {5, 6}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 3, 0, 1, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/19 24/18*"));
// Check ordinary move with double hit
bstate->SetState(
kXPlayerId, false, {5, 6}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/19* 24/18*"));
// Check double pass
bstate->SetState(
kXPlayerId, false, {5, 3}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, "Pass");
// Check single pass
bstate->SetState(
kXPlayerId, false, {5, 6}, {0, 0}, {13, 3},
{{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}});
std::cout << bstate->ToString();
legal_actions = bstate->LegalActions();
std::cout << "First legal action:" << std::endl;
notation = bstate->ActionToString(kXPlayerId, legal_actions[0]);
std::cout << notation << std::endl;
SPIEL_CHECK_EQ(notation, absl::StrCat(legal_actions[0], " - 24/18 Pass"));
}
void BasicHyperBackgammonTest() {
std::shared_ptr<const Game> game =
LoadGame("backgammon", {{"hyper_backgammon", GameParameter(true)}});
std::unique_ptr<State> state = game->NewInitialState();
BackgammonState* bstate = static_cast<BackgammonState*>(state.get());
SPIEL_CHECK_EQ(bstate->CountTotalCheckers(kXPlayerId), 3);
SPIEL_CHECK_EQ(bstate->CountTotalCheckers(kOPlayerId), 3);
}
} // namespace
} // namespace backgammon
} // namespace open_spiel
int main(int argc, char** argv) {
open_spiel::testing::LoadGameTest("backgammon");
open_spiel::backgammon::BasicBackgammonTestsCheckHits();
open_spiel::backgammon::BasicBackgammonTestsDoNotStartWithDoubles();
open_spiel::backgammon::BasicBackgammonTestsVaryScoring();
open_spiel::backgammon::BasicHyperBackgammonTestsVaryScoring();
open_spiel::backgammon::BearOffFurthestFirstTest();
open_spiel::backgammon::NormalBearOffSituation();
open_spiel::backgammon::NormalBearOffSituation2();
open_spiel::backgammon::BearOffOutsideHome();
open_spiel::backgammon::DoublesBearOffOutsideHome();
open_spiel::backgammon::HumanReadableNotation();
open_spiel::backgammon::BasicHyperBackgammonTest();
}
| 37.330565 | 80 | 0.580697 | [
"vector"
] |
0e356865eabf3d6be9a697e1ad2118d6b4e7ca39 | 12,861 | cc | C++ | DQM/DTMonitorClient/src/DTRunConditionVarClient.cc | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | DQM/DTMonitorClient/src/DTRunConditionVarClient.cc | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | DQM/DTMonitorClient/src/DTRunConditionVarClient.cc | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | /******* \class DTRunConditionVarClient *******
*
* Description:
*
* detailed description
*
* \author : Paolo Bellan, Antonio Branca
* $date : 23/09/2011 15:42:04 CET $
*
* Modification:
*
* threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
*
*
*********************************/
#include <DQM/DTMonitorClient/src/DTRunConditionVarClient.h>
#include <DQMServices/Core/interface/MonitorElement.h>
#include <DQMServices/Core/interface/DQMStore.h>
#include <FWCore/Framework/interface/EventSetup.h>
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "CondFormats/DataRecord/interface/DTMtimeRcd.h"
#include <stdio.h>
#include <sstream>
#include <math.h>
using namespace edm;
using namespace std;
DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet)
{
LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient")
<< "DTRunConditionVarClient: Constructor called";
minRangeVDrift = pSet.getUntrackedParameter<double>("minRangeVDrift");
maxRangeVDrift = pSet.getUntrackedParameter<double>("maxRangeVDrift");
minRangeT0 = pSet.getUntrackedParameter<double>("minRangeT0");
maxRangeT0 = pSet.getUntrackedParameter<double>("maxRangeT0");
maxGoodVDriftDev = pSet.getUntrackedParameter<double>("maxGoodVDriftDev");
minBadVDriftDev = pSet.getUntrackedParameter<double>("minBadVDriftDev");
maxGoodT0 = pSet.getUntrackedParameter<double>("maxGoodT0");
minBadT0 = pSet.getUntrackedParameter<double>("minBadT0");
maxGoodVDriftSigma = pSet.getUntrackedParameter<double>("maxGoodVDriftSigma");
minBadVDriftSigma = pSet.getUntrackedParameter<double>("minBadVDriftSigma");
maxGoodT0Sigma = pSet.getUntrackedParameter<double>("maxGoodT0Sigma");
minBadT0Sigma = pSet.getUntrackedParameter<double>("minBadT0Sigma");
nevents = 0;
bookingdone = 0;
}
DTRunConditionVarClient::~DTRunConditionVarClient()
{
LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient")
<< "DTRunConditionVarClient: Destructor called";
}
void DTRunConditionVarClient::beginRun(const Run& run, const EventSetup& context){
LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTRunConditionVarClient]: BeginRun";
// Get the map of vdrift from the setup
context.get<DTMtimeRcd>().get(mTime);
mTimeMap_ = &*mTime;
}
void DTRunConditionVarClient::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter,
edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context)
{
}
void DTRunConditionVarClient::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter)
{
LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient")
<< "DTRunConditionVarClient: end job";
ibooker.setCurrentFolder("DT/02-Segments");
glbVDriftSummary = ibooker.book2D("VDriftGlbSummary", "# of MBs with good mean and good sigma of vDrift",12,1,13,5,-2,3);
glbT0Summary = ibooker.book2D("T0GlbSummary", "# of MBs with good mean and good sigma of t0",12,1,13,5,-2,3);
ibooker.setCurrentFolder("DT/02-Segments/02-MeanVDrift");
summaryHistos["MeanVDriftGlbSummary"] = ibooker.book2D("MeanVDriftGlbSummary","mean VDrift average per sector",12,1.,13.,5,-2.,3.);
allwheelHistos["allMeanVDrift"] = ibooker.book1D("VDriftMeanAllWheels","mean VDrift for all chambers",60,0.0048,0.006);
ibooker.setCurrentFolder("DT/02-Segments/02-SigmaVDrift");
summaryHistos["SigmaVDriftGlbSummary"] = ibooker.book2D("SigmaVDriftGlbSummary","# of Chambers with good sigma VDrift",12,1.,13.,5,-2.,3.);
allwheelHistos["allSigmaVDrift"] = ibooker.book1D("VDriftSigmaAllWheels","sigma VDrift for all chambers",30,0.,0.0006);
ibooker.setCurrentFolder("DT/02-Segments/03-MeanT0");
summaryHistos["MeanT0GlbSummary"] = ibooker.book2D("MeanT0GlbSummary","mean T0 average per sector",12,1.,13.,5,-2.,3.);
allwheelHistos["allMeanT0"] = ibooker.book1D("T0MeanAllWheels","mean T0 for all chambers",100,-25.,25.);
ibooker.setCurrentFolder("DT/02-Segments/03-SigmaT0");
summaryHistos["SigmaT0GlbSummary"] = ibooker.book2D("SigmaT0GlbSummary","# of Chambers with good sigma T0",12,1.,13.,5,-2.,3.);
allwheelHistos["allSigmaT0"] = ibooker.book1D("T0SigmaAllWheels","sigma T0 for alla chambers",50,0,25);
for(int wh=-2; wh<=2; wh++) {
bookWheelHistos(ibooker,"MeanVDrift","02-MeanVDrift",wh,60,0.0048,0.006,true);
bookWheelHistos(ibooker,"SigmaVDrift","02-SigmaVDrift",wh,30,0.,0.0006);
bookWheelHistos(ibooker,"MeanT0","03-MeanT0",wh,100,-25.,25.);
bookWheelHistos(ibooker,"SigmaT0","03-SigmaT0",wh,50,0,25);
}
for(int wheel=-2;wheel<=2;wheel++){
for(int sec=1; sec<=14; sec++) {
for(int stat=1; stat<=4; stat++) {
if( (sec == 13 || sec == 14) && stat != 4 ) continue;
// Get the ME produced by DTRunConditionVar Source
MonitorElement* VDriftME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"VDrift_FromSegm");
MonitorElement* T0ME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"T0_FromSegm");
if (!VDriftME || !T0ME) {
edm::LogWarning("DTRunConditionVarClient") << "ME not available" << std::endl;
return;
}
// Get the means per chamber
float vDriftMean = VDriftME->getMean();
float t0Mean = T0ME->getMean();
// Get the sigma per chamber
float vDriftSigma = VDriftME->getRMS();
float t0Sigma = T0ME->getRMS();
if( VDriftME->getEntries() != 0 ) {
allwheelHistos["allMeanVDrift"] -> Fill(vDriftMean);
allwheelHistos["allSigmaVDrift"] -> Fill(vDriftSigma);
(wheelHistos[wheel])["MeanVDrift"] -> Fill(vDriftMean);
(wheelHistos[wheel])["SigmaVDrift"] -> Fill(vDriftSigma);
}
if( T0ME->getEntries() != 0 ) {
allwheelHistos["allMeanT0"] -> Fill(t0Mean);
allwheelHistos["allSigmaT0"] -> Fill(t0Sigma);
(wheelHistos[wheel])["MeanT0"] -> Fill(t0Mean);
(wheelHistos[wheel])["SigmaT0"] -> Fill(t0Sigma);
}
DTChamberId indexCh(wheel,stat,sec);
float vDriftDev(0.), errvDriftDev(0.);
percDevVDrift(indexCh, vDriftMean, vDriftSigma, vDriftDev, errvDriftDev);
int sec_ = sec;
if( sec == 13 || sec == 14 ) sec_ = ( sec == 13 ) ? 4 : 10;
float fillvDriftDev = max(min(vDriftDev,maxRangeVDrift),minRangeVDrift);
float fillT0Mean = max(min(t0Mean,maxRangeT0),minRangeT0);
float vDriftDevQ = varQuality(fabs(vDriftDev),maxGoodVDriftDev,minBadVDriftDev);
float t0MeanQ = varQuality(fabs(t0Mean),maxGoodT0,minBadT0);
float vDriftSigmQ = varQuality(vDriftSigma,maxGoodVDriftSigma,minBadVDriftSigma);
float t0SigmQ = varQuality(t0Sigma,maxGoodT0Sigma,minBadT0Sigma);
if( sec == 13 || sec == 14 ) {
float binVDriftDev = (wheelHistos[wheel])["MeanVDriftSummary"]->getBinContent(sec_,stat);
binVDriftDev = (fabs(binVDriftDev) > fabs(fillvDriftDev)) ? binVDriftDev : fillvDriftDev;
(wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,binVDriftDev);
float binT0MeanVal = (wheelHistos[wheel])["MeanT0Summary"] -> getBinContent(sec_,stat);
binT0MeanVal = (fabs(binT0MeanVal) > fabs(fillT0Mean)) ? binT0MeanVal : fillT0Mean;
(wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,binT0MeanVal);
float binVDriftSigmVal = (wheelHistos[wheel])["SigmaVDriftSummary"] -> getBinContent(sec_,stat);
binVDriftSigmVal = (binVDriftSigmVal > 0. && binVDriftSigmVal < vDriftSigmQ) ? binVDriftSigmVal : vDriftSigmQ;
(wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,binVDriftSigmVal);
float binT0SigmVal = (wheelHistos[wheel])["SigmaT0Summary"] -> getBinContent(sec_,stat);
binT0SigmVal = (binT0SigmVal > 0. && binT0SigmVal < t0SigmQ) ? binT0SigmVal : t0SigmQ;
(wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,binT0SigmVal);
} else {
(wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,fillvDriftDev);
(wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,fillT0Mean);
(wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,vDriftSigmQ);
(wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,t0SigmQ);
}
double weight = 1/4.;
if(( sec_ == 4 || sec_ == 10) && stat == 4) weight = 1/8.;
if( vDriftDevQ > 0.85 && vDriftSigmQ > 0.85 ) {
glbVDriftSummary -> Fill(sec_,wheel,weight);
summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight);
summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight);
} else {
if( vDriftDevQ > 0.85 && vDriftSigmQ < 0.85 ) {
summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight);
}
if( vDriftDevQ < 0.85 && vDriftSigmQ > 0.85 ) {
summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight);
}
}
if( t0MeanQ > 0.85 && t0SigmQ > 0.85 ) {
glbT0Summary -> Fill(sec_,wheel,weight);
summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight);
summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight);
} else {
if( t0MeanQ > 0.85 && t0SigmQ < 0.85 ) {
summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight);
}
if( t0MeanQ < 0.85 && t0SigmQ > 0.85 ) {
summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight);
}
}
}// end loop on stations
}// end loop on sectors
}//end loop on wheels
return;
}
float DTRunConditionVarClient::varQuality(float var, float maxGood, float minBad) {
float qual(0);
if( var <= maxGood ) {qual = 1.;}
else if( var > maxGood && var < minBad ) {qual = 0.9;}
else if( var >= minBad ) {qual = 0.1;}
return qual;
}
void DTRunConditionVarClient::percDevVDrift(DTChamberId indexCh, float meanVD, float sigmaVD, float& devVD, float& errdevVD) {
DTSuperLayerId indexSLPhi1(indexCh,1);
DTSuperLayerId indexSLPhi2(indexCh,3);
float vDriftPhi1(0.), vDriftPhi2(0.);
float ResPhi1(0.), ResPhi2(0.);
int status1 = mTimeMap_->get(indexSLPhi1,vDriftPhi1,ResPhi1,DTVelocityUnits::cm_per_ns);
int status2 = mTimeMap_->get(indexSLPhi2,vDriftPhi2,ResPhi2,DTVelocityUnits::cm_per_ns);
if(status1 != 0 || status2 != 0) {
DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2;
throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for"
<< sl << endl;
}
float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.;
devVD = (meanVD - vDriftMed) / vDriftMed;
devVD = devVD < 1. ? devVD : 1.;
errdevVD = sigmaVD/vDriftMed;
return;
}
void DTRunConditionVarClient::bookWheelHistos(DQMStore::IBooker & ibooker, string histoType, string subfolder,
int wh, int nbins, float min, float max, bool isVDCorr )
{
stringstream wheel; wheel << wh;
string folder = "DT/02-Segments/" + subfolder;
ibooker.setCurrentFolder(folder);
string histoName = histoType + "_W" + wheel.str();
string histoLabel = histoType;
(wheelHistos[wh])[histoType] = ibooker.book1D(histoName, histoLabel, nbins, min, max);
if( isVDCorr ) {
histoLabel = "Summary of corrections to VDrift DB values";
histoName = "CorrTo" + histoType + "Summary_W" + wheel.str();
} else {
histoLabel = histoType + "Summary";
histoName = histoType + "Summary_W" + wheel.str();
}
MonitorElement* me = ibooker.book2D(histoName, histoLabel,12,1,13,4,1,5);
me->setBinLabel(1,"MB1",2);
me->setBinLabel(2,"MB2",2);
me->setBinLabel(3,"MB3",2);
me->setBinLabel(4,"MB4",2);
me->setAxisTitle("Sector",1);
(wheelHistos[wh])[histoType + "Summary"] = me;
return;
}
MonitorElement* DTRunConditionVarClient::getChamberHistos(DQMStore::IGetter & igetter,const DTChamberId& dtCh, string histoType) {
int wh = dtCh.wheel();
int sc = dtCh.sector();
int st = dtCh.station();
stringstream wheel; wheel << wh;
stringstream station; station << st;
stringstream sector; sector << sc;
string folder = "DT/02-Segments/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str();
string histoTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
string MEpath = folder + "/" + histoType + histoTag;
igetter.setCurrentFolder(folder);
LogTrace ("DTDQM|DTMonitorModule|DTRunConditionVar")
<< "[DTRunConditionVar]: getting ME from " << folder << endl;
MonitorElement* ME = igetter.get(MEpath);
return ME;
}
| 37.386628 | 141 | 0.674598 | [
"geometry"
] |
0e3651de8bb182c87c55eacf8b11551542717d8c | 17,804 | cpp | C++ | L1Trigger/Phase2L1ParticleFlow/src/newfirmware/egamma/pftkegalgo_ref.cpp | p2l1pfp/cmssw | 9bda22bf33ecf18dd19a3af2b3a8cbdb1de556a9 | [
"Apache-2.0"
] | 2 | 2018-06-01T05:18:55.000Z | 2021-04-08T21:44:06.000Z | L1Trigger/Phase2L1ParticleFlow/src/newfirmware/egamma/pftkegalgo_ref.cpp | p2l1pfp/cmssw | 9bda22bf33ecf18dd19a3af2b3a8cbdb1de556a9 | [
"Apache-2.0"
] | 26 | 2018-10-30T12:47:58.000Z | 2022-03-29T08:39:00.000Z | L1Trigger/Phase2L1ParticleFlow/src/newfirmware/egamma/pftkegalgo_ref.cpp | p2l1pfp/cmssw | 9bda22bf33ecf18dd19a3af2b3a8cbdb1de556a9 | [
"Apache-2.0"
] | null | null | null | #include "pftkegalgo_ref.h"
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <memory>
#include <iostream>
#ifdef CMSSW_GIT_HASH
#include "L1Trigger/Phase2L1ParticleFlow/src/dbgPrintf.h"
#else
#include "../../../utils/dbgPrintf.h"
#endif
using namespace l1ct;
#ifdef CMSSW_GIT_HASH
#include "FWCore/ParameterSet/interface/ParameterSet.h"
l1ct::PFTkEGAlgoEmuConfig::PFTkEGAlgoEmuConfig(const edm::ParameterSet &pset)
: nTRACK(pset.getParameter<uint32_t>("nTRACK")),
nTRACK_EGIN(pset.getParameter<uint32_t>("nTRACK_EGIN")),
nEMCALO_EGIN(pset.getParameter<uint32_t>("nEMCALO_EGIN")),
nEM_EGOUT(pset.getParameter<uint32_t>("nEM_EGOUT")),
filterHwQuality(pset.getParameter<bool>("filterHwQuality")),
doBremRecovery(pset.getParameter<bool>("doBremRecovery")),
writeBeforeBremRecovery(pset.getParameter<bool>("writeBeforeBremRecovery")),
caloHwQual(pset.getParameter<int>("caloHwQual")),
emClusterPtMin(pset.getParameter<double>("caloEtMin")),
dEtaMaxBrem(pset.getParameter<double>("dEtaMaxBrem")),
dPhiMaxBrem(pset.getParameter<double>("dPhiMaxBrem")),
absEtaBoundaries(pset.getParameter<std::vector<double>>("absEtaBoundaries")),
dEtaValues(pset.getParameter<std::vector<double>>("dEtaValues")),
dPhiValues(pset.getParameter<std::vector<double>>("dPhiValues")),
trkQualityPtMin(pset.getParameter<double>("trkQualityPtMin")),
writeEgSta(pset.getParameter<bool>("writeEGSta")),
tkIsoParams_tkEle(pset.getParameter<edm::ParameterSet>("tkIsoParametersTkEle")),
tkIsoParams_tkEm(pset.getParameter<edm::ParameterSet>("tkIsoParametersTkEm")),
pfIsoParams_tkEle(pset.getParameter<edm::ParameterSet>("pfIsoParametersTkEle")),
pfIsoParams_tkEm(pset.getParameter<edm::ParameterSet>("pfIsoParametersTkEm")),
doTkIso(pset.getParameter<bool>("doTkIso")),
doPfIso(pset.getParameter<bool>("doPfIso")),
hwIsoTypeTkEle(static_cast<EGIsoEleObjEmu::IsoType>(pset.getParameter<uint32_t>("hwIsoTypeTkEle"))),
hwIsoTypeTkEm(static_cast<EGIsoObjEmu::IsoType>(pset.getParameter<uint32_t>("hwIsoTypeTkEm"))),
debug(pset.getUntrackedParameter<uint32_t>("debug", 0)) {}
l1ct::PFTkEGAlgoEmuConfig::IsoParameters::IsoParameters(const edm::ParameterSet &pset)
: IsoParameters(pset.getParameter<double>("tkQualityPtMin"),
pset.getParameter<double>("dZ"),
pset.getParameter<double>("dRMin"),
pset.getParameter<double>("dRMax")) {}
#endif
void PFTkEGAlgoEmulator::toFirmware(const PFInputRegion &in,
PFRegion ®ion,
EmCaloObj emcalo[/*nCALO*/],
TkObj track[/*nTRACK*/]) const {
region = in.region;
l1ct::toFirmware(in.track, cfg.nTRACK_EGIN, track);
l1ct::toFirmware(in.emcalo, cfg.nEMCALO_EGIN, emcalo);
if (debug_ > 0)
dbgCout() << "# of inpput tracks: " << in.track.size() << " (max: " << cfg.nTRACK_EGIN << ")"
<< " emcalo: " << in.emcalo.size() << "(" << cfg.nEMCALO_EGIN << ")" << std::endl;
}
void PFTkEGAlgoEmulator::toFirmware(const OutputRegion &out, EGIsoObj out_egphs[], EGIsoEleObj out_egeles[]) const {
l1ct::toFirmware(out.egphoton, cfg.nEM_EGOUT, out_egphs);
l1ct::toFirmware(out.egelectron, cfg.nEM_EGOUT, out_egeles);
if (debug_ > 0)
dbgCout() << "# output photons: " << out.egphoton.size() << " electrons: " << out.egelectron.size() << std::endl;
}
void PFTkEGAlgoEmulator::toFirmware(
const PFInputRegion &in, const l1ct::PVObjEmu &pvin, PFRegion ®ion, TkObj track[/*nTRACK*/], PVObj &pv) const {
region = in.region;
l1ct::toFirmware(in.track, cfg.nTRACK, track);
pv = pvin;
if (debug_ > 0)
dbgCout() << "# of inpput tracks: " << in.track.size() << " (max: " << cfg.nTRACK << ")" << std::endl;
}
float PFTkEGAlgoEmulator::deltaPhi(float phi1, float phi2) const {
// reduce to [-pi,pi]
float x = phi1 - phi2;
float o2pi = 1. / (2. * M_PI);
if (std::abs(x) <= float(M_PI))
return x;
float n = std::round(x * o2pi);
return x - n * float(2. * M_PI);
}
void PFTkEGAlgoEmulator::link_emCalo2emCalo(const std::vector<EmCaloObjEmu> &emcalo,
std::vector<int> &emCalo2emCalo) const {
// NOTE: we assume the input to be sorted!!!
for (int ic = 0, nc = emcalo.size(); ic < nc; ++ic) {
auto &calo = emcalo[ic];
if (emCalo2emCalo[ic] != -1)
continue;
for (int jc = ic + 1; jc < nc; ++jc) {
if (emCalo2emCalo[jc] != -1)
continue;
auto &otherCalo = emcalo[jc];
if (fabs(otherCalo.floatEta() - calo.floatEta()) < cfg.dEtaMaxBrem &&
fabs(deltaPhi(otherCalo.floatPhi(), calo.floatPhi())) < cfg.dPhiMaxBrem) {
emCalo2emCalo[jc] = ic;
}
}
}
}
void PFTkEGAlgoEmulator::link_emCalo2tk(const PFRegionEmu &r,
const std::vector<EmCaloObjEmu> &emcalo,
const std::vector<TkObjEmu> &track,
std::vector<int> &emCalo2tk) const {
unsigned int nTrackMax = std::min<unsigned>(track.size(), cfg.nTRACK_EGIN);
for (int ic = 0, nc = emcalo.size(); ic < nc; ++ic) {
auto &calo = emcalo[ic];
float dPtMin = 999;
for (unsigned int itk = 0; itk < nTrackMax; ++itk) {
const auto &tk = track[itk];
if (tk.floatPt() < cfg.trkQualityPtMin)
continue;
float d_phi = deltaPhi(tk.floatPhi(), calo.floatPhi());
float d_eta = tk.floatEta() - calo.floatEta(); // We only use it squared
auto eta_index =
std::distance(cfg.absEtaBoundaries.begin(),
std::lower_bound(
cfg.absEtaBoundaries.begin(), cfg.absEtaBoundaries.end(), abs(r.floatGlbEta(calo.hwEta)))) -
1;
float dEtaMax = cfg.dEtaValues[eta_index];
float dPhiMax = cfg.dPhiValues[eta_index];
if ((((d_phi / dPhiMax) * (d_phi / dPhiMax)) + ((d_eta / dEtaMax) * (d_eta / dEtaMax))) < 1.) {
// NOTE: for now we implement only best pt match. This is NOT what is done in the L1TkElectronTrackProducer
if (fabs(tk.floatPt() - calo.floatPt()) < dPtMin) {
emCalo2tk[ic] = itk;
dPtMin = fabs(tk.floatPt() - calo.floatPt());
}
}
}
}
}
void PFTkEGAlgoEmulator::sel_emCalo(unsigned int nmax_sel,
const std::vector<EmCaloObjEmu> &emcalo,
std::vector<EmCaloObjEmu> &emcalo_sel) const {
for (int ic = 0, nc = emcalo.size(); ic < nc; ++ic) {
const auto &calo = emcalo[ic];
if ((calo.hwPt == 0) || (cfg.filterHwQuality && calo.hwEmID != cfg.caloHwQual) ||
(calo.floatPt() < cfg.emClusterPtMin))
continue;
emcalo_sel.push_back(calo);
if (emcalo_sel.size() >= nmax_sel)
break;
}
}
void PFTkEGAlgoEmulator::run(const PFInputRegion &in, OutputRegion &out) const {
if (debug_ > 1) {
for (int ic = 0, nc = in.emcalo.size(); ic < nc; ++ic) {
const auto &calo = in.emcalo[ic];
if (calo.hwPt > 0)
dbgCout() << "[REF] IN calo[" << ic << "] pt: " << calo.hwPt << " eta: " << calo.hwEta
<< " (glb eta: " << in.region.floatGlbEta(calo.hwEta) << ") phi: " << calo.hwPhi
<< "(glb phi: " << in.region.floatGlbPhi(calo.hwPhi) << ") qual: " << calo.hwEmID << std::endl;
}
}
// FIXME: can be removed in the endcap since now running with the "interceptor".
// Might still be needed in barrel
// filter and select first N elements of input clusters
std::vector<EmCaloObjEmu> emcalo_sel;
sel_emCalo(cfg.nEMCALO_EGIN, in.emcalo, emcalo_sel);
std::vector<int> emCalo2emCalo(emcalo_sel.size(), -1);
if (cfg.doBremRecovery)
link_emCalo2emCalo(emcalo_sel, emCalo2emCalo);
std::vector<int> emCalo2tk(emcalo_sel.size(), -1);
link_emCalo2tk(in.region, emcalo_sel, in.track, emCalo2tk);
out.egsta.clear();
std::vector<EGIsoObjEmu> egobjs;
std::vector<EGIsoEleObjEmu> egeleobjs;
eg_algo(in.region, emcalo_sel, in.track, emCalo2emCalo, emCalo2tk, out.egsta, egobjs, egeleobjs);
unsigned int nEGOut = std::min<unsigned>(cfg.nEM_EGOUT, egobjs.size());
unsigned int nEGEleOut = std::min<unsigned>(cfg.nEM_EGOUT, egeleobjs.size());
// init output containers
out.egphoton.clear();
out.egelectron.clear();
ptsort_ref(egobjs.size(), nEGOut, egobjs, out.egphoton);
ptsort_ref(egeleobjs.size(), nEGEleOut, egeleobjs, out.egelectron);
}
void PFTkEGAlgoEmulator::eg_algo(const PFRegionEmu ®ion,
const std::vector<EmCaloObjEmu> &emcalo,
const std::vector<TkObjEmu> &track,
const std::vector<int> &emCalo2emCalo,
const std::vector<int> &emCalo2tk,
std::vector<EGObjEmu> &egstas,
std::vector<EGIsoObjEmu> &egobjs,
std::vector<EGIsoEleObjEmu> &egeleobjs) const {
for (int ic = 0, nc = emcalo.size(); ic < nc; ++ic) {
auto &calo = emcalo[ic];
// discard immediately EG objects that would not fall in the fiducial eta-phi region
if (!region.isFiducial(calo))
continue;
if (debug_ > 3)
dbgCout() << "[REF] SEL emcalo with pt: " << calo.hwPt << " qual: " << calo.hwEmID << " eta: " << calo.hwEta
<< " phi " << calo.hwPhi << std::endl;
int itk = emCalo2tk[ic];
// check if brem recovery is on
if (!cfg.doBremRecovery || cfg.writeBeforeBremRecovery) {
// 1. create EG objects before brem recovery
addEgObjsToPF(egstas, egobjs, egeleobjs, emcalo, track, ic, calo.hwEmID, calo.hwPt, itk);
}
if (!cfg.doBremRecovery)
continue;
// check if the cluster has already been used in a brem reclustering
if (emCalo2emCalo[ic] != -1)
continue;
pt_t ptBremReco = calo.hwPt;
std::vector<unsigned int> components;
for (int jc = ic; jc < nc; ++jc) {
if (emCalo2emCalo[jc] == ic) {
auto &otherCalo = emcalo[jc];
ptBremReco += otherCalo.hwPt;
components.push_back(jc);
}
}
// 2. create EG objects with brem recovery
// NOTE: duplicating the object is suboptimal but this is done for keeping things as in TDR code...
addEgObjsToPF(egstas, egobjs, egeleobjs, emcalo, track, ic, calo.hwEmID + 2, ptBremReco, itk, components);
}
}
EGObjEmu &PFTkEGAlgoEmulator::addEGStaToPF(std::vector<EGObjEmu> &egobjs,
const EmCaloObjEmu &calo,
const int hwQual,
const pt_t ptCorr,
const std::vector<unsigned int> &components) const {
EGObjEmu egsta;
egsta.clear();
egsta.hwPt = ptCorr;
egsta.hwEta = calo.hwEta;
egsta.hwPhi = calo.hwPhi;
egsta.hwQual = hwQual;
egobjs.push_back(egsta);
return egobjs.back();
}
EGIsoObjEmu &PFTkEGAlgoEmulator::addEGIsoToPF(std::vector<EGIsoObjEmu> &egobjs,
const EmCaloObjEmu &calo,
const int hwQual,
const pt_t ptCorr) const {
EGIsoObjEmu egiso;
egiso.clear();
egiso.hwPt = ptCorr;
egiso.hwEta = calo.hwEta;
egiso.hwPhi = calo.hwPhi;
egiso.hwQual = hwQual;
egiso.srcCluster = calo.src;
egobjs.push_back(egiso);
if (debug_ > 2)
dbgCout() << "[REF] EGIsoObjEmu pt: " << egiso.hwPt << " eta: " << egiso.hwEta << " phi: " << egiso.hwPhi
<< " qual: " << egiso.hwQual << " packed: " << egiso.pack().to_string(16) << std::endl;
return egobjs.back();
}
EGIsoEleObjEmu &PFTkEGAlgoEmulator::addEGIsoEleToPF(std::vector<EGIsoEleObjEmu> &egobjs,
const EmCaloObjEmu &calo,
const TkObjEmu &track,
const int hwQual,
const pt_t ptCorr) const {
EGIsoEleObjEmu egiso;
egiso.clear();
egiso.hwPt = ptCorr;
egiso.hwEta = calo.hwEta;
egiso.hwPhi = calo.hwPhi;
egiso.hwQual = hwQual;
egiso.hwDEta = track.hwVtxEta() - egiso.hwEta;
egiso.hwDPhi = abs(track.hwVtxPhi() - egiso.hwPhi);
egiso.hwZ0 = track.hwZ0;
egiso.hwCharge = track.hwCharge;
egiso.srcCluster = calo.src;
egiso.srcTrack = track.src;
egobjs.push_back(egiso);
if (debug_ > 2)
dbgCout() << "[REF] EGIsoEleObjEmu pt: " << egiso.hwPt << " eta: " << egiso.hwEta << " phi: " << egiso.hwPhi
<< " qual: " << egiso.hwQual << " packed: " << egiso.pack().to_string(16) << std::endl;
return egobjs.back();
}
void PFTkEGAlgoEmulator::addEgObjsToPF(std::vector<EGObjEmu> &egstas,
std::vector<EGIsoObjEmu> &egobjs,
std::vector<EGIsoEleObjEmu> &egeleobjs,
const std::vector<EmCaloObjEmu> &emcalo,
const std::vector<TkObjEmu> &track,
const int calo_idx,
const int hwQual,
const pt_t ptCorr,
const int tk_idx,
const std::vector<unsigned int> &components) const {
int sta_idx = -1;
if (writeEgSta()) {
addEGStaToPF(egstas, emcalo[calo_idx], hwQual, ptCorr, components);
sta_idx = egstas.size() - 1;
}
EGIsoObjEmu &egobj = addEGIsoToPF(egobjs, emcalo[calo_idx], hwQual, ptCorr);
egobj.sta_idx = sta_idx;
if (tk_idx != -1) {
EGIsoEleObjEmu &eleobj = addEGIsoEleToPF(egeleobjs, emcalo[calo_idx], track[tk_idx], hwQual, ptCorr);
eleobj.sta_idx = sta_idx;
}
}
void PFTkEGAlgoEmulator::runIso(const PFInputRegion &in,
const std::vector<l1ct::PVObjEmu> &pvs,
OutputRegion &out) const {
if (cfg.doTkIso) {
compute_isolation(out.egelectron, in.track, cfg.tkIsoParams_tkEle, pvs[0].hwZ0);
compute_isolation(out.egphoton, in.track, cfg.tkIsoParams_tkEm, pvs[0].hwZ0);
}
if (cfg.doPfIso) {
compute_isolation(out.egelectron, out.pfcharged, out.pfneutral, cfg.pfIsoParams_tkEle, pvs[0].hwZ0);
compute_isolation(out.egphoton, out.pfcharged, out.pfneutral, cfg.pfIsoParams_tkEm, pvs[0].hwZ0);
}
std::for_each(out.egelectron.begin(), out.egelectron.end(), [&](EGIsoEleObjEmu &obj) {
obj.hwIso = obj.hwIsoVar(cfg.hwIsoTypeTkEle);
});
std::for_each(
out.egphoton.begin(), out.egphoton.end(), [&](EGIsoObjEmu &obj) { obj.hwIso = obj.hwIsoVar(cfg.hwIsoTypeTkEm); });
}
void PFTkEGAlgoEmulator::compute_isolation(std::vector<EGIsoObjEmu> &egobjs,
const std::vector<TkObjEmu> &objects,
const PFTkEGAlgoEmuConfig::IsoParameters ¶ms,
z0_t z0) const {
for (int ic = 0, nc = egobjs.size(); ic < nc; ++ic) {
auto &egphoton = egobjs[ic];
iso_t sumPt = 0.;
iso_t sumPtPV = 0.;
compute_sumPt(sumPt, sumPtPV, objects, cfg.nTRACK, egphoton, params, z0);
egphoton.setHwIso(EGIsoObjEmu::IsoType::TkIso, sumPt);
egphoton.setHwIso(EGIsoObjEmu::IsoType::TkIsoPV, sumPtPV);
}
}
void PFTkEGAlgoEmulator::compute_isolation(std::vector<EGIsoEleObjEmu> &egobjs,
const std::vector<TkObjEmu> &objects,
const PFTkEGAlgoEmuConfig::IsoParameters ¶ms,
z0_t z0) const {
for (int ic = 0, nc = egobjs.size(); ic < nc; ++ic) {
auto &egele = egobjs[ic];
iso_t sumPt = 0.;
iso_t sumPtPV = 0.;
compute_sumPt(sumPt, sumPtPV, objects, cfg.nTRACK, egele, params, z0);
egele.setHwIso(EGIsoEleObjEmu::IsoType::TkIso, sumPtPV);
}
}
void PFTkEGAlgoEmulator::compute_isolation(std::vector<EGIsoObjEmu> &egobjs,
const std::vector<PFChargedObjEmu> &charged,
const std::vector<PFNeutralObjEmu> &neutrals,
const PFTkEGAlgoEmuConfig::IsoParameters ¶ms,
z0_t z0) const {
for (int ic = 0, nc = egobjs.size(); ic < nc; ++ic) {
auto &egphoton = egobjs[ic];
iso_t sumPt = 0.;
iso_t sumPtPV = 0.;
// FIXME: set max # of PF objects for iso
compute_sumPt(sumPt, sumPtPV, charged, charged.size(), egphoton, params, z0);
compute_sumPt(sumPt, sumPtPV, neutrals, neutrals.size(), egphoton, params, z0);
egphoton.setHwIso(EGIsoObjEmu::IsoType::PfIso, sumPt);
egphoton.setHwIso(EGIsoObjEmu::IsoType::PfIsoPV, sumPtPV);
}
}
void PFTkEGAlgoEmulator::compute_isolation(std::vector<EGIsoEleObjEmu> &egobjs,
const std::vector<PFChargedObjEmu> &charged,
const std::vector<PFNeutralObjEmu> &neutrals,
const PFTkEGAlgoEmuConfig::IsoParameters ¶ms,
z0_t z0) const {
for (int ic = 0, nc = egobjs.size(); ic < nc; ++ic) {
auto &egele = egobjs[ic];
iso_t sumPt = 0.;
iso_t sumPtPV = 0.;
compute_sumPt(sumPt, sumPtPV, charged, charged.size(), egele, params, z0);
compute_sumPt(sumPt, sumPtPV, neutrals, neutrals.size(), egele, params, z0);
egele.setHwIso(EGIsoEleObjEmu::IsoType::PfIso, sumPtPV);
}
}
| 42.695444 | 120 | 0.591889 | [
"object",
"vector"
] |
0e36835f0b4d90ab39e309c246e988a52c44d8a8 | 1,929 | cpp | C++ | src/homework/tic_tac_toe/tic_tac_toe_3.cpp | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-isaiahgher | 2ac0de683502073155472549429bcbc56c170b28 | [
"MIT"
] | null | null | null | src/homework/tic_tac_toe/tic_tac_toe_3.cpp | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-isaiahgher | 2ac0de683502073155472549429bcbc56c170b28 | [
"MIT"
] | null | null | null | src/homework/tic_tac_toe/tic_tac_toe_3.cpp | acc-cosc-1337-spring-2021/acc-cosc-1337-spring-2021-isaiahgher | 2ac0de683502073155472549429bcbc56c170b28 | [
"MIT"
] | 1 | 2021-02-05T02:13:58.000Z | 2021-02-05T02:13:58.000Z | //cpp
#include "tic_tac_toe.h"
#include <iostream>
using namespace std;
//Public functions of class Tictactoe
// bool TicTacToe::game_over()
// {
// return check_board_full();
// }
//start_game
void TicTacToe::start_game(string first_player)
{
//first_player function argument value must be X or O
//using if else function
player = first_player;
this -> clear_board();
}
//mark_board
void TicTacToe::mark_board(int position)
{
//mark vector w position -1 equal to player
pegs[position-1] = this -> player;
//call set_next_player private function
this -> set_next_player();
}
//get_player
// string TicTacToe::get_player() const
// {
// return player; //player needs to be either X or O
// }
//display_board
void TicTacToe::display_board() const
{
//iterate vector of strings pegs to display
//a tic tac toe board in 3x3 format
cout<<pegs[0]<<"|"<<pegs[1]<<"|"<<pegs[2]<<"|"<<"\n";
cout<<pegs[3]<<"|"<<pegs[4]<<"|"<<pegs[5]<<"|"<<"\n";
cout<<pegs[6]<<"|"<<pegs[7]<<"|"<<pegs[8]<<"|"<<"\n";
}
//Private functions of class Tictactoe
//set_next_player
void TicTacToe::set_next_player()
{
//Set player. If private variable player
// X player is O else player is X
//using if else
if (player == "X")
{
player = 'O';
}
else
{
player = "X";
}
}
//check_board_full
bool TicTacToe::check_board_full()
{
// return false if vector of strings pegs has available slot by checking
//for a “ “(space)in each element.
//Otherwise return true
//using loop
bool board_full = true;
for (std::size_t i = 0; i < pegs.size(); ++i)
{
if (pegs[i] == " ")
{
board_full = false;
break;
}
}
return board_full;
}
//clear_board
void TicTacToe::clear_board()
{
for(std::size_t i = 0; i < pegs.size(); ++i){
pegs [i] == " ";
}
} | 20.741935 | 77 | 0.59098 | [
"vector"
] |
0e378025d2e51ead37d92afc78855ae6908e186a | 99,141 | hpp | C++ | src/odb/src/lef/lef/lefwWriter.hpp | erictaur/OpenROAD | 438dbb41316fc7fe27e2c405078aa465395125ba | [
"BSD-3-Clause"
] | 525 | 2019-11-20T00:21:42.000Z | 2022-03-31T05:38:44.000Z | src/odb/src/lef/lef/lefwWriter.hpp | erictaur/OpenROAD | 438dbb41316fc7fe27e2c405078aa465395125ba | [
"BSD-3-Clause"
] | 741 | 2019-11-20T15:19:38.000Z | 2022-03-31T23:09:17.000Z | src/odb/src/lef/lef/lefwWriter.hpp | erictaur/OpenROAD | 438dbb41316fc7fe27e2c405078aa465395125ba | [
"BSD-3-Clause"
] | 215 | 2019-11-25T13:37:43.000Z | 2022-03-28T00:51:29.000Z | // *****************************************************************************
// *****************************************************************************
// Copyright 2012 - 2013, Cadence Design Systems
//
// This file is part of the Cadence LEF/DEF Open Source
// Distribution, Product Version 5.8.
//
// 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.
//
// For updates, support, or to become part of the LEF/DEF Community,
// check www.openeda.org for details.
//
// $Author: dell $
// $Revision: #1 $
// $Date: 2017/06/06 $
// $State: $
// *****************************************************************************
// *****************************************************************************
#ifndef LEFW_WRITERCALLS_H
#define LEFW_WRITERCALLS_H
#include <stdio.h>
#include "lefiKRDefs.hpp"
#include "lefiDefs.hpp"
#include "lefiUser.hpp"
BEGIN_LEFDEF_PARSER_NAMESPACE
// Return codes for writing functions:
#define LEFW_OK 0
#define LEFW_UNINITIALIZED 1
#define LEFW_BAD_ORDER 2
#define LEFW_BAD_DATA 3
#define LEFW_ALREADY_DEFINED 4
#define LEFW_WRONG_VERSION 5
#define LEFW_MIX_VERSION_DATA 6
#define LEFW_OBSOLETE 7
// orient
// 0 = N
// 1 = W
// 2 = S
// 3 = E
// 4 = FN
// 5 = FW
// 6 = FS
// 7 = FE
// The LEF writer initialization. Must be called first.
// Either this routine or lefwInitCbk should be call only,
// Can't call both routines.
// This routine must be called only once.
// Returns 0 if successful.
extern int lefwInit(FILE* f);
// The LEF writer initialization. Must be called first.
// Either this routine or lefwInit should be call only,
// Can't call both routines.
// This routine must be called only once.
// Returns 0 if successful.
extern int lefwInitCbk(FILE* f);
// This routine will set the writer to write out an encrypted
// lef file.
// This routine must be called only once and has to be called after
// lefwInit or lefwInitCbk
// Need to call lefwCloseEncrypt to do some cleaning if this routine
// has called
extern int lefwEncrypt();
// This routine needs to be called if lefwEncrypt has called.
// It should be called before the fclose.
// It does some house cleaning.
extern int lefwCloseEncrypt();
// This routine will write a blank line
extern int lefwNewLine();
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
extern int lefwVersion (int vers1, int vers2);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
// The caseSensitive can be ON or OFF.
extern int lefwCaseSensitive (const char* caseSensitive);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
// The noWireExtensionAtPin can be ON or OFF.
extern int lefwNoWireExtensionAtPin (const char* noWireExt);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
// already have one
extern int lefwMinfeature (double minFeatureX, double minFeatureY);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
extern int lefwDielectric (double dielectric);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
extern int lefwBusBitChars (const char* busBitChars);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
extern int lefwDividerChar (const char* dividerChar);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwManufacturingGrid (double grid);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.8 syntax.
// Returns 0 if successful.
extern int lefwFixedMask();
// This routine is called after lefwInit.
// This routine can be called multiple times.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwUseMinSpacing (const char* type, const char* onOff);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwClearanceMeasure (const char* type);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwAntennaInputGateArea (double inputGateArea);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwAntennaInOutDiffArea (double inOutDiffArea);
// This routine is called after lefwInit.
// This routine can be called only once.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwAntennaOutputDiffArea (double outputDiffArea);
// This routine is called after lefwInit.
// This routine can be called only once.
// Returns 0 if successful.
// This section of routines is optional.
// The routine starts the units section. All of the units must follow.
extern int lefwStartUnits();
// This routine is called once for each unit. The call must
// be preceeded by a call to lefwStartUnits and must be
// terminated by a call to lefwEndUnits.
// Returns 0 if successful.
extern int lefwUnits(double time, // optional(0) - TIME NANOSECONDS
double capacitance, // optional(0) - CAPACITANCE PICOFARADS
double resistance, // optional(0) - RESISTANCE OHMS
double power, // optional(0) - POWER MILLIWATTS
double current, // optional(0) - CURRENT MILLIAMPS
double voltage, // optional(0) - VOLTAGE VOLTS
double database); // optional(0) - DATABASE MICRONS
// This routine is called once for each unit. It is separated from
// lefwUnits due to backwards compatible for pre 5.3.
// Returns 0 if successful.
extern int lefwUnitsFrequency(double frequency);
// This routine must be called after the lefwUnits call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndUnits();
// This routine is called after lefwInit.
// Either this routine or lefwStartLayerRouting must be called.
// Multiple sections of lefwStartLayer can be called.
// This routine can be called only once per section.
// Returns 0 if successful.
// The routine starts the layer section. All of the layers must follow.
// The type can be either CUT for Cut Layer, MASTERSLICE or OVERLAP for
// Masterslice or Overlay Layer.
extern int lefwStartLayer(const char* layerName,
const char* type); // CUT | MASTERSLICE | OVERLAP
// This routine must be called after lefwStartLayer.
// This section of routines is optional.
// Returns 0 if successful.
// This is a 5.8 syntax.
extern int lefwLayerMask(int maskColor);
// This routine must be called after lefwStartLayer.
// This section of routines is optional.
// Returns 0 if successful.
// This is a 5.5 syntax.
// This routine is called if the layer type is IMPLANT when
// lefwStartLayer is called.
extern int lefwLayerWidth(double minWidth);
// The following APIs are for lefwrite 5.7 Layer, Spacing with type CUT
// Due to adding new constructs, it is impossible to use the previous
// APIs.
// The following APIs are obsoleted in 5.7:
// lefwLayer
// lefwLayerStack
// lefwLayerSpacingAdjacent
// lefwLayerSpacingCenterToCenter
// This routine must be called after lefwStartLayer.
// This routine starts the Layer Type Cut Spacing
// Returns 0 if successful.
// The routing lefwLayerCutSpacingEnd has to call at the end of each spacing.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacing(double spacing) ;
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingCenterToCenter();
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingSameNet();
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Either this routine, lefwLayerCutSpacingAdjacent,
// lefwLayerCutSpacingParallel or lefwLayerCutSpacingArea is called per Spacing.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingLayer(const char* name2,
int stack); // optional(0)
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Either this routine, lefwLayerCutSpacingLayer,
// lefwLayerCutSpacingParallel or lefwLayerCutSpacingArea is called per Spacing.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingAdjacent(int viaCuts, // either 2, 3, or 4, opt
double distance,
int stack); // optional(0)
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Either this routine, lefwLayerCutSpacingLayer,
// lefwLayerCutSpacingAdjacent or lefwLayerCutSpacingArea is called per Spacing.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingParallel();
// This routine must be called after lefwLayerSpacing
// This routine is optional.
// Either this routine, lefwLayerCutSpacingLayer, * lefwLayerCutSpacingAdjacent
// or lefwLayerCutSpacingParallel is called per Spacing.
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingArea(double cutArea);
// This routine must be called after lefwLayerSpacing
// This routine marks the end of a Layer Type CUT Spacing
// Returns 0 if successful.
// This is a 5.7 syntax.
extern int lefwLayerCutSpacingEnd();
// This routine must be called after lefwStartLayer.
// This routine can be called only once.
// This section of routines is optional.
// This is a 5.7 syntax
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerCutSpacingTableOrtho(int numSpacing,
double* cutWithins,
double* orthoSpacings);
// This routine must be called after lefwStartLayer.
// This routine can be called only once.
// This section of routines is optional.
// This is a 5.7 syntax
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerArraySpacing(int longArray, // optional (0)
double viaWidth, // optional (0)
double cutSpacing,
int numArrayCut,
int* arrayCuts, double* arraySpacings);
// This routine must be called after lefwStartLayer.
// This routine can be called multiple times.
// This section of routines is optional.
// This is a 5.6 syntax.
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerEnclosure(const char* location, //ABOVE|BELOW, optional ""
double overhang1,
double overhang2,
double width); // optional (0)
// This routine must be called after lefwStartLayer.
// This routine can be called multiple times.
// This routine is similar as lefwLayerEnclosure, but allow user to add
// EXCEPTEXTRACUT option
// This section of routines is optional.
// This is a 5.7 syntax.
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerEnclosureWidth(
const char* location, //ABOVE|BELOW, optional ""
double overhang1,
double overhang2,
double width, // optional (0)
double cutWithin); // optional (0)
// This routine must be called after lefwStartLayer.
// This routine can be called multiple times.
// This routine is to write out minLength inside ENCLOSURE instead of WIDTH
// as in the routine lefwLayerEnclosure & lefwLayerEnclosureWidth.
// This section of routines is optional.
// This is a 5.7 syntax.
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerEnclosureLength(
const char* location, //ABOVE|BELOW, optional ""
double overhang1,
double overhang2,
double minLength); // optional (0)
// This routine must be called after lefwStartLayer.
// This routine can be called multiple times.
// This section of routines is optional.
// This is a 5.6 syntax.
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerPreferEnclosure(
const char* location, //ABOVE|BELOW, optional ""
double overhang1,
double overhang2,
double width); // optional (0)
// This routine must be called after lefwStartLayer.
// This routine can be called only once per Layer.
// This section of routines is optional.
// This is a 5.6 syntax.
// Returns 0 if successful.
// This routine is called if the layer type is CUT when
// lefwStartLayer is called.
extern int lefwLayerResistancePerCut(double resistance);
// This routine must be called after the lefwStartLayer call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
extern int lefwEndLayer(const char* layerName);
// This routine is called after lefwInit.
// Either this routine or lefwStartLayer must be called.
// Multiple section of lefwStartLayer can be called.
// The routine can be called only once per section.
// Returns 0 if successful.
// The routine starts the layer routing section.
// All of the layers must follow.
extern int lefwStartLayerRouting(const char* layerName);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is required for LayerRouting.
// Returns 0 if successful.
extern int lefwLayerRouting(const char* direction, // HORIZONTAL | VERTICAL |
// DIAG45 | DIAG135
double width);
// This routine must be called only once after lefwStartLayerRouting.
// Either this routine or lefwLayerRoutingPitchXYDistance can be called
// but not both
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingPitch(double pitch);
// This routine must be called only once after lefwStartLayerRouting.
// Either this routine or lefwLayerRoutingPitch can be called but not both
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingPitchXYDistance(double xDistance, double yDistance);
// This routine must be called only once after lefwStartLayerRouting.
// Either this routine or lefwLayerRoutingDiagPitchXYDistance can be called
// but not both
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingDiagPitch(double distance);
// This routine must be called only once after lefwStartLayerRouting.
// Either this routine or lefwLayerRoutingDiagPitch can be called
// but not both
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingDiagPitchXYDistance(double diag45Distance,
double diag135Distance);
// This routine must be called only once after lefwStartLayerRouting.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingDiagWidth(double diagWidth);
// This routine must be called only once after lefwStartLayerRouting.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingDiagSpacing(double diagSpacing);
// This routine must be called only once after lefwStartLayerRouting.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingDiagMinEdgeLength(double diagLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Either this routine or lefwLayerRoutingOffsetXYDistance can be called
// but not both
// Returns 0 if successful.
extern int lefwLayerRoutingOffset(double offset);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Either this routine or lefwLayerRoutingOffset can be called but not both
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingOffsetXYDistance(double xDistance, double yDistance);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingArea(double area);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingMinsize(int numRect, double* minWidth,
double* minLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingMinimumcut(double numCuts, double minWidth);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is similar as lefwLayerRoutingMinimumcut, but allow user
// to specify value for WITHIN
// This is a 5.7 syntax.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingMinimumcutWithin(double numCuts, double minWidth,
double cutDistance);
// This routine must be called only once after lefwLayerRoutingMinimumcut.
// This routine is optional.
// Direction can be either FROMABOVE or FROMBELOW
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingMinimumcutConnections(const char* direction);
// This routine must be called only once after lefwLayerRoutingMinimumcut.
// This routine is optional.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingMinimumcutLengthWithin(double length,
double distance);
// This routine must be called multiple time after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingSpacing(double spacing);
// Either this routine, lefwLayerRoutingSpacingLengthThreshold or
// lefwLayerRoutingSpacingSameNet can be
// called only once after lefwLayerRoutingSpacing.
// This routine is optional.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingRange(double minWidth, double maxWidth);
// Either this routine or lefwLayerRoutingSpacingRangeInfluence or
// lefwLayerRoutingSpacingRangeRange can
// be called once after llefwLayerRoutingSpacingRange.
// This routine is valid only if either or both leftRange and rightRange
// in lefwLayerRoutingSpacing are non zero
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingRangeUseLengthThreshold();
// Either this routine or lefwLayerRoutingSpacingRangeUseLengthThreshold or
// lefwLayerRoutingSpacingRangeRange can be called once after
// lefwLayerRoutingSpacingRange.
// subMinWidth & subMaxWidth are optional.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingRangeInfluence(double infValue,
double subMinWidth, double subMaxWidth);
// Either this routine or lefwLayerRoutingSpacingRangeUseLengthThreshold or
// lefwLayerRoutingSpacingRangeInfluence can be called once after
// lefwLayerRoutingSpacingRange.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingRangeRange(double minWidth, double maxWidth);
// Either this routine, lefwLayerRoutingSpacingRange or
// lefwLayerRoutingSpacingSameNet can be
// be called once after lefwLayerRoutingSpacing.
// minWidth & maxWidth are optional.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingLengthThreshold(double lengthValue,
double minWidth, double maxWidth);
// Either this routine, lefwLayerRoutingSpacingRange or
// lefwLayerRoutingSpacingRange can be
// be called once after lefwLayerRoutingSpacing.
// This is a 5.7 routine.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingSameNet(int PGOnly) ; // optional (0)
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingEndOfLine(double eolWidth, double eolWithin);
// This routine must be called only once after lefwLayerRoutingSpacingEndOfLine
// This routine is optional
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingEOLParallel(double parSpace, double parWithin,
int twoEdges); // optional(0)
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingNotchLength(double minNLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingEndOfNotchWidth(double eonWidth,
double minNSpacing, double minNLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingWireExtension(double wireExtension);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingResistance(const char* resistance);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingCapacitance(const char* capacitance);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingHeight(double height);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingThickness(double thickness);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingShrinkage(double shrinkage);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingCapMultiplier(double capMultiplier);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingEdgeCap(double edgeCap);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingAntennaArea(double antennaArea);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional
// Returns 0 if successful.
extern int lefwLayerRoutingAntennaLength(double antennaLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This is a 5.5 syntax.
// width is the maximum width.
// Returns 0 if successful.
extern int lefwLayerRoutingMaxwidth(double width);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This is a 5.5 syntax.
// width is the maximum width.
// Returns 0 if successful.
extern int lefwLayerRoutingMinwidth(double width);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional.
// This is a 5.5 syntax.
// Area is the minimum area size limit for metal that encloses an empty area.
// Width is optional, it says the rule only applies when a donut is careted
// from a wire of width <= width. The parameter width is required for the
// routine lefwLayerRoutineMinenclosedarea. If width is optional, a "0"
// value is assigned for that index slot of the array.
// Returns 0 if successful.
extern int lefwLayerRoutingMinenclosedarea(int numMinenclosed, double* area,
double* width);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingMinstep(double distance);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This routine is equivalent to lefwLayerRoutingMinstep, except it also
// takes the options for type & Lengthsum.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingMinstepWithOptions(double distance,
const char* rule, // INSIDECORNER|OUTSIDECORNER|STEP
double maxLength);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This routine is equivalent to lefwLayerRoutingMinstep, except it also
// takes the option for MaxEdges.
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingMinstepMaxEdges(double distance,
double maxEdges);
// This routine must be called only once after lefwStartLayerRouting.
// This routine is optional and can be called once.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingProtrusion(double width1, double length,
double width2);
// This routine must be called only after lefwStartLayerRouting.
// This routine is optional and can be called multiple times.
// This is a 5.5 syntax.
// numLength has the size of the array length.
// length is an array of length values.
// Returns 0 if successful.
extern int lefwLayerRoutingStartSpacingtableParallel(int numLength,
double* length);
// This routine must be called only after
// lefwLayerRoutingStartSpacingtableParallel.
// This routine is required after lefwLayerRoutingStartSpacingtableParallel.
// This routine can be called multiple times.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingtableParallelWidth(double width,
int numSpacing, double* spacing);
// This routine must be called only after lefwStartLayerRouting.
// This routine is optional and can be called multiple times.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingStartSpacingtableInfluence();
// This routine must be called only after
// lefwLayerRoutingStartSpacingtableInfluence.
// This routine is required after lefwLayerRoutingStartSpacingtableInfluence.
// This routine can be called multiple times.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingInfluenceWidth(double width, double distance,
double spacing);
// This routine must be called only after lefwStartLayerRouting.
// This routine is optional and can be called multiple times.
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingStartSpacingtableTwoWidths();
// This routine must be called only after
// lefwLayerRoutingStartSpacingtableInfluence.
// This routine is required after lefwLayerRoutingStartSpacingtableTwoWidths.
// This routine can be called multiple times.
// This is a 5.7 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutingSpacingtableTwoWidthsWidth(double width,
double runLength, // PRL, optional (0)
int numSpacing,
double* spacing);
// This routine can be called after lefwLayerRoutingStartSpacingtableParallel
// or lefwLayerRoutingStartSpacingtableInfluence.
// It can only be called once.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerRoutineEndSpacingtable();
// This routine must be called after the lefwStartLayer call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
extern int lefwEndLayerRouting(const char* layerName);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called multiple times.
// if the value for the variable value is not 0, one of the following
// routines have to be called: lefwLayerACFrequency,
// lefwLayerACWidth, lefwLayerACCutarea, or
// lefwLayerACTableEntries
// Returns 0 if successful.
extern int lefwLayerACCurrentDensity(const char* type, double value);
// This routine must be called after lefwLayerACCurrentDensity.
// This routine is required and can be called only once after each
// lefwLayerACCurrentDensity.
// Returns 0 if successful.
extern int lefwLayerACFrequency(int numFrequency, double* frequency);
// This routine must be called after lefwLayerACCurrentDensity.
// This routine is optional and can be called only once after each
// lefwLayerACCurrentDensity.
// This routine can only be called in Layer Routing
// Returns 0 if successful.
extern int lefwLayerACWidth(int numWidths, double* widths);
// This routine must be called after lefwLayerACCurrentDensity.
// This routine is optional and can be called only once after each
// lefwLayerACCurrentDensity.
// This routine can only be called in Layer
// Returns 0 if successful.
extern int lefwLayerACCutarea(int numCutareas, double* cutareas);
// This routine must be called after lefwLayerACCurrentDensity.
// This routine is required and can be called only once after each
// lefwLayerACCurrentDensity.
// Returns 0 if successful.
extern int lefwLayerACTableEntries(int numEntries, double* entries);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called multiple times.
// if the value for the variable value is not 0, one of the following
// routines have to be called: lefwLayerDCWidth, lefwLayerDCCutarea, or
// lefwLayerDCTableEntries
// Returns 0 if successful.
extern int lefwLayerDCCurrentDensity(const char* type, double value);
// This routine must be called after lefwLayerDCCurrentDensity.
// This routine is optional and can be called only once after each
// lefwLayerDCCurrentDensity.
// This routine can only be called in Layer Routing
// Returns 0 if successful.
extern int lefwLayerDCWidth(int numWidths, double* widths);
// This routine must be called after lefwLayerDCCurrentDensity.
// This routine is optional and can be called only once after each
// lefwLayerDCCurrentDensity.
// This routine can only be called in Layer
// Returns 0 if successful.
extern int lefwLayerDCCutarea(int numCutareas, double* cutareas);
// This routine must be called after lefwLayerDCCurrentDensity.
// This routine is required and can be called only once after each
// lefwLayerDCCurrentDensity.
// Returns 0 if successful.
extern int lefwLayerDCTableEntries(int numEntries, double* entries);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional. The oxide value, can be either OXIDE1, OXIDE2,
// OXIDE3, or OXIDE4. Each can only be called once within a layer.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwLayerAntennaModel(const char* oxide);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaDiffAreaRatioPwl can be called, but
// not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaDiffAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaDiffAreaRatio can be called, but
// not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaDiffAreaRatioPwl(int numPwls,
double* diffusions, double* ratios);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaCumDiffAreaRatioPwl can be called,
// but not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumDiffAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaCumDiffAreaRatio can be called, but
// not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumDiffAreaRatioPwl(int numPwls,
double* diffusions, double* ratios);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// The option DIFFUSEONLY is a 5.4 syntax.
// If DIFFUSEONLY, lefwLayerRoutingAntennaLength is not allowed.
// This function is similar to lefwLayerRoutingAntennaArea
// diffUseOnly has to be DIFFUSEONLY.
// Returns 0 if successful.
extern int lefwLayerAntennaAreaFactor(double value,
const char* diffUseOnly); // optional(NULL)
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING.
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaSideAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING.
// Either this routine or lefwLayerAntennaDiffSideAreaRatioPwl can be
// called, but not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaDiffSideAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaDiffSideAreaRatio can be called,
// but not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaDiffSideAreaRatioPwl(int numPwls,
double* diffusions, double* ratios);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING.
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumSideAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING.
// Either this routine or lefwLayerAntennaCumDiffSideAreaRatioPwl can be
// called, but not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumDiffSideAreaRatio(double value);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// Either this routine or lefwLayerAntennaCumDiffSideAreaRatio can be called,
// but not both
// This is a 5.4 syntax.
// Either this routine or lefwLayerRoutingAntennaLength is allowed, not both.
// Returns 0 if successful.
extern int lefwLayerAntennaCumDiffSideAreaRatioPwl(int numPwls,
double* diffusions, double* ratios);
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING.
// The option DIFFUSEONLY is a 5.4 syntax.
// diffUseOnly has to be DIFFUSEONLY.
// Returns 0 if successful.
extern int lefwLayerAntennaSideAreaFactor(double value,
const char* diffUseOnly); // optional(NULL)
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.7 routine.
// Returns 0 if successful.
extern int lefwLayerAntennaCumRoutingPlusCut() ;
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.7 routine.
// Returns 0 if successful.
extern int lefwLayerAntennaGatePlusDiff(double plusDiffFactor) ;
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.7 routine.
// Returns 0 if successful.
extern int lefwLayerAntennaAreaMinusDiff(double minusDiffFactor) ;
// This routine must be called after lefwStartLayerRouting or lefwStartLayer.
// This routine is optional and can be called only once within a layer
// after each lefwLayerAntennaModel function.
// This routine is valid only if the layer type is either ROUTING or CUT.
// This is a 5.7 routine.
// Returns 0 if successful.
extern int lefwLayerAntennaAreaDiffReducePwl(int numPwls,
double* diffAreas, double* metalDiffFactors);
// This routine must be called only once after lefwStartLayer.
// The option MINIMUMDENSITY is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwMinimumDensity(double minDensity);
// This routine must be called only once after lefwStartLayer.
// The option MAXIMUMDENSITY is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwMaximumDensity(double maxDensity);
// This routine must be called only once after lefwStartLayer.
// The option DENSITYCHECKWINDOW is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwDensityCheckWindow(double checkWindowLength,
double checkWindowWidth);
// This routine must be called only once after lefwStartLayer.
// The option DENSITYCHECKSTEP is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwDensityCheckStep(double checkStepValue);
// This routine must be called only once after lefwStartLayer.
// The option FILLACTIVESPACING is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwFillActiveSpacing(double fillToActiveSpacing);
// This routine must be called only once after all the layers.
// This routine is optional.
// This is a 5.5 syntax.
// Returns 0 if succesful.
extern int lefwMaxviastack(int value,
const char* bottomLayer, // optional (NULL)
const char* topLayer); // optional (NULL)
// This routine is called after lefwInit.
// This section of routines is optional.
// The routine can be called only once.
// Returns 0 if successful.
// The routine starts propertydefinitions section.
extern int lefwStartPropDef();
// This routine must be called after lefwStartPropDef.
// This routine can be called multiple times.
// It adds integer property definition to the statement.
// Returns 0 if successful.
// The objType can be LIBRARY or VIA or MACRO or PIN.
extern int lefwIntPropDef(
const char* objType, // LIBRARY | LAYER | VIA | VIARULE |
// NONDEFAULTRULE | MACRO | PIN
const char* propName,
double leftRange, // optional(0) - RANGE
double rightRange, // optional(0)
int propValue); // optional(NULL)
// This routine must be called after lefwStartPropDef.
// This routine can be called multiple times.
// It adds real property definition to the statement.
// Returns 0 if successful.
// The objType can be LIBRARY or VIA or MACRO or PIN.
extern int lefwRealPropDef(
const char* objType, // LIBRARY | LAYER | VIA | VIARULE |
// NONDEFAULTRULE | MACRO | PIN
const char* propName,
double leftRange, // optional(0) - RANGE
double rightRange, // optional(0)
double propValue); // optional(NULL)
// This routine must be called after lefwStartPropDef.
// This routine can be called multiple times.
// It adds string property definition to the statement.
// Returns 0 if successful.
// The objType can be LIBRARY or VIA or MACRO or PIN.
extern int lefwStringPropDef(
const char* objType, // LIBRARY | LAYER | VIA | VIARULE |
// NONDEFAULTRULE | MACRO | PIN
const char* propName,
double leftRange, // optional(0) - RANGE
double rightRange, // optional(0)
const char* propValue); // optional(NULL)
// This routine must be called after the lefwStartPropDef call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndPropDef();
// This routine is called after lefwInit.
// This routine must be called only once.
// Returns 0 if successful.
// The routine starts the via section. All of the vias must follow.
extern int lefwStartVia(const char* viaName,
const char* isDefault); // optional(NULL) - DEFAULT
// This routine is optional, it call only be called after lefwStartVia.
// It can only be called once.
// Returns 0 if successful.
extern int lefwViaTopofstackonly(); // TOPOFSTACKONLY
// This routine is optional, it call only be called after lefwStartVia.
// It can only be called once.
// Returns 0 if successful.
extern int lefwViaForeign(const char* foreignName,
double xl, // optional(0) - pt(x)
double yl, // optional(0) - pt(y)
int orient); // optional(-1)
// This routine is optional, it call only be called after lefwStartVia.
// It can only be called once.
// Returns 0 if successful.
// This routine is the same as lefwViaForeign, except orient is a char*
extern int lefwViaForeignStr(const char* foreignName,
double xl, // optional(0) - pt(x)
double yl, // optional(0) - pt(y)
const char* orient); // optional("")
// This routine is optional, it call only be called after lefwStartVia.
// Either this routine or lefwViaViarule can be called within a via.
// It can only be called once in a via.
// Returns 0 if successful.
extern int lefwViaResistance(double resistance); // RESISTANCE
// This routine must be called after lefwStartVia.
// It can be called multiple times.
// Returns 0 if successful.
extern int lefwViaLayer(const char* layerName); // LAYER
// This routine can call only after lefwViaLayer.
// Either this routine or lefwViaLayerPolygon can be called within a layer
// It can be called multiple times.
// Returns 0 if successful.
// mask is 5.8 syntax
extern int lefwViaLayerRect(double x1l, // RECT pt1(x)
double y1l, // RECT pt1(y)
double x2l, // RECT pt2(x)
double y2l, // RECT pt2(y)
int mask = 0);
// This routine can call only after lefwViaLayer.
// Either this routine or lefwViaLayerRect can be called within a layer
// It can be called multiple times.
// This is a 5.6 syntax.
// Returns 0 if successful.
// mask is 5.8 syntax
extern int lefwViaLayerPolygon(int num_polys, double* xl, double* yl,
int mask = 0);
// This routine can call only after lefwStartVia.
// Either this routine or lefwViaResistance can be called within a via.
// It can only be called once in a via.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwViaViarule(const char* viaRuleName,
double xCutSize, double yCutSize,
const char* botMetalLayer, const char* cutLayer,
const char* topMetalLayer,
double xCutSpacing, double yCutSpacing,
double xBotEnc, double yBotEnc,
double xTopEnc, double yTopEnc);
// This routine can call only after lefwViaViarule.
// It can only be called once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwViaViaruleRowCol(int numCutRows, int numCutCols);
// This routine can call only after lefwViaViarule.
// It can only be called once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwViaViaruleOrigin(double xOffset, double yOffset);
// This routine can call only after lefwViaViarule.
// It can only be called once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwViaViaruleOffset(double xBotOffset, double yBotOffset,
double xTopOffset, double yTopOffset);
// This routine can call only after lefwViaViarule.
// It can only be called once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwViaViarulePattern(const char* cutPattern);
// This routine is called after lefwVia.
// This routine is optional, it adds string property to the statement.
// It can be called multiple times.
// Returns 0 if successful.
extern int lefwStringProperty(const char* propName, const char* propValue);
// This routine is called after lefwVia.
// This routine is optional, it adds real property to the statement.
// It can be called multiple times.
// Returns 0 if successful.
extern int lefwRealProperty(const char* propName, double propValue);
// This routine is called after lefwVia.
// This routine is optional, it adds int property to the statement.
// It can be called multiple times.
// Returns 0 if successful.
extern int lefwIntProperty(const char* propName, int propValue);
// This routine must be called after the lefwStartVia call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndVia(const char* viaName);
// This routine is called after lefwInit.
// This routine must be called as a set with lefwViaRuleLayer, lefwViaRuleVia
// and lefwEndViaRule
// multiple times.
// Returns 0 if successful.
// The routine starts the via rule section. The via rule data and its property
// must follow
extern int lefwStartViaRule(const char* viaRuleName);
// This routine is called after lefwStartViaRule.
// This routine has to be called 2 times exact.
// Returns 0 if successful.
// The direction1 or direction2 can be HORIZONTAL or VERTICAL.
extern int lefwViaRuleLayer(
const char* layerName,
const char* direction, // HORIZONTAL | VERTICAL
double minWidth, // optional(0) - WIDTH
double maxWidth, // optional(0) - WIDTH
double overhang, // optional(0) - OVERHANG
double metalOverhang); // optional(0) - METALOVERHANG
// This routine is called after lefwViaRuleLayer is called twice.
// This routine is required in a viarule and can be called more than once.
// Returns 0 if successful.
// The direction1 or direction2 can be HORIZONTAL or VERTICAL.
extern int lefwViaRuleVia(
const char* viaName);
// This routine must be called after the lefwStartViaRule call (if any).
// The routine can be called only once per lefwStartViaRule.
// Returns 0 if successful.
extern int lefwEndViaRule(const char* viaRuleName);
// This routine is called after lefwInit.
// This routine must be called as a set with lefwViaRuleGenLayer,
// lefwViaRuleGenLayer3, and lefwEndViaRuleGen multiple times.
// Returns 0 if successful.
// The routine starts the via rule section. The via rule data and its property
// must follow
extern int lefwStartViaRuleGen(const char* viaRuleName);
// This routine is called after lefwSartViaRuleGen.
// This routine is optional
// Returns 0 if successful
extern int lefwViaRuleGenDefault();
// This routine is called after lefwStartViaRuleGen.
// This routine has to be called 2 times exact.
// Returns 0 if successful.
// Either this routine or lefwViaRuleGenLayerEnclosure, not both.
// The direction1 or direction2 can be HORIZONTAL or VERTICAL.
extern int lefwViaRuleGenLayer(
const char* layerName,
const char* direction, // HORIZONTAL | VERTICAL
double minWidth, // optional(0) - WIDTH
double maxWidth, // optional(0) - WIDTH
double overhang, // optional(0) - OVERHANG
double metalOverhang); // optional(0) - METALOVERHANG
// This routine is called after lefwStartViaRuleGen.
// This routine has to be called 2 times exact.
// This is 5.5 syntax
// Returns 0 if successful.
// Either this routine or lefwViaRuleGenLayer, not both.
extern int lefwViaRuleGenLayerEnclosure(
const char* layerName,
double overhang1,
double overhang2,
double minWidth, // optional(0) - WIDTH
double maxWidth); // optional(0) - WIDTH
// This routine is called after lefwViaRuleLayerGen is called twice.
// This routine is optional in a viarule generate and can be called once.
// Returns 0 if successful.
// The direction1 or direction2 can be HORIZONTAL or VERTICAL.
extern int lefwViaRuleGenLayer3(
const char* layerName,
double xl, double yl, // RECT pt1(x), pt1(y)
double xh, double yh, // RECT pt2(x), pt2(y)
double xSpacing, double ySpacing, // SPACING x and y
double resistance); // optional(0) - RESISTANCE
// This routine must be called after the lefwStartViaRuleGen call (if any).
// The routine can be called only once per lefwStartViaRuleGen.
// Returns 0 if successful.
extern int lefwEndViaRuleGen(const char* viaRuleName);
// This routine is called after lefwInit.
// This routine must be called only once.
// Returns 0 if successful.
// The routine starts the nonDefaultRule section. The nonDefaultRule layers
// must follow
extern int lefwStartNonDefaultRule(const char* ruleName);
// This routine is called after lefwInit.
// This routine must be called after lefwStartNonDefaultRule
// This routine can be called multiple times.
// Returns 0 if successful.
extern int lefwNonDefaultRuleLayer(const char* routingLayerName,
double width, // WIDTH
double minSpacing, // MINSPACING
double wireExtension, // optinal(0) - WIREEXTENSION
double resistance, // optinal(0) - RESISTANCE RPERQ
double capacitance, // optinal(0) - CAPACITANCE CPERSQDIST
double edgeCap); // optinal(0) - EDGECAPACITANCE
// This routine is called after lefwInit.
// This routine must be called after lefwStartNonDefaultRule
// This routine is optional and it can be called only once.
// Returns 0 if successful.
extern int lefwNonDefaultRuleHardspacing();
// This routine is called after lefwStartNonDefaultRule.
// This routine must be called only once for each via section.
// Returns 0 if successful.
// The routine starts the nondefaultrule via section.
// Call the following via functions for the rest of NONDEFAULTRULE VIA:
// lefwViaTopofstackonly
// lefwViaForeign
// lefwViaForeignStr
// lefwViaResistance
// lefwViaLayer
// lefwViaLayerRect
// lefwNonDefaultRuleEndVia
extern int lefwNonDefaultRuleStartVia(const char* viaName,
const char* isDefault); // optional(NULL) - DEFAULT
// This routine must be called after the lefwNonDefaultRuleStartVia call.
// The routine can be called only once per via section.
// Returns 0 if successful.
extern int lefwNonDefaultRuleEndVia(const char* viaName);
// This routine is called after lefwStartNonDefaultRule.
// This routine can be called multiple times.
// Returns 0 if successful.
extern int lefwNonDefaultRuleUseVia(const char* viaName);
// This routine is called after lefwStartNonDefaultRule.
// This routine can be called multiple times.
// Returns 0 if successful.
extern int lefwNonDefaultRuleUseViaRule(const char* viaRuleName);
// This routine is called after lefwStartNonDefaultRule.
// This routine can be called multiple times.
// Returns 0 if successful.
extern int lefwNonDefaultRuleMinCuts(const char* layerName, int numCuts);
// This routine must be called after the lefwStartNonDefaultRule call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndNonDefaultRule(const char* ruleName);
// This routine is called after lefwInit.
// This section of routines is optional.
// This routine can be called only once.
// Returns 0 if successful.
// It starts the spacing section.
extern int lefwStartSpacing();
// This routine must be called after lefwStartSpacing.
// It can be called multiple times.
// Returns 0 if successful.
// The stack has to be STACK.
extern int lefwSpacing(const char* layerName1,
const char* layerName2,
double minSpace,
const char* stack); // optional(NULL)
// This routine must be called after the lefwStartSpacing call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndSpacing();
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwUniversalNoiseMargin (double high, double low);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEdgeRateThreshold1 (double num);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEdgeRateThreshold2 (double num);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEdgeRateScaleFactor (double num);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This routine starts the noisetable section.
// This api is obsolete in 5.4.
extern int lefwStartNoiseTable(int num);
// This routine is called after lefwStartNoiseTable or lefwStartCorrectTable.
// This routine is optional and it can be called multiple times
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEdgeRate(double num) ;
// This routine is called after lefwEdgeRate.
// This routine is optional and it can be called only once inside lefwEdgeRate.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwOutputResistance(int numResists, double* resistance);
// This routine is called after lefwOutputResistance.
// This routine is optional and it can be called multiple times inside
// lefwOutputResistance
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwVictims(int length, int numNoises, double* noises);
// This routine must be called after the lefwStartNoiseTable call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEndNoiseTable();
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This routine starts the correctTable section.
// This api is obsolete in 5.4.
extern int lefwStartCorrectTable(int num);
// This routine must be called after the lefwStartCorrectTable call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEndCorrectTable();
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
extern int lefwMinFeature (double x, double y);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
// extern int lefwDielectric (float dielectric);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
// This routine starts the irdrop section.
// This api is obsolete in 5.4.
extern int lefwStartIrdrop();
// This routine is must be called after lefwStartIrdrop.
// It can be called multiple times.
// Returns 0 if successful.
// The currentsNvolts is a list of current and volts.
// This api is obsolete in 5.4.
extern int lefwIrdropTable(const char* tableName, const char* currentsNvolts);
// This routine must be called after the lefwStartIrdrop call (if any).
// The routine can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEndIrdrop();
// This routine is must be called after lefwInit.
// It can be called multiple times.
// Returns 0 if successful.
// The classType can be PAD or CORE.
// The symmetry can be a list of X or Y or R90.
extern int lefwSite(const char* siteName, const char* classType,
const char* symmetry, double width, double height);
// This routine is must be called after lefwSite.
// It can be called multiple times.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwSiteRowPattern(const char* siteName, int orient);
// This routine is must be called after lefwSite.
// It can be called multiple times.
// This is a 5.6 syntax.
// Returns 0 if successful.
// This routine is the same as lefwSiteRowPattern, except orient is a char*
extern int lefwSiteRowPatternStr(const char* siteName, const char *orient);
// This routine must be called after the lefwSite call (if any).
// The routine can be called only once after lefwSite.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwEndSite(const char* siteName);
// This routine is called after lefwInit.
// This routine is optional and it can be called multiple times.
// Returns 0 if successful.
// This routine starts the array section.
extern int lefwStartArray(const char* arrayName);
// This routine is called after lefwStartArray.
// Either this routine, lefwArrayCanplace, lefwArrayCannotoccupy,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
extern int lefwArraySite(const char* name, double origX, double origY,
int orient, double numX, double numY, double spaceX,
double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArrayCanplace, lefwArrayCannotoccupy,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
// This routine is the same as lefwArraySite, except orient is a char*
extern int lefwArraySiteStr(const char* name, double origX, double origY,
const char *orient, double numX, double numY, double spaceX,
double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCannotoccupy,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
extern int lefwArrayCanplace(const char* name, double origX, double origY,
int orient, double numX, double numY, double spaceX,
double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCannotoccupy,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
// This routine is the same as lefwArrayCanplace, except orient is a char*
extern int lefwArrayCanplaceStr(const char* name, double origX, double origY,
const char *orient, double numX, double numY, double spaceX,
double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCanplace,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
extern int lefwArrayCannotoccupy(const char* name, double origX, double origY,
int orient, double numX, double numY, double spaceX,
double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCanplace,
// lefwArrayTracks, or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
// This routine is the same as lefwArrayTracks, except orient is a char*
extern int lefwArrayCannotoccupyStr(const char* name, double origX,
double origY, const char *orient, double numX, double numY,
double spaceX, double spaceY);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCanplace, lefwArrayCannotoccupy,
// or lefwStartArrayFloorplan must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
extern int lefwArrayTracks(const char* xy, double start, int numTracks,
double space, const char* layers);
// This routine is called after lefwStartArray.
// Either this routine, lefwArraySite, lefwArrayCanplace, lefwArrayCannotoccupy,
// or lefwArrayTracks must be called at least once.
// It can be call multiple times.
// Returns 0 if successful.
// The routine starts the array floorplan section
extern int lefwStartArrayFloorplan(const char* name);
// This routine must be called after lefwStartArrayFloorplan.
// It can be called multiple times.
// Returns 0 if successful.
// The site can be CANPLACE or CANNOTOCCUPY
extern int lefwArrayFloorplan(const char* site, const char* name,
double origX, double origY, int orient,
int numX, int numY, double spaceX, double spaceY);
// This routine must be called after lefwStartArrayFloorplan.
// It can be called multiple times.
// Returns 0 if successful.
// The site can be CANPLACE or CANNOTOCCUPY
// This routine is the same as lefwArrayFloorplan, except orient is a char*
extern int lefwArrayFloorplanStr(const char* site, const char* name,
double origX, double origY, const char *orient,
int numX, int numY, double spaceX, double spaceY);
// This routine must be called after the lefwStartArrayFloorplan call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
extern int lefwEndArrayFloorplan(const char* name);
// This routine is called after lefwStartArray.
// This routine is optional.
// It can be called multiple times.
// Returns 0 if successful.
// The xy can be X or Y.
extern int lefwArrayGcellgrid(const char* xy, double startXY, int colRows,
double spaceXY);
// This routine is called after lefwStartArray.
// This section of routines is optional and can be call only once.
// Returns 0 if successful.
// The routine starts the array defaultcap section
extern int lefwStartArrayDefaultCap(int size);
// This routine must be called after lefwStartArrayDefaultCap.
// It can be called multiple times.
// Returns 0 if successful.
extern int lefwArrayDefaultCap(double numPins, double cap);
// This routine must be called after the lefwStartArrayDefaultCap call (if any).
// The routine can be called only once.
// Returns 0 if successful.
extern int lefwEndArrayDefaultCap();
// This routine must be called after the lefwStartArray call (if any).
// The routine can be called only once per section.
// Returns 0 if successful.
extern int lefwEndArray(const char* arrayName);
// This routine is must be called after lefwInit.
// This routine can be called multiple times.
// Returns 0 if successful.
// This routine starts the macro section.
extern int lefwStartMacro(const char* macroName);
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
// The value1 can be COVER, RING, BLOCK, PAD, CORE, or ENCAP.
// The value2 can be BUMP if value1 is COVER,
// or BLACKBOX, or SOFT if value1 is BLOCK,
// or INPUT, OUTPUT, INOUT, POWER, or SPACER if value1 is PAD,
// or FEEDTHRU, TIEHIGH, TIELOW, SPACER, ANTENNACELL, or WELLTAP
// if value1 is CORE,
// or PRE, POST, TOPLEFT, TOPRIGHT, BOOTOMLEFT, or BOTTOMRIGHT if value1 is
// ENCAP.
extern int lefwMacroClass(const char* value1,
const char* value2); // optional(NULL)
// This routine is must be called after lefwInit.
// This routine can be called multiple times.
// Returns 0 if successful.
// This is a 5.8 syntax.
extern int lefwMacroFixedMask();
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
// The value1 can be USER, GENERATE, or BLOCK.
extern int lefwMacroSource(const char* value1);
// This routine is called after lefwStartMacro.
// This routine is optional and can be called multiple times per macro section.
// Returns 0 if successful.
extern int lefwMacroForeign(const char* name,
double xl, // optional(0) - pt(x)
double yl, // optional(0) - pt(y)
int orient); // optional(-1) - 0 to 7
// This routine is called after lefwStartMacro.
// This routine is optional and can be called multiple times per macro section.
// Returns 0 if successful.
// This routine is the same as lefwMacroForeign, except orient is a char*
extern int lefwMacroForeignStr(const char* name,
double xl, // optional(0) - pt(x)
double yl, // optional(0) - pt(y)
const char *orient); // optional("")
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
extern int lefwMacroOrigin(double xl, // pt(x)
double yl); // pt(y)
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
extern int lefwMacroEEQ(const char* macroName);
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
extern int lefwMacroLEQ(const char* macroName);
// This routine is called after lefwStartMacro.
// This routine must be called only once per macro section.
// Returns 0 if successful.
extern int lefwMacroSize(double width, double height);
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
// The symmetry can be a list of X, Y, or R90
extern int lefwMacroSymmetry(const char* symmetry);
// This routine is called after lefwStartMacro.
// This routine must be called only once per macro section.
// Returns 0 if successful.
extern int lefwMacroSite(const char* siteName);
// This routine is called after lefwStartMacro.
// This routine must be called at least once per macro section.
// Returns 0 if successful.
extern int lefwMacroSitePattern(const char* name,
double origX, double origY, // optional(0)
int orient, // optional(-1)
int numX, int numY, // optional(0)
double spaceX, double spaceY); // optional(0)
// This routine is called after lefwStartMacro.
// This routine must be called at least once per macro section.
// Returns 0 if successful.
// This routine is the same as lefwMacroSitePattern, except orient is a char*
extern int lefwMacroSitePatternStr(const char* name,
double origX, double origY, // optional(0)
const char *orient, // optional (-1)
int numX, int numY, // optional(0)
double spaceX, double spaceY); // optional(0)
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPower(double power);
// This routine must be called after the lefwStartMacro call (if any).
// The routine can be called only once per macro section.
// Returns 0 if successful.
extern int lefwEndMacro(const char* macroName);
// This routine is called after lefwStartMacro.
// This routine is optional and can be called only once per macro section.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwStartMacroDensity(const char* layerName);
// This routine is called after lefwStartMacroDensity.
// This routine can be called multiple times.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwMacroDensityLayerRect(double x1, double y1,
double x2, double y2,
double densityValue);
// This routine must be called after the lefwStartMacroPin call (if any).
// The routine can be called only once per macro section.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwEndMacroDensity();
// This routine must be called after the lefwStartMacro call (if any).
// The routine can be called multiple time.
// Returns 0 if successful.
// It starts the macro pin section within macro.
extern int lefwStartMacroPin(const char* pinName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
extern int lefwMacroPinTaperRule(const char* ruleName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
extern int lefwMacroPinForeign(const char* name,
double xl, // optional(0)
double yl, // optional(0)
int orient); // optional(-1) - 0 to 7
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// Ths routine is the same as lefwMacroPinForeign, except orient is a char*
extern int lefwMacroPinForeignStr(const char* name,
double xl, // optional(0)
double yl, // optional(0)
const char* orient); // optional("")
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
extern int lefwMacroPinLEQ(const char* pinName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// The direction can be INPUT, OUTPUT, OUTPUT TRISTATE, INOUT, or FEEDTHRU.
extern int lefwMacroPinDirection(const char* direction);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// The use can be SIGNAL, ANALOG, POWER, GROUND, or CLOCK.
extern int lefwMacroPinUse(const char* use);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// The namce can be ABUTMENT, RING, or FEEDTHRU.
extern int lefwMacroPinShape(const char* name);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
extern int lefwMacroPinMustjoin(const char* name);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwMacroPinNetExpr(const char* name);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwMacroPinSupplySensitivity(const char* pinName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.6 syntax.
// Returns 0 if successful.
extern int lefwMacroPinGroundSensitivity(const char* pinName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinOutputnoisemargin(int high, int low);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinOutputresistance(int high, int low);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinInputnoisemargin(int high, int low);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinPower(double power);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinLeakage(double leakage);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinCapacitance(double capacitance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinResistance(double resistance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinPulldownres(double resistance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinTieoffr(double resistance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinVHI(double voltage);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinVLO(double voltage);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinRisevoltagethreshold(double voltage);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinFallvoltagethreshold(double voltage);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinRisethresh(double capacitance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinFallthresh(double capacitance);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinRisesatcur(double current);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinFallsatcur(double current);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// The name can be ACTIVE or RESISTIVE.
// This api is obsolete in 5.4.
extern int lefwMacroPinCurrentsource(const char* name);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroPinIV_Tables(const char* lowName, const char* highName);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// Either this routine or 5.4 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennasize(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// Either this routine or 5.4 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaMetalArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// Either this routine or 5.4 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaMetalLength(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaPartialMetalArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaPartialMetalSideArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaPartialCutArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaDiffArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// The oxide value, can be either OXIDE1, OXIDE2, OXIDE3, or OXIDE4.
// This routine is optional. Each oxide value can be called only once
// after the lefwStartMacroPin.
// This is a 5.5 syntax.
// Returns 0 if successful.
extern int lefwMacroPinAntennaModel(const char* oxide);
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called multiple times.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaGateArea(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaMaxAreaCar(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaMaxSideAreaCar(double value,
const char* layerName); // optional(NULL)
// This routine is called after lefwStartMacroPin.
// This routine is optional and can be called only once.
// This is a 5.4 syntax.
// Either this routine or 5.3 Antenna syntax, cannot be both
// Returns 0 if successful.
extern int lefwMacroPinAntennaMaxCutCar(double value,
const char* layerName); // optional(NULL)
// This routine must be called after the lefwStartMacroPin call (if any).
// The routine can be called only once per macro section.
// Returns 0 if successful.
extern int lefwEndMacroPin(const char* pinName);
// This routine must be called after the lefwStartMacroPin call (if any).
// The routine can be called multiple time.
// Returns 0 if successful.
// It starts the macro pin port section within macro pin.
// The classType can be NONE or CORE.
extern int lefwStartMacroPinPort(const char* classType); // optional(NULL)
// This routine is called after lefwStartMacroPinPort.
// Either this routine or lefwMacroPinPortDesignRuleWidth must be called,
// but can't be both.
// Spacing is optional for minimum spacing.
// Returns 0 if successful.
extern int lefwMacroPinPortLayer(const char* layerName,
double spacing); // optional(0)
// This routine is called after lefwStartMacroPinPort.
// Either this routine or lefwMacroPinPortLayer must be called, but can't
// be both.
// width is optional for DesignRuleWidth
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwMacroPinPortDesignRuleWidth(const char* layerName,
double width); // optional(0)
// This routine is called after lefwMacroPinPortLayer.
// Returns 0 if successful.
extern int lefwMacroPinPortLayerWidth(double width);
// This routine is called after lefwStartMacroPinPortLayer.
// Either this routine, lefwStartMacroPinPortLayerRect, or
// lefwStartMacroPinPortLayerPolygon must be called.
// Returns 0 if successful.
extern int lefwMacroPinPortLayerPath(int num_paths, double* xl, double* yl,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroPinPortLayer.
// Either this routine, lefwStartMacroPinPortLayerPath, or
// lefwStartMacroPinPortLayerPolygon must be called.
// Returns 0 if successful.
extern int lefwMacroPinPortLayerRect(double xl1, double yl1,
double xl2, double yl2,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroPinPortLayer.
// Either this routine, lefwStartMacroPinPortLayerPath, or
// lefwStartMacroPinPortLayerRect must be called.
// Returns 0 if successful.
extern int lefwMacroPinPortLayerPolygon(int num_polys,
double* xl, double* yl,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroPinPort.
// Either this routine or lefwStartMacroPinPortLayer must be called.
// Returns 0 if successful.
extern int lefwMacroPinPortVia(double xl, double yl, const char* viaName,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine must be called after the lefwStartMacroPinPort call (if any).
// The routine can be called only once per macro section.
// Returns 0 if successful.
extern int lefwEndMacroPinPort();
// This routine is called after the lefwStartMacro call (if any).
// The routine is optional and can be called multiple times.
// Returns 0 if successful.
// It starts the macro obs section within macro.
extern int lefwStartMacroObs();
// This routine is called after lefwStartMacroObs.
// Either this routine, lefwMacroObsDesignRuleWidth, lefwMacroObsVia or
// lefwMacroExceptPGNet must be called.
// Spacing is optional for minimum spacing.
// Returns 0 if successful.
extern int lefwMacroObsLayer(const char* layerName,
double spacing); // optional(0)
// This routine is called after lefwStartMacroObs.
// Either this routine, lefwMacroObsLayer, lefwMacroObsVia or
// lefwMacroExceptPGNet must be called.
// Spacing is optional for minimum spacing.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwMacroObsDesignRuleWidth(const char* layerName,
double width); // optional(0)
// This routine is called after lefwStartMacroObs.
// Either this routine, lefwMacroObsLayer, lefwMacroObsVia or
// lefwMacroObsDesignRuleWidth must be called.
// Spacing is optional for minimum spacing.
// This is a 5.4 syntax.
// Returns 0 if successful.
extern int lefwMacroExceptPGNet(const char* layerName);
// This routine is called after lefwStartMacroObs.
// Returns 0 if successful.
extern int lefwMacroObsLayerWidth(double width);
// This routine is called after lefwStartMacroObsLayer.
// Either this routine, lefwMacroObsLayerRect, or
// lefwStartMacroObsLayerPolygon must be called.
// Returns 0 if successful.
extern int lefwMacroObsLayerPath(int num_paths, double* xl, double* yl,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroObsLayer.
// Either this routine, lefwMacroObsLayerPath, or
// lefwStartMacroObsLayerPolygon must be called.
// Returns 0 if successful.
extern int lefwMacroObsLayerRect(double xl1, double yl1,
double xl2, double yl2,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroObsLayer.
// Either this routine, lefwMacroObsLayerPath, or
// lefwStartMacroObsLayerPath must be called.
// Returns 0 if successful.
extern int lefwMacroObsLayerPolygon(int num_polys, double* xl, double* yl,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine is called after lefwStartMacroObs.
// Either this routine or lefwMacroObsLayer|lefwMacroObsDesignRuleWidth
// must be called.
// Returns 0 if successful.
extern int lefwMacroObsVia(double xl, double yl, const char* viaName,
int numX, // optional(0)
int numY, // optional(0)
double spaceX, // optional(0)
double spaceY, // optional(0)
int mask = 0); // optional(0)
// This routine must be called after the lefwStartMacroObs call (if any).
// The routine can be called only once per macro section.
// Returns 0 if successful.
extern int lefwEndMacroObs();
// This routine is called after the lefwStartMacro call (if any).
// The routine is optional and can be called only once.
// Returns 0 if successful.
// It starts the macro timing section within macro.
// This api is obsolete in 5.4.
extern int lefwStartMacroTiming();
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This routine is for {FROMPIN pinName...; [TOPIN pinName...;] | FROMPIN
// pinName...;}
// This routince can be called multiple times.
// The num_frPinNames contains the number of object in the array fromPins.
// This api is obsolete in 5.4.
extern int lefwMacroTimingPin(const char* fromPin, const char* toPin);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// The riseFall can be RISE or FALL.
// This api is obsolete in 5.4.
extern int lefwMacroTimingIntrinsic(const char* riseFall, double min,
double max,
double slewT1, // optional(0)
double slewT1Min, // optional(0)
double slewT1Max, // optional(0)
double slewT2, // optional(0)
double slewT2Min, // optional(0)
double slewT2Max, // optional(0)
double slewT3, // optional(0)
double varMin, double varMax);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingRisers(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingFallrs(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingRisecs(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingFallcs(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingRisesatt1(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingFallsatt1(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingRiset0(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwMacroTimingFallt0(double min, double max);
// This routine must be called after the lefwStartMacroTiming.
// It can be called multiple times.
// Returns 0 if successful.
// The unateness can be INVERT, NONINVERT or NONUNATE.
// This api is obsolete in 5.4.
extern int lefwMacroTimingUnateness(const char* unateness);
// This routine must be called after the lefwStartMacroTiming call (if any).
// The routine can be called only once.
// Returns 0 if successful.
// This api is obsolete in 5.4.
extern int lefwEndMacroTiming();
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
extern int lefwAntenna(const char* type, // INPUTPINANTENNASIZE |
// OUTPUTPINANTENNASIZE |
// INOUTPINANTENNASIZE
double value);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
extern int lefwStartBeginext(const char* name);
// This routine is called after lefwBeginext.
// This routine is optional, it can be called only once.
// Returns 0 if successful.
extern int lefwBeginextCreator (const char* creatorName);
// This routine is called after lefwBeginext.
// This routine is optional, it can be called only once.
// It gets the current system time and date.
// Returns 0 if successful.
extern int lefwBeginextDate ();
// This routine is called after lefwBeginext.
// This routine is optional, it can be called only once.
// Returns 0 if successful.
extern int lefwBeginextRevision (int vers1, int vers2); // vers1.vers2
// This routine is called after lefwBeginext.
// This routine is optional, it can be called many times.
// It allows user to customize their own syntax.
// Returns 0 if successful.
extern int lefwBeginextSyntax (const char* title, const char* string);
// This routine is called after lefwInit.
// This routine is optional and it can be called only once.
// Returns 0 if successful.
extern int lefwEndBeginext();
// General routines that can be called anytime after the Init is called.
extern int lefwCurrentLineNumber();
// This routine must call last, it ends the Lef library.
// It must be called only once.
// Returns 0 if successful.
extern int lefwEnd();
// This routine will print the error message.
extern void lefwPrintError(int status);
// This routine will allow user to write their own comemnt. It will
// automactically add a # infront of the line.
extern void lefwAddComment(const char* comment);
// This routine will indent 3 blank spaces
extern void lefwAddIndent();
END_LEFDEF_PARSER_NAMESPACE
USE_LEFDEF_PARSER_NAMESPACE
#endif
| 41.743579 | 80 | 0.71476 | [
"object"
] |
0e412095f3bd3f93671e5b4aa97f3de5ecf717bb | 5,604 | cc | C++ | tools/uorb_tcp_topic_listener_lib/src/uorb_tcp_listener.cc | ShawnFeng0/uorb | a2f4b8d6f44b11b5c4940ac4772bae50646ff2df | [
"MIT"
] | 25 | 2020-08-12T02:33:55.000Z | 2022-03-29T02:05:19.000Z | tools/uorb_tcp_topic_listener_lib/src/uorb_tcp_listener.cc | ShawnFeng0/uorb | a2f4b8d6f44b11b5c4940ac4772bae50646ff2df | [
"MIT"
] | 5 | 2020-09-01T11:43:57.000Z | 2022-01-06T07:18:42.000Z | tools/uorb_tcp_topic_listener_lib/src/uorb_tcp_listener.cc | ShawnFeng0/uorb | a2f4b8d6f44b11b5c4940ac4772bae50646ff2df | [
"MIT"
] | 8 | 2021-04-14T08:34:38.000Z | 2022-02-10T08:23:22.000Z | //
// Created by shawnfeng on 2021/9/30.
//
#include "uorb_tcp_listener.h"
#include <uorb/abs_time.h>
#include <uorb/uorb.h>
#include <csignal>
#include <thread>
#include <utility>
#include "command_manager.h"
#include "data_printer.h"
#include "fd_stream.h"
#include "tcp_server.h"
static orb_get_topics_callback global_topics_callback_ = nullptr;
/*
* Returns array of topics metadata
*/
static const struct orb_metadata *const *orb_get_topics(size_t *size) {
if (global_topics_callback_ != nullptr) {
return global_topics_callback_(size);
} else {
if (size) *size = 0;
return nullptr;
}
}
static void CmdGetVersion(uorb::listener::Fd &fd,
const std::vector<std::string> &) {
fd.write(orb_version());
fd.write("\n");
}
static const orb_metadata *find_meta(const std::string &topic_name) {
size_t orb_topics_count = 0;
auto topics = orb_get_topics(&orb_topics_count);
for (size_t i = 0; i < orb_topics_count; ++i)
if (topic_name == topics[i]->o_name) return topics[i];
return nullptr;
}
static void CmdListener(uorb::listener::Fd &fd,
const std::vector<std::string> &argv) {
if (argv.empty()) {
fd.write("Need topic name, example: listener <topic_name>\n");
return;
}
auto topic_name = argv[0];
auto meta = find_meta(topic_name);
if (!meta) {
fd.write("Can't find topic: " + topic_name + "\n");
return;
}
auto sub = orb_create_subscription(meta);
std::vector<uint8_t> data(meta->o_size);
orb_pollfd fds{.fd = sub, .events = POLLIN, .revents = 0};
uorb::listener::DataPrinter data_printer(*meta);
orb_abstime_us last_write_timestamp{};
do {
if (orb_poll(&fds, 1, 100) > 0) {
if (orb_check_and_copy(sub, data.data())) {
using namespace uorb::time_literals;
if (orb_elapsed_time_us(last_write_timestamp) > 100_ms) {
last_write_timestamp = orb_absolute_time_us();
fd.write(data_printer.Convert2String(data.data(), data.size()));
}
}
}
char c;
auto ret = fd.read(&c, 1);
// == 0 means socket is closed; > 0 means need quit the function.
if (ret >= 0) {
break;
}
if (ret == -1 && errno == EAGAIN) {
continue;
}
} while (true);
orb_destroy_subscription(&sub);
}
static void CmdStatus(uorb::listener::Fd &fd,
const std::vector<std::string> &) {
char send_buffer[256];
snprintf(send_buffer, sizeof(send_buffer),
"%-20s %-10s %-10s %-10s %-10s %-10s\n", "topic", "instance",
"queue", "sub", "pub", "index");
fd.write(send_buffer);
size_t orb_topics_count = 0;
auto topics = orb_get_topics(&orb_topics_count);
for (size_t i = 0; i < orb_topics_count; ++i) {
for (size_t instance = 0; instance < ORB_MULTI_MAX_INSTANCES; ++instance) {
orb_status status{};
if (orb_get_topic_status(topics[i], instance, &status)) {
std::string sub_count_str = std::to_string(status.subscriber_count);
if (status.has_anonymous_subscriber) sub_count_str += "+";
std::string pub_count_str = std::to_string(status.publisher_count);
if (status.has_anonymous_publisher) pub_count_str += "+";
snprintf(send_buffer, sizeof(send_buffer),
"%-20s %-10zu %-10d %-10s %-10s %-10d\n", topics[i]->o_name,
instance, status.queue_size, sub_count_str.c_str(),
pub_count_str.c_str(), status.latest_data_index);
fd.write(send_buffer);
}
}
}
}
static void TcpSocketSendThread(
int socket_fd, const uorb::listener::CommandManager &command_manager) {
uorb::listener::Fd socket(socket_fd);
std::string read_buffer;
while (true) {
if (socket.poll_in(-1) <= 0) {
continue;
}
char buffer[1024];
auto n = socket.read(buffer, sizeof(buffer));
if (n == 0) break;
if (n < 0) continue;
read_buffer.append(buffer, buffer + n);
auto line = uorb::listener::get_line(&read_buffer);
if (line.empty()) continue;
auto args = uorb::listener::split_string(line, " \t\n");
std::string command;
if (!args.empty()) {
command = *args.begin();
args.erase(args.begin());
}
uorb::listener::strip(command);
if (!command.empty()) {
if (!command_manager.ExecuteCommand(command, socket, args)) {
socket.write("Command not found: " + command + "\n");
command_manager.ExecuteHelp(socket, args);
}
break; // Execute the command only once
}
}
}
static void TcpServerThread(uint16_t port) {
uorb::listener::CommandManager command_manager;
command_manager.AddCommand("version", CmdGetVersion, "Print uorb version");
command_manager.AddCommand("status", CmdStatus, "Print uorb status");
command_manager.AddCommand("listener", CmdListener,
"topic listener, example: listener topic_name");
// Prevent process shutdown due to SIGPIPE signal:
// https://stackoverflow.com/questions/54871085/is-it-a-good-practice-to-call-pthread-sigmask-in-a-thread-created-by-stdthread
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &mask, nullptr);
uorb::listener::TcpServer tcp_server(port);
int new_socket;
while ((new_socket = tcp_server.accept()) >= 0) {
std::thread{TcpSocketSendThread, new_socket, command_manager}.detach();
}
printf("TCP server finished");
}
void orb_tcp_listener_init(orb_get_topics_callback callback, uint16_t port) {
global_topics_callback_ = callback;
std::thread{TcpServerThread, port}.detach();
}
| 30.129032 | 128 | 0.649536 | [
"vector"
] |
0e418bf4920e464c514b46085d75fb55bbd929a8 | 17,707 | cpp | C++ | Source/AllKeysOverview.cpp | Woyten/TerpstraSysEx.2014 | 347596b4b56360328f9c021104ffe92ce496b0ea | [
"BSD-3-Clause"
] | null | null | null | Source/AllKeysOverview.cpp | Woyten/TerpstraSysEx.2014 | 347596b4b56360328f9c021104ffe92ce496b0ea | [
"BSD-3-Clause"
] | null | null | null | Source/AllKeysOverview.cpp | Woyten/TerpstraSysEx.2014 | 347596b4b56360328f9c021104ffe92ce496b0ea | [
"BSD-3-Clause"
] | null | null | null | /*
==============================================================================
This is an automatically generated GUI class created by the Projucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Projucer version: 6.0.8
------------------------------------------------------------------------------
The Projucer is part of the JUCE library.
Copyright (c) 2020 - Raw Material Software Limited.
==============================================================================
*/
//[Headers] You can add your own extra header files here...
#include "ViewComponents.h"
#include "MainComponent.h"
#include "Main.h"
#include "LumatoneMenu.h"
//[/Headers]
#include "AllKeysOverview.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
//==============================================================================
KeyMiniDisplayInsideAllKeysOverview::KeyMiniDisplayInsideAllKeysOverview(int newBoardIndex, int newKeyIndex)
: Component("AllKeysOverview_Key" + String(newKeyIndex) + "," + String(newBoardIndex))
{
// In your constructor, you should add any child components, and
// initialise any special settings that your component needs.
boardIndex = newBoardIndex;
keyIndex = newKeyIndex;
// TerpstraSysExApplication::getApp().getLumatoneController()->addMidiListener(this);
}
KeyMiniDisplayInsideAllKeysOverview::~KeyMiniDisplayInsideAllKeysOverview()
{
// TerpstraSysExApplication::getApp().getLumatoneController()->removeMidiListener(this);
}
void KeyMiniDisplayInsideAllKeysOverview::paint(Graphics& g)
{
jassert(getParentComponent() != nullptr);
bool boardIsSelected = boardIndex == dynamic_cast<AllKeysOverview*>(getParentComponent())->getCurrentSetSelection();
Colour hexagonColour = findColour(TerpstraKeyEdit::backgroundColourId).overlaidWith(getKeyColour());
if (hexagonColour.getPerceivedBrightness() >= 0.6)
hexagonColour = hexagonColour.darker((1.0 - hexagonColour.getPerceivedBrightness()));
g.setColour(hexagonColour);
if (colourGraphic && shadowGraphic)
{
int x = roundToInt((getWidth() - colourGraphic->getWidth()) * 0.5f);
int y = roundToInt((getHeight() - colourGraphic->getHeight()) * 0.5f);
g.drawImageAt(*colourGraphic, x, y, true);
g.drawImageAt(*shadowGraphic, x, y);
}
}
void KeyMiniDisplayInsideAllKeysOverview::resized()
{
}
void KeyMiniDisplayInsideAllKeysOverview::mouseDown(const MouseEvent& e)
{
Component::mouseDown(e);
// Select this octave board
jassert(getParentComponent() != nullptr);
jassert(getParentComponent()->getParentComponent() != nullptr);
dynamic_cast<MainContentComponent*>(getParentComponent()->getParentComponent())->
getOctaveBoardSelectorTab()->setCurrentTabIndex(boardIndex);
isHighlighted = true;
repaint();
if (e.mods.isRightButtonDown())
{
// Right mouse click: popup menu
PopupMenu menu;
TerpstraSysExApplication::getApp().getMainMenu()->createEditMenu(menu);
menu.showMenuAsync(PopupMenu::Options());
}
// TODO integrate interaction through LumatoneController
//else
//{
// // NoteOn MIDI message
// auto keyData = getKeyData();
// if (keyData != nullptr && keyData->channelNumber > 0)
// {
// if (keyData->keyType == LumatoneKeyType::noteOnNoteOff)
// {
// // Send "note on" event
// //TerpstraSysExApplication::getApp().getMidiDriver().sendNoteOnMessage(keyData->noteNumber, keyData->channelNumber, 60);
// }
// // ToDo if keyType is "continuous controller": send controller event?
// }
//}
}
void KeyMiniDisplayInsideAllKeysOverview::mouseUp(const MouseEvent& e)
{
Component::mouseDown(e);
isHighlighted = false;
repaint();
// TODO integrate interaction through LumatoneController
//// NoteOff MIDI message
//auto keyData = getKeyData();
//if (keyData != nullptr && keyData->channelNumber > 0)
//{
// if (keyData->keyType == TerpstraKey::noteOnNoteOff)
// {
// // Send "note off" event
// TerpstraSysExApplication::getApp().getMidiDriver().sendNoteOffMessage(keyData->noteNumber, keyData->channelNumber, 60);
// }
//}
}
void KeyMiniDisplayInsideAllKeysOverview::handleMidiMessage(const MidiMessage& msg)
{
auto keyData = getKeyData();
if (keyData != nullptr && msg.getChannel() == keyData->channelNumber && msg.getNoteNumber() == keyData->noteNumber)
{
isHighlighted = msg.isNoteOn();
repaint();
}
}
const TerpstraKey* KeyMiniDisplayInsideAllKeysOverview::getKeyData() const
{
if (boardIndex >= 0 && boardIndex < NUMBEROFBOARDS && keyIndex >= 0 && keyIndex < TerpstraSysExApplication::getApp().getOctaveBoardSize())
{
jassert(getParentComponent() != nullptr);
jassert(getParentComponent()->getParentComponent() != nullptr);
return &dynamic_cast<MainContentComponent*>(getParentComponent()->getParentComponent())
->getMappingInEdit().sets[boardIndex].theKeys[keyIndex];
}
return nullptr;
}
Colour KeyMiniDisplayInsideAllKeysOverview::getKeyColour() const
{
auto keyData = getKeyData();
if ( keyData != nullptr)
return keyData->colour;
else
return findColour(TerpstraKeyEdit::backgroundColourId);
}
void KeyMiniDisplayInsideAllKeysOverview::setKeyGraphics(Image& colourGraphicIn, Image& shadowGraphicIn)
{
colourGraphic = &colourGraphicIn;
shadowGraphic = &shadowGraphicIn;
}
//[/MiscUserDefs]
//==============================================================================
AllKeysOverview::AllKeysOverview ()
{
//[Constructor_pre] You can add your own custom stuff here..
//[/Constructor_pre]
setName ("AllKeysOverview");
btnLoadFile.reset (new juce::TextButton ("btnLoadFile"));
addAndMakeVisible (btnLoadFile.get());
btnLoadFile->setButtonText (TRANS("LoadFile"));
btnLoadFile->addListener (this);
btnLoadFile->setBounds (368, 8, 96, 24);
btnSaveFile.reset (new juce::TextButton ("btnSaveFile"));
addAndMakeVisible (btnSaveFile.get());
btnSaveFile->setButtonText (TRANS("SaveFile"));
btnSaveFile->addListener (this);
btnSaveFile->setBounds (472, 8, 96, 24);
buttonReceive.reset (new juce::TextButton ("buttonReceive"));
addAndMakeVisible (buttonReceive.get());
buttonReceive->setTooltip (TRANS("ImportTooltip"));
buttonReceive->setButtonText (TRANS("Import from Lumatone"));
buttonReceive->addListener (this);
buttonReceive->setBounds (584, 8, 176, 24);
//[UserPreSize]
btnLoadFile->getProperties().set(LumatoneEditorStyleIDs::textButtonIconHashCode, LumatoneEditorIcon::LoadIcon);
btnSaveFile->getProperties().set(LumatoneEditorStyleIDs::textButtonIconHashCode, LumatoneEditorIcon::SaveIcon);
buttonReceive->getProperties().set(LumatoneEditorStyleIDs::textButtonIconHashCode, LumatoneEditorIcon::ArrowUp);
buttonReceive->getProperties().set(LumatoneEditorStyleIDs::textButtonIconPlacement, LumatoneEditorStyleIDs::TextButtonIconPlacement::RightOfText);
lblFirmwareVersion.reset(new Label("FirmwareVersionLabel"));
addChildComponent(lblFirmwareVersion.get());
tilingGeometry.setColumnAngle(LUMATONEGRAPHICCOLUMNANGLE);
tilingGeometry.setRowAngle(LUMATONEGRAPHICROWANGLE);
TerpstraSysExApplication::getApp().getLumatoneController()->addStatusListener(this);
TerpstraSysExApplication::getApp().getLumatoneController()->addFirmwareListener(this);
resetOctaveSize();
//[/UserPreSize]
setSize (928, 214);
//[Constructor] You can add your own custom stuff here..
currentSetSelection = -1;
buttonReceive->setVisible(false);
showDeveloperMode(TerpstraSysExApplication::getApp().getPropertiesFile()->getBoolValue("DeveloperMode", false));
//[/Constructor]
}
AllKeysOverview::~AllKeysOverview()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
btnLoadFile = nullptr;
btnSaveFile = nullptr;
buttonReceive = nullptr;
//[Destructor]. You can add your own custom destruction code here..
imageProcessor = nullptr;
//[/Destructor]
}
//==============================================================================
void AllKeysOverview::paint (juce::Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
//[UserPaint] Add your own custom painting code here..
g.drawImageAt(lumatoneGraphic, lumatoneBounds.getX(), lumatoneBounds.getY());
// Draw a line under the selected sub board
if (currentSetSelection >= 0 && currentSetSelection < NUMBEROFBOARDS)
{
Path selectionMarkPath;
selectionMarkPath.startNewSubPath(octaveBoards[currentSetSelection]->leftPos, octaveLineY);
selectionMarkPath.lineTo(octaveBoards[currentSetSelection]->rightPos, octaveLineY);
Colour lineColour = findColour(TerpstraKeyEdit::outlineColourId);
g.setColour(lineColour);
g.strokePath(selectionMarkPath, PathStrokeType(1.0f));
}
//[/UserPaint]
}
void AllKeysOverview::resized()
{
//[UserPreResize] Add your own custom resize code here..
//[/UserPreResize]
//[UserResized] Add your own custom resize handling here..
// Prepare position helpers for graphics
int graphicHeight = roundToInt(getHeight() * imageHeight);
int graphicWidth = roundToInt(imageAspect * graphicHeight);
lumatoneBounds.setBounds(
roundToInt((getWidth() - graphicWidth) / 2.0f), roundToInt(getHeight() * imageY),
graphicWidth, graphicHeight
);
int btnHeight = roundToInt(getHeight() * saveLoadH);
int btnMargin = roundToInt(getWidth() * saveloadMarginW);
int saveLoadWidth = roundToInt(getWidth() * saveLoadW);
int btnY = lumatoneBounds.getY() - roundToInt(getHeight() * btnYFromImageTop);
int halfWidthX = roundToInt(getWidth() * 0.5f);
btnLoadFile->setBounds(halfWidthX - btnMargin - saveLoadWidth, btnY, saveLoadWidth, btnHeight);
btnSaveFile->setBounds(halfWidthX + btnMargin, btnY, saveLoadWidth, btnHeight);
octaveLineY = lumatoneBounds.getBottom() + roundToInt(getHeight() * octaveLineYRatio);
int importY = lumatoneBounds.getY() - roundToInt(getHeight() * importYFromImageTop);
int importWidth = roundToInt(getWidth() * importW);
buttonReceive->setBounds(lumatoneBounds.getRight() - importWidth, importY, importWidth, btnHeight);
resizeLabelWithHeight(lblFirmwareVersion.get(), btnHeight * 0.6f);
lblFirmwareVersion->setTopLeftPosition(lumatoneBounds.getX(), lumatoneBounds.getY() - btnHeight * 0.6f);
int keyWidth = roundToInt(lumatoneBounds.getWidth() * keyW);
int keyHeight = roundToInt(lumatoneBounds.getHeight() * keyH);
// Scale key graphics once
lumatoneGraphic = imageProcessor->resizeImage(ImageCache::getFromHashCode(LumatoneEditorAssets::LumatoneGraphic), lumatoneBounds.getWidth(), lumatoneBounds.getHeight());
keyShapeGraphic = imageProcessor->resizeImage(ImageCache::getFromHashCode(LumatoneEditorAssets::KeyShape), keyWidth, keyHeight);
keyShadowGraphic = imageProcessor->resizeImage(ImageCache::getFromHashCode(LumatoneEditorAssets::KeyShadow), keyWidth, keyHeight);
oct1Key1 = Point<float>(oct1Key1X * lumatoneBounds.getWidth() + lumatoneBounds.getX(), oct1Key1Y * lumatoneBounds.getHeight() + lumatoneBounds.getY());
oct1Key56 = Point<float>(oct1Key56X * lumatoneBounds.getWidth() + lumatoneBounds.getX(), oct1Key56Y * lumatoneBounds.getHeight() + lumatoneBounds.getY());
oct5Key7 = Point<float>(oct5Key7X * lumatoneBounds.getWidth() + lumatoneBounds.getX(), oct5Key7Y * lumatoneBounds.getHeight() + lumatoneBounds.getY());
tilingGeometry.fitSkewedTiling(oct1Key1, oct1Key56, 10, oct5Key7, 24, false);
Array<Point<float>> keyCentres = tilingGeometry.getHexagonCentresSkewed(boardGeometry, 0, NUMBEROFBOARDS);
jassert(keyCentres.size() == TerpstraSysExApplication::getApp().getOctaveBoardSize() * NUMBEROFBOARDS);
int octaveIndex = 0;
octaveBoards[octaveIndex]->leftPos = keyCentres[0].getX() - keyWidth * 0.5;
for (int keyIndex = 0; keyIndex < keyCentres.size(); keyIndex++)
{
int keyOctaveIndex = keyIndex % TerpstraSysExApplication::getApp().getOctaveBoardSize();
// Apply rotational transform
Point<int> centre = keyCentres[keyIndex].roundToInt();
auto key = octaveBoards[octaveIndex]->keyMiniDisplay[keyOctaveIndex];
key->setSize(keyWidth, keyHeight);
key->setCentrePosition(centre);
key->setKeyGraphics(keyShapeGraphic, keyShadowGraphic);
if (keyOctaveIndex + 1 == TerpstraSysExApplication::getApp().getOctaveBoardSize())
{
octaveBoards[octaveIndex]->rightPos = key->getRight();
octaveIndex++;
if (octaveIndex < NUMBEROFBOARDS)
octaveBoards[octaveIndex]->leftPos = key->getX();
}
}
//[/UserResized]
}
void AllKeysOverview::buttonClicked (juce::Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == btnLoadFile.get())
{
//[UserButtonCode_btnLoadFile] -- add your button handler code here..
TerpstraSysExApplication::getApp().openSysExMapping();
//[/UserButtonCode_btnLoadFile]
}
else if (buttonThatWasClicked == btnSaveFile.get())
{
//[UserButtonCode_btnSaveFile] -- add your button handler code here..
TerpstraSysExApplication::getApp().saveSysExMappingAs();
//[/UserButtonCode_btnSaveFile]
}
else if (buttonThatWasClicked == buttonReceive.get())
{
//[UserButtonCode_buttonReceive] -- add your button handler code here..
TerpstraSysExApplication::getApp().requestConfigurationFromDevice();
//[/UserButtonCode_buttonReceive]
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void AllKeysOverview::setFirmwareVersion(FirmwareVersion versionIn)
{
if (versionIn.isValid())
{
if (versionIn.major == 0 && versionIn.minor == 0)
{
if (versionIn.revision == 55)
{
lblFirmwareVersion->setText("55-keys Prototype", NotificationType::dontSendNotification);
}
}
else
{
#if JUCE_DEBUG
lblFirmwareVersion->setText("Firmware version: " + versionIn.toString(), NotificationType::dontSendNotification);
#else
lblFirmwareVersion->setText("Firmware version: " + versionIn.toDisplayString(), NotificationType::dontSendNotification);
#endif
}
lblFirmwareVersion->setVisible(true);
resized();
}
else
{
lblFirmwareVersion->setVisible(false);
}
repaint();
}
void AllKeysOverview::showDeveloperMode(bool developerModeOn)
{
if (developerModeOn)
buttonReceive->setVisible(true);
repaint();
}
void AllKeysOverview::connectionEstablished(int, int)
{
buttonReceive->setVisible(true);
}
void AllKeysOverview::connectionLost()
{
buttonReceive->setVisible(false);
}
void AllKeysOverview::firmwareRevisionReceived(FirmwareVersion version)
{
setFirmwareVersion(version);
}
void AllKeysOverview::resetOctaveSize()
{
int octaveSize = TerpstraSysExApplication::getApp().getOctaveBoardSize();
if (currentOctaveSize != octaveSize)
{
boardGeometry = TerpstraBoardGeometry();
octaveBoards.clear();
for (int subBoardIndex = 0; subBoardIndex < NUMBEROFBOARDS; subBoardIndex++)
{
OctaveBoard* board = octaveBoards.add(new OctaveBoard());
for (int keyIndex = 0; keyIndex < octaveSize; keyIndex++)
{
auto key = board->keyMiniDisplay.add(new KeyMiniDisplayInsideAllKeysOverview(subBoardIndex, keyIndex));
addAndMakeVisible(key);
}
jassert(board->keyMiniDisplay.size() == octaveSize);
}
currentOctaveSize = octaveSize;
}
jassert(octaveBoards.size() == NUMBEROFBOARDS);
}
//[/MiscUserCode]
//==============================================================================
#if 0
/* -- Projucer information section --
This is where the Projucer stores the metadata that describe this GUI layout, so
make changes in here at your peril!
BEGIN_JUCER_METADATA
<JUCER_COMPONENT documentType="Component" className="AllKeysOverview" componentName="AllKeysOverview"
parentClasses="public juce::Component, public LumatoneEditor::StatusListener, public LumatoneEditor::FirmwareListener"
constructorParams="" variableInitialisers="" snapPixels="8" snapActive="1"
snapShown="1" overlayOpacity="0.330" fixedSize="0" initialWidth="928"
initialHeight="214">
<BACKGROUND backgroundColour="0"/>
<TEXTBUTTON name="btnLoadFile" id="6c0c074c9f137f23" memberName="btnLoadFile"
virtualName="" explicitFocusOrder="0" pos="368 8 96 24" buttonText="Load File"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="btnSaveFile" id="abbc33d699ba1e52" memberName="btnSaveFile"
virtualName="" explicitFocusOrder="0" pos="472 8 96 24" buttonText="Save File"
connectedEdges="0" needsCallback="1" radioGroupId="0"/>
<TEXTBUTTON name="buttonReceive" id="6a7ed19ee86a3b97" memberName="buttonReceive"
virtualName="" explicitFocusOrder="0" pos="584 8 176 24" tooltip="Receive current layout from connected Lumatone"
buttonText="Import from Lumatone" connectedEdges="0" needsCallback="1"
radioGroupId="0"/>
</JUCER_COMPONENT>
END_JUCER_METADATA
*/
#endif
//[EndFile] You can add extra defines here...
//[/EndFile]
| 34.856299 | 171 | 0.695431 | [
"transform"
] |
0e41bba604beb2a59486da8a62dcfe9fa50751df | 2,791 | cpp | C++ | ThirdParty/assimp-3.0.1270/test/unit/utJoinVertices.cpp | vif/3D-STG | 721402e76a9b9b99b88ba3eb06beb6abb17a9254 | [
"MIT"
] | 7 | 2015-05-30T13:56:34.000Z | 2017-11-04T17:58:26.000Z | modules/assimp/ext/assimp/test/unit/utJoinVertices.cpp | liu3xing3long/inviwo | 69cca9b6ecd58037bda0ed9e6f53d02f189f19a7 | [
"BSD-2-Clause"
] | 1 | 2019-05-20T23:10:19.000Z | 2019-05-20T23:13:49.000Z | modules/assimp/ext/assimp/test/unit/utJoinVertices.cpp | liu3xing3long/inviwo | 69cca9b6ecd58037bda0ed9e6f53d02f189f19a7 | [
"BSD-2-Clause"
] | 1 | 2020-07-17T10:27:57.000Z | 2020-07-17T10:27:57.000Z |
#include "UnitTestPCH.h"
#include "utJoinVertices.h"
CPPUNIT_TEST_SUITE_REGISTRATION (JoinVerticesTest);
// ------------------------------------------------------------------------------------------------
void JoinVerticesTest :: setUp (void)
{
// construct the process
piProcess = new JoinVerticesProcess();
// create a quite small mesh for testing purposes -
// the mesh itself is *something* but it has redundant vertices
pcMesh = new aiMesh();
pcMesh->mNumVertices = 900;
aiVector3D*& pv = pcMesh->mVertices = new aiVector3D[900];
for (unsigned int i = 0; i < 3;++i)
{
const unsigned int base = i*300;
for (unsigned int a = 0; a < 300;++a)
{
pv[base+a].x = pv[base+a].y = pv[base+a].z = (float)a;
}
}
// generate faces - each vertex is referenced once
pcMesh->mNumFaces = 300;
pcMesh->mFaces = new aiFace[300];
for (unsigned int i = 0,p = 0; i < 300;++i)
{
aiFace& face = pcMesh->mFaces[i];
face.mIndices = new unsigned int[ face.mNumIndices = 3 ];
for (unsigned int a = 0; a < 3;++a)
face.mIndices[a] = p++;
}
// generate extra members - set them to zero to make sure they're identical
pcMesh->mTextureCoords[0] = new aiVector3D[900];
for (unsigned int i = 0; i < 900;++i)pcMesh->mTextureCoords[0][i] = aiVector3D( 0.f );
pcMesh->mNormals = new aiVector3D[900];
for (unsigned int i = 0; i < 900;++i)pcMesh->mNormals[i] = aiVector3D( 0.f );
pcMesh->mTangents = new aiVector3D[900];
for (unsigned int i = 0; i < 900;++i)pcMesh->mTangents[i] = aiVector3D( 0.f );
pcMesh->mBitangents = new aiVector3D[900];
for (unsigned int i = 0; i < 900;++i)pcMesh->mBitangents[i] = aiVector3D( 0.f );
}
// ------------------------------------------------------------------------------------------------
void JoinVerticesTest :: tearDown (void)
{
delete this->pcMesh;
delete this->piProcess;
}
// ------------------------------------------------------------------------------------------------
void JoinVerticesTest :: testProcess(void)
{
// execute the step on the given data
piProcess->ProcessMesh(pcMesh,0);
// the number of faces shouldn't change
CPPUNIT_ASSERT(pcMesh->mNumFaces == 300);
CPPUNIT_ASSERT(pcMesh->mNumVertices == 300);
CPPUNIT_ASSERT(NULL != pcMesh->mNormals);
CPPUNIT_ASSERT(NULL != pcMesh->mTangents);
CPPUNIT_ASSERT(NULL != pcMesh->mBitangents);
CPPUNIT_ASSERT(NULL != pcMesh->mTextureCoords[0]);
// the order doesn't care
float fSum = 0.f;
for (unsigned int i = 0; i < 300;++i)
{
aiVector3D& v = pcMesh->mVertices[i];
fSum += v.x + v.y + v.z;
CPPUNIT_ASSERT(!pcMesh->mNormals[i].x);
CPPUNIT_ASSERT(!pcMesh->mTangents[i].x);
CPPUNIT_ASSERT(!pcMesh->mBitangents[i].x);
CPPUNIT_ASSERT(!pcMesh->mTextureCoords[0][i].x);
}
CPPUNIT_ASSERT(fSum == 150.f*299.f*3.f); // gaussian sum equation
}
| 31.011111 | 99 | 0.601935 | [
"mesh"
] |
0e46fb79528ce0c740addd1da1fca337cf907028 | 12,741 | cpp | C++ | src/pme/ivc/caivc.cpp | ryanberryhill/pme | 416be2d52c920d285cc686a56d2f30bfab66bc51 | [
"MIT"
] | 2 | 2019-01-25T16:07:56.000Z | 2019-08-14T17:34:22.000Z | src/pme/ivc/caivc.cpp | ryanberryhill/pme | 416be2d52c920d285cc686a56d2f30bfab66bc51 | [
"MIT"
] | 2 | 2018-08-21T22:46:41.000Z | 2019-08-14T17:36:31.000Z | src/pme/ivc/caivc.cpp | ryanberryhill/pme | 416be2d52c920d285cc686a56d2f30bfab66bc51 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2018 Ryan Berryhill, University of Toronto
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "pme/ivc/caivc.h"
#include "pme/util/hybrid_safety_checker.h"
#include <cassert>
namespace PME {
CAIVCFinder::CAIVCFinder(VariableManager & varman,
const TransitionRelation & tr)
: IVCFinder(varman, tr),
m_debug_tr(tr),
m_gates(tr.begin_gate_ids(), tr.end_gate_ids()),
m_finder(varman, m_debug_tr),
m_approx_finder(varman, m_debug_tr),
m_solver(varman),
m_ivc_checker(varman, m_debug_tr)
{
for (ID gate : m_gates)
{
m_solver.addForOptimization(negate(gate));
}
}
std::ostream & CAIVCFinder::log(int verbosity) const
{
return IVCFinder::log(LOG_CAIVC, verbosity);
}
void CAIVCFinder::doFindIVCs()
{
log(2) << "Starting CAIVC (there are " << m_gates.size() << " gates)" << std::endl;
// Check for constant output
if (tr().bad() == ID_FALSE)
{
log(3) << "Output is a literal 0" << std::endl;
IVC empty;
addMIVC(empty);
logMIVC(empty);
}
else if (opts().caivc_abstraction_refinement)
{
abstractionRefinementFindIVCs();
}
else
{
naiveFindIVCs();
}
}
void CAIVCFinder::abstractionRefinementFindIVCs()
{
// Typically, we want to start by finding all cardinality 1 MCSes
// An option allows us to start with even higher cardinalities
{
AutoTimer timer(stats().caivc_prep_time);
unsigned n_max = opts().caivc_ar_upfront_nmax;
for (unsigned n = 1; n <= n_max; ++n)
{
while (true)
{
bool found;
CorrectionSet corr;
std::tie(found, corr) = findUpfront(n);
if (!found) { break; }
logMCS(corr);
if (corr.size() == 1) { m_necessary_gates.insert(corr.at(0)); }
}
}
}
// Repeatedly find candidate MIVCs. If the candidate is not safe, then
// find a new MCS consiting only of gates outside the candidate.
while (true)
{
bool found;
IVC candidate;
std::tie(found, candidate) = findCandidateMIVC();
if (found) { logCandidate(candidate); }
else
{
log(2) << "No more candidates" << std::endl;
break;
}
if (isIVC(candidate))
{
if (!minimumIVCKnown()) { setMinimumIVC(candidate); }
addMIVC(candidate);
logMIVC(candidate);
blockMIVC(candidate);
}
else
{
std::vector<ID> neg = negateGateSet(candidate);
CorrectionSet corr = findCorrectionSetOverGates(neg);
logMCS(corr);
m_solver.addClause(corr);
}
}
}
void CAIVCFinder::naiveFindIVCs()
{
unsigned cardinality = 1;
{
AutoTimer timer(stats().caivc_prep_time);
unsigned count = 0;
do {
m_finder.setCardinality(cardinality);
while (true)
{
bool found;
CorrectionSet corr;
std::tie(found, corr) = findCorrectionSet();
if (!found) { break; }
count++;
logMCS(corr);
if (corr.size() == 1) { m_necessary_gates.insert(corr.at(0)); }
else { m_solver.addClause(corr); }
}
cardinality++;
} while (moreCorrectionSets());
log(2) << "Done finding correction sets (" << count << " found)" << std::endl;
}
while (true)
{
bool found;
IVC mivc;
std::tie(found, mivc) = findAndBlockCandidateMIVC();
if (!found) { break; }
if (!minimumIVCKnown()) { setMinimumIVC(mivc); }
addMIVC(mivc);
logMIVC(mivc);
}
}
bool CAIVCFinder::moreCorrectionSets()
{
stats().caivc_more_mcs_calls++;
AutoTimer timer(stats().caivc_more_mcs_time);
return m_finder.moreCorrectionSets();
}
std::pair<bool, CorrectionSet> CAIVCFinder::findCorrectionSet()
{
stats().caivc_find_mcs_calls++;
AutoTimer timer(stats().caivc_find_mcs_time);
auto result = m_finder.findAndBlock();
assert(!result.first || !result.second.empty());
if (result.first) { stats().caivc_correction_sets_found++; }
return result;
}
CorrectionSet CAIVCFinder::findCorrectionSetOverGates(const std::vector<ID> & gates)
{
assert(!gates.empty());
stats().caivc_find_mcs_calls++;
AutoTimer timer(stats().caivc_find_mcs_time);
if (opts().caivc_grow_mcs)
{
return findMCSOverGatesByGrow(gates);
}
else if (opts().caivc_simple_mcs)
{
return gates;
}
else if (opts().caivc_approx_mcs)
{
return findApproxMCSOverGates(gates);
}
else
{
return findMCSOverGates(gates);
}
}
std::pair<bool, CorrectionSet> CAIVCFinder::findUpfront(unsigned n)
{
if (opts().caivc_approx_mcs)
{
auto result = m_approx_finder.findAndBlockWithBMC(n);
assert(!result.first || !result.second.empty());
return result;
}
else
{
m_finder.setCardinality(n);
return findCorrectionSet();
}
}
CorrectionSet CAIVCFinder::findMCSOverGatesByGrow(const std::vector<ID> & gates)
{
std::vector<ID> mss = negateGateSet(gates);
std::set<ID> mss_set(mss.begin(), mss.end());
for (ID gate : m_gates)
{
if (mss_set.count(gate) > 0) { continue; }
// Try to add to mss
std::vector<ID> candidate = mss;
candidate.push_back(gate);
if (!isIVC(candidate))
{
// No need to add to mss_set, since we'll never see this
// gate again
mss.push_back(gate);
}
}
return negateGateSet(mss);
}
CorrectionSet CAIVCFinder::findApproxMCSOverGates(const std::vector<ID> & gates)
{
bool found;
CorrectionSet corr;
std::tie(found, corr) = m_approx_finder.findAndBlockOverGates(gates);
// This should only be called when we know a correction set exists
assert(found);
assert(!found || !corr.empty());
stats().caivc_correction_sets_found++;
return corr;
}
CorrectionSet CAIVCFinder::findMCSOverGates(const std::vector<ID> & gates)
{
// Assuming we already found all cardinality 1 MCSes
for (unsigned cardinality = 2; cardinality <= gates.size(); ++cardinality)
{
bool found;
CorrectionSet corr;
m_finder.setCardinality(cardinality);
std::tie(found, corr) = m_finder.findAndBlockOverGates(gates);
assert(!found || !corr.empty());
stats().caivc_correction_sets_found++;
if (found) { return corr; }
}
// This should only be called when we know a correction set exists
assert(false);
CorrectionSet empty;
return empty;
}
std::pair<bool, IVC> CAIVCFinder::findAndBlockCandidateMIVC()
{
return findCandidateMIVC(true);
}
std::pair<bool, IVC> CAIVCFinder::findCandidateMIVC()
{
return findCandidateMIVC(false);
}
std::pair<bool, IVC> CAIVCFinder::findCandidateMIVC(bool block)
{
stats().caivc_find_candidate_calls++;
AutoTimer timer(stats().caivc_find_candidate_time);
bool found;
IVC mivc;
found = m_solver.solve();
if (!found) { return std::make_pair(false, mivc); }
mivc = extractIVC();
if (block) { blockMIVC(mivc); }
return std::make_pair(true, mivc);
}
void CAIVCFinder::blockMIVC(const IVC & mivc)
{
IVC blockable_ivc;
for (ID id : mivc)
{
if (m_necessary_gates.count(id) == 0)
{
blockable_ivc.push_back(id);
}
}
Clause block_cls;
if (blockable_ivc.empty())
{
// This occurs when the original circuit is already a MIVC. We
// don't allow empty clauses, so add the clause (false).
block_cls.push_back(ID_FALSE);
}
else
{
block_cls = negateVec(blockable_ivc);
}
m_solver.addClause(block_cls);
}
bool CAIVCFinder::isIVC(const IVC & candidate)
{
stats().caivc_isivc_calls++;
AutoTimer timer(stats().caivc_isivc_time);
if (opts().caivc_check_with_debug)
{
// Debug over the gates not in candidate with unlimited cardinality
// (i.e., all non-candidate gates are removed)
// TODO: we don't get very much incrementality at all here (indeed,
// none in IC3, only whatever we get in BMC)
std::vector<ID> neg = negateGateSet(candidate);
bool unsafe;
std::tie(unsafe, std::ignore) = m_ivc_checker.debugOverGates(neg);
return !unsafe;
}
else
{
// Construct the candidate IVC and see if it's safe
TransitionRelation partial(tr(), candidate);
HybridSafetyChecker checker(vars(), partial);
SafetyResult safe = checker.prove();
return (safe.result == SAFE);
}
}
IVC CAIVCFinder::extractIVC() const
{
assert(m_solver.isSAT());
// Start with the necessary gates
IVC mivc(m_necessary_gates.begin(), m_necessary_gates.end());
for (ID gate : m_gates)
{
if (m_solver.getAssignmentToVar(gate) == SAT::TRUE)
{
assert(m_necessary_gates.count(gate) == 0);
mivc.push_back(gate);
}
}
return mivc;
}
std::vector<ID> CAIVCFinder::negateGateSet(const std::vector<ID> & gates) const
{
std::set<ID> gate_set(gates.begin(), gates.end());
std::vector<ID> neg;
for (ID gate : m_gates)
{
if (gate_set.count(gate) == 0)
{
neg.push_back(gate);
}
}
return neg;
}
void CAIVCFinder::logMCS(const CorrectionSet & mcs) const
{
log(2) << "Found correction set of size " << mcs.size();
log(3) << " [ ";
for (ID id : mcs) { log(3) << id << " "; }
log(3) << "]";
log(2) << std::endl;
}
void CAIVCFinder::logMIVC(const IVC & mivc) const
{
log(2) << "Found MIVC of size " << mivc.size();
log(3) << " [ ";
for (ID id : mivc) { log(3) << id << " "; }
log(3) << "]";
log(2) << std::endl;
}
void CAIVCFinder::logCandidate(const IVC & candidate) const
{
log(4) << "Found candidate MIVC of size " << candidate.size();
log(4) << " [ ";
for (ID id : candidate) { log(4) << id << " "; }
log(4) << "]" << std::endl;
}
}
| 29.022779 | 91 | 0.539911 | [
"vector"
] |
0e48cbdfc4d29c56eb773153ddc1e8012a4fa809 | 3,723 | cpp | C++ | test/test_Resource.cpp | tomcreutz/knowledge-reasoning-moreorg | 545fa92eaf0fc8ccc4cc042bd994afc918d16f68 | [
"BSD-3-Clause"
] | null | null | null | test/test_Resource.cpp | tomcreutz/knowledge-reasoning-moreorg | 545fa92eaf0fc8ccc4cc042bd994afc918d16f68 | [
"BSD-3-Clause"
] | 1 | 2021-02-26T11:11:03.000Z | 2021-02-26T19:16:10.000Z | test/test_Resource.cpp | tomcreutz/knowledge-reasoning-moreorg | 545fa92eaf0fc8ccc4cc042bd994afc918d16f68 | [
"BSD-3-Clause"
] | 1 | 2021-05-17T13:02:49.000Z | 2021-05-17T13:02:49.000Z | #include <boost/test/unit_test.hpp>
#include <moreorg/Resource.hpp>
using namespace moreorg;
using namespace owlapi::model;
BOOST_AUTO_TEST_SUITE(resource)
BOOST_AUTO_TEST_CASE(merge)
{
owlapi::model::IRI modelA("http://test/a");
owlapi::model::IRI modelB("http://test/b");
owlapi::model::IRI propertyA("http://test/propertyA");
owlapi::model::IRI propertyB("http://test/propertyB");
{
Resource a(modelA);
Resource b(modelB);
BOOST_REQUIRE_THROW(a.merge(b), std::invalid_argument);
}
{
Resource a(modelA);
Resource b(modelA);
BOOST_REQUIRE_NO_THROW(a.merge(b));
}
{
Resource a0(modelA);
PropertyConstraint pcA0(propertyA, PropertyConstraint::GREATER_EQUAL, 10);
a0.addPropertyConstraint(pcA0);
Resource a1(modelA);
PropertyConstraint pcA1(propertyA, PropertyConstraint::GREATER_EQUAL, 20);
a1.addPropertyConstraint(pcA1);
a0.merge(a1);
BOOST_REQUIRE_MESSAGE(a0.getPropertyConstraints().size() == 2, "Merge should result in 2 property constraints, but was " << a0.getPropertyConstraints().size());
// Checkin sets
Resource b0(modelB);
Resource::Set aSet;
aSet.insert(a0);
aSet.insert(a1);
Resource::Set bSet;
bSet.insert(a0);
bSet.insert(b0);
Resource::Set r = Resource::merge(aSet, bSet);
BOOST_REQUIRE_MESSAGE(r.size() == 2, "Merge should result in two functionalities, was " << r.size());
}
}
BOOST_AUTO_TEST_CASE(merge_single_set)
{
owlapi::model::IRI modelA("http://test/a");
owlapi::model::IRI modelB("http://test/b");
owlapi::model::IRI propertyA("http://test/propertyA");
Resource a0(modelA);
PropertyConstraint pcA0(propertyA, PropertyConstraint::GREATER_EQUAL, 3);
a0.addPropertyConstraint(pcA0);
Resource a1(modelA);
PropertyConstraint pcA1(propertyA, PropertyConstraint::GREATER_EQUAL, 4);
a1.addPropertyConstraint(pcA1);
Resource::Set resources = { a0, a1 };
Resource::Set mergedResources = Resource::merge(resources);
BOOST_REQUIRE_MESSAGE(mergedResources.size() == 1, "Merged resources of size"
" 1");
PropertyConstraint::Set constraints = mergedResources.begin()->getPropertyConstraints();
BOOST_REQUIRE_MESSAGE(constraints.size() == 2, "There should be two"
"constraints, was " << constraints.size());
PropertyConstraint::Set expectedConstraints = { pcA1, pcA0 };
BOOST_REQUIRE_MESSAGE(constraints == expectedConstraints, "Property constraint should equal "
<< PropertyConstraint::toString(expectedConstraints, 4)
<< " was "
<< PropertyConstraint::toString(constraints, 4));
}
BOOST_AUTO_TEST_CASE(merge_single_resource)
{
owlapi::model::IRI modelA("http://test/a");
owlapi::model::IRI propertyA("http://test/propertyA");
Resource a0(modelA);
Resource a1(modelA);
PropertyConstraint pcA1(propertyA, PropertyConstraint::GREATER_EQUAL, 4);
a1.addPropertyConstraint(pcA1);
Resource::Set resources = { a0, a1 };
Resource::Set mergedResources = Resource::merge(resources);
BOOST_REQUIRE_MESSAGE(mergedResources.size() == 1, "There should be only"
" one resource");
PropertyConstraint::Set constraints = mergedResources.begin()->getPropertyConstraints();
BOOST_REQUIRE_MESSAGE(constraints.size() == 1, "There should be one constraint");
PropertyConstraint constraint = *constraints.begin();
BOOST_REQUIRE_MESSAGE(constraint == pcA1, "Property constraint should equal "
<< pcA1.toString() << ", was " << constraint.toString());
}
BOOST_AUTO_TEST_SUITE_END()
| 33.845455 | 168 | 0.673919 | [
"model"
] |
0e4c71f7227ae28840e37c6e592888c612d35b82 | 7,063 | cpp | C++ | worker/src/RTC/RtpStreamRecv.cpp | maytrue/mediasoup | 11c0ae83d8cb0e238c91bc43132825a7bafcba80 | [
"ISC"
] | 1 | 2019-07-25T16:45:11.000Z | 2019-07-25T16:45:11.000Z | worker/src/RTC/RtpStreamRecv.cpp | maytrue/mediasoup | 11c0ae83d8cb0e238c91bc43132825a7bafcba80 | [
"ISC"
] | 3 | 2019-04-23T18:30:03.000Z | 2020-09-18T23:41:03.000Z | worker/src/RTC/RtpStreamRecv.cpp | maytrue/mediasoup | 11c0ae83d8cb0e238c91bc43132825a7bafcba80 | [
"ISC"
] | 1 | 2020-06-18T22:07:43.000Z | 2020-06-18T22:07:43.000Z | #define MS_CLASS "RTC::RtpStreamRecv"
// #define MS_LOG_DEV
#include "RTC/RtpStreamRecv.hpp"
#include "DepLibUV.hpp"
#include "Logger.hpp"
#include "RTC/Codecs/Codecs.hpp"
namespace RTC
{
/* Static. */
static constexpr uint16_t StatusCheckPeriod{ 250 };
/* Instance methods. */
RtpStreamRecv::RtpStreamRecv(Listener* listener, RTC::RtpStream::Params& params)
: RtpStream::RtpStream(params), listener(listener)
{
MS_TRACE();
if (this->params.useNack)
this->nackGenerator.reset(new RTC::NackGenerator(this));
// Run the timer.
this->statusCheckTimer->Start(StatusCheckPeriod, StatusCheckPeriod);
}
RtpStreamRecv::~RtpStreamRecv()
{
MS_TRACE();
}
Json::Value RtpStreamRecv::GetStats()
{
static const std::string Type = "inbound-rtp";
static const Json::StaticString JsonStringType{ "type" };
static const Json::StaticString JsonStringJitter{ "jitter" };
Json::Value json = RtpStream::GetStats();
json[JsonStringType] = Type;
json[JsonStringJitter] = Json::UInt{ this->jitter };
return json;
}
bool RtpStreamRecv::ReceivePacket(RTC::RtpPacket* packet)
{
MS_TRACE();
// Call the parent method.
if (!RtpStream::ReceivePacket(packet))
{
MS_WARN_TAG(rtp, "packet discarded");
return false;
}
// Calculate Jitter.
CalculateJitter(packet->GetTimestamp());
// Process the packet at codec level.
if (packet->GetPayloadType() == GetPayloadType())
Codecs::ProcessRtpPacket(packet, GetMimeType());
// Pass the packet to the NackGenerator.
if (this->params.useNack)
this->nackGenerator->ReceivePacket(packet);
return true;
}
bool RtpStreamRecv::ReceiveRtxPacket(RTC::RtpPacket* packet)
{
MS_TRACE();
MS_ASSERT(packet->GetSsrc() == this->rtxSsrc, "invalid ssrc on RTX packet");
// Check that the payload type corresponds to the one negotiated.
if (packet->GetPayloadType() != this->rtxPayloadType)
{
MS_WARN_TAG(
rtx,
"ignoring RTX packet with invalid payload type [ssrc:%" PRIu32 ", seq:%" PRIu16
", pt:%" PRIu8 "]",
packet->GetSsrc(),
packet->GetSequenceNumber(),
packet->GetPayloadType());
return false;
}
// Get the RTX packet sequence number for logging purposes.
auto rtxSeq = packet->GetSequenceNumber();
// Get the original RTP packet.
if (!packet->RtxDecode(this->params.payloadType, this->params.ssrc))
{
MS_DEBUG_TAG(
rtx,
"ignoring empty RTX packet [ssrc:%" PRIu32 ", seq:%" PRIu16 ", pt:%" PRIu8 "]",
packet->GetSsrc(),
packet->GetSequenceNumber(),
packet->GetPayloadType());
return false;
}
MS_DEBUG_TAG(
rtx,
"received RTX packet [ssrc:%" PRIu32 ", seq:%" PRIu16 "] recovering original [ssrc:%" PRIu32
", seq:%" PRIu16 "]",
this->rtxSsrc,
rtxSeq,
packet->GetSsrc(),
packet->GetSequenceNumber());
// If not a valid packet ignore it.
if (!UpdateSeq(packet))
{
MS_WARN_TAG(
rtx,
"invalid RTX packet [ssrc:%" PRIu32 ", seq:%" PRIu16 "]",
packet->GetSsrc(),
packet->GetSequenceNumber());
return false;
}
// Process the packet at codec level.
if (packet->GetPayloadType() == GetPayloadType())
Codecs::ProcessRtpPacket(packet, GetMimeType());
// Pass the packet to the NackGenerator and return true just if this was a
// NACKed packet.
if (this->params.useNack)
return this->nackGenerator->ReceivePacket(packet);
return false;
}
RTC::RTCP::ReceiverReport* RtpStreamRecv::GetRtcpReceiverReport()
{
MS_TRACE();
auto report = new RTC::RTCP::ReceiverReport();
// Calculate Packets Expected and Lost.
uint32_t expected = (this->cycles + this->maxSeq) - this->baseSeq + 1;
this->packetsLost = expected - this->transmissionCounter.GetPacketCount();
report->SetTotalLost(this->packetsLost);
// Calculate Fraction Lost.
uint32_t expectedInterval = expected - this->expectedPrior;
this->expectedPrior = expected;
uint32_t receivedInterval = this->transmissionCounter.GetPacketCount() - this->receivedPrior;
this->receivedPrior = transmissionCounter.GetPacketCount();
int32_t lostInterval = expectedInterval - receivedInterval;
if (expectedInterval == 0 || lostInterval <= 0)
this->fractionLost = 0;
else
this->fractionLost = (lostInterval << 8) / expectedInterval;
report->SetFractionLost(this->fractionLost);
// Fill the rest of the report.
report->SetLastSeq(static_cast<uint32_t>(this->maxSeq) + this->cycles);
report->SetJitter(this->jitter);
if (this->lastSrReceived != 0u)
{
// Get delay in milliseconds.
auto delayMs = static_cast<uint32_t>(DepLibUV::GetTime() - this->lastSrReceived);
// Express delay in units of 1/65536 seconds.
uint32_t dlsr = (delayMs / 1000) << 16;
dlsr |= uint32_t{ (delayMs % 1000) * 65536 / 1000 };
report->SetDelaySinceLastSenderReport(dlsr);
report->SetLastSenderReport(this->lastSrTimestamp);
}
else
{
report->SetDelaySinceLastSenderReport(0);
report->SetLastSenderReport(0);
}
return report;
}
void RtpStreamRecv::ReceiveRtcpSenderReport(RTC::RTCP::SenderReport* report)
{
MS_TRACE();
this->lastSrReceived = DepLibUV::GetTime();
this->lastSrTimestamp = report->GetNtpSec() << 16;
this->lastSrTimestamp += report->GetNtpFrac() >> 16;
}
void RtpStreamRecv::RequestKeyFrame()
{
MS_TRACE();
if (this->params.usePli)
{
// Reset NackGenerator.
if (this->params.useNack)
this->nackGenerator->Reset();
this->listener->OnRtpStreamRecvPliRequired(this);
}
}
void RtpStreamRecv::CalculateJitter(uint32_t rtpTimestamp)
{
MS_TRACE();
if (this->params.clockRate == 0u)
return;
auto transit =
static_cast<int>(DepLibUV::GetTime() - (rtpTimestamp * 1000 / this->params.clockRate));
int d = transit - this->transit;
this->transit = transit;
if (d < 0)
d = -d;
this->jitter += (1. / 16.) * (static_cast<double>(d) - this->jitter);
}
void RtpStreamRecv::CheckStatus()
{
MS_TRACE();
auto now = DepLibUV::GetTime();
if (this->transmissionCounter.GetRate(now) == 0)
{
if (this->active)
{
this->active = false;
this->listener->OnRtpStreamInactive(this);
}
}
else if (!this->active)
{
this->active = true;
this->listener->OnRtpStreamActive(this);
}
}
void RtpStreamRecv::OnNackGeneratorNackRequired(const std::vector<uint16_t>& seqNumbers)
{
MS_TRACE();
MS_ASSERT(this->params.useNack, "NACK required but not supported");
MS_DEBUG_TAG(
rtx,
"triggering NACK [ssrc:%" PRIu32 ", first seq:%" PRIu16 ", num packets:%zu]",
this->params.ssrc,
seqNumbers[0],
seqNumbers.size());
this->listener->OnRtpStreamRecvNackRequired(this, seqNumbers);
}
void RtpStreamRecv::OnNackGeneratorKeyFrameRequired()
{
MS_TRACE();
MS_DEBUG_TAG(rtx, "requesting key frame [ssrc:%" PRIu32 "]", this->params.ssrc);
RequestKeyFrame();
}
void RtpStreamRecv::SetRtx(uint8_t payloadType, uint32_t ssrc)
{
MS_TRACE();
this->hasRtx = true;
this->rtxPayloadType = payloadType;
this->rtxSsrc = ssrc;
}
} // namespace RTC
| 24.188356 | 96 | 0.679598 | [
"vector"
] |
0e4c9d65350b19a858629878003b159445bbc3b5 | 566 | cpp | C++ | demos/demo3-foodthrowing/src/bullet.cpp | uhteoman/gba-sprite-engine | bd67ef025e653c5db316f4e8b4c6733f030265dc | [
"MIT"
] | null | null | null | demos/demo3-foodthrowing/src/bullet.cpp | uhteoman/gba-sprite-engine | bd67ef025e653c5db316f4e8b4c6733f030265dc | [
"MIT"
] | null | null | null | demos/demo3-foodthrowing/src/bullet.cpp | uhteoman/gba-sprite-engine | bd67ef025e653c5db316f4e8b4c6733f030265dc | [
"MIT"
] | null | null | null | //
// Created by Wouter Groeneveld on 09/08/18.
//
#include <libgba-sprite-engine/background/text_stream.h>
#include <libgba-sprite-engine/gba/tonc_bios.h>
#include <cmath>
#include <libgba-sprite-engine/gbavector.h>
#include "bullet.h"
void Bullet::setDestination(VECTOR destination) {
auto currentPos = sprite->getPosAsVector();
this->dest = destination;
this->coords = currentPos.bresenhamLineTo(destination);
}
void Bullet::tick() {
if(coords.empty()) {
return;
}
sprite->moveTo(coords.front());
coords.pop_front();
}
| 19.517241 | 59 | 0.689046 | [
"vector"
] |
0e4d7eef2efb4af24c9578b6778242bc4860651a | 8,395 | cpp | C++ | snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 2 | 2020-02-22T09:30:21.000Z | 2021-08-02T23:44:31.000Z | snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 555 | 2019-09-23T22:22:58.000Z | 2021-07-15T18:51:12.000Z | snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 3 | 2020-01-29T16:31:15.000Z | 2021-08-24T07:00:15.000Z | using namespace System;
using namespace System::Globalization;
//<snippet1>
/// <summary>
/// Temperature class stores the value as UInt64
/// and delegates most of the functionality
/// to the UInt64 implementation.
/// </summary>
public ref class Temperature: public IComparable, public IFormattable
{
public:
/// <summary>
/// IComparable.CompareTo implementation.
/// </summary>
virtual int CompareTo( Object^ obj )
{
if ( (Temperature^)( obj ) )
{
Temperature^ temp = (Temperature^)( obj );
return m_value.CompareTo( temp->m_value );
}
throw gcnew ArgumentException( "object is not a Temperature" );
}
/// <summary>
/// IFormattable.ToString implementation.
/// </summary>
virtual String^ ToString( String^ format, IFormatProvider^ provider )
{
if ( format != nullptr && format == "F" )
{
return String::Format( "{0}'F", this->Value.ToString() );
}
return m_value.ToString( format, provider );
}
/// <summary>
/// Parses the temperature from a string in form
/// [ws][sign]digits['F|'C][ws]
/// </summary>
static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
{
Temperature^ temp = gcnew Temperature;
if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
{
temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
}
else
{
temp->Value = UInt64::Parse( s, styles, provider );
}
return temp;
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
//</snippet1>
namespace Snippets2
{
//<snippet2>
public ref class Temperature
{
public:
static property Int64 MinValue
{
Int64 get()
{
return UInt64::MinValue;
}
}
static property UInt64 MaxValue
{
UInt64 get()
{
return UInt64::MaxValue;
}
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet2>
namespace Snippets3
{
//<snippet3>
public ref class Temperature: public IComparable
{
public:
/// <summary>
/// IComparable.CompareTo implementation.
/// </summary>
virtual int CompareTo( Object^ obj )
{
if ( (Temperature^)( obj ) )
{
Temperature^ temp = (Temperature^)( obj );
return m_value.CompareTo( temp->m_value );
}
throw gcnew ArgumentException( "object is not a Temperature" );
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet3>
namespace Snippets4
{
//<snippet4>
public ref class Temperature: public IFormattable
{
public:
/// <summary>
/// IFormattable.ToString implementation.
/// </summary>
virtual String^ ToString( String^ format, IFormatProvider^ provider )
{
if ( format != nullptr && format == "F" )
{
return String::Format( "{0}'F", this->Value.ToString() );
}
return m_value.ToString( format, provider );
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet4>
namespace Snippets5
{
//<snippet5>
public ref class Temperature
{
public:
/// <summary>
/// Parses the temperature from a string in form
/// [ws][sign]digits['F|'C][ws]
/// </summary>
static Temperature^ Parse( String^ s )
{
Temperature^ temp = gcnew Temperature;
if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
{
temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) );
}
else
{
temp->Value = UInt64::Parse( s );
}
return temp;
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet5>
namespace Snippets6
{
//<snippet6>
public ref class Temperature
{
public:
/// <summary>
/// Parses the temperature from a string in form
/// [ws][sign]digits['F|'C][ws]
/// </summary>
static Temperature^ Parse( String^ s, IFormatProvider^ provider )
{
Temperature^ temp = gcnew Temperature;
if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
{
temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider );
}
else
{
temp->Value = UInt64::Parse( s, provider );
}
return temp;
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet6>
namespace Snippets7
{
//<snippet7>
public ref class Temperature
{
public:
/// <summary>
/// Parses the temperature from a string in form
/// [ws][sign]digits['F|'C][ws]
/// </summary>
static Temperature^ Parse( String^ s, NumberStyles styles )
{
Temperature^ temp = gcnew Temperature;
if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
{
temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles );
}
else
{
temp->Value = UInt64::Parse( s, styles );
}
return temp;
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet7>
namespace Snippets8
{
//<snippet8>
public ref class Temperature
{
public:
/// <summary>
/// Parses the temperature from a string in form
/// [ws][sign]digits['F|'C][ws]
/// </summary>
static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider )
{
Temperature^ temp = gcnew Temperature;
if ( s->TrimEnd( 0 )->EndsWith( "'F" ) )
{
temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider );
}
else
{
temp->Value = UInt64::Parse( s, styles, provider );
}
return temp;
}
protected:
// The value holder
UInt64 m_value;
public:
property UInt64 Value
{
UInt64 get()
{
return m_value;
}
void set( UInt64 value )
{
m_value = value;
}
}
};
}
//</snippet8>
int main()
{
Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr );
Console::WriteLine( t1->ToString( "F", nullptr ) );
String^ str1 = t1->ToString( "G", nullptr );
Console::WriteLine( str1 );
Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr );
Console::WriteLine( t2->ToString( "F", nullptr ) );
Console::WriteLine( t1->CompareTo( t2 ) );
Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr );
Console::WriteLine( t3->ToString( "F", nullptr ) );
Console::WriteLine( t1->CompareTo( t3 ) );
Console::ReadLine();
}
| 20.67734 | 100 | 0.509589 | [
"object"
] |
0e4fdbd8f1ea39b32508ffcc9302d349f23477c0 | 6,783 | hpp | C++ | inc/maiken/dist/message.hpp | PhilipDeegan/maiken | 3171cf566759ed36cacb94f137a9bfa0932fc59f | [
"BSD-3-Clause"
] | 2 | 2021-02-27T08:25:45.000Z | 2021-09-19T12:40:36.000Z | inc/maiken/dist/message.hpp | PhilipDeegan/maiken | 3171cf566759ed36cacb94f137a9bfa0932fc59f | [
"BSD-3-Clause"
] | 5 | 2021-01-25T16:30:05.000Z | 2021-11-19T08:08:14.000Z | inc/maiken/dist/message.hpp | PhilipDeegan/maiken | 3171cf566759ed36cacb94f137a9bfa0932fc59f | [
"BSD-3-Clause"
] | null | null | null | /**
Copyright (c) 2017, Philip Deegan.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Philip Deegan nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MAIKEN_DIST_MESSAGE_HPP_
#define _MAIKEN_DIST_MESSAGE_HPP_
namespace maiken {
namespace dist {
class Post;
class Server;
class ServerSession;
using Sessions = std::unordered_map<std::string, ServerSession>;
class AMessage : public Constants {
friend class ::cereal::access;
public:
virtual ~AMessage() {}
std::string clazz_name() const { return std::string(typeid(*this).name()); }
protected:
void build_from(YAML::Node const&& node) {
YAML::Emitter out;
out << node;
str = out.c_str();
}
protected:
std::string str;
private:
template <class Archive>
void serialize(Archive& ar) {
ar(str);
}
};
class ARequest : public AMessage {
friend class ::cereal::access;
public:
ARequest() {}
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("AMessage", ::cereal::base_class<AMessage>(this)));
}
virtual void do_response_for(const kul::http::A1_1Request& req, Sessions& sessions,
kul::http::_1_1Response& resp) = 0;
};
class SetupRequest : public ARequest {
friend class ::cereal::access;
friend class RemoteCommandManager;
friend class Server;
public:
SetupRequest() {}
SetupRequest(std::string const& project, std::string const& settings, kul::cli::Args const& args)
: m_project_yaml(project), m_settings_yaml(settings), m_args(args) {}
void do_response_for(const kul::http::A1_1Request& req, Sessions& sessions,
kul::http::_1_1Response& resp) override;
private:
SetupRequest(const SetupRequest&) = delete;
SetupRequest(const SetupRequest&&) = delete;
SetupRequest& operator=(const SetupRequest&) = delete;
SetupRequest& operator=(const SetupRequest&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("ARequest", ::cereal::base_class<ARequest>(this)));
ar(::cereal::make_nvp("m_project_yaml", m_project_yaml));
ar(::cereal::make_nvp("m_settings_yaml", m_settings_yaml));
ar(::cereal::make_nvp("m_args", m_args));
}
private:
std::string m_project_yaml, m_settings_yaml;
kul::cli::Args m_args;
};
class CompileRequest : public ARequest {
friend class ::cereal::access;
friend class RemoteCommandManager;
friend class Server;
public:
CompileRequest() {}
CompileRequest(std::string const& directory,
const std::vector<std::pair<std::string, std::string>>& src_obj)
: m_directory(directory), m_src_obj(src_obj) {}
void do_response_for(const kul::http::A1_1Request& req, Sessions& sessions,
kul::http::_1_1Response& resp) override;
private:
CompileRequest(const CompileRequest&) = delete;
CompileRequest(const CompileRequest&&) = delete;
CompileRequest& operator=(const CompileRequest&) = delete;
CompileRequest& operator=(const CompileRequest&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("ARequest", ::cereal::base_class<ARequest>(this)));
ar(::cereal::make_nvp("m_src_obj", m_src_obj));
ar(::cereal::make_nvp("m_directory", m_directory));
}
private:
std::string m_directory;
std::vector<std::pair<std::string, std::string>> m_src_obj;
};
class DownloadRequest : public ARequest {
friend class ::cereal::access;
friend class RemoteCommandManager;
friend class Server;
public:
DownloadRequest() {}
void do_response_for(const kul::http::A1_1Request& req, Sessions& sessions,
kul::http::_1_1Response& resp) override;
private:
DownloadRequest(const DownloadRequest&) = delete;
DownloadRequest(const DownloadRequest&&) = delete;
DownloadRequest& operator=(const DownloadRequest&) = delete;
DownloadRequest& operator=(const DownloadRequest&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("ARequest", ::cereal::base_class<ARequest>(this)));
}
};
class LinkRequest : public ARequest {
friend class ::cereal::access;
friend class RemoteCommandManager;
friend class Server;
public:
LinkRequest() {}
LinkRequest(std::string const& b) { str = b; }
void do_response_for(const kul::http::A1_1Request& req, Sessions& sessions,
kul::http::_1_1Response& resp) override;
private:
LinkRequest(const LinkRequest&) = delete;
LinkRequest(const LinkRequest&&) = delete;
LinkRequest& operator=(const LinkRequest&) = delete;
LinkRequest& operator=(const LinkRequest&&) = delete;
template <class Archive>
void serialize(Archive& ar) {
ar(::cereal::make_nvp("ARequest", ::cereal::base_class<ARequest>(this)));
}
};
class Blob {
public:
bool last_packet = 0;
size_t len = 0, files_left = 1;
uint8_t* c1 = new uint8_t[BUFF_SIZE];
std::string file;
Blob() {}
~Blob() { delete[] c1; }
template <class Archive>
void serialize(Archive& ar) {
ar(last_packet);
ar(cereal::make_size_tag(files_left));
ar(cereal::make_size_tag(len));
ar(cereal::binary_data(c1, sizeof(uint8_t) * len));
ar(file);
}
private:
Blob(const Blob&) = delete;
Blob(const Blob&&) = delete;
Blob& operator=(const Blob&) = delete;
Blob& operator=(const Blob&&) = delete;
};
} // end namespace dist
} // end namespace maiken
#endif // _MAIKEN_DIST_MESSAGE_HPP_
| 31.402778 | 99 | 0.713991 | [
"vector"
] |
0e50486c402daca7432d950d77d36a26e19e9a51 | 6,857 | cpp | C++ | fuzzers/src/peer_conn.cpp | projectxorg/libtorrent | 449b39318796addaafc6e655c9affc88706b8aa7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14 | 2022-01-30T09:53:39.000Z | 2022-03-30T15:38:31.000Z | fuzzers/src/peer_conn.cpp | projectxorg/libtorrent | 449b39318796addaafc6e655c9affc88706b8aa7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2020-11-10T09:10:32.000Z | 2020-11-10T09:10:33.000Z | fuzzers/src/peer_conn.cpp | projectxorg/libtorrent | 449b39318796addaafc6e655c9affc88706b8aa7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5 | 2018-12-29T14:46:14.000Z | 2021-07-22T15:30:23.000Z | /*
Copyright (c) 2019, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <memory>
#include <iostream>
#include "libtorrent/session.hpp"
#include "libtorrent/settings_pack.hpp"
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/random.hpp"
#if LIBTORRENT_VERSION_NUM >= 10300
#include "libtorrent/io_context.hpp"
#else
#include "libtorrent/io_service.hpp"
#endif
using namespace lt;
std::unique_ptr<session> g_ses;
sha1_hash g_info_hash;
int g_listen_port = 0;
#if LIBTORRENT_VERSION_NUM >= 10300
io_context g_ios;
#else
io_service g_ios;
#endif
//#define DEBUG_LOGGING 1
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
{
// set up a session
settings_pack pack;
pack.set_int(settings_pack::piece_timeout, 1);
pack.set_int(settings_pack::request_timeout, 1);
pack.set_int(settings_pack::peer_timeout, 1);
pack.set_int(settings_pack::peer_connect_timeout, 1);
pack.set_int(settings_pack::inactivity_timeout, 1);
pack.set_int(settings_pack::handshake_timeout, 1);
#ifdef DEBUG_LOGGING
pack.set_int(settings_pack::alert_mask, 0xffffff);
#else
pack.set_int(settings_pack::alert_mask, alert_category::connect
| alert_category::error
| alert_category::status
| alert_category::peer);
#endif
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
// don't waste time making outbound connections
pack.set_bool(settings_pack::enable_outgoing_tcp, false);
pack.set_bool(settings_pack::enable_outgoing_utp, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_ip_notifier, false);
// pick an available listen port and only listen on loopback
pack.set_str(settings_pack::listen_interfaces, "127.0.0.1:0");
g_ses = std::unique_ptr<session>(new lt::session(pack));
// create a torrent
file_storage fs;
int const piece_size = 1024 * 1024;
std::int64_t const total_size = std::int64_t(piece_size) * 100;
fs.add_file("test_file", total_size);
create_torrent t(fs, piece_size);
for (piece_index_t i : fs.piece_range())
t.set_hash(i, sha1_hash("abababababababababab"));
std::vector<char> buf;
bencode(std::back_inserter(buf), t.generate());
auto ti = std::make_shared<torrent_info>(buf, from_span);
// remember the info-hash to give the fuzzer a chance to connect to it
g_info_hash = ti->info_hash();
// add the torrent to the session
add_torrent_params atp;
atp.ti = std::move(ti);
atp.save_path = ".";
g_ses->add_torrent(std::move(atp));
// pull the alerts for the listen socket we ended up using
time_point const end_time = clock_type::now() + seconds(5);
bool started = false;
while (g_listen_port == 0 || !started)
{
std::vector<alert*> alerts;
auto const now = clock_type::now();
if (now > end_time) return -1;
g_ses->wait_for_alert(end_time - now);
g_ses->pop_alerts(&alerts);
for (auto const a : alerts)
{
std::cout << a->message() << '\n';
if (auto la = alert_cast<listen_succeeded_alert>(a))
{
if (la->socket_type == socket_type_t::tcp)
{
g_listen_port = la->port;
std::cout << "listening on " << g_listen_port << '\n';
}
}
if (alert_cast<torrent_resumed_alert>(a))
{
started = true;
}
}
}
// we have to destruct the session before global destructors, such as the
// system error code category. The session objects rely on error_code during
// its destruction
std::atexit([]{ g_ses.reset(); });
return 0;
}
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
if (size < 8) return 0;
#ifdef DEBUG_LOGGING
time_point const start_time = clock_type::now();
#endif
// connect
tcp::socket s(g_ios);
error_code ec;
do {
ec.clear();
error_code ignore;
s.connect(tcp::endpoint(make_address("127.0.0.1", ignore), g_listen_port), ec);
} while (ec == boost::system::errc::interrupted);
// bittorrent handshake
std::vector<char> handshake(1 + 19 + 8 + 20 + 20 + size - 8);
std::memcpy(handshake.data(), "\x13" "BitTorrent protocol", 20);
std::memcpy(handshake.data() + 20, data, 8);
std::memcpy(handshake.data() + 28, g_info_hash.data(), 20);
lt::aux::random_bytes({handshake.data() + 48, 20});
data += 8;
size -= 8;
std::memcpy(handshake.data() + 68, data, size);
// we're likely to fail to write entire (garbage) messages, as libtorrent may
// disconnect us half-way through. This may fail with broken_pipe for
// instance
error_code ignore;
boost::asio::write(s, boost::asio::buffer(handshake), ignore);
s.close();
// wait for the alert saying the connection was closed
time_point const end_time = clock_type::now() + seconds(3);
for (;;)
{
std::vector<alert*> alerts;
auto const now = clock_type::now();
if (now > end_time) return -1;
g_ses->wait_for_alert(end_time - now);
g_ses->pop_alerts(&alerts);
for (auto const a : alerts)
{
#ifdef DEBUG_LOGGING
std::cout << duration_cast<milliseconds>(a->timestamp() - start_time).count()
<< ": " << a->message() << '\n';
#endif
if (alert_cast<peer_error_alert>(a)
|| alert_cast<peer_disconnected_alert>(a))
{
goto done;
}
}
}
done:
return 0;
}
| 30.207048 | 81 | 0.729619 | [
"vector"
] |
0e5b55d210799880bcf9fbbe4f419af8f305f5dd | 25,806 | cc | C++ | src/BlockMaker.cc | AYCH-Inc/aych.bitpool.bcash | 34a09fc2fd17c8965894875263aa7ee1c0623db6 | [
"MIT"
] | 21 | 2017-09-22T00:37:27.000Z | 2021-12-07T05:48:30.000Z | src/BlockMaker.cc | AYCH-Inc/aych.bitpool.bcash | 34a09fc2fd17c8965894875263aa7ee1c0623db6 | [
"MIT"
] | 2 | 2017-11-09T02:15:34.000Z | 2017-11-11T06:04:14.000Z | src/BlockMaker.cc | AYCH-Inc/aych.bitpool.bcash | 34a09fc2fd17c8965894875263aa7ee1c0623db6 | [
"MIT"
] | 19 | 2017-09-16T14:17:29.000Z | 2022-02-20T21:14:43.000Z | /*
The MIT License (MIT)
Copyright (c) [2016] [BTC.COM]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "BlockMaker.h"
#include <boost/thread.hpp>
#include "bitcoin/consensus/merkle.h"
#include "bitcoin/core_io.h"
#include "bitcoin/added_functions.h"
#include "utilities_js.hpp"
////////////////////////////////// BlockMaker //////////////////////////////////
BlockMaker::BlockMaker(const char *kafkaBrokers, const MysqlConnectInfo &poolDB):
running_(true),
kMaxRawGbtNum_(100), /* if 5 seconds a rawgbt, will hold 100*5/60 = 8 mins rawgbt */
kMaxStratumJobNum_(120), /* if 30 seconds a stratum job, will hold 60 mins stratum job */
kafkaConsumerRawGbt_ (kafkaBrokers, KAFKA_TOPIC_RAWGBT, 0/* patition */),
kafkaConsumerStratumJob_ (kafkaBrokers, KAFKA_TOPIC_STRATUM_JOB, 0/* patition */),
kafkaConsumerSovledShare_(kafkaBrokers, KAFKA_TOPIC_SOLVED_SHARE, 0/* patition */),
kafkaConsumerNamecoinSovledShare_(kafkaBrokers, KAFKA_TOPIC_NMC_SOLVED_SHARE, 0/* patition */),
poolDB_(poolDB)
{
}
BlockMaker::~BlockMaker() {
if (threadConsumeRawGbt_.joinable())
threadConsumeRawGbt_.join();
if (threadConsumeStratumJob_.joinable())
threadConsumeStratumJob_.join();
if (threadConsumeNamecoinSovledShare_.joinable())
threadConsumeNamecoinSovledShare_.join();
}
void BlockMaker::stop() {
if (!running_)
return;
running_ = false;
LOG(INFO) << "stop block maker";
}
void BlockMaker::addBitcoind(const string &rpcAddress, const string &rpcUserpass) {
bitcoindRpcUri_.push_back(make_pair(rpcAddress, rpcUserpass));
}
bool BlockMaker::init() {
if (!checkBitcoinds())
return false;
//
// Raw Gbt
//
// we need to consume the latest N messages
if (kafkaConsumerRawGbt_.setup(RD_KAFKA_OFFSET_TAIL(kMaxRawGbtNum_)) == false) {
LOG(INFO) << "setup kafkaConsumerRawGbt_ fail";
return false;
}
if (!kafkaConsumerRawGbt_.checkAlive()) {
LOG(ERROR) << "kafka brokers is not alive: kafkaConsumerRawGbt_";
return false;
}
//
// Stratum Job
//
// we need to consume the latest 2 messages, just in case
if (kafkaConsumerStratumJob_.setup(RD_KAFKA_OFFSET_TAIL(kMaxStratumJobNum_)) == false) {
LOG(INFO) << "setup kafkaConsumerStratumJob_ fail";
return false;
}
if (!kafkaConsumerStratumJob_.checkAlive()) {
LOG(ERROR) << "kafka brokers is not alive: kafkaConsumerStratumJob_";
return false;
}
//
// Sloved Share
//
// we need to consume the latest 2 messages, just in case
if (kafkaConsumerSovledShare_.setup(RD_KAFKA_OFFSET_TAIL(2)) == false) {
LOG(INFO) << "setup kafkaConsumerSovledShare_ fail";
return false;
}
if (!kafkaConsumerSovledShare_.checkAlive()) {
LOG(ERROR) << "kafka brokers is not alive: kafkaConsumerSovledShare_";
return false;
}
//
// Namecoin Sloved Share
//
// we need to consume the latest 2 messages, just in case
if (kafkaConsumerNamecoinSovledShare_.setup(RD_KAFKA_OFFSET_TAIL(2)) == false) {
LOG(INFO) << "setup kafkaConsumerNamecoinSovledShare_ fail";
return false;
}
if (!kafkaConsumerNamecoinSovledShare_.checkAlive()) {
LOG(ERROR) << "kafka brokers is not alive: kafkaConsumerNamecoinSovledShare_";
return false;
}
return true;
}
void BlockMaker::consumeRawGbt(rd_kafka_message_t *rkmessage) {
// check error
if (rkmessage->err) {
if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
// Reached the end of the topic+partition queue on the broker.
// Not really an error.
// LOG(INFO) << "consumer reached end of " << rd_kafka_topic_name(rkmessage->rkt)
// << "[" << rkmessage->partition << "] "
// << " message queue at offset " << rkmessage->offset;
// acturlly
return;
}
LOG(ERROR) << "consume error for topic " << rd_kafka_topic_name(rkmessage->rkt)
<< "[" << rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);
if (rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ||
rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC) {
LOG(FATAL) << "consume fatal";
stop();
}
return;
}
LOG(INFO) << "received rawgbt message, len: " << rkmessage->len;
addRawgbt((const char *)rkmessage->payload, rkmessage->len);
}
void BlockMaker::addRawgbt(const char *str, size_t len) {
JsonNode r;
if (!JsonNode::parse(str, str + len, r)) {
LOG(ERROR) << "parse rawgbt message to json fail";
return;
}
if (r["created_at_ts"].type() != Utilities::JS::type::Int ||
r["block_template_base64"].type() != Utilities::JS::type::Str ||
r["gbthash"].type() != Utilities::JS::type::Str) {
LOG(ERROR) << "invalid rawgbt: missing fields";
return;
}
const uint256 gbtHash = uint256S(r["gbthash"].str());
if (rawGbtMap_.find(gbtHash) != rawGbtMap_.end()) {
LOG(ERROR) << "already exist raw gbt, ingore: " << gbtHash.ToString();
return;
}
const string gbt = DecodeBase64(r["block_template_base64"].str());
assert(gbt.length() > 64); // valid gbt string's len at least 64 bytes
JsonNode nodeGbt;
if (!JsonNode::parse(gbt.c_str(), gbt.c_str() + gbt.length(), nodeGbt)) {
LOG(ERROR) << "parse gbt message to json fail";
return;
}
JsonNode jgbt = nodeGbt["result"];
// transaction without coinbase_tx
shared_ptr<vector<CTransactionRef>> vtxs = std::make_shared<vector<CTransactionRef>>();
for (JsonNode & node : jgbt["transactions"].array()) {
CMutableTransaction tx;
DecodeHexTx(tx, node["data"].str());
vtxs->push_back(MakeTransactionRef(std::move(tx)));
}
LOG(INFO) << "insert rawgbt: " << gbtHash.ToString() << ", txs: " << vtxs->size();
insertRawGbt(gbtHash, vtxs);
}
void BlockMaker::insertRawGbt(const uint256 &gbtHash,
shared_ptr<vector<CTransactionRef>> vtxs) {
ScopeLock ls(rawGbtLock_);
// insert rawgbt
rawGbtMap_[gbtHash] = vtxs;
rawGbtQ_.push_back(gbtHash);
// remove rawgbt if need
while (rawGbtQ_.size() > kMaxRawGbtNum_) {
const uint256 h = *rawGbtQ_.begin();
rawGbtMap_.erase(h); // delete from map
rawGbtQ_.pop_front(); // delete from Q
}
}
static
string _buildAuxPow(const CBlock *block) {
//
// see: https://en.bitcoin.it/wiki/Merged_mining_specification
//
string auxPow;
//
// build auxpow
//
// 1. coinbase hex
{
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << block->vtx[0];
auxPow += HexStr(ssTx.begin(), ssTx.end());
}
// 2. block_hash
auxPow += block->GetHash().GetHex();
// 3. coinbase_branch, Merkle branch
{
vector<uint256> merkleBranch = BlockMerkleBranch(*block, 0/* position */);
// Number of links in branch
// should be Variable integer, but can't over than 0xfd, so we just print
// out 2 hex char
// https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer
auxPow += Strings::Format("%02x", merkleBranch.size());
// merkle branch
for (auto &itr : merkleBranch) {
// dump 32 bytes from memory
string hex;
Bin2Hex(itr.begin(), 32, hex);
auxPow += hex;
}
// branch_side_mask is always going to be all zeroes, because the branch
// hashes will always be "on the right" of the working hash
auxPow += "00000000";
}
// 4. Aux Blockchain Link
{
auxPow += "00"; // Number of links in branch
auxPow += "00000000"; // Branch sides bitmask
}
// 5. Parent Block Header
{
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
ssBlock << block->GetBlockHeader();
auxPow += HexStr(ssBlock.begin(), ssBlock.end());
}
return auxPow;
}
void BlockMaker::consumeNamecoinSovledShare(rd_kafka_message_t *rkmessage) {
// check error
if (rkmessage->err) {
if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
// Reached the end of the topic+partition queue on the broker.
// Not really an error.
// LOG(INFO) << "consumer reached end of " << rd_kafka_topic_name(rkmessage->rkt)
// << "[" << rkmessage->partition << "] "
// << " message queue at offset " << rkmessage->offset;
// acturlly
return;
}
LOG(ERROR) << "consume error for topic " << rd_kafka_topic_name(rkmessage->rkt)
<< "[" << rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);
if (rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ||
rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC) {
LOG(FATAL) << "consume fatal";
stop();
}
return;
}
LOG(INFO) << "received Namecoin SolvedShare message, len: " << rkmessage->len;
//
// namecoin solved share message
//
JsonNode j;
if (JsonNode::parse((const char *)rkmessage->payload,
(const char *)rkmessage->payload + rkmessage->len, j) == false) {
LOG(ERROR) << "decode namecoin solved share message fail: "
<< string((const char *)rkmessage->payload, rkmessage->len);
return;
}
// check fields
if (j["job_id"].type() != Utilities::JS::type::Int ||
j["aux_block_hash"].type() != Utilities::JS::type::Str ||
j["block_header"].type() != Utilities::JS::type::Str ||
j["coinbase_tx"].type() != Utilities::JS::type::Str ||
j["rpc_addr"].type() != Utilities::JS::type::Str ||
j["rpc_userpass"].type() != Utilities::JS::type::Str) {
LOG(ERROR) << "namecoin solved share message missing some fields";
return;
}
const uint64_t jobId = j["job_id"].uint64();
const string auxBlockHash = j["aux_block_hash"].str();
const string blockHeaderHex = j["block_header"].str();
const string coinbaseTxHex = j["coinbase_tx"].str();
const string rpcAddr = j["rpc_addr"].str();
const string rpcUserpass = j["rpc_userpass"].str();
assert(blockHeaderHex.size() == sizeof(CBlockHeader)*2);
CBlockHeader blkHeader;
vector<char> coinbaseTxBin;
// block header, hex -> bin
{
vector<char> binOut;
Hex2Bin(blockHeaderHex.c_str(), blockHeaderHex.length(), binOut);
assert(binOut.size() == sizeof(CBlockHeader));
memcpy((uint8_t *)&blkHeader, binOut.data(), binOut.size());
}
// coinbase tx, hex -> bin
Hex2Bin(coinbaseTxHex.c_str(), coinbaseTxHex.length(), coinbaseTxBin);
// get gbtHash and rawgbt (vtxs)
uint256 gbtHash;
shared_ptr<vector<CTransactionRef>> vtxs;
{
ScopeLock sl(jobIdMapLock_);
if (jobId2GbtHash_.find(jobId) != jobId2GbtHash_.end()) {
gbtHash = jobId2GbtHash_[jobId];
}
}
{
ScopeLock ls(rawGbtLock_);
if (rawGbtMap_.find(gbtHash) == rawGbtMap_.end()) {
LOG(ERROR) << "can't find this gbthash in rawGbtMap_: " << gbtHash.ToString();
return;
}
vtxs = rawGbtMap_[gbtHash];
}
assert(vtxs.get() != nullptr);
//
// build new block
//
CBlock newblk(blkHeader);
// put coinbase tx
{
CSerializeData sdata;
sdata.insert(sdata.end(), coinbaseTxBin.begin(), coinbaseTxBin.end());
newblk.vtx.push_back(MakeTransactionRef());
CDataStream c(sdata, SER_NETWORK, PROTOCOL_VERSION);
c >> newblk.vtx[newblk.vtx.size() - 1];
}
// put other txs
if (vtxs->size()) {
newblk.vtx.insert(newblk.vtx.end(), vtxs->begin(), vtxs->end());
}
//
// build aux POW
//
const string auxPow = _buildAuxPow(&newblk);
// submit to namecoind
submitNamecoinBlockNonBlocking(auxBlockHash, auxPow,
newblk.GetHash().ToString(),
rpcAddr, rpcUserpass);
}
void BlockMaker::submitNamecoinBlockNonBlocking(const string &auxBlockHash,
const string &auxPow,
const string &bitcoinBlockHash,
const string &rpcAddress,
const string &rpcUserpass) {
// use thread to submit
boost::thread t(boost::bind(&BlockMaker::_submitNamecoinBlockThread, this,
auxBlockHash, auxPow, bitcoinBlockHash,
rpcAddress, rpcUserpass));
}
void BlockMaker::_submitNamecoinBlockThread(const string &auxBlockHash,
const string &auxPow,
const string &bitcoinBlockHash,
const string &rpcAddress,
const string &rpcUserpass) {
//
// request : submitauxblock <hash> <auxpow>
//
{
const string request = Strings::Format("{\"id\":1,\"method\":\"submitauxblock\",\"params\":[\"%s\",\"%s\"]}",
auxBlockHash.c_str(),
auxPow.c_str());
DLOG(INFO) << "submitauxblock request: " << request;
// try N times
for (size_t i = 0; i < 3; i++) {
string response;
bool res = bitcoindRpcCall(rpcAddress.c_str(), rpcUserpass.c_str(),
request.c_str(), response);
// success
if (res == true) {
LOG(INFO) << "rpc call success, submit block response: " << response;
break;
}
// failure
LOG(ERROR) << "rpc call fail: " << response;
}
}
//
// save to databse
//
{
const string nowStr = date("%F %T");
string sql;
sql = Strings::Format("INSERT INTO `found_nmc_blocks` "
" (`bitcoin_block_hash`,`aux_block_hash`,"
" `aux_pow`,`created_at`) "
" VALUES (\"%s\",\"%s\",\"%s\",\"%s\"); ",
bitcoinBlockHash.c_str(),
auxBlockHash.c_str(), auxPow.c_str(), nowStr.c_str());
// try connect to DB
MySQLConnection db(poolDB_);
for (size_t i = 0; i < 3; i++) {
if (db.ping())
break;
else
sleep(3);
}
if (db.execute(sql) == false) {
LOG(ERROR) << "insert found block failure: " << sql;
}
}
}
void BlockMaker::consumeSovledShare(rd_kafka_message_t *rkmessage) {
// check error
if (rkmessage->err) {
if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
// Reached the end of the topic+partition queue on the broker.
// Not really an error.
// LOG(INFO) << "consumer reached end of " << rd_kafka_topic_name(rkmessage->rkt)
// << "[" << rkmessage->partition << "] "
// << " message queue at offset " << rkmessage->offset;
// acturlly
return;
}
LOG(ERROR) << "consume error for topic " << rd_kafka_topic_name(rkmessage->rkt)
<< "[" << rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);
if (rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ||
rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC) {
LOG(FATAL) << "consume fatal";
stop();
}
return;
}
LOG(INFO) << "received SolvedShare message, len: " << rkmessage->len;
//
// solved share message: FoundBlock + coinbase_Tx
//
FoundBlock foundBlock;
CBlockHeader blkHeader;
vector<char> coinbaseTxBin;
{
if (rkmessage->len <= sizeof(FoundBlock)) {
LOG(ERROR) << "invalid SolvedShare length: " << rkmessage->len;
return;
}
coinbaseTxBin.resize(rkmessage->len - sizeof(FoundBlock));
// foundBlock
memcpy((uint8_t *)&foundBlock, (const uint8_t *)rkmessage->payload, sizeof(FoundBlock));
// coinbase tx
memcpy((uint8_t *)coinbaseTxBin.data(),
(const uint8_t *)rkmessage->payload + sizeof(FoundBlock),
coinbaseTxBin.size());
// copy header
memcpy((uint8_t *)&blkHeader, foundBlock.header80_, sizeof(CBlockHeader));
}
// get gbtHash and rawgbt (vtxs)
uint256 gbtHash;
shared_ptr<vector<CTransactionRef>> vtxs;
{
ScopeLock sl(jobIdMapLock_);
if (jobId2GbtHash_.find(foundBlock.jobId_) != jobId2GbtHash_.end()) {
gbtHash = jobId2GbtHash_[foundBlock.jobId_];
}
}
{
ScopeLock ls(rawGbtLock_);
if (rawGbtMap_.find(gbtHash) == rawGbtMap_.end()) {
LOG(ERROR) << "can't find this gbthash in rawGbtMap_: " << gbtHash.ToString();
return;
}
vtxs = rawGbtMap_[gbtHash];
}
assert(vtxs.get() != nullptr);
//
// build new block
//
CBlock newblk(blkHeader);
// put coinbase tx
{
CSerializeData sdata;
sdata.insert(sdata.end(), coinbaseTxBin.begin(), coinbaseTxBin.end());
newblk.vtx.push_back(MakeTransactionRef());
CDataStream c(sdata, SER_NETWORK, PROTOCOL_VERSION);
c >> newblk.vtx[newblk.vtx.size() - 1];
}
// put other txs
if (vtxs->size()) {
newblk.vtx.insert(newblk.vtx.end(), vtxs->begin(), vtxs->end());
}
// submit to bitcoind
LOG(INFO) << "submit block: " << newblk.GetHash().ToString();
const string blockHex = EncodeHexBlock(newblk);
submitBlockNonBlocking(blockHex); // using thread
// save to DB, using thread
saveBlockToDBNonBlocking(foundBlock, blkHeader,
newblk.vtx[0]->GetValueOut(), // coinbase value
blockHex.length()/2);
}
void BlockMaker::saveBlockToDBNonBlocking(const FoundBlock &foundBlock,
const CBlockHeader &header,
const uint64_t coinbaseValue,
const int32_t blksize) {
boost::thread t(boost::bind(&BlockMaker::_saveBlockToDBThread, this,
foundBlock, header, coinbaseValue, blksize));
}
void BlockMaker::_saveBlockToDBThread(const FoundBlock &foundBlock,
const CBlockHeader &header,
const uint64_t coinbaseValue,
const int32_t blksize) {
const string nowStr = date("%F %T");
string sql;
sql = Strings::Format("INSERT INTO `found_blocks` "
" (`puid`, `worker_id`, `worker_full_name`, `job_id`"
" ,`height`, `hash`, `rewards`, `size`, `prev_hash`"
" ,`bits`, `version`, `created_at`)"
" VALUES (%d,%" PRId64",\"%s\", %" PRIu64",%d,\"%s\""
" ,%" PRId64",%d,\"%s\",%u,%d,\"%s\"); ",
foundBlock.userId_, foundBlock.workerId_,
// filter again, just in case
filterWorkerName(foundBlock.workerFullName_).c_str(),
foundBlock.jobId_, foundBlock.height_,
header.GetHash().ToString().c_str(),
coinbaseValue, blksize,
header.hashPrevBlock.ToString().c_str(),
header.nBits, header.nVersion, nowStr.c_str());
// try connect to DB
MySQLConnection db(poolDB_);
for (size_t i = 0; i < 3; i++) {
if (db.ping())
break;
else
sleep(3);
}
if (db.execute(sql) == false) {
LOG(ERROR) << "insert found block failure: " << sql;
}
}
bool BlockMaker::checkBitcoinds() {
const string request = "{\"jsonrpc\":\"1.0\",\"id\":\"1\",\"method\":\"getinfo\",\"params\":[]}";
if (bitcoindRpcUri_.size() == 0)
return false;
for (const auto &itr : bitcoindRpcUri_) {
string response;
bool res = bitcoindRpcCall(itr.first.c_str(), itr.second.c_str(),
request.c_str(), response);
if (res == false) {
return false;
}
LOG(INFO) << "response: " << response;
JsonNode r;
if (!JsonNode::parse(response.c_str(), response.c_str() + response.length(), r)) {
LOG(ERROR) << "json parse failure: " << response;
return false;
}
JsonNode result = r["result"];
if (result.type() == Utilities::JS::type::Null ||
result["connections"].int32() == 0) {
LOG(ERROR) << "bitcoind is NOT works fine, getinfo: " << response;
return false;
}
}
return true;
}
void BlockMaker::submitBlockNonBlocking(const string &blockHex) {
for (const auto &itr : bitcoindRpcUri_) {
// use thread to submit
boost::thread t(boost::bind(&BlockMaker::_submitBlockThread, this,
itr.first, itr.second, blockHex));
}
}
void BlockMaker::_submitBlockThread(const string &rpcAddress,
const string &rpcUserpass,
const string &blockHex) {
string request = "{\"jsonrpc\":\"1.0\",\"id\":\"1\",\"method\":\"submitblock\",\"params\":[\"";
request += blockHex + "\"]}";
LOG(INFO) << "submit block to: " << rpcAddress;
// try N times
for (size_t i = 0; i < 3; i++) {
string response;
bool res = bitcoindRpcCall(rpcAddress.c_str(), rpcUserpass.c_str(),
request.c_str(), response);
// success
if (res == true) {
LOG(INFO) << "rpc call success, submit block response: " << response;
break;
}
// failure
LOG(ERROR) << "rpc call fail: " << response;
}
}
void BlockMaker::consumeStratumJob(rd_kafka_message_t *rkmessage) {
// check error
if (rkmessage->err) {
if (rkmessage->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
// Reached the end of the topic+partition queue on the broker.
// Not really an error.
// LOG(INFO) << "consumer reached end of " << rd_kafka_topic_name(rkmessage->rkt)
// << "[" << rkmessage->partition << "] "
// << " message queue at offset " << rkmessage->offset;
// acturlly
return;
}
LOG(ERROR) << "consume error for topic " << rd_kafka_topic_name(rkmessage->rkt)
<< "[" << rkmessage->partition << "] offset " << rkmessage->offset
<< ": " << rd_kafka_message_errstr(rkmessage);
if (rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION ||
rkmessage->err == RD_KAFKA_RESP_ERR__UNKNOWN_TOPIC) {
LOG(FATAL) << "consume fatal";
stop();
}
return;
}
LOG(INFO) << "received StratumJob message, len: " << rkmessage->len;
StratumJob *sjob = new StratumJob();
bool res = sjob->unserializeFromJson((const char *)rkmessage->payload,
rkmessage->len);
if (res == false) {
LOG(ERROR) << "unserialize stratum job fail";
delete sjob;
return;
}
const uint256 gbtHash = uint256S(sjob->gbtHash_);
{
ScopeLock sl(jobIdMapLock_);
jobId2GbtHash_[sjob->jobId_] = gbtHash;
// Maps (and sets) are sorted, so the first element is the smallest,
// and the last element is the largest.
while (jobId2GbtHash_.size() > kMaxStratumJobNum_) {
jobId2GbtHash_.erase(jobId2GbtHash_.begin());
}
}
LOG(INFO) << "StratumJob, jobId: " << sjob->jobId_ << ", gbtHash: " << gbtHash.ToString();
delete sjob;
}
void BlockMaker::runThreadConsumeRawGbt() {
const int32_t timeoutMs = 1000;
while (running_) {
rd_kafka_message_t *rkmessage;
rkmessage = kafkaConsumerRawGbt_.consumer(timeoutMs);
if (rkmessage == nullptr) /* timeout */
continue;
consumeRawGbt(rkmessage);
/* Return message to rdkafka */
rd_kafka_message_destroy(rkmessage);
}
}
void BlockMaker::runThreadConsumeStratumJob() {
const int32_t timeoutMs = 1000;
while (running_) {
rd_kafka_message_t *rkmessage;
rkmessage = kafkaConsumerStratumJob_.consumer(timeoutMs);
if (rkmessage == nullptr) /* timeout */
continue;
consumeStratumJob(rkmessage);
/* Return message to rdkafka */
rd_kafka_message_destroy(rkmessage);
}
}
void BlockMaker::runThreadConsumeSovledShare() {
const int32_t timeoutMs = 1000;
while (running_) {
rd_kafka_message_t *rkmessage;
rkmessage = kafkaConsumerSovledShare_.consumer(timeoutMs);
if (rkmessage == nullptr) /* timeout */
continue;
consumeSovledShare(rkmessage);
/* Return message to rdkafka */
rd_kafka_message_destroy(rkmessage);
}
}
void BlockMaker::runThreadConsumeNamecoinSovledShare() {
const int32_t timeoutMs = 1000;
while (running_) {
rd_kafka_message_t *rkmessage;
rkmessage = kafkaConsumerNamecoinSovledShare_.consumer(timeoutMs);
if (rkmessage == nullptr) /* timeout */
continue;
consumeNamecoinSovledShare(rkmessage);
/* Return message to rdkafka */
rd_kafka_message_destroy(rkmessage);
}
}
void BlockMaker::run() {
// setup threads
threadConsumeRawGbt_ = thread(&BlockMaker::runThreadConsumeRawGbt, this);
threadConsumeStratumJob_ = thread(&BlockMaker::runThreadConsumeStratumJob, this);
threadConsumeNamecoinSovledShare_ = thread(&BlockMaker::runThreadConsumeNamecoinSovledShare, this);
sleep(3);
runThreadConsumeSovledShare();
}
| 32.460377 | 113 | 0.615438 | [
"vector"
] |
0e627e7c13cfb321933f33073e42c6741e1482b6 | 6,276 | cpp | C++ | src/service/tcp/notifier.cpp | sptrakesh/config-db | 583ef3a3b636b2d56283194ff2b183bac2a36f21 | [
"Apache-2.0"
] | null | null | null | src/service/tcp/notifier.cpp | sptrakesh/config-db | 583ef3a3b636b2d56283194ff2b183bac2a36f21 | [
"Apache-2.0"
] | null | null | null | src/service/tcp/notifier.cpp | sptrakesh/config-db | 583ef3a3b636b2d56283194ff2b183bac2a36f21 | [
"Apache-2.0"
] | null | null | null | //
// Created by Rakesh on 25/01/2022.
//
#include "server.h"
#include "signal/signal.h"
#include "../common/contextholder.h"
#include "../common/model/configuration.h"
#include "../common/util/concurrentqueue.h"
#include "../log/NanoLog.h"
#include <functional>
#include <sstream>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/redirect_error.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/ip/tcp.hpp>
using SecureSocket = boost::asio::ssl::stream<boost::asio::ip::tcp::socket>;
namespace spt::configdb::tcp::pnotifier
{
struct Listener
{
Listener()
{
std::ostringstream ss;
ss << "Connecting listener " << this;
LOG_DEBUG << ss.str();
signal::SignalMgr::instance().connect<&Listener::notify>( *this );
}
~Listener()
{
std::ostringstream ss;
ss << "Disconnecting listener " << this;
LOG_DEBUG << ss.str();
signal::SignalMgr::instance().disconnect<&Listener::notify>( *this );
}
void notify( signal::SignalMgr::BytesPtr b )
{
std::ostringstream ss;
ss << "Received notification of size " << b->size() << ' ' << this;
LOG_DEBUG << ss.str();
queue.enqueue( b );
}
moodycamel::ConcurrentQueue<signal::SignalMgr::BytesPtr> queue;
std::string ping{ "ping" };
using Time = std::chrono::time_point<std::chrono::system_clock>;
Time time = std::chrono::system_clock::now();
};
template <typename Socket>
boost::asio::awaitable<void> respond( Socket& socket, Listener& listener )
{
const auto brokenPipe = []( const boost::system::error_code& ec )
{
static const std::string msg{ "Broken pipe" };
return boost::algorithm::starts_with( ec.message(), msg );
};
signal::SignalMgr::BytesPtr bytes;
if ( !listener.queue.try_dequeue( bytes ) )
{
auto now = std::chrono::system_clock::now();
auto diff = std::chrono::duration_cast<std::chrono::seconds>( now - listener.time ).count();
if ( diff > 15 )
{
boost::system::error_code ec;
co_await boost::asio::async_write( socket,
boost::asio::buffer( listener.ping.data(), listener.ping.size() ),
boost::asio::redirect_error( boost::asio::use_awaitable, ec ) );
if ( ec && !brokenPipe( ec ) ) LOG_WARN << "Error writing to socket. " << ec.message();
listener.time = now;
}
co_return;
}
uint32_t size = bytes->size();
std::vector<boost::asio::const_buffer> buffers;
buffers.reserve( 2 );
buffers.emplace_back( &size, sizeof(size) );
buffers.emplace_back( bytes->data(), size );
boost::system::error_code ec;
co_await boost::asio::async_write( socket, buffers,
boost::asio::redirect_error( boost::asio::use_awaitable, ec ) );
if ( ec && !brokenPipe( ec ) ) LOG_WARN << "Error writing to socket. " << ec.message();
else LOG_DEBUG << "Write notification of size " << int(bytes->size()) << " + " << int(sizeof(size)) << " bytes";
}
boost::asio::ssl::context createSSLContext()
{
auto& conf = model::Configuration::instance();
auto ctx = boost::asio::ssl::context( boost::asio::ssl::context::tlsv13_server );
ctx.set_options(
boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::single_dh_use );
ctx.load_verify_file( conf.ssl.caCertificate );
ctx.use_certificate_file( conf.ssl.certificate, boost::asio::ssl::context::pem );
ctx.use_private_key_file( conf.ssl.key, boost::asio::ssl::context::pem );
ctx.set_verify_mode( boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert );
return ctx;
}
boost::asio::awaitable<void> serveWithSSL( boost::asio::ip::tcp::socket s )
{
try
{
auto ctx = createSSLContext();
auto socket = SecureSocket{ std::move( s ), ctx };
boost::system::error_code ec;
co_await socket.async_handshake( boost::asio::ssl::stream_base::server,
boost::asio::redirect_error( boost::asio::use_awaitable, ec ) );
if ( ec )
{
LOG_WARN << "Handshake error. " << ec.message();
socket.next_layer().close( ec );
if ( ec ) LOG_WARN << "Error closing socket. " << ec.message();
co_return;
}
auto listener = Listener{};
for (;;)
{
co_await respond( socket, listener );
}
}
catch ( const std::exception& e )
{
static const auto eof{ "stream truncated" };
if ( !boost::algorithm::starts_with( e.what(), eof ) ) LOG_WARN << "Exception servicing request " << e.what();
}
}
boost::asio::awaitable<void> serve( boost::asio::ip::tcp::socket socket )
{
try
{
auto listener = Listener{};
for (;;)
{
co_await respond( socket, listener );
}
}
catch ( const std::exception& e )
{
static const auto eof{ "End of file" };
if ( !boost::algorithm::starts_with( e.what(), eof ) ) LOG_WARN << "Exception servicing request " << e.what();
}
}
boost::asio::awaitable<void> listener( int port, bool ssl )
{
auto executor = co_await boost::asio::this_coro::executor;
boost::asio::ip::tcp::acceptor acceptor{ executor,
{ boost::asio::ip::tcp::v4(), static_cast<boost::asio::ip::port_type>( port ) } };
for (;;)
{
if ( ContextHolder::instance().ioc.stopped() ) break;
boost::asio::ip::tcp::socket socket = co_await acceptor.async_accept( boost::asio::use_awaitable );
LOG_INFO << "Received socket connection from " << socket.remote_endpoint().address().to_string();
if ( ssl )
{
boost::asio::co_spawn( executor, serveWithSSL( std::move(socket) ), boost::asio::detached );
}
else
{
boost::asio::co_spawn( executor, serve( std::move(socket) ), boost::asio::detached );
}
}
}
}
int spt::configdb::tcp::notifier( int port, bool ssl )
{
boost::asio::co_spawn( ContextHolder::instance().ioc, pnotifier::listener( port, ssl ), boost::asio::detached );
LOG_INFO << "TCP notifier service started on port " << port;
return 0;
}
| 32.858639 | 116 | 0.618388 | [
"vector",
"model"
] |
0e65fff7e12a3f98115b718a413a6bd90ded1e3e | 12,730 | cpp | C++ | euhatrtsplib/src/main/jni/euhatrtsp/livevideo/DecoderHard.cpp | euhat/EuhatRtsp | f5d9919adff27b06e185d4469671e7aababcb941 | [
"Apache-2.0"
] | 11 | 2019-06-15T06:28:51.000Z | 2020-11-11T09:21:18.000Z | euhatrtsplib/src/main/jni/euhatrtsp/livevideo/DecoderHard.cpp | baechirhoon/EuhatRtsp | f5d9919adff27b06e185d4469671e7aababcb941 | [
"Apache-2.0"
] | 2 | 2019-07-17T08:38:01.000Z | 2020-05-07T00:41:52.000Z | euhatrtsplib/src/main/jni/euhatrtsp/livevideo/DecoderHard.cpp | baechirhoon/EuhatRtsp | f5d9919adff27b06e185d4469671e7aababcb941 | [
"Apache-2.0"
] | 8 | 2019-05-28T04:04:50.000Z | 2021-07-30T14:29:58.000Z | #include "DecoderHard.h"
#include <media/NdkMediaCodec.h>
#include "CommonOp.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/system_properties.h>
#include <dlfcn.h>
#include "RtspOp.h"
#include "CommonOp.h"
#define MIN(_a,_b) ((_a) > (_b) ? (_b) : (_a))
static int test() {
char *key = (char *)"ro.build.version.sdk";
//char *key = (char *)"ro.build.version.release";
char value[1024] = {0};
int ret = __system_property_get(key, value);
if (ret <= 0 ) {
DBG(("get prop value failed.\n"));
return 0;
}
DBG(("ro.build.id is [%s]\n", value));
return 0;
}
typedef AMediaCodec *(*AMediaCodec_createCodecByName_t)(const char *name);
typedef AMediaCodec *(*AMediaCodec_createDecoderByType_t)(const char *mime_type);
typedef media_status_t (*AMediaCodec_stop_t)(AMediaCodec *);
typedef media_status_t (*AMediaCodec_delete_t)(AMediaCodec *);
typedef media_status_t (*AMediaCodec_configure_t)(
AMediaCodec *,
const AMediaFormat *format,
ANativeWindow *surface,
AMediaCrypto *crypto,
uint32_t flags);
typedef media_status_t (*AMediaCodec_start_t)(AMediaCodec*);
typedef ssize_t (*AMediaCodec_dequeueInputBuffer_t)(AMediaCodec *, int64_t timeoutUs);
typedef uint8_t *(*AMediaCodec_getInputBuffer_t)(AMediaCodec *, size_t idx, size_t *out_size);
typedef media_status_t (*AMediaCodec_queueInputBuffer_t)(AMediaCodec *,
size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags);
typedef ssize_t (*AMediaCodec_dequeueOutputBuffer_t)(AMediaCodec *, AMediaCodecBufferInfo *info, int64_t timeoutUs);
typedef uint8_t *(*AMediaCodec_getOutputBuffer_t)(AMediaCodec *, size_t idx, size_t *out_size);
typedef media_status_t (*AMediaCodec_releaseOutputBuffer_t)(AMediaCodec *, size_t idx, bool render);
typedef AMediaFormat *(*AMediaCodec_getOutputFormat_t)(AMediaCodec *);
typedef AMediaFormat *(*AMediaFormat_new_t)();
typedef media_status_t (*AMediaFormat_delete_t)(AMediaFormat *);
typedef bool (*AMediaFormat_getInt32_t)(AMediaFormat *, const char *name, int32_t *out);
typedef void (*AMediaFormat_setInt32_t)(AMediaFormat *, const char *name, int32_t value);
typedef void (*AMediaFormat_setString_t)(AMediaFormat *, const char *name, const char *value);
typedef void (*AMediaFormat_setBuffer_t)(AMediaFormat *, const char *name, void *data, size_t size);
#define API_LOOP(_m) \
_m(AMediaCodec_createCodecByName) \
_m(AMediaCodec_createDecoderByType) \
_m(AMediaCodec_stop) \
_m(AMediaCodec_delete) \
_m(AMediaCodec_configure) \
_m(AMediaCodec_start) \
_m(AMediaCodec_dequeueInputBuffer) \
_m(AMediaCodec_getInputBuffer) \
_m(AMediaCodec_queueInputBuffer) \
_m(AMediaCodec_dequeueOutputBuffer) \
_m(AMediaCodec_getOutputBuffer) \
_m(AMediaCodec_releaseOutputBuffer) \
_m(AMediaCodec_getOutputFormat) \
_m(AMediaFormat_new) \
_m(AMediaFormat_delete) \
_m(AMediaFormat_getInt32) \
_m(AMediaFormat_setInt32) \
_m(AMediaFormat_setString) \
_m(AMediaFormat_setBuffer)
#define API_DEF(_name) _name##_t _name##_;
#define API_(_name) gApi._name##_
#define API_LOAD(_name) API_(_name) = (_name##_t)dlsym(handle, #_name);
struct CodecApi
{
API_LOOP(API_DEF)
};
static const char *gAMEDIAFORMAT_KEY_WIDTH = "width";
static const char *gAMEDIAFORMAT_KEY_HEIGHT = "height";
static const char *gAMEDIAFORMAT_KEY_FRAME_RATE = "frame-rate";
static CodecApi gApi;
static int gIsApiLoaded = 0;
int EuhatDecoderHard::canWork()
{
if (gIsApiLoaded)
return 1;
void *handle = dlopen("libmediandk.so", RTLD_LAZY);
if (NULL == handle) {
return 0;
}
API_LOOP(API_LOAD)
gIsApiLoaded = 1;
/* char* szError = dlerror();
dlclose(handle);
*/
return 1;
}
EuhatDecoderHard::EuhatDecoderHard()
{
// test();
mediaCodec_ = NULL;
spsChanged_ = 0;
ppsChanged_ = 0;
sps_ = pps_ = NULL;
surfaceChanged_ = 0;
isCodecInited_ = 0;
}
EuhatDecoderHard::~EuhatDecoderHard()
{
if (isCodecInited_) {
API_(AMediaCodec_stop)(mediaCodec_);
}
API_(AMediaCodec_delete)(mediaCodec_);
mediaCodec_ = NULL;
}
int EuhatDecoderHard::init(EuhatDecoderCallback callback, void *context)
{
callback_ = callback;
context_ = context;
surface_ = NULL;
if (NULL == mediaCodec_) {
#if 1
const char *mine = "video/avc";
mediaCodec_ = API_(AMediaCodec_createDecoderByType)(mine);
if (NULL == mediaCodec_) {
DBG(("avc hard decoder is not supported.\n"));
return 0;
}
#else
// const char *name = "OMX.qcom.video.decoder.avc";
const char *name = "OMX.SEC.avc.sw.dec";
// const char *name = "OMX.google.h264.decoder";
mediaCodec_ = API_(AMediaCodec_createCodecByName)(name);
if (NULL == mediaCodec_) {
DBG(("hard decoder [%s] is not supported.\n", name));
return 0;
} else {
DBG(("hard decoder [%s] is in work.\n", name));
}
#endif
}
DBG(("codec is %p\n", mediaCodec_));
return 1;
}
int EuhatDecoderHard::fini()
{
spsChanged_ = 0;
ppsChanged_ = 0;
free(sps_); sps_ = NULL;
free(pps_); pps_ = NULL;
return 1;
}
int EuhatDecoderHard::updateSps(const char *sps)
{
spsChanged_ = 1;
free(sps_);
sps_ = (char *)malloc((*(int *)sps) + 4);
memcpy(sps_, sps, (*(int *)sps) + 4);
updateSpsAndPps();
return 1;
}
int EuhatDecoderHard::updatePps(const char *pps)
{
ppsChanged_ = 1;
free(pps_);
pps_ = (char *)malloc((*(int *)pps) + 4);
memcpy(pps_, pps, (*(int *)pps) + 4);
updateSpsAndPps();
return 1;
}
int EuhatDecoderHard::updateWH(int width, int height)
{
width_ = width;
height_ = height;
return 1;
}
int EuhatDecoderHard::updateSurface(void *surface)
{
#if 1
surface_ = NULL;
return 1;
#endif
if (surface_ != surface) {
surfaceChanged_ = 1;
}
surface_ = surface;
return 0;
}
int EuhatDecoderHard::updateSpsAndPps()
{
if (spsChanged_ && !isCodecInited_) {
media_status_t status;
const char *mine = "video/avc";
AMediaFormat *videoFormat = API_(AMediaFormat_new)();
API_(AMediaFormat_setString)(videoFormat, "mime", mine);
API_(AMediaFormat_setInt32)(videoFormat, gAMEDIAFORMAT_KEY_WIDTH, width_);
API_(AMediaFormat_setInt32)(videoFormat, gAMEDIAFORMAT_KEY_HEIGHT, height_);
API_(AMediaFormat_setInt32)(videoFormat, gAMEDIAFORMAT_KEY_FRAME_RATE, 25);
// API_(AMediaFormat_setInt32)(videoFormat, "color-format", 19);
API_(AMediaFormat_setBuffer)(videoFormat, "csd-0", sps_ + 4, *(int *)sps_);
// API_(AMediaFormat_setBuffer)(videoFormat, "csd-1", pps_ + 4, *(int *)pps_);
DBG(("codec %p, format %p, surface %p\n", mediaCodec_, videoFormat, surface_));
status = API_(AMediaCodec_configure)(mediaCodec_, videoFormat, (ANativeWindow *)surface_, NULL, 0);
API_(AMediaFormat_delete)(videoFormat);
if (status != AMEDIA_OK) {
DBG(("media codec configured failed, %d.\n", status));
return 0;
}
colorFormat_ = 0;
oriHeight_ = height_;
stride_ = width_;
sliceHeight_ = height_;
cropTop_ = -1;
cropBottom_ = -1;
cropLeft_ = -1;
cropRight_ = -1;
status = API_(AMediaCodec_start)(mediaCodec_);
if (status != AMEDIA_OK)
{
DBG(("media codec started failed, %d.\n", status));
return 0;
}
DBG(("codec configured.\n"));
isCodecInited_ = 1;
}
return 1;
}
static void nv212Yv12(char *nv21, char *yv12, int width, int height)
{
int frameSize = width * height;
memcpy(yv12, nv21, frameSize);
nv21 += frameSize;
yv12 += frameSize;
int halfWidth = width / 2;
int halfHeight = height / 2;
int quadFrame = halfWidth * halfHeight;
for (int i = 0; i < halfHeight; i++) {
for (int j = 0; j < halfWidth; j++) {
*(yv12 + i * halfWidth + j) = *nv21++;
*(yv12 + quadFrame + i * halfWidth + j) = *nv21++;
}
}
}
int EuhatDecoderHard::decode(char *frame, int frameLen)
{
if (!isCodecInited_)
return 0;
ssize_t bufIdx;
int times = 10;
do {
bufIdx = API_(AMediaCodec_dequeueInputBuffer)(mediaCodec_, 2000 * 100);
if (bufIdx >= 0) {
size_t outSize;
uint8_t *inputBuf = API_(AMediaCodec_getInputBuffer)(mediaCodec_, bufIdx, &outSize);
if (inputBuf != nullptr && frameLen <= outSize) {
memcpy(inputBuf, frame, frameLen);
media_status_t status = API_(AMediaCodec_queueInputBuffer)(mediaCodec_, bufIdx, 0, frameLen, 2000 /* pts */, 0);
} else {
DBG(("inputBuf %p, outSize %d, frameLen %d.\n", inputBuf, outSize, frameLen));
}
break;
} else {
whSleepMs(10);
// DBG(("hard codec dequeue input buffer failed.\n"));
}
} while (--times > 0);
if (times <= 0) {
DBG(("hard codec dequeue input buffer failed still.\n"));
}
AMediaCodecBufferInfo info;
ssize_t outBufIdx = API_(AMediaCodec_dequeueOutputBuffer)(mediaCodec_, &info, 2000);
if (outBufIdx >= 0) {
size_t outSize;
uint8_t *outputBuf = API_(AMediaCodec_getOutputBuffer)(mediaCodec_, outBufIdx, &outSize);
if (outputBuf != nullptr) {
int sizeYUV = width_ * height_ * 3 / 2;
char *yuv = (char *)outputMemPool_->alloc(sizeYUV + 4 * 3);
*(int *)yuv = width_;
*(int *)(yuv + 4) = height_;
*(int *)(yuv + 8) = sizeYUV;
char *dst = yuv + 4 * 3;
/*
DBG(("width %d, height %d, oriHeight %d, format %d, stride %d, sliceHeight %d, outSize %d, cropTop %d, cropBottom %d, cropLeft %d, cropRight %d.\n",
width_, height_, oriHeight_, colorFormat_, stride_, sliceHeight_, outSize, cropTop_, cropBottom_, cropLeft_, cropRight_));
*/
if (colorFormat_ != 21) {
uint8_t *src = outputBuf + info.offset;
memcpy(dst, src, width_ * height_);
src += sliceHeight_ * stride_;
dst += width_ * height_;
memcpy(dst, src, width_ * height_ / 4);
src += sliceHeight_ * stride_ / 4;
dst += width_ * height_ / 4;
memcpy(dst, src, width_ * height_ / 4);
} else {
uint8_t *src = outputBuf + info.offset;
memcpy(dst, src, width_ * height_);
src += sliceHeight_ * stride_;
dst += width_ * height_;
memcpy(dst, src, width_ * height_ / 2);
char *yuvYv12 = (char *)outputMemPool_->alloc(sizeYUV + 4 * 3);
*(int *)yuvYv12 = width_;
*(int *)(yuvYv12 + 4) = height_;
*(int *)(yuvYv12 + 8) = sizeYUV;
nv212Yv12(yuv + 4 * 3, yuvYv12 + 4 * 3, width_, height_);
outputMemPool_->dealloc(yuv);
yuv = yuvYv12;
}
callback_(yuv, context_);
API_(AMediaCodec_releaseOutputBuffer)(mediaCodec_, outBufIdx, info.size != 0);
return 1;
}
} else {
switch (outBufIdx) {
case AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED:
{
AMediaFormat *format = API_(AMediaCodec_getOutputFormat)(mediaCodec_);
// API_(AMediaFormat_getInt32)(format, "width", &width_);
API_(AMediaFormat_getInt32)(format, "height", &oriHeight_);
API_(AMediaFormat_getInt32)(format, "color-format", &colorFormat_); // 21 COLOR_FormatYUV420SemiPlanar, AV_PIX_FMT_NV12
API_(AMediaFormat_getInt32)(format, "stride", &stride_);
API_(AMediaFormat_getInt32)(format, "slice-height", &sliceHeight_);
API_(AMediaFormat_getInt32)(format, "crop-top", &cropTop_);
API_(AMediaFormat_getInt32)(format, "crop-bottom", &cropBottom_);
API_(AMediaFormat_getInt32)(format, "crop-left", &cropLeft_);
API_(AMediaFormat_getInt32)(format, "crop-right", &cropRight_);
API_(AMediaFormat_delete)(format);
stride_ = stride_ > 0? stride_ : width_;
sliceHeight_ = sliceHeight_ > 0? sliceHeight_ : height_;
return 0;
}
case AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED:
break;
default:
break;
}
}
return 1;
} | 33.412073 | 160 | 0.612097 | [
"render"
] |
0e66ebb394a24b829cfdce09e811f6f9bf532747 | 1,544 | cpp | C++ | graphicsengine/Vector.cpp | mustlammas/graphics-engine | b882140fd6dde542caaabb0c6813a60d90b14580 | [
"MIT"
] | null | null | null | graphicsengine/Vector.cpp | mustlammas/graphics-engine | b882140fd6dde542caaabb0c6813a60d90b14580 | [
"MIT"
] | null | null | null | graphicsengine/Vector.cpp | mustlammas/graphics-engine | b882140fd6dde542caaabb0c6813a60d90b14580 | [
"MIT"
] | null | null | null | #include "stdafx.h"
#include "Vector.h"
#include "Point.h"
#include <string>
#include <sstream>
#include <math.h>
namespace ge {
Vector::Vector(float x, float y, float z)
: x(x), y(y), z(z)
{
}
Vector::Vector(Point a, Point b)
: x(b.getX() - a.getX()), y(b.getY() - a.getY()), z(b.getZ() - a.getZ())
{
}
std::string Vector::str() {
std::ostringstream buffer;
buffer << "(" << x << ", " << y << ", " << z << ")";
return buffer.str();
}
float Vector::getX() {
return x;
}
float Vector::getY() {
return y;
}
float Vector::getZ() {
return z;
}
/*
The dot product indicates how much overlap there is between all the axis of the two vectors.
*/
float Vector::dotProduct(Vector v) {
// Dot product formula: Av . Bv = Ax * Bx + Ay * By + Az * Bz
return x * v.getX() + y * v.getY() + z * v.getZ();
}
Vector Vector::scale(float k) {
return Vector(k * x, k * y, k * z);
}
Point Vector::fromPoint(Point p) {
return Point(x + p.getX(), y + p.getY(), z + p.getZ());
}
float Vector::getMagnitude() {
return sqrtf(x * x + y * y + z * z);
}
Vector Vector::plus(Vector v) {
return Vector(x + v.getX(), y + v.getY(), z + v.getZ());
}
Vector Vector::minus(Vector v) {
return Vector(x - v.getX(), y - v.getY(), z - v.getZ());
}
Vector Vector::projectOn(Vector v) {
float ac = this->dotProduct(v);
float vv = v.dotProduct(v);
float k = ac / vv;
return v.scale(k);
}
Vector Vector::negate() {
return Vector(-x, -y, -z);
}
Point Vector::asPoint() {
return Point(x, y, z);
}
} | 19.3 | 93 | 0.566062 | [
"vector"
] |
0e673caf3eccca11c08e4a46eb71d455184eea27 | 4,067 | hpp | C++ | NESEmu/NESEmu/Cartridge/Mapper0_s.hpp | johnmph/NESEmu | 1923ee77c4ad742827bc2817a886bde0261131e3 | [
"MIT"
] | 4 | 2020-04-24T17:33:51.000Z | 2022-02-10T01:14:28.000Z | NESEmu/NESEmu/Cartridge/Mapper0_s.hpp | johnmph/NESEmu | 1923ee77c4ad742827bc2817a886bde0261131e3 | [
"MIT"
] | null | null | null | NESEmu/NESEmu/Cartridge/Mapper0_s.hpp | johnmph/NESEmu | 1923ee77c4ad742827bc2817a886bde0261131e3 | [
"MIT"
] | null | null | null | //
// Mapper0_s.hpp
// NESEmu
//
// Created by Jonathan Baliko on 24/02/20.
// Copyright © 2020 Jonathan Baliko. All rights reserved.
//
#ifndef NESEmu_Cartridge_Mapper0_s_hpp
#define NESEmu_Cartridge_Mapper0_s_hpp
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
Chip<TCpuHardwareInterface, TPpuHardwareInterface>::Chip(std::vector<uint8_t> prgRom, std::size_t prgRamSize, std::vector<uint8_t> chrRom, std::size_t chrRamSize, MirroringType mirroringType) : Interface<TCpuHardwareInterface, TPpuHardwareInterface>(std::move(prgRom), prgRamSize, std::move(chrRom), chrRamSize), _mirroringType(mirroringType) {
}
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
void Chip<TCpuHardwareInterface, TPpuHardwareInterface>::cpuReadPerformed(TCpuHardwareInterface &cpuHardwareInterface) {
// Get address
uint16_t address = cpuHardwareInterface.getAddressBus();
// Prg-Ram
if ((address >= 0x6000) && (address < 0x8000)) {
// If has Prg-Ram
if (this->hasPrgRam()) {
// Read Prg-Ram with possible mirrored address
cpuHardwareInterface.setDataBus(this->readPrgRam(address));
}
}
// Prg-Rom
else if (address >= 0x8000) { // TODO: voir si nécessaire la condition (est ce qu'on peut etre en dessous de 0x6000 dans cette methode ? : oui nécessaire !!! voir http://forums.nesdev.com/viewtopic.php?f=9&t=14421
// Read Prg-Rom with possible mirrored address
cpuHardwareInterface.setDataBus(this->readPrgRom(address));
}
}
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
void Chip<TCpuHardwareInterface, TPpuHardwareInterface>::cpuWritePerformed(TCpuHardwareInterface &cpuHardwareInterface) {
// Get address
uint16_t address = cpuHardwareInterface.getAddressBus();
// Get data
uint8_t data = cpuHardwareInterface.getDataBus();
// Prg-Ram
if ((address >= 0x6000) && (address < 0x8000)) {
// If has Prg-Ram
if (this->hasPrgRam()) {
// Write Prg-Ram with possible mirrored address
this->writePrgRam(address, data);
}
}
// Nothing for Prg-Rom (Can't write to a ROM)
}
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
void Chip<TCpuHardwareInterface, TPpuHardwareInterface>::ppuReadPerformed(TPpuHardwareInterface &ppuHardwareInterface) {
// Get address
uint16_t address = ppuHardwareInterface.getAddressBus();
// Chr-Rom / Ram
if (address < 0x2000) {
// Read Chr-Rom / Ram
ppuHardwareInterface.setDataBus((this->hasChrRam()) ? this->readChrRam(address) : this->readChrRom(address));
}
// Internal VRAM (PPU address is always < 0x4000)
else {
// Read VRAM with mirrored address
ppuHardwareInterface.setDataBus(ppuHardwareInterface.getVram()[getVramAddress(address)]);
}
}
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
void Chip<TCpuHardwareInterface, TPpuHardwareInterface>::ppuWritePerformed(TPpuHardwareInterface &ppuHardwareInterface) {
// Get address
uint16_t address = ppuHardwareInterface.getAddressBus();
// Get data
uint8_t data = ppuHardwareInterface.getDataBus();
// Chr-Ram
if (address < 0x2000) {
// Write Chr-Ram if exist
if (this->hasChrRam()) {
this->writeChrRam(address, data);
}
}
// Internal VRAM (PPU address is always < 0x4000)
else {
// Write VRAM with mirrored address
ppuHardwareInterface.getVram()[getVramAddress(address)] = data;
}
}
template <class TCpuHardwareInterface, class TPpuHardwareInterface>
uint16_t Chip<TCpuHardwareInterface, TPpuHardwareInterface>::getVramAddress(uint16_t address) {
// Only Vertical or Horizontal mirroring
if (_mirroringType == MirroringType::Horizontal) {
return getMirroredAddress<MirroringType::Horizontal>(address);
}
return getMirroredAddress<MirroringType::Vertical>(address);
}
#endif /* NESEmu_Cartridge_Mapper0_s_hpp */
| 38.367925 | 344 | 0.708385 | [
"vector"
] |
0e69c451fafc677c68508e7e5d3a699c5c490168 | 4,878 | cpp | C++ | AndroidTrustyOS/app/sample/ElastosRuntime/reflection/CCarArrayInfo.cpp | haitao52198/TrustyOS | 40ad09911aa12dd774fefcab9747c30da802d2c8 | [
"Apache-2.0"
] | 9 | 2017-11-10T15:54:02.000Z | 2021-04-15T20:57:29.000Z | AndroidTrustyOS/lk/trusty/lib/ElastosRuntime/reflection/CCarArrayInfo.cpp | haitao52198/TrustyOS | 40ad09911aa12dd774fefcab9747c30da802d2c8 | [
"Apache-2.0"
] | null | null | null | AndroidTrustyOS/lk/trusty/lib/ElastosRuntime/reflection/CCarArrayInfo.cpp | haitao52198/TrustyOS | 40ad09911aa12dd774fefcab9747c30da802d2c8 | [
"Apache-2.0"
] | 7 | 2018-01-08T02:53:32.000Z | 2020-10-15T13:01:46.000Z | //==========================================================================
// Copyright (c) 2000-2008, Elastos, Inc. All Rights Reserved.
//==========================================================================
#include "CCarArrayInfo.h"
#include "CVariableOfCarArray.h"
#include "CObjInfoList.h"
#include "CStructInfo.h"
CCarArrayInfo::CCarArrayInfo(
/* [in] */ CarDataType quintetType,
/* [in] */ IDataTypeInfo* elementTypeInfo,
/* [in] */ CarDataType dataType)
: mElementTypeInfo(elementTypeInfo)
, mElementDataType(dataType)
, mQuintetType(quintetType)
{}
UInt32 CCarArrayInfo::AddRef()
{
return ElLightRefBase::AddRef();
}
UInt32 CCarArrayInfo::Release()
{
g_objInfoList.LockHashTable(EntryType_DataType);
Int32 ref = atomic_dec(&mRef);
if (0 == ref) {
g_objInfoList.DetachCarArrayInfo(this);
delete this;
}
g_objInfoList.UnlockHashTable(EntryType_DataType);
assert(ref >= 0);
return ref;
}
PInterface CCarArrayInfo::Probe(
/* [in] */ REIID riid)
{
if (riid == EIID_IInterface) {
return (PInterface)this;
}
else if (riid == EIID_ICarArrayInfo) {
return (ICarArrayInfo *)this;
}
else if (riid == EIID_IDataTypeInfo) {
return (IDataTypeInfo *)this;
}
else {
return NULL;
}
}
ECode CCarArrayInfo::GetInterfaceID(
/* [in] */ IInterface* object,
/* [out] */ InterfaceID* iid)
{
return E_NOT_IMPLEMENTED;
}
ECode CCarArrayInfo::GetName(
/* [out] */ String* name)
{
if (name == NULL) {
return E_INVALID_ARGUMENT;
}
// if (mElementDataType == CarDataType_LocalType) {
// name->Copy(g_cDataTypeList[CarDataType_LocalType].name);
// }
*name = g_cDataTypeList[mQuintetType].mName;
String elementName;
ECode ec = mElementTypeInfo->GetName(&elementName);
if (FAILED(ec)) return ec;
name->Append("<");
name->Append(elementName);
if (mElementDataType == CarDataType_Interface) {
name->Append("*");
}
name->Append(">");
return NOERROR;
}
ECode CCarArrayInfo::GetSize(
/* [out] */ MemorySize* size)
{
return E_INVALID_OPERATION;
}
ECode CCarArrayInfo::GetDataType(
/* [out] */ CarDataType* dataType)
{
if (!dataType) {
return E_INVALID_ARGUMENT;
}
*dataType = mQuintetType;
return NOERROR;
}
ECode CCarArrayInfo::GetElementTypeInfo(
/* [out] */ IDataTypeInfo** elementTypeInfo)
{
if (!elementTypeInfo) {
return E_INVALID_ARGUMENT;
}
*elementTypeInfo = mElementTypeInfo;
(*elementTypeInfo)->AddRef();
return NOERROR;
}
ECode CCarArrayInfo::CreateVariable(
/* [in] */ Int32 capacity,
/* [out] */ IVariableOfCarArray** variable)
{
if (capacity <= 0 || !variable) {
return E_INVALID_ARGUMENT;
}
Int32 size = 0;
ECode ec = mElementTypeInfo->GetSize(&size);
if (FAILED(ec)) return ec;
Int32 bufSize = capacity * size;
PCarQuintet carQuintet =
(PCarQuintet)calloc(sizeof(CarQuintet) + bufSize, sizeof(Byte));
if (!carQuintet) {
return E_OUT_OF_MEMORY;
}
carQuintet->mFlags = DataTypeToFlag(mElementDataType);
if (mQuintetType == CarDataType_ArrayOf) {
carQuintet->mUsed = bufSize;
}
carQuintet->mSize = bufSize;
carQuintet->mBuf = (Byte *)carQuintet + sizeof(CarQuintet);
CVariableOfCarArray* carArrayBox = new CVariableOfCarArray(this,
carQuintet, TRUE);
if (carArrayBox == NULL) {
free(carQuintet);
return E_OUT_OF_MEMORY;
}
*variable = (IVariableOfCarArray *)carArrayBox;
(*variable)->AddRef();
return NOERROR;
}
ECode CCarArrayInfo::CreateVariableBox(
/* [in] */ PCarQuintet variableDescriptor,
/* [out] */ IVariableOfCarArray** variable)
{
if (!variableDescriptor || !variable) {
return E_INVALID_ARGUMENT;
}
Int32 size = 0;
ECode ec = mElementTypeInfo->GetSize(&size);
if (FAILED(ec)) return ec;
if (variableDescriptor->mSize < size) {
return E_INVALID_ARGUMENT;
}
if (!(variableDescriptor->mFlags & DataTypeToFlag(mElementDataType))) {
return E_INVALID_ARGUMENT;
}
CVariableOfCarArray* carArrayBox = new CVariableOfCarArray(this,
variableDescriptor, FALSE);
if (carArrayBox == NULL) {
return E_OUT_OF_MEMORY;
}
*variable = (IVariableOfCarArray *)carArrayBox;
(*variable)->AddRef();
return NOERROR;
}
ECode CCarArrayInfo::GetMaxAlignSize(
/* [out] */ MemorySize* alignSize)
{
Int32 size = 1;
if (mElementDataType == CarDataType_Struct) {
((CStructInfo *)mElementTypeInfo.Get())->GetMaxAlignSize(&size);
}
else {
mElementTypeInfo->GetSize(&size);
}
if (size > ALIGN_BOUND) size = ALIGN_BOUND;
*alignSize = size;
return NOERROR;
}
| 23.565217 | 76 | 0.618286 | [
"object"
] |
0e6a6746127c07d3fdd8f3695360f48a01c15a85 | 25,397 | cxx | C++ | main/dbaccess/source/ui/dlg/advancedsettings.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/dbaccess/source/ui/dlg/advancedsettings.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/dbaccess/source/ui/dlg/advancedsettings.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.000Z | /**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*
*************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbui.hxx"
#include "advancedsettings.hxx"
#include "advancedsettingsdlg.hxx"
#include "moduledbu.hxx"
#include "dsitems.hxx"
#include "DbAdminImpl.hxx"
#include "DriverSettings.hxx"
#include "optionalboolitem.hxx"
#include "dbu_resource.hrc"
#include "dbu_dlg.hrc"
#include "dbadmin.hrc"
#include "advancedsettings.hrc"
/** === begin UNO includes === **/
/** === end UNO includes === **/
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
#include <vcl/msgbox.hxx>
//........................................................................
namespace dbaui
{
//........................................................................
/** === begin UNO using === **/
using ::com::sun::star::uno::Reference;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::uno::Any;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::sdbc::XConnection;
using ::com::sun::star::sdbc::XDriver;
/** === end UNO using === **/
//========================================================================
//= SpecialSettingsPage
//========================================================================
struct BooleanSettingDesc
{
CheckBox** ppControl; // the dialog's control which displays this setting
sal_uInt16 nControlResId; // the resource ID to load the control from
sal_uInt16 nItemId; // the ID of the item (in an SfxItemSet) which corresponds to this setting
bool bInvertedDisplay; // true if and only if the checkbox is checked when the item is sal_False, and vice versa
};
//========================================================================
//= SpecialSettingsPage
//========================================================================
SpecialSettingsPage::SpecialSettingsPage( Window* pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta )
:OGenericAdministrationPage( pParent, ModuleRes( PAGE_ADVANCED_SETTINGS_SPECIAL ), _rCoreAttrs )
,m_aTopLine( this, ModuleRes( FL_DATAHANDLING ) )
,m_pIsSQL92Check( NULL )
,m_pAppendTableAlias( NULL )
,m_pAsBeforeCorrelationName( NULL )
,m_pEnableOuterJoin( NULL )
,m_pIgnoreDriverPrivileges( NULL )
,m_pParameterSubstitution( NULL )
,m_pSuppressVersionColumn( NULL )
,m_pCatalog( NULL )
,m_pSchema( NULL )
,m_pIndexAppendix( NULL )
,m_pDosLineEnds( NULL )
,m_pCheckRequiredFields( NULL )
,m_pIgnoreCurrency(NULL)
,m_pEscapeDateTime(NULL)
,m_pPrimaryKeySupport(NULL)
,m_pRespectDriverResultSetType(NULL)
,m_pBooleanComparisonModeLabel( NULL )
,m_pBooleanComparisonMode( NULL )
,m_pMaxRowScanLabel( NULL )
,m_pMaxRowScan( NULL )
,m_aControlDependencies()
,m_aBooleanSettings()
,m_bHasBooleanComparisonMode( _rDSMeta.getFeatureSet().has( DSID_BOOLEANCOMPARISON ) )
,m_bHasMaxRowScan( _rDSMeta.getFeatureSet().has( DSID_MAX_ROW_SCAN ) )
{
impl_initBooleanSettings();
const FeatureSet& rFeatures( _rDSMeta.getFeatureSet() );
// create all the check boxes for the boolean settings
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
++setting
)
{
sal_uInt16 nItemId = setting->nItemId;
if ( rFeatures.has( nItemId ) )
{
sal_uInt16 nResourceId = setting->nControlResId;
(*setting->ppControl) = new CheckBox( this, ModuleRes( nResourceId ) );
(*setting->ppControl)->SetClickHdl( getControlModifiedLink() );
// check whether this must be a tristate check box
const SfxPoolItem& rItem = _rCoreAttrs.Get( nItemId );
if ( rItem.ISA( OptionalBoolItem ) )
(*setting->ppControl)->EnableTriState( sal_True );
}
}
if ( m_pAsBeforeCorrelationName && m_pAppendTableAlias )
// make m_pAsBeforeCorrelationName depend on m_pAppendTableAlias
m_aControlDependencies.enableOnCheckMark( *m_pAppendTableAlias, *m_pAsBeforeCorrelationName );
// move the controls to the appropriate positions
Point aPos( m_aTopLine.GetPosPixel() );
aPos.Move( 0, m_aTopLine.GetSizePixel().Height() );
Size aFirstDistance( LogicToPixel( Size( INDENTED_X, RELATED_CONTROLS ), MAP_APPFONT ) );
aPos.Move( aFirstDistance.Width(), aFirstDistance.Height() );
Size aUnrelatedControls( LogicToPixel( Size( RELATED_CONTROLS, RELATED_CONTROLS ), MAP_APPFONT ) );
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
++setting
)
{
if ( !*setting->ppControl )
continue;
(*setting->ppControl)->SetPosPixel( aPos );
aPos.Move( 0, (*setting->ppControl)->GetSizePixel().Height() );
aPos.Move( 0, aUnrelatedControls.Height() );
}
// create the controls for the boolean comparison mode
if ( m_bHasBooleanComparisonMode )
{
m_pBooleanComparisonModeLabel = new FixedText( this, ModuleRes( FT_BOOLEANCOMPARISON ) );
m_pBooleanComparisonMode = new ListBox( this, ModuleRes( LB_BOOLEANCOMPARISON ) );
m_pBooleanComparisonMode->SetDropDownLineCount( 4 );
m_pBooleanComparisonMode->SetSelectHdl( getControlModifiedLink() );
Point aLabelPos( m_pBooleanComparisonModeLabel->GetPosPixel() );
Point aControlPos( m_pBooleanComparisonMode->GetPosPixel() );
long nMoveUp = aControlPos.Y() - aPos.Y();
m_pBooleanComparisonModeLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) );
m_pBooleanComparisonMode->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) );
}
// create the controls for the max row scan
if ( m_bHasMaxRowScan )
{
m_pMaxRowScanLabel = new FixedText( this, ModuleRes( FT_MAXROWSCAN ) );
m_pMaxRowScan = new NumericField( this, ModuleRes( NF_MAXROWSCAN ) );
m_pMaxRowScan->SetModifyHdl(getControlModifiedLink());
m_pMaxRowScan->SetUseThousandSep(sal_False);
Point aLabelPos( m_pMaxRowScanLabel->GetPosPixel() );
Point aControlPos( m_pMaxRowScan->GetPosPixel() );
long nMoveUp = aControlPos.Y() - aPos.Y();
m_pMaxRowScanLabel->SetPosPixel( Point( aLabelPos.X(), aLabelPos.Y() - nMoveUp ) );
m_pMaxRowScan->SetPosPixel( Point( aControlPos.X(), aControlPos.Y() - nMoveUp ) );
}
FreeResource();
}
// -----------------------------------------------------------------------
SpecialSettingsPage::~SpecialSettingsPage()
{
m_aControlDependencies.clear();
DELETEZ( m_pIsSQL92Check );
DELETEZ( m_pAppendTableAlias );
DELETEZ( m_pAsBeforeCorrelationName );
DELETEZ( m_pParameterSubstitution );
DELETEZ( m_pIgnoreDriverPrivileges );
DELETEZ( m_pSuppressVersionColumn );
DELETEZ( m_pEnableOuterJoin );
DELETEZ( m_pCatalog );
DELETEZ( m_pSchema );
DELETEZ( m_pIndexAppendix );
DELETEZ( m_pDosLineEnds );
DELETEZ( m_pCheckRequiredFields );
DELETEZ( m_pIgnoreCurrency );
DELETEZ( m_pEscapeDateTime );
DELETEZ( m_pPrimaryKeySupport );
DELETEZ( m_pRespectDriverResultSetType );
DELETEZ( m_pBooleanComparisonModeLabel );
DELETEZ( m_pBooleanComparisonMode );
DELETEZ( m_pMaxRowScanLabel );
DELETEZ( m_pMaxRowScan );
}
// -----------------------------------------------------------------------
void SpecialSettingsPage::impl_initBooleanSettings()
{
OSL_PRECOND( m_aBooleanSettings.empty(), "SpecialSettingsPage::impl_initBooleanSettings: called twice!" );
// for easier maintenance, write the table in this form, then copy it to m_aBooleanSettings
BooleanSettingDesc aSettings[] = {
{ &m_pIsSQL92Check, CB_SQL92CHECK, DSID_SQL92CHECK, false },
{ &m_pAppendTableAlias, CB_APPENDTABLEALIAS, DSID_APPEND_TABLE_ALIAS, false },
{ &m_pAsBeforeCorrelationName, CB_AS_BEFORE_CORR_NAME, DSID_AS_BEFORE_CORRNAME, false },
{ &m_pEnableOuterJoin, CB_ENABLEOUTERJOIN, DSID_ENABLEOUTERJOIN, false },
{ &m_pIgnoreDriverPrivileges, CB_IGNOREDRIVER_PRIV, DSID_IGNOREDRIVER_PRIV, false },
{ &m_pParameterSubstitution, CB_PARAMETERNAMESUBST, DSID_PARAMETERNAMESUBST, false },
{ &m_pSuppressVersionColumn, CB_SUPPRESVERSIONCL, DSID_SUPPRESSVERSIONCL, true },
{ &m_pCatalog, CB_CATALOG, DSID_CATALOG, false },
{ &m_pSchema, CB_SCHEMA, DSID_SCHEMA, false },
{ &m_pIndexAppendix, CB_IGNOREINDEXAPPENDIX, DSID_INDEXAPPENDIX, false },
{ &m_pDosLineEnds, CB_DOSLINEENDS, DSID_DOSLINEENDS, false },
{ &m_pCheckRequiredFields, CB_CHECK_REQUIRED, DSID_CHECK_REQUIRED_FIELDS, false },
{ &m_pIgnoreCurrency, CB_IGNORECURRENCY, DSID_IGNORECURRENCY, false },
{ &m_pEscapeDateTime, CB_ESCAPE_DATETIME, DSID_ESCAPE_DATETIME, false },
{ &m_pPrimaryKeySupport, CB_PRIMARY_KEY_SUPPORT, DSID_PRIMARY_KEY_SUPPORT, false },
{ &m_pRespectDriverResultSetType, CB_RESPECTRESULTSETTYPE,DSID_RESPECTRESULTSETTYPE, false },
{ NULL, 0, 0, false }
};
for ( const BooleanSettingDesc* pCopy = aSettings; pCopy->nItemId != 0; ++pCopy )
{
m_aBooleanSettings.push_back( *pCopy );
}
}
// -----------------------------------------------------------------------
void SpecialSettingsPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
if ( m_bHasBooleanComparisonMode )
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pBooleanComparisonModeLabel ) );
}
if ( m_bHasMaxRowScan )
{
_rControlList.push_back( new ODisableWrapper< FixedText >( m_pMaxRowScanLabel ) );
}
}
// -----------------------------------------------------------------------
void SpecialSettingsPage::fillControls(::std::vector< ISaveValueWrapper* >& _rControlList)
{
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
++setting
)
{
if ( *setting->ppControl )
{
_rControlList.push_back( new OSaveValueWrapper< CheckBox >( *setting->ppControl ) );
}
}
if ( m_bHasBooleanComparisonMode )
_rControlList.push_back( new OSaveValueWrapper< ListBox >( m_pBooleanComparisonMode ) );
if ( m_bHasMaxRowScan )
_rControlList.push_back(new OSaveValueWrapper<NumericField>(m_pMaxRowScan));
}
// -----------------------------------------------------------------------
void SpecialSettingsPage::implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue)
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags( _rSet, bValid, bReadonly );
if ( !bValid )
{
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
return;
}
// the boolean items
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
++setting
)
{
if ( !*setting->ppControl )
continue;
::boost::optional< bool > aValue;
SFX_ITEMSET_GET( _rSet, pItem, SfxPoolItem, setting->nItemId, sal_True );
if ( pItem->ISA( SfxBoolItem ) )
{
aValue.reset( PTR_CAST( SfxBoolItem, pItem )->GetValue() );
}
else if ( pItem->ISA( OptionalBoolItem ) )
{
aValue = PTR_CAST( OptionalBoolItem, pItem )->GetFullValue();
}
else
DBG_ERROR( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
if ( !aValue )
{
(*setting->ppControl)->SetState( STATE_DONTKNOW );
}
else
{
sal_Bool bValue = *aValue;
if ( setting->bInvertedDisplay )
bValue = !bValue;
(*setting->ppControl)->Check( bValue );
}
}
// the non-boolean items
if ( m_bHasBooleanComparisonMode )
{
SFX_ITEMSET_GET( _rSet, pBooleanComparison, SfxInt32Item, DSID_BOOLEANCOMPARISON, sal_True );
m_pBooleanComparisonMode->SelectEntryPos( static_cast< sal_uInt16 >( pBooleanComparison->GetValue() ) );
}
if ( m_bHasMaxRowScan )
{
SFX_ITEMSET_GET(_rSet, pMaxRowScan, SfxInt32Item, DSID_MAX_ROW_SCAN, sal_True);
m_pMaxRowScan->SetValue(pMaxRowScan->GetValue());
}
OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
}
// -----------------------------------------------------------------------
sal_Bool SpecialSettingsPage::FillItemSet( SfxItemSet& _rSet )
{
sal_Bool bChangedSomething = sal_False;
// the boolean items
for ( BooleanSettingDescs::const_iterator setting = m_aBooleanSettings.begin();
setting != m_aBooleanSettings.end();
++setting
)
{
if ( !*setting->ppControl )
continue;
fillBool( _rSet, *setting->ppControl, setting->nItemId, bChangedSomething, setting->bInvertedDisplay );
}
// the non-boolean items
if ( m_bHasBooleanComparisonMode )
{
if ( m_pBooleanComparisonMode->GetSelectEntryPos() != m_pBooleanComparisonMode->GetSavedValue() )
{
_rSet.Put( SfxInt32Item( DSID_BOOLEANCOMPARISON, m_pBooleanComparisonMode->GetSelectEntryPos() ) );
bChangedSomething = sal_True;
}
}
if ( m_bHasMaxRowScan )
{
fillInt32(_rSet,m_pMaxRowScan,DSID_MAX_ROW_SCAN,bChangedSomething);
}
return bChangedSomething;
}
//========================================================================
//= GeneratedValuesPage
//========================================================================
//------------------------------------------------------------------------
GeneratedValuesPage::GeneratedValuesPage( Window* pParent, const SfxItemSet& _rCoreAttrs )
:OGenericAdministrationPage(pParent, ModuleRes( PAGE_GENERATED_VALUES ), _rCoreAttrs)
,m_aAutoFixedLine ( this, ModuleRes( FL_SEPARATORAUTO ) )
,m_aAutoRetrievingEnabled( this, ModuleRes( CB_RETRIEVE_AUTO ) )
,m_aAutoIncrementLabel ( this, ModuleRes( FT_AUTOINCREMENTVALUE ) )
,m_aAutoIncrement ( this, ModuleRes( ET_AUTOINCREMENTVALUE ) )
,m_aAutoRetrievingLabel ( this, ModuleRes( FT_RETRIEVE_AUTO ) )
,m_aAutoRetrieving ( this, ModuleRes( ET_RETRIEVE_AUTO ) )
{
m_aAutoRetrievingEnabled.SetClickHdl( getControlModifiedLink() );
m_aAutoIncrement.SetModifyHdl( getControlModifiedLink() );
m_aAutoRetrieving.SetModifyHdl( getControlModifiedLink() );
m_aControlDependencies.enableOnCheckMark( m_aAutoRetrievingEnabled,
m_aAutoIncrementLabel, m_aAutoIncrement, m_aAutoRetrievingLabel, m_aAutoRetrieving );
FreeResource();
}
// -----------------------------------------------------------------------
GeneratedValuesPage::~GeneratedValuesPage()
{
m_aControlDependencies.clear();
}
// -----------------------------------------------------------------------
void GeneratedValuesPage::fillWindows( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
_rControlList.push_back( new ODisableWrapper< FixedLine >( &m_aAutoFixedLine ) );
_rControlList.push_back( new ODisableWrapper< FixedText >( &m_aAutoIncrementLabel ) );
_rControlList.push_back( new ODisableWrapper< FixedText >( &m_aAutoRetrievingLabel ) );
}
// -----------------------------------------------------------------------
void GeneratedValuesPage::fillControls( ::std::vector< ISaveValueWrapper* >& _rControlList )
{
_rControlList.push_back( new OSaveValueWrapper< CheckBox >( &m_aAutoRetrievingEnabled ) );
_rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aAutoIncrement ) );
_rControlList.push_back( new OSaveValueWrapper< Edit >( &m_aAutoRetrieving ) );
}
// -----------------------------------------------------------------------
void GeneratedValuesPage::implInitControls( const SfxItemSet& _rSet, sal_Bool _bSaveValue )
{
// check whether or not the selection is invalid or readonly (invalid implies readonly, but not vice versa)
sal_Bool bValid, bReadonly;
getFlags(_rSet, bValid, bReadonly);
// collect the items
SFX_ITEMSET_GET(_rSet, pAutoIncrementItem, SfxStringItem, DSID_AUTOINCREMENTVALUE, sal_True);
SFX_ITEMSET_GET(_rSet, pAutoRetrieveValueItem, SfxStringItem, DSID_AUTORETRIEVEVALUE, sal_True);
SFX_ITEMSET_GET(_rSet, pAutoRetrieveEnabledItem, SfxBoolItem, DSID_AUTORETRIEVEENABLED, sal_True);
// forward the values to the controls
if (bValid)
{
sal_Bool bEnabled = pAutoRetrieveEnabledItem->GetValue();
m_aAutoRetrievingEnabled.Check( bEnabled );
m_aAutoIncrement.SetText( pAutoIncrementItem->GetValue() );
m_aAutoIncrement.ClearModifyFlag();
m_aAutoRetrieving.SetText( pAutoRetrieveValueItem->GetValue() );
m_aAutoRetrieving.ClearModifyFlag();
}
OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue );
}
// -----------------------------------------------------------------------
sal_Bool GeneratedValuesPage::FillItemSet(SfxItemSet& _rSet)
{
sal_Bool bChangedSomething = sal_False;
fillString( _rSet, &m_aAutoIncrement, DSID_AUTOINCREMENTVALUE, bChangedSomething );
fillBool( _rSet, &m_aAutoRetrievingEnabled, DSID_AUTORETRIEVEENABLED, bChangedSomething );
fillString( _rSet, &m_aAutoRetrieving, DSID_AUTORETRIEVEVALUE, bChangedSomething );
return bChangedSomething;
}
//========================================================================
//= AdvancedSettingsDialog
//========================================================================
//------------------------------------------------------------------------
AdvancedSettingsDialog::AdvancedSettingsDialog( Window* _pParent, SfxItemSet* _pItems,
const Reference< XMultiServiceFactory >& _rxORB, const Any& _aDataSourceName )
:SfxTabDialog(_pParent, ModuleRes(DLG_DATABASE_ADVANCED), _pItems)
,m_pItemSet(_pItems)
{
m_pImpl = ::std::auto_ptr<ODbDataSourceAdministrationHelper>(new ODbDataSourceAdministrationHelper(_rxORB,_pParent,this));
m_pImpl->setDataSourceOrName(_aDataSourceName);
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
m_pImpl->translateProperties(xDatasource, *_pItems);
SetInputSet(_pItems);
// propagate this set as our new input set and reset the example set
delete pExampleSet;
pExampleSet = new SfxItemSet(*GetInputSetImpl());
const ::rtl::OUString eType = m_pImpl->getDatasourceType(*_pItems);
DataSourceMetaData aMeta( eType );
const FeatureSet& rFeatures( aMeta.getFeatureSet() );
// auto-generated values?
if ( rFeatures.supportsGeneratedValues() )
AddTabPage( PAGE_GENERATED_VALUES, String( ModuleRes( STR_GENERATED_VALUE ) ), ODriversSettings::CreateGeneratedValuesPage, NULL );
// any "special settings"?
if ( rFeatures.supportsAnySpecialSetting() )
AddTabPage( PAGE_ADVANCED_SETTINGS_SPECIAL, String( ModuleRes( STR_DS_BEHAVIOUR ) ), ODriversSettings::CreateSpecialSettingsPage, NULL );
// remove the reset button - it's meaning is much too ambiguous in this dialog
RemoveResetButton();
FreeResource();
}
// -----------------------------------------------------------------------
AdvancedSettingsDialog::~AdvancedSettingsDialog()
{
SetInputSet(NULL);
DELETEZ(pExampleSet);
}
// -----------------------------------------------------------------------
bool AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( const ::rtl::OUString& _sURL )
{
DataSourceMetaData aMeta( _sURL );
const FeatureSet& rFeatures( aMeta.getFeatureSet() );
if ( rFeatures.supportsGeneratedValues() || rFeatures.supportsAnySpecialSetting() )
return true;
return false;
}
// -----------------------------------------------------------------------
short AdvancedSettingsDialog::Execute()
{
short nRet = SfxTabDialog::Execute();
if ( nRet == RET_OK )
{
pExampleSet->Put(*GetOutputItemSet());
m_pImpl->saveChanges(*pExampleSet);
}
return nRet;
}
//-------------------------------------------------------------------------
void AdvancedSettingsDialog::PageCreated(sal_uInt16 _nId, SfxTabPage& _rPage)
{
// register ourself as modified listener
static_cast<OGenericAdministrationPage&>(_rPage).SetServiceFactory(m_pImpl->getORB());
static_cast<OGenericAdministrationPage&>(_rPage).SetAdminDialog(this,this);
AdjustLayout();
Window *pWin = GetViewWindow();
if(pWin)
pWin->Invalidate();
SfxTabDialog::PageCreated(_nId, _rPage);
}
// -----------------------------------------------------------------------------
const SfxItemSet* AdvancedSettingsDialog::getOutputSet() const
{
return pExampleSet;
}
// -----------------------------------------------------------------------------
SfxItemSet* AdvancedSettingsDialog::getWriteOutputSet()
{
return pExampleSet;
}
// -----------------------------------------------------------------------------
::std::pair< Reference< XConnection >, sal_Bool > AdvancedSettingsDialog::createConnection()
{
return m_pImpl->createConnection();
}
// -----------------------------------------------------------------------------
Reference< XMultiServiceFactory > AdvancedSettingsDialog::getORB() const
{
return m_pImpl->getORB();
}
// -----------------------------------------------------------------------------
Reference< XDriver > AdvancedSettingsDialog::getDriver()
{
return m_pImpl->getDriver();
}
// -----------------------------------------------------------------------------
::rtl::OUString AdvancedSettingsDialog::getDatasourceType(const SfxItemSet& _rSet) const
{
return m_pImpl->getDatasourceType(_rSet);
}
// -----------------------------------------------------------------------------
void AdvancedSettingsDialog::clearPassword()
{
m_pImpl->clearPassword();
}
// -----------------------------------------------------------------------------
void AdvancedSettingsDialog::setTitle(const ::rtl::OUString& _sTitle)
{
SetText(_sTitle);
}
//-------------------------------------------------------------------------
void AdvancedSettingsDialog::enableConfirmSettings( bool _bEnable )
{
(void)_bEnable;
}
//-------------------------------------------------------------------------
sal_Bool AdvancedSettingsDialog::saveDatasource()
{
return PrepareLeaveCurrentPage();
}
//........................................................................
} // namespace dbaui
//........................................................................
| 42.257903 | 140 | 0.575934 | [
"vector"
] |
0e6bfab8ad054c72b46dc72892470a8fde4ecd1b | 1,325 | cpp | C++ | src/thunderbots/software/ai/ai.cpp | MaxonZhao/Software | e587ee6d441d2d10c08ba58bd44b1b2091e7c53f | [
"MIT"
] | null | null | null | src/thunderbots/software/ai/ai.cpp | MaxonZhao/Software | e587ee6d441d2d10c08ba58bd44b1b2091e7c53f | [
"MIT"
] | null | null | null | src/thunderbots/software/ai/ai.cpp | MaxonZhao/Software | e587ee6d441d2d10c08ba58bd44b1b2091e7c53f | [
"MIT"
] | null | null | null | #include "ai.h"
AI::AI() : navigator(std::make_unique<RRTNav>()), high_level(std::make_unique<STP_HL>())
{
}
std::vector<std::unique_ptr<Primitive>> AI::getPrimitives(
const AITimestamp ×tamp) const
{
// NOTE: The only thing the AI really needs an updated timestamp for (updated relative
// to the timestamp when the state/world was last updated) is to update the
// "zero-time"
// for any predictors (ie. modules that predict Robot, Ball position etc.). When those
// are implemented we can update them in some way from here, if necessary.
std::vector<std::unique_ptr<Intent>> assignedIntents =
high_level->getIntentAssignment(world);
std::vector<std::unique_ptr<Primitive>> assignedPrimitives =
navigator->getAssignedPrimitives(world, assignedIntents);
return assignedPrimitives;
}
void AI::updateWorldBallState(const Ball &new_ball_data)
{
world.updateBallState(new_ball_data);
}
void AI::updateWorldFieldState(const Field &new_field_data)
{
world.updateFieldGeometry(new_field_data);
}
void AI::updateWorldFriendlyTeamState(const Team &new_friendly_team_data)
{
world.updateFriendlyTeamState(new_friendly_team_data);
}
void AI::updateWorldEnemyTeamState(const Team &new_enemy_team_data)
{
world.updateEnemyTeamState(new_enemy_team_data);
} | 30.813953 | 90 | 0.749434 | [
"vector"
] |
0e6cb6cec645699f979cf599eafd6f6805a275df | 5,693 | cc | C++ | p4rt_app/tests/p4_programs_test.cc | fichtl/sonic-pins | 60d2467b03cf67b9a61be5be7b6840b63dbb9c5b | [
"Apache-2.0"
] | 6 | 2021-12-08T17:29:38.000Z | 2022-02-17T20:36:54.000Z | p4rt_app/tests/p4_programs_test.cc | fichtl/sonic-pins | 60d2467b03cf67b9a61be5be7b6840b63dbb9c5b | [
"Apache-2.0"
] | 2 | 2022-01-20T08:55:05.000Z | 2022-03-08T18:30:11.000Z | p4rt_app/tests/p4_programs_test.cc | fichtl/sonic-pins | 60d2467b03cf67b9a61be5be7b6840b63dbb9c5b | [
"Apache-2.0"
] | 5 | 2021-12-10T02:41:52.000Z | 2022-03-03T06:59:23.000Z | // Copyright 2021 Google LLC
//
// 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 <vector>
#include "absl/strings/str_cat.h"
#include "gmock/gmock.h"
#include "grpcpp/security/credentials.h"
#include "gtest/gtest.h"
#include "gutil/status_matchers.h"
#include "p4/config/v1/p4info.pb.h"
#include "p4/v1/p4runtime.pb.h"
#include "p4_pdpi/ir.h"
#include "p4_pdpi/ir.pb.h"
#include "p4_pdpi/p4_runtime_session.h"
#include "p4_pdpi/utils/annotation_parser.h"
#include "p4rt_app/tests/lib/p4runtime_grpc_service.h"
#include "sai_p4/instantiations/google/instantiations.h"
#include "sai_p4/instantiations/google/sai_p4info.h"
#include "swss/json.hpp"
namespace p4rt_app {
namespace {
using ::testing::Contains;
using ::testing::Key;
MATCHER_P2(HasJsonObject, key, value, "") {
nlohmann::json json = nlohmann::json::parse(arg);
if (json.count(key) == 0) {
*result_listener << "Missing JSON object \"" << key << "\"";
return false;
}
return json[key] == value;
}
bool IsCompositeUdfMatchField(
const pdpi::IrMatchFieldDefinition& match_field_def) {
// They will be marked by the 'composite_field'.
auto composite_field = pdpi::GetAnnotationAsArgList(
"composite_field", match_field_def.match_field().annotations());
if (!composite_field.ok() || composite_field->empty()) return false;
// And all the sub annotations should be marked as 'sai_udf'.
for (const auto& sub_annotation : pdpi::GetAllAnnotations(*composite_field)) {
if (sub_annotation.label != "sai_udf") return false;
}
return true;
}
// The P4 programs tests verify that the P4 programs can be pushed end-to-end
// through the P4RT App. They are also used to verify the P4 programs match
// SONiC expectations. Sanity checks that
// using P4ProgramsTest = testing::TestWithParam<sai::Instantiation>;
class P4ProgramsTest : public testing::TestWithParam<sai::Instantiation> {
protected:
void SetUp() override {
// Create a P4RT session, and connect.
std::string address = absl::StrCat("localhost:", p4rt_service_.GrpcPort());
auto stub =
pdpi::CreateP4RuntimeStub(address, grpc::InsecureChannelCredentials());
ASSERT_OK_AND_ASSIGN(
p4rt_session_, pdpi::P4RuntimeSession::Create(std::move(stub),
/*device_id=*/183807201));
}
test_lib::P4RuntimeGrpcService p4rt_service_ =
test_lib::P4RuntimeGrpcService(test_lib::P4RuntimeGrpcServiceOptions{});
std::unique_ptr<pdpi::P4RuntimeSession> p4rt_session_;
};
TEST_P(P4ProgramsTest, CanPushP4InfoWithoutFailure) {
EXPECT_OK(pdpi::SetForwardingPipelineConfig(
p4rt_session_.get(),
p4::v1::SetForwardingPipelineConfigRequest::RECONCILE_AND_COMMIT,
sai::GetP4Info(GetParam())));
}
// SONiC requires any composite UDF field to be formatted as a HEX_STRING.
// However, P4Info isn't limited by this same restriction. It can use other
// formats for ease of readability. Therefore, the P4RT App should update any
// composite UDFs to use HEX_STRING before writing to the AppDb.
TEST_P(P4ProgramsTest, CompositeUdfFieldsShouldAlwaysUseHexStrings) {
const p4::config::v1::P4Info& p4_info = sai::GetP4Info(GetParam());
const pdpi::IrP4Info& ir_p4_info = sai::GetIrP4Info(GetParam());
struct AppDbField {
std::string table_name;
std::string field_name;
};
// Push the P4Info for the instance under test.
EXPECT_OK(pdpi::SetForwardingPipelineConfig(
p4rt_session_.get(),
p4::v1::SetForwardingPipelineConfigRequest::RECONCILE_AND_COMMIT,
p4_info));
// Go through all match fields for the table definitions looking for composite
// UDF fields.
std::vector<AppDbField> composite_udf_fields;
for (const auto& [table_name, table_def] : ir_p4_info.tables_by_name()) {
for (const auto& [match_field_name, match_field_def] :
table_def.match_fields_by_name()) {
if (!IsCompositeUdfMatchField(match_field_def)) continue;
LOG(INFO) << "Found composite UDF: " << match_field_def.DebugString();
composite_udf_fields.push_back({
.table_name = absl::StrCat(absl::StrCat(APP_P4RT_ACL_TABLE_DEFINITION_NAME, ":", "ACL_"),
absl::AsciiStrToUpper(table_name)),
.field_name = absl::StrCat("match/", match_field_name),
});
}
}
// Ensure all the identified fields are using a HEX_STRING.
for (const AppDbField& app_db_field : composite_udf_fields) {
ASSERT_OK_AND_ASSIGN(auto app_db_definition,
p4rt_service_.GetP4rtAppDbTable().ReadTableEntry(
app_db_field.table_name));
ASSERT_THAT(app_db_definition, Contains(Key(app_db_field.field_name)));
const std::string& composite_udf_field =
app_db_definition.at(app_db_field.field_name);
EXPECT_THAT(composite_udf_field, HasJsonObject("format", "HEX_STRING"));
}
}
INSTANTIATE_TEST_SUITE_P(
P4ProgramsTestInstance, P4ProgramsTest,
testing::ValuesIn(sai::AllInstantiations()),
[](const testing::TestParamInfo<P4ProgramsTest::ParamType>& param) {
return sai::InstantiationToString(param.param);
});
} // namespace
} // namespace p4rt_app
| 38.727891 | 99 | 0.717899 | [
"object",
"vector"
] |
0e6d7e4bd46bdd9202a8fe4599098f2a223e6751 | 8,187 | cxx | C++ | GUISupport/Qt/Testing/Cxx/TestLineSeries.cxx | Lin1225/vtk_v5.10.0 | b54ac74f4716572862365fbff28cd0ecb8d08c3d | [
"BSD-3-Clause"
] | 2 | 2015-07-11T13:30:23.000Z | 2017-12-19T05:23:38.000Z | GUISupport/Qt/Testing/Cxx/TestLineSeries.cxx | Armand0s/homemade_vtk | 6bc7b595a4a7f86e8fa969d067360450fa4e0a6a | [
"BSD-3-Clause"
] | null | null | null | GUISupport/Qt/Testing/Cxx/TestLineSeries.cxx | Armand0s/homemade_vtk | 6bc7b595a4a7f86e8fa969d067360450fa4e0a6a | [
"BSD-3-Clause"
] | 5 | 2015-03-23T21:13:19.000Z | 2022-01-03T11:15:39.000Z | /*=========================================================================
Program: Visualization Toolkit
Module: TestLineSeries.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-------------------------------------------------------------------------
Copyright 2008 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
#ifdef _MSC_VER
// Disable warnings that Qt headers give.
#pragma warning(disable:4127)
#endif
#include "vtkQtChartArea.h"
#include "vtkQtChartAxis.h"
#include "vtkQtChartAxisLayer.h"
#include "vtkQtChartAxisModel.h"
#include "vtkQtChartInteractor.h"
#include "vtkQtChartInteractorSetup.h"
#include "vtkQtChartKeyboardFunction.h"
#include "vtkQtChartLegend.h"
#include "vtkQtChartLegendManager.h"
#include "vtkQtChartMouseSelection.h"
#include "vtkQtChartSeriesModelCollection.h"
#include "vtkQtChartSeriesSelectionHandler.h"
#include "vtkQtChartTableSeriesModel.h"
#include "vtkQtChartWidget.h"
#include "vtkQtLineChart.h"
#include "vtkQtChartSeriesOptions.h"
#include <QStandardItemModel>
#include <QVariant>
#include <QFile>
#include <QFileDialog>
#include "QTestApp.h"
class LineChartFileOpener : public vtkQtChartKeyboardFunction
{
public:
LineChartFileOpener(QObject *parent=0);
virtual ~LineChartFileOpener() {}
virtual void activate();
public:
vtkQtChartTableSeriesModel *Model;
};
LineChartFileOpener::LineChartFileOpener(QObject *parentObject)
: vtkQtChartKeyboardFunction(parentObject)
{
this->Model = 0;
}
void LineChartFileOpener::activate()
{
// Get the file from the user.
QString fileName = QFileDialog::getOpenFileName(0, "Open Chart File",
QString(), "Chart Files (*.csv)");
if(!fileName.isEmpty())
{
// Clear the current chart model.
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(
this->Model->getItemModel());
if(model)
{
this->Model->setItemModel(0);
delete model;
}
// Open the file.
QFile movies(fileName);
if(movies.open(QIODevice::ReadOnly))
{
// Create a new item model for the file.
model = new QStandardItemModel(0, 0, this->Model);
model->setItemPrototype(new QStandardItem());
// Read in the file data.
for(int row = -1; movies.bytesAvailable() > 0; ++row)
{
QString line = movies.readLine(256);
QStringList tokens = line.trimmed().split(",");
QStringList::Iterator iter = tokens.begin();
for(int column = -1; iter != tokens.end(); ++iter, ++column)
{
if(row == -1)
{
if(column == -1)
{
continue;
}
model->setHorizontalHeaderItem(column, new QStandardItem());
model->horizontalHeaderItem(column)->setData(QVariant(*iter),
Qt::DisplayRole);
}
else if(column == -1)
{
model->setVerticalHeaderItem(row, new QStandardItem());
model->verticalHeaderItem(row)->setData(QVariant(iter->toInt()),
Qt::DisplayRole);
}
else
{
model->setItem(row, column, new QStandardItem());
model->item(row, column)->setData(QVariant(iter->toDouble()),
Qt::DisplayRole);
}
}
}
// Set the new model in the chart.
this->Model->setItemModel(model);
}
}
}
class LineChartFileReseter : public vtkQtChartKeyboardFunction
{
public:
LineChartFileReseter(QObject *parent=0);
virtual ~LineChartFileReseter() {}
virtual void activate();
public:
vtkQtChartTableSeriesModel *Model;
};
LineChartFileReseter::LineChartFileReseter(QObject *parentObject)
: vtkQtChartKeyboardFunction(parentObject)
{
this->Model = 0;
}
void LineChartFileReseter::activate()
{
// Clear the current chart model.
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(
this->Model->getItemModel());
if(model)
{
this->Model->setItemModel(0);
delete model;
}
// Create a new item model for the file.
model = new QStandardItemModel(3, 2, this->Model);
model->setItemPrototype(new QStandardItem());
model->setVerticalHeaderItem(0, new QStandardItem());
model->setVerticalHeaderItem(1, new QStandardItem());
model->setVerticalHeaderItem(2, new QStandardItem());
model->verticalHeaderItem(0)->setData(0.0, Qt::DisplayRole);
model->verticalHeaderItem(1)->setData(1.0, Qt::DisplayRole);
model->verticalHeaderItem(2)->setData(2.0, Qt::DisplayRole);
model->setHorizontalHeaderItem(0, new QStandardItem("series 1"));
model->setHorizontalHeaderItem(1, new QStandardItem("series 2"));
model->setItem(0, 0, new QStandardItem());
model->setItem(1, 0, new QStandardItem());
model->setItem(2, 0, new QStandardItem());
model->item(0, 0)->setData(0.5, Qt::DisplayRole);
model->item(1, 0)->setData(0.4, Qt::DisplayRole);
model->item(2, 0)->setData(0.6, Qt::DisplayRole);
model->setItem(0, 1, new QStandardItem());
model->setItem(1, 1, new QStandardItem());
model->setItem(2, 1, new QStandardItem());
model->item(0, 1)->setData(0.4, Qt::DisplayRole);
model->item(1, 1)->setData(0.5, Qt::DisplayRole);
model->item(2, 1)->setData(0.4, Qt::DisplayRole);
// Set the new model in the chart.
this->Model->setItemModel(model);
}
int TestLineSeries(int argc, char* argv[])
{
QTestApp app(argc, argv);
vtkQtChartWidget *chart = new vtkQtChartWidget();
vtkQtChartArea *area = chart->getChartArea();
vtkQtLineChart* line = new vtkQtLineChart();
area->addLayer(line);
// Set up the legend.
vtkQtChartLegend *legend = new vtkQtChartLegend();
vtkQtChartLegendManager *manager = new vtkQtChartLegendManager(legend);
manager->setChartLegend(legend);
manager->setChartArea(area);
chart->setLegend(legend);
// Set up the default interactor.
vtkQtChartMouseSelection *selector =
vtkQtChartInteractorSetup::createDefault(area);
vtkQtChartSeriesSelectionHandler *handler =
new vtkQtChartSeriesSelectionHandler(selector);
handler->setModeNames("Line Chart - Series", "Line Chart - Points");
handler->setMousePressModifiers(Qt::ControlModifier, Qt::ControlModifier);
handler->setLayer(line);
selector->addHandler(handler);
selector->setSelectionMode("Line Chart - Points");
vtkQtChartInteractorSetup::setupDefaultKeys(area->getInteractor());
// Add the file opener to the interactor.
vtkQtChartInteractor *interactor = area->getInteractor();
LineChartFileOpener *opener = new LineChartFileOpener(interactor);
interactor->addKeyboardFunction(
QKeySequence(Qt::Key_O | Qt::ControlModifier), opener);
LineChartFileReseter *reseter = new LineChartFileReseter(interactor);
interactor->addKeyboardFunction(
QKeySequence(Qt::Key_N | Qt::ControlModifier), reseter);
// Set up the chart table model.
vtkQtChartTableSeriesModel *adaptor =
new vtkQtChartTableSeriesModel(0, line);
opener->Model = adaptor;
reseter->Model = adaptor;
// Add the default model to the chart.
reseter->activate();
// For fun, add the table model to a collection.
vtkQtChartSeriesModelCollection *collection =
new vtkQtChartSeriesModelCollection(line);
collection->addSeriesModel(adaptor);
line->setModel(collection);
vtkQtChartSeriesOptions *opts = line->getSeriesOptions(0);
opts->setMarkerStyle(vtkQtPointMarker::Circle);
opts = line->getSeriesOptions(1);
opts->setMarkerStyle(vtkQtPointMarker::Diamond);
opts->setMarkerSize(QSizeF(7.0, 7.0));
chart->show();
int status = app.exec();
delete chart;
return status;
}
| 31.129278 | 76 | 0.668743 | [
"model"
] |
0e6e13377047e0813d0c3812e0fb1c38d01c82ae | 641 | cpp | C++ | contests/Codeforces Round #599 Div 2/Maximum_square.cpp | Razdeep/Codeforces-Solutions | e808575219ec15bc07720d6abafe3c4c8df036f4 | [
"MIT"
] | 2 | 2020-08-27T18:21:04.000Z | 2020-08-30T13:24:39.000Z | contests/Codeforces Round #599 Div 2/Maximum_square.cpp | Razdeep/Codeforces-Solutions | e808575219ec15bc07720d6abafe3c4c8df036f4 | [
"MIT"
] | null | null | null | contests/Codeforces Round #599 Div 2/Maximum_square.cpp | Razdeep/Codeforces-Solutions | e808575219ec15bc07720d6abafe3c4c8df036f4 | [
"MIT"
] | null | null | null | // https://codeforces.com/contest/1243/problem/A
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
int main()
{
int tc;
cin >> tc;
while(tc--)
{
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; ++i)
cin >> arr[i];
int ans = INT_MIN;
for (int len = 1; len <= 1000; ++len)
{
int cnt = 0;
for (int i = 0; i < int(arr.size()); ++i)
cnt += (arr[i] >= len);
if (cnt >= len)
ans = max(ans, len);
}
cout << ans << endl;
}
return 0;
} | 22.103448 | 53 | 0.416537 | [
"vector"
] |
0e73ccb63a0fa965d5a85a22bafdc66c90281cb1 | 2,517 | cpp | C++ | aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp | Neusoft-Technology-Solutions/aws-sdk-cpp | 88c041828b0dbee18a297c3cfe98c5ecd0706d0b | [
"Apache-2.0"
] | 1 | 2022-02-12T08:09:30.000Z | 2022-02-12T08:09:30.000Z | aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp | Neusoft-Technology-Solutions/aws-sdk-cpp | 88c041828b0dbee18a297c3cfe98c5ecd0706d0b | [
"Apache-2.0"
] | 1 | 2021-10-14T16:57:00.000Z | 2021-10-18T10:47:24.000Z | aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp | ravindra-wagh/aws-sdk-cpp | 7d5ff01b3c3b872f31ca98fb4ce868cd01e97696 | [
"Apache-2.0"
] | 1 | 2021-11-09T11:58:03.000Z | 2021-11-09T11:58:03.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/support/model/TrustedAdvisorResourcesSummary.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Support
{
namespace Model
{
TrustedAdvisorResourcesSummary::TrustedAdvisorResourcesSummary() :
m_resourcesProcessed(0),
m_resourcesProcessedHasBeenSet(false),
m_resourcesFlagged(0),
m_resourcesFlaggedHasBeenSet(false),
m_resourcesIgnored(0),
m_resourcesIgnoredHasBeenSet(false),
m_resourcesSuppressed(0),
m_resourcesSuppressedHasBeenSet(false)
{
}
TrustedAdvisorResourcesSummary::TrustedAdvisorResourcesSummary(JsonView jsonValue) :
m_resourcesProcessed(0),
m_resourcesProcessedHasBeenSet(false),
m_resourcesFlagged(0),
m_resourcesFlaggedHasBeenSet(false),
m_resourcesIgnored(0),
m_resourcesIgnoredHasBeenSet(false),
m_resourcesSuppressed(0),
m_resourcesSuppressedHasBeenSet(false)
{
*this = jsonValue;
}
TrustedAdvisorResourcesSummary& TrustedAdvisorResourcesSummary::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("resourcesProcessed"))
{
m_resourcesProcessed = jsonValue.GetInt64("resourcesProcessed");
m_resourcesProcessedHasBeenSet = true;
}
if(jsonValue.ValueExists("resourcesFlagged"))
{
m_resourcesFlagged = jsonValue.GetInt64("resourcesFlagged");
m_resourcesFlaggedHasBeenSet = true;
}
if(jsonValue.ValueExists("resourcesIgnored"))
{
m_resourcesIgnored = jsonValue.GetInt64("resourcesIgnored");
m_resourcesIgnoredHasBeenSet = true;
}
if(jsonValue.ValueExists("resourcesSuppressed"))
{
m_resourcesSuppressed = jsonValue.GetInt64("resourcesSuppressed");
m_resourcesSuppressedHasBeenSet = true;
}
return *this;
}
JsonValue TrustedAdvisorResourcesSummary::Jsonize() const
{
JsonValue payload;
if(m_resourcesProcessedHasBeenSet)
{
payload.WithInt64("resourcesProcessed", m_resourcesProcessed);
}
if(m_resourcesFlaggedHasBeenSet)
{
payload.WithInt64("resourcesFlagged", m_resourcesFlagged);
}
if(m_resourcesIgnoredHasBeenSet)
{
payload.WithInt64("resourcesIgnored", m_resourcesIgnored);
}
if(m_resourcesSuppressedHasBeenSet)
{
payload.WithInt64("resourcesSuppressed", m_resourcesSuppressed);
}
return payload;
}
} // namespace Model
} // namespace Support
} // namespace Aws
| 22.274336 | 94 | 0.762416 | [
"model"
] |
0e7592c13361054b38161e56d602ebd1ac517d9a | 13,263 | cc | C++ | ui/events/keycodes/dom/dom_keyboard_layout_map_unittest.cc | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | ui/events/keycodes/dom/dom_keyboard_layout_map_unittest.cc | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | ui/events/keycodes/dom/dom_keyboard_layout_map_unittest.cc | iridium-browser/iridium-browser | 907e31cf5ce5ad14d832796e3a7c11e496828959 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <vector>
#include "base/check_op.h"
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/notreached.h"
#include "base/stl_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/dom/dom_keyboard_layout.h"
#include "ui/events/keycodes/dom/dom_keyboard_layout_manager.h"
#include "ui/events/keycodes/dom/dom_keyboard_layout_map_base.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
namespace ui {
namespace {
// Represents a keyboard layout where every key is ASCII capable.
constexpr uint32_t kKeyboardLayoutWithAllValidKeys = 1;
// Layout contains all valid keys so this number represents a complete layout.
constexpr uint32_t kKeyboardLayoutWithAllValidKeysCount = 50;
// Represents a keyboard layout where every alpha key is ASCII capable.
constexpr uint32_t kKeyboardLayoutWithAllValidAlphaKeys = 2;
// Layout contains all valid alpha keys so this number represents a complete
// layout minus two INTL keys which are subbed.
constexpr uint32_t kKeyboardLayoutWithAllValidAlphaKeysCount = 48;
// Represents a keyboard layout where some alpha keys are ASCII capable.
constexpr uint32_t kKeyboardLayoutWithSomeValidKeys = 3;
// The mostly valid keyboard does not pass the 'IsAsciiCapable()' test however
// the DomKeyboardLayoutManager will pass the first layout it has if it doesn't
// find an ASCII capable layout first.
constexpr uint32_t kKeyboardLayoutWithSomeValidKeysCount = 47;
// Represents a keyboard layout where no alpha keys are ASCII capable.
constexpr uint32_t kKeyboardLayoutWithNoValidKeys = 4;
constexpr uint32_t kKeyboardLayoutWithNoValidKeysCount = 0;
DomKey GetKeyFromFullLookupTable(DomCode dom_code) {
// Includes all DomCodes used in |writing_system_key_domcodes|. Tests can
// use this table to retrieve valid DomKeys for each DomCode to simulate a
// 'complete' keyboard layout. They can also use this to construct a partial
// layout with valid DomKey values for the populated entries.
static base::flat_map<DomCode, DomKey> kFullLookupTable(
{{DomCode::DIGIT0, DomKey::Constant<'0'>::Character},
{DomCode::DIGIT1, DomKey::Constant<'1'>::Character},
{DomCode::DIGIT2, DomKey::Constant<'2'>::Character},
{DomCode::DIGIT3, DomKey::Constant<'3'>::Character},
{DomCode::DIGIT4, DomKey::Constant<'4'>::Character},
{DomCode::DIGIT5, DomKey::Constant<'5'>::Character},
{DomCode::DIGIT6, DomKey::Constant<'6'>::Character},
{DomCode::DIGIT7, DomKey::Constant<'7'>::Character},
{DomCode::DIGIT8, DomKey::Constant<'8'>::Character},
{DomCode::DIGIT9, DomKey::Constant<'9'>::Character},
{DomCode::US_A, DomKey::Constant<'a'>::Character},
{DomCode::US_B, DomKey::Constant<'b'>::Character},
{DomCode::US_C, DomKey::Constant<'c'>::Character},
{DomCode::US_D, DomKey::Constant<'d'>::Character},
{DomCode::US_E, DomKey::Constant<'e'>::Character},
{DomCode::US_F, DomKey::Constant<'f'>::Character},
{DomCode::US_G, DomKey::Constant<'g'>::Character},
{DomCode::US_H, DomKey::Constant<'h'>::Character},
{DomCode::US_I, DomKey::Constant<'i'>::Character},
{DomCode::US_J, DomKey::Constant<'j'>::Character},
{DomCode::US_K, DomKey::Constant<'k'>::Character},
{DomCode::US_L, DomKey::Constant<'l'>::Character},
{DomCode::US_M, DomKey::Constant<'m'>::Character},
{DomCode::US_N, DomKey::Constant<'n'>::Character},
{DomCode::US_O, DomKey::Constant<'o'>::Character},
{DomCode::US_P, DomKey::Constant<'p'>::Character},
{DomCode::US_Q, DomKey::Constant<'q'>::Character},
{DomCode::US_R, DomKey::Constant<'r'>::Character},
{DomCode::US_S, DomKey::Constant<'s'>::Character},
{DomCode::US_T, DomKey::Constant<'t'>::Character},
{DomCode::US_U, DomKey::Constant<'u'>::Character},
{DomCode::US_V, DomKey::Constant<'v'>::Character},
{DomCode::US_W, DomKey::Constant<'w'>::Character},
{DomCode::US_X, DomKey::Constant<'x'>::Character},
{DomCode::US_Y, DomKey::Constant<'y'>::Character},
{DomCode::US_Z, DomKey::Constant<'z'>::Character},
{DomCode::BACKQUOTE, DomKey::Constant<'`'>::Character},
{DomCode::MINUS, DomKey::Constant<'-'>::Character},
{DomCode::EQUAL, DomKey::Constant<'='>::Character},
{DomCode::INTL_YEN, DomKey::Constant<0x00A5>::Dead},
{DomCode::BRACKET_LEFT, DomKey::Constant<'{'>::Character},
{DomCode::BRACKET_RIGHT, DomKey::Constant<'}'>::Character},
{DomCode::BACKSLASH, DomKey::Constant<'\\'>::Character},
{DomCode::SEMICOLON, DomKey::Constant<';'>::Character},
{DomCode::QUOTE, DomKey::Constant<'\''>::Character},
{DomCode::INTL_BACKSLASH, DomKey::Constant<'/'>::Character},
{DomCode::COMMA, DomKey::Constant<','>::Character},
{DomCode::PERIOD, DomKey::Constant<'.'>::Character},
{DomCode::SLASH, DomKey::Constant<'/'>::Character},
{DomCode::INTL_RO, DomKey::Constant<0x308D>::Dead}});
// Ensure the 'full' lookup table contains the same number of elements as the
// writing system table used by the class under test. Ideally this would be a
// static assert however that doesn't work since the other table is in a
// different compilation unit.
DCHECK_EQ(base::size(kFullLookupTable), kWritingSystemKeyDomCodeEntries);
if (kFullLookupTable.count(dom_code) == 0)
return DomKey::NONE;
return kFullLookupTable[dom_code];
}
DomKey GetKeyFromCombiningLayoutTable(DomCode dom_code) {
// Used for testing combining keys in both printable and combining forms.
static base::flat_map<DomCode, DomKey> kCombiningLayoutTable({
// Grave, combining.
{DomCode::DIGIT0, DomKey::Constant<0x0300>::Dead},
// Grave, printable.
{DomCode::DIGIT1, DomKey::Constant<0x0060>::Character},
// Acute, combining.
{DomCode::DIGIT2, DomKey::Constant<0x0301>::Dead},
// Acute, printable.
{DomCode::DIGIT3, DomKey::Constant<0x0027>::Character},
// Circumflex, combining.
{DomCode::DIGIT4, DomKey::Constant<0x0302>::Dead},
// Circumflex, printable.
{DomCode::DIGIT5, DomKey::Constant<0x005e>::Character},
// Tilde, combining.
{DomCode::DIGIT6, DomKey::Constant<0x0303>::Dead},
// Tilde, printable.
{DomCode::DIGIT7, DomKey::Constant<0x007e>::Character},
// Diaeresis, combining.
{DomCode::DIGIT8, DomKey::Constant<0x0308>::Dead},
// Diaeresis, printable.
{DomCode::DIGIT9, DomKey::Constant<0x00a8>::Character},
});
if (kCombiningLayoutTable.count(dom_code) == 0)
return DomKey::NONE;
return kCombiningLayoutTable[dom_code];
}
} // namespace
class TestDomKeyboardLayoutMap : public DomKeyboardLayoutMapBase {
public:
TestDomKeyboardLayoutMap();
~TestDomKeyboardLayoutMap() override;
// DomKeyboardLayoutMapBase overrides.
uint32_t GetKeyboardLayoutCount() override;
DomKey GetDomKeyFromDomCodeForLayout(DomCode dom_code,
uint32_t keyboard_layout_id) override;
// Adds a new keyboard layout in FIFO order.
void AddKeyboardLayout(uint32_t test_layout_id);
private:
// Helper methods used to populate a layout for testing.
DomKey GetDomKeyForLayoutWithAllValidKeys(DomCode dom_code);
DomKey GetDomKeyForLayoutWithAllValidAlphaKeys(DomCode dom_code);
DomKey GetDomKeyForLayoutWithSomeValidKeys(DomCode dom_code);
DomKey GetDomKeyForLayoutWithNoValidKeys();
std::vector<uint32_t> test_keyboard_layouts_;
DISALLOW_COPY_AND_ASSIGN(TestDomKeyboardLayoutMap);
};
TestDomKeyboardLayoutMap::TestDomKeyboardLayoutMap() = default;
TestDomKeyboardLayoutMap::~TestDomKeyboardLayoutMap() = default;
uint32_t TestDomKeyboardLayoutMap::GetKeyboardLayoutCount() {
return test_keyboard_layouts_.size();
}
DomKey TestDomKeyboardLayoutMap::GetDomKeyFromDomCodeForLayout(
DomCode dom_code,
uint32_t keyboard_layout_id) {
uint32_t test_layout_id = test_keyboard_layouts_[keyboard_layout_id];
if (test_layout_id == kKeyboardLayoutWithAllValidKeys)
return GetDomKeyForLayoutWithAllValidKeys(dom_code);
if (test_layout_id == kKeyboardLayoutWithAllValidAlphaKeys)
return GetDomKeyForLayoutWithAllValidAlphaKeys(dom_code);
if (test_layout_id == kKeyboardLayoutWithSomeValidKeys)
return GetDomKeyForLayoutWithSomeValidKeys(dom_code);
if (test_layout_id == kKeyboardLayoutWithNoValidKeys)
return GetDomKeyForLayoutWithNoValidKeys();
NOTREACHED();
return DomKey::NONE;
}
void TestDomKeyboardLayoutMap::AddKeyboardLayout(uint32_t test_layout_id) {
test_keyboard_layouts_.push_back(test_layout_id);
}
DomKey TestDomKeyboardLayoutMap::GetDomKeyForLayoutWithAllValidKeys(
DomCode dom_code) {
return GetKeyFromFullLookupTable(dom_code);
}
DomKey TestDomKeyboardLayoutMap::GetDomKeyForLayoutWithAllValidAlphaKeys(
DomCode dom_code) {
// If the number of excluded keys changes, please modify
// |kKeyboardLayoutWithAllValidAlphaKeysCount| to match the new value.
if (dom_code == DomCode::INTL_RO || dom_code == DomCode::INTL_YEN)
return DomKey::NONE;
// DIGIT 0 - 9 are overridden for combining char tests so use those here since
// this method only ensures the alpha keys are valid.
if (GetKeyFromCombiningLayoutTable(dom_code) != DomKey::NONE)
return GetKeyFromCombiningLayoutTable(dom_code);
return GetKeyFromFullLookupTable(dom_code);
}
DomKey TestDomKeyboardLayoutMap::GetDomKeyForLayoutWithSomeValidKeys(
DomCode dom_code) {
if (dom_code == DomCode::US_A || dom_code == DomCode::US_Z ||
dom_code == DomCode::BACKQUOTE)
return DomKey::NONE;
return GetKeyFromFullLookupTable(dom_code);
}
DomKey TestDomKeyboardLayoutMap::GetDomKeyForLayoutWithNoValidKeys() {
return DomKey::NONE;
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithZeroLayouts) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(0UL, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithCompletelyValidLayout) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithAllValidKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithAllValidKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithValidAlphaKeys) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(
kKeyboardLayoutWithAllValidAlphaKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithAllValidAlphaKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithMostlyValidAlphaKeys) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithSomeValidKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithSomeValidKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithNoValidKeys) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithNoValidKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithNoValidKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithValidLayoutFirst) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithAllValidKeys);
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithSomeValidKeys);
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithNoValidKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithAllValidKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithValidLayoutLast) {
TestDomKeyboardLayoutMap test_keyboard_layout_map;
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithSomeValidKeys);
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithNoValidKeys);
test_keyboard_layout_map.AddKeyboardLayout(kKeyboardLayoutWithAllValidKeys);
auto map = test_keyboard_layout_map.Generate();
ASSERT_EQ(kKeyboardLayoutWithAllValidKeysCount, map.size());
}
TEST(DomKeyboardLayoutMapTest, MapGenerationWithTwoValidLayouts) {
TestDomKeyboardLayoutMap test_keyboard_layout_map_1;
test_keyboard_layout_map_1.AddKeyboardLayout(kKeyboardLayoutWithAllValidKeys);
test_keyboard_layout_map_1.AddKeyboardLayout(
kKeyboardLayoutWithAllValidAlphaKeys);
auto map_1 = test_keyboard_layout_map_1.Generate();
EXPECT_EQ(kKeyboardLayoutWithAllValidKeysCount, map_1.size());
TestDomKeyboardLayoutMap test_keyboard_layout_map_2;
test_keyboard_layout_map_2.AddKeyboardLayout(
kKeyboardLayoutWithAllValidAlphaKeys);
test_keyboard_layout_map_2.AddKeyboardLayout(kKeyboardLayoutWithAllValidKeys);
auto map_2 = test_keyboard_layout_map_2.Generate();
EXPECT_EQ(kKeyboardLayoutWithAllValidAlphaKeysCount, map_2.size());
}
} // namespace ui
| 42.509615 | 80 | 0.756164 | [
"vector"
] |
0e7a27dde692ffdaea532569035fd878f8c12cde | 9,116 | cxx | C++ | SimVascular-master/Code/Source/sv3/Segmentation/sv3_SegmentationUtils.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | SimVascular-master/Code/Source/sv3/Segmentation/sv3_SegmentationUtils.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | SimVascular-master/Code/Source/sv3/Segmentation/sv3_SegmentationUtils.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | /* Copyright (c) Stanford University, The Regents of the University of
* California, and others.
*
* All Rights Reserved.
*
* See Copyright-SimVascular.txt for additional details.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "SimVascular.h"
#include "sv3_SegmentationUtils.h"
#include "sv_StrPts.h"
#include <vtkImageData.h>
#include <vtkStructuredPoints.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkImageReslice.h>
using sv3::SegmentationUtils;
double SV_PI=3.1415926535;
double math_radToDeg(double rad){
return rad*180.0/SV_PI;
}
double math_dot(double vecA[3], double vecB[3])
{
return vecA[0]*vecB[0]+vecA[1]*vecB[1]+vecA[2]*vecB[2];
}
void math_cross(double cross[3], double vecA[3], double vecB[3])
{
cross[0]=vecA[1]*vecB[2]-vecA[2]*vecB[1];
cross[1]=vecA[2]*vecB[0]-vecA[0]*vecB[2];
cross[2]=vecA[0]*vecB[1]-vecA[1]*vecB[0];
}
double math_magnitude(double vecA[3])
{
return sqrt(math_dot(vecA,vecA));
}
double math_angleBtw3DVectors(double vecA[3], double vecB[3])
{
double dot=math_dot(vecA, vecB);
double magA=math_magnitude(vecA);
double magB=math_magnitude(vecB);
double cosTheta=dot / (magA * magB);
if (cosTheta >= 1) {
cosTheta=1;
}
return acos(cosTheta);
}
cvStrPts* SegmentationUtils::vtkImageData2cvStrPts(vtkImageData* vtkImg)
{
vtkStructuredPoints *mysp = vtkStructuredPoints::New();
mysp->ShallowCopy(vtkImg);
int whole[6];
// int extent[6];
double *spacing, origin[3];
vtkImg->GetExtent(whole);
spacing = vtkImg->GetSpacing();
vtkImg->GetOrigin(origin);
origin[0] += spacing[0] * whole[0];
origin[1] += spacing[1] * whole[2];
whole[1] -= whole[0];
whole[3] -= whole[2];
whole[0] = 0;
whole[2] = 0;
// shift Z origin for 3-D images
// if (whole[4] > 0 && whole[5] > 0) {
origin[2] += spacing[2] * whole[4];
whole[5] -= whole[4];
whole[4] = 0;
// }
mysp->SetExtent(whole);
mysp->SetOrigin(origin);
mysp->SetSpacing(spacing);
cvStrPts *sp;
sp = new cvStrPts (mysp);
// mysp->Delete();
return sp;
}
std::deque<int> SegmentationUtils::GetOrderedPtIDs(vtkCellArray* lines, bool& ifClosed)
{
vtkIdType *ptIds;
vtkIdType npts;
lines->InitTraversal();
std::vector<std::vector<int>> lineList;
std::deque<int> linkedPtList;
while ( lines->GetNextCell( npts, ptIds ) ) {
if(npts!=2) break;
std::vector<int> ids;
ids.push_back(ptIds[0]);
ids.push_back(ptIds[1]);
lineList.push_back(ids);
}
bool firstTime=true;
while(lineList.size()>0)
{
if(firstTime)
{
linkedPtList.push_back(lineList[0][0]);
linkedPtList.push_back(lineList[0][1]);
lineList.erase(lineList.begin()+0);
firstTime=false;
}
else
{
int first=linkedPtList.front();
int last=linkedPtList.back();
bool firstLinked=false;
bool lastLinked=false;
for(int i=0;i<lineList.size();i++){
if(firstLinked&&lastLinked) break;
int id1=lineList[i][0];
int id2=lineList[i][1];
if(!firstLinked&&(first==id1||first==id2))
{
if(first==id1){
linkedPtList.push_front(id2);
}else{
linkedPtList.push_front(id1);
}
firstLinked=true;
lineList.erase(lineList.begin()+i);
i--;
continue;
} else if(!lastLinked&&(last==id1||last==id2))
{
if(last==id1){
linkedPtList.push_back(id2);
}else{
linkedPtList.push_back(id1);
}
lastLinked=true;
lineList.erase(lineList.begin()+i);
i--;
continue;
}
}
if(!firstLinked&&!lastLinked) break;
}
}
ifClosed=false;
if(linkedPtList.size()>0&&linkedPtList.front()==linkedPtList.back())
{
ifClosed=true;
linkedPtList.pop_back();
}
return linkedPtList;
}
vtkTransform* SegmentationUtils::GetvtkTransform(sv3::PathElement::PathPoint pathPoint)
{
double pos[3],nrm[3],xhat[3];
pos[0]=pathPoint.pos[0];
pos[1]=pathPoint.pos[1];
pos[2]=pathPoint.pos[2];
nrm[0]=pathPoint.tangent[0];
nrm[1]=pathPoint.tangent[1];
nrm[2]=pathPoint.tangent[2];
xhat[0]=pathPoint.rotation[0];
xhat[1]=pathPoint.rotation[1];
xhat[2]=pathPoint.rotation[2];
double zhat[3]={0,0,1};
double theta=math_radToDeg(math_angleBtw3DVectors(zhat,nrm));
double axis[3];
math_cross(axis,zhat,nrm);
vtkTransform* tmpTr=vtkTransform::New();
tmpTr->Identity();
tmpTr->RotateWXYZ(theta,axis);
vtkPoints* tmpPt=vtkPoints::New();
tmpPt->InsertNextPoint(1, 0, 0);
vtkPolyData* tmpPd=vtkPolyData::New();
tmpPd->SetPoints(tmpPt);
vtkTransformPolyDataFilter* tmpTf=vtkTransformPolyDataFilter::New();
tmpTf->SetInputDataObject(tmpPd);
tmpTf->SetTransform(tmpTr);
tmpTf->Update();
double pt[3];
tmpTf->GetOutput()->GetPoint(0,pt);
tmpTr->Delete();
tmpPt->Delete();
tmpPd->Delete();
tmpTf->Delete();
double rot=math_radToDeg(math_angleBtw3DVectors(pt,xhat));
double x[3];
math_cross(x,pt,xhat);
double d=math_dot(x,nrm);
if (d < 0.0) {
rot=-rot;
}
vtkTransform* tr=vtkTransform::New();
tr->Identity();
tr->Translate(pos);
tr->RotateWXYZ(rot,nrm);
tr->RotateWXYZ(theta,axis);
return tr;
}
vtkImageData* SegmentationUtils::GetSlicevtkImage(sv3::PathElement::PathPoint pathPoint, vtkImageData* volumeimage, double size)
{
vtkTransform* tr =GetvtkTransform(pathPoint);
vtkImageReslice* rs=vtkImageReslice::New();
double spacing[3];
volumeimage->GetSpacing(spacing);
double vmin=std::min(spacing[0],std::min(spacing[0],spacing[1]));
int width=size/vmin;
int height=size/vmin;
double pdimx=width*vmin;
double pdimy=height*vmin;
double ors[3];
ors[0]=-0.5*pdimx;
ors[1]=-0.5*pdimy;
ors[2]=0.0;
rs->SetInputDataObject(volumeimage);
rs->SetResliceTransform(tr);
rs->SetOutputSpacing(vmin,vmin,vmin);
rs->SetOutputOrigin(ors);
rs->SetOutputExtent(0,width-1,0,height-1,0,0);
rs->InterpolateOn();
rs->Update();
return rs->GetOutput();
}
vtkPlane* SegmentationUtils::CreatePlaneGeometry(sv3::PathElement::PathPoint pathPoint, std::array<double,3> spacing, double size)
{
vtkTransform* tr=GetvtkTransform(pathPoint);
vtkPlane* planegeometry = vtkPlane::New();
planegeometry->SetOrigin(pathPoint.pos[0],pathPoint.pos[1],pathPoint.pos[2]);
planegeometry->SetNormal(pathPoint.tangent[0],pathPoint.tangent[1],pathPoint.tangent[2]);
return planegeometry;
}
void SegmentationUtils::getOrthogonalVector(double normal[3], double vec[3])
{
if(normal[2]!=0.)
{
vec[0] = 1.;
vec[1] = 1.;
vec[2] = (0.-1.*normal[0]-1.*normal[1])/normal[2];
}
else if (normal[1]!=0.)
{
vec[0] = 1.;
vec[1] = (0.-1.*normal[0]-1.*normal[2])/normal[1];
vec[2] = 1.;
}
else if (normal[0]!=0.)
{
vec[0] = (0.-1.*normal[1]-1.*normal[2])/normal[0];
vec[1] = 1.;
vec[2] = 1.;
}
else
return;
double lth = sqrt(pow(vec[0],2)+pow(vec[1],2)+pow(vec[2],2));
vec[0]/=lth; vec[1]/=lth; vec[2]/=lth;
}
| 27.130952 | 130 | 0.610465 | [
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.