hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
8dc4c128dd04faf3388ec6339cfa11a79e53ed37
4,274
hxx
C++
include/rtkConditionalMedianImageFilter.hxx
kabcode/RTK
e5cbec4f2953abd3ba3bd1b5e7af30357af28674
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
include/rtkConditionalMedianImageFilter.hxx
kabcode/RTK
e5cbec4f2953abd3ba3bd1b5e7af30357af28674
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
include/rtkConditionalMedianImageFilter.hxx
kabcode/RTK
e5cbec4f2953abd3ba3bd1b5e7af30357af28674
[ "Apache-2.0", "BSD-3-Clause" ]
null
null
null
/*========================================================================= * * Copyright RTK Consortium * * 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. * *=========================================================================*/ #ifndef rtkConditionalMedianImageFilter_hxx #define rtkConditionalMedianImageFilter_hxx #include "rtkConditionalMedianImageFilter.h" #include <itkImageRegionIterator.h> #include <numeric> namespace rtk { // // Constructor // template <typename TInputImage> ConditionalMedianImageFilter<TInputImage>::ConditionalMedianImageFilter() { // Default parameters m_Radius.Fill(1); m_ThresholdMultiplier = 1; } template <typename TInputImage> void ConditionalMedianImageFilter<TInputImage>::GenerateInputRequestedRegion() { // Call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); // Compute the requested region typename TInputImage::RegionType inputRequested = this->GetOutput()->GetRequestedRegion(); typename TInputImage::SizeType requestedSize = inputRequested.GetSize(); typename TInputImage::IndexType requestedIndex = inputRequested.GetIndex(); // We need the previous projection to extract the noise, // and the neighboring pixels to compute its variance for (unsigned int dim = 0; dim < TInputImage::ImageDimension; dim++) { requestedSize[dim] += 2 * m_Radius[dim]; requestedIndex[dim] -= m_Radius[dim]; } inputRequested.SetSize(requestedSize); inputRequested.SetIndex(requestedIndex); // Crop the requested region to the LargestPossibleRegion inputRequested.Crop(this->GetInput()->GetLargestPossibleRegion()); // Get a pointer to the input and set the requested region typename TInputImage::Pointer inputPtr = const_cast<TInputImage *>(this->GetInput()); inputPtr->SetRequestedRegion(inputRequested); } template <typename TInputImage> void ConditionalMedianImageFilter<TInputImage> #if ITK_VERSION_MAJOR < 5 ::ThreadedGenerateData(const typename TInputImage::RegionType & outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) #else ::DynamicThreadedGenerateData(const typename TInputImage::RegionType & outputRegionForThread) #endif { // Compute the centered difference with the previous and next frames, store it into the intermediate image itk::ConstNeighborhoodIterator<TInputImage> nIt(m_Radius, this->GetInput(), outputRegionForThread); itk::ImageRegionIterator<TInputImage> outIt(this->GetOutput(), outputRegionForThread); // Build a vector in which all pixel of the neighborhood will be temporarily stored std::vector<typename TInputImage::PixelType> pixels; pixels.resize(nIt.Size()); // Walk the output image while (!outIt.IsAtEnd()) { // Walk the neighborhood in the input image, store the pixels into a vector for (unsigned int i = 0; i < nIt.Size(); i++) pixels[i] = nIt.GetPixel(i); // Compute the standard deviation double sum = std::accumulate(pixels.begin(), pixels.end(), 0.0); double mean = sum / pixels.size(); double sq_sum = std::inner_product(pixels.begin(), pixels.end(), pixels.begin(), 0.0); double stdev = std::sqrt(sq_sum / pixels.size() - mean * mean); // Compute the median of the neighborhood std::nth_element(pixels.begin(), pixels.begin() + pixels.size() / 2, pixels.end()); // If the pixel value is too far from the median, replace it by the median if (itk::Math::abs(pixels[pixels.size() / 2] - nIt.GetCenterPixel()) > (m_ThresholdMultiplier * stdev)) outIt.Set(pixels[pixels.size() / 2]); else // Otherwise, leave it as is outIt.Set(nIt.GetCenterPixel()); ++nIt; ++outIt; } } } // namespace rtk #endif
36.529915
108
0.703088
kabcode
44f0fb29baa82d0b25c0b908685d18206c7d6c03
675
cpp
C++
Krakoa/Source/Input/Input.cpp
KingKiller100/Krakatoa-Engine
ff07f7328d428c04e06b561b6afd315eea39865c
[ "Apache-2.0" ]
1
2020-04-05T13:37:48.000Z
2020-04-05T13:37:48.000Z
Krakoa/Source/Input/Input.cpp
KingKiller100/Krakoa-Engine
0f2a5a5109e256a384abe8dc21eacaa45c1de610
[ "Apache-2.0" ]
null
null
null
Krakoa/Source/Input/Input.cpp
KingKiller100/Krakoa-Engine
0f2a5a5109e256a384abe8dc21eacaa45c1de610
[ "Apache-2.0" ]
null
null
null
#include "Precompile.hpp" #include "Input.hpp" #include "InputManager.hpp" namespace krakoa::input { bool IsKeyPressed(KeyCode keycode) noexcept { return InputManager::IsKeyPressed(keycode); } bool IsKeyReleased(KeyCode keycode) noexcept { return InputManager::IsKeyReleased(keycode); } float GetMousePosX() noexcept { return InputManager::GetMousePosX(); } float GetMousePosY() noexcept { return InputManager::GetMousePosX(); } kmaths::Vector2f GetMousePosition() noexcept { return InputManager::GetMousePosition(); } bool IsMouseButtonPressed(MouseCode mouseCode) noexcept { return InputManager::IsMouseButtonPressed(mouseCode); } }
17.307692
56
0.752593
KingKiller100
44f45594b5f07f3d55c2b2d4ba97f59b01bdc956
29,586
hpp
C++
include/GlobalNamespace/PlayerSpecificSettings.hpp
marksteward/BeatSaber-Quest-Codegen
a76f063f71cef207a9f048ad7613835f554911a7
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/PlayerSpecificSettings.hpp
marksteward/BeatSaber-Quest-Codegen
a76f063f71cef207a9f048ad7613835f554911a7
[ "Unlicense" ]
null
null
null
include/GlobalNamespace/PlayerSpecificSettings.hpp
marksteward/BeatSaber-Quest-Codegen
a76f063f71cef207a9f048ad7613835f554911a7
[ "Unlicense" ]
null
null
null
// Autogenerated from CppHeaderCreator // Created by Sc2ad // ========================================================================= #pragma once // Begin includes #include "extern/beatsaber-hook/shared/utils/typedefs.h" #include "extern/beatsaber-hook/shared/utils/byref.hpp" // Including type: EnvironmentEffectsFilterPreset #include "GlobalNamespace/EnvironmentEffectsFilterPreset.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp" #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp" #include "extern/beatsaber-hook/shared/utils/utils.h" // Completed includes // Begin forward declares // Forward declaring namespace: System namespace System { // Forward declaring type: Nullable`1<T> template<typename T> struct Nullable_1; } // Completed forward declares // Type namespace: namespace GlobalNamespace { // Size: 0x3C #pragma pack(push, 1) // Autogenerated type: PlayerSpecificSettings // [TokenAttribute] Offset: FFFFFFFF class PlayerSpecificSettings : public ::Il2CppObject { public: // private System.Boolean _leftHanded // Size: 0x1 // Offset: 0x10 bool leftHanded; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: leftHanded and: playerHeight char __padding0[0x3] = {}; // private System.Single _playerHeight // Size: 0x4 // Offset: 0x14 float playerHeight; // Field size check static_assert(sizeof(float) == 0x4); // private System.Boolean _automaticPlayerHeight // Size: 0x1 // Offset: 0x18 bool automaticPlayerHeight; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: automaticPlayerHeight and: sfxVolume char __padding2[0x3] = {}; // private System.Single _sfxVolume // Size: 0x4 // Offset: 0x1C float sfxVolume; // Field size check static_assert(sizeof(float) == 0x4); // private System.Boolean _reduceDebris // Size: 0x1 // Offset: 0x20 bool reduceDebris; // Field size check static_assert(sizeof(bool) == 0x1); // private System.Boolean _noTextsAndHuds // Size: 0x1 // Offset: 0x21 bool noTextsAndHuds; // Field size check static_assert(sizeof(bool) == 0x1); // private System.Boolean _noFailEffects // Size: 0x1 // Offset: 0x22 bool noFailEffects; // Field size check static_assert(sizeof(bool) == 0x1); // private System.Boolean _advancedHud // Size: 0x1 // Offset: 0x23 bool advancedHud; // Field size check static_assert(sizeof(bool) == 0x1); // private System.Boolean _autoRestart // Size: 0x1 // Offset: 0x24 bool autoRestart; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: autoRestart and: saberTrailIntensity char __padding8[0x3] = {}; // private System.Single _saberTrailIntensity // Size: 0x4 // Offset: 0x28 float saberTrailIntensity; // Field size check static_assert(sizeof(float) == 0x4); // private System.Single _noteJumpStartBeatOffset // Size: 0x4 // Offset: 0x2C float noteJumpStartBeatOffset; // Field size check static_assert(sizeof(float) == 0x4); // private System.Boolean _hideNoteSpawnEffect // Size: 0x1 // Offset: 0x30 bool hideNoteSpawnEffect; // Field size check static_assert(sizeof(bool) == 0x1); // private System.Boolean _adaptiveSfx // Size: 0x1 // Offset: 0x31 bool adaptiveSfx; // Field size check static_assert(sizeof(bool) == 0x1); // Padding between fields: adaptiveSfx and: environmentEffectsFilterDefaultPreset char __padding12[0x2] = {}; // private EnvironmentEffectsFilterPreset _environmentEffectsFilterDefaultPreset // Size: 0x4 // Offset: 0x34 GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterDefaultPreset; // Field size check static_assert(sizeof(GlobalNamespace::EnvironmentEffectsFilterPreset) == 0x4); // private EnvironmentEffectsFilterPreset _environmentEffectsFilterExpertPlusPreset // Size: 0x4 // Offset: 0x38 GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterExpertPlusPreset; // Field size check static_assert(sizeof(GlobalNamespace::EnvironmentEffectsFilterPreset) == 0x4); // Creating value type constructor for type: PlayerSpecificSettings PlayerSpecificSettings(bool leftHanded_ = {}, float playerHeight_ = {}, bool automaticPlayerHeight_ = {}, float sfxVolume_ = {}, bool reduceDebris_ = {}, bool noTextsAndHuds_ = {}, bool noFailEffects_ = {}, bool advancedHud_ = {}, bool autoRestart_ = {}, float saberTrailIntensity_ = {}, float noteJumpStartBeatOffset_ = {}, bool hideNoteSpawnEffect_ = {}, bool adaptiveSfx_ = {}, GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterDefaultPreset_ = {}, GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterExpertPlusPreset_ = {}) noexcept : leftHanded{leftHanded_}, playerHeight{playerHeight_}, automaticPlayerHeight{automaticPlayerHeight_}, sfxVolume{sfxVolume_}, reduceDebris{reduceDebris_}, noTextsAndHuds{noTextsAndHuds_}, noFailEffects{noFailEffects_}, advancedHud{advancedHud_}, autoRestart{autoRestart_}, saberTrailIntensity{saberTrailIntensity_}, noteJumpStartBeatOffset{noteJumpStartBeatOffset_}, hideNoteSpawnEffect{hideNoteSpawnEffect_}, adaptiveSfx{adaptiveSfx_}, environmentEffectsFilterDefaultPreset{environmentEffectsFilterDefaultPreset_}, environmentEffectsFilterExpertPlusPreset{environmentEffectsFilterExpertPlusPreset_} {} // Get instance field: private System.Boolean _leftHanded bool _get__leftHanded(); // Set instance field: private System.Boolean _leftHanded void _set__leftHanded(bool value); // Get instance field: private System.Single _playerHeight float _get__playerHeight(); // Set instance field: private System.Single _playerHeight void _set__playerHeight(float value); // Get instance field: private System.Boolean _automaticPlayerHeight bool _get__automaticPlayerHeight(); // Set instance field: private System.Boolean _automaticPlayerHeight void _set__automaticPlayerHeight(bool value); // Get instance field: private System.Single _sfxVolume float _get__sfxVolume(); // Set instance field: private System.Single _sfxVolume void _set__sfxVolume(float value); // Get instance field: private System.Boolean _reduceDebris bool _get__reduceDebris(); // Set instance field: private System.Boolean _reduceDebris void _set__reduceDebris(bool value); // Get instance field: private System.Boolean _noTextsAndHuds bool _get__noTextsAndHuds(); // Set instance field: private System.Boolean _noTextsAndHuds void _set__noTextsAndHuds(bool value); // Get instance field: private System.Boolean _noFailEffects bool _get__noFailEffects(); // Set instance field: private System.Boolean _noFailEffects void _set__noFailEffects(bool value); // Get instance field: private System.Boolean _advancedHud bool _get__advancedHud(); // Set instance field: private System.Boolean _advancedHud void _set__advancedHud(bool value); // Get instance field: private System.Boolean _autoRestart bool _get__autoRestart(); // Set instance field: private System.Boolean _autoRestart void _set__autoRestart(bool value); // Get instance field: private System.Single _saberTrailIntensity float _get__saberTrailIntensity(); // Set instance field: private System.Single _saberTrailIntensity void _set__saberTrailIntensity(float value); // Get instance field: private System.Single _noteJumpStartBeatOffset float _get__noteJumpStartBeatOffset(); // Set instance field: private System.Single _noteJumpStartBeatOffset void _set__noteJumpStartBeatOffset(float value); // Get instance field: private System.Boolean _hideNoteSpawnEffect bool _get__hideNoteSpawnEffect(); // Set instance field: private System.Boolean _hideNoteSpawnEffect void _set__hideNoteSpawnEffect(bool value); // Get instance field: private System.Boolean _adaptiveSfx bool _get__adaptiveSfx(); // Set instance field: private System.Boolean _adaptiveSfx void _set__adaptiveSfx(bool value); // Get instance field: private EnvironmentEffectsFilterPreset _environmentEffectsFilterDefaultPreset GlobalNamespace::EnvironmentEffectsFilterPreset _get__environmentEffectsFilterDefaultPreset(); // Set instance field: private EnvironmentEffectsFilterPreset _environmentEffectsFilterDefaultPreset void _set__environmentEffectsFilterDefaultPreset(GlobalNamespace::EnvironmentEffectsFilterPreset value); // Get instance field: private EnvironmentEffectsFilterPreset _environmentEffectsFilterExpertPlusPreset GlobalNamespace::EnvironmentEffectsFilterPreset _get__environmentEffectsFilterExpertPlusPreset(); // Set instance field: private EnvironmentEffectsFilterPreset _environmentEffectsFilterExpertPlusPreset void _set__environmentEffectsFilterExpertPlusPreset(GlobalNamespace::EnvironmentEffectsFilterPreset value); // public System.Boolean get_leftHanded() // Offset: 0x1F58D54 bool get_leftHanded(); // public System.Single get_playerHeight() // Offset: 0x1F58D5C float get_playerHeight(); // public System.Boolean get_automaticPlayerHeight() // Offset: 0x1F58D64 bool get_automaticPlayerHeight(); // public System.Single get_sfxVolume() // Offset: 0x1F58D6C float get_sfxVolume(); // public System.Boolean get_reduceDebris() // Offset: 0x1F58D74 bool get_reduceDebris(); // public System.Boolean get_noTextsAndHuds() // Offset: 0x1F58D7C bool get_noTextsAndHuds(); // public System.Boolean get_noFailEffects() // Offset: 0x1F58D84 bool get_noFailEffects(); // public System.Boolean get_advancedHud() // Offset: 0x1F58D8C bool get_advancedHud(); // public System.Boolean get_autoRestart() // Offset: 0x1F58D94 bool get_autoRestart(); // public System.Single get_saberTrailIntensity() // Offset: 0x1F58D9C float get_saberTrailIntensity(); // public System.Single get_noteJumpStartBeatOffset() // Offset: 0x1F58DA4 float get_noteJumpStartBeatOffset(); // public System.Boolean get_hideNoteSpawnEffect() // Offset: 0x1F58DAC bool get_hideNoteSpawnEffect(); // public System.Boolean get_adaptiveSfx() // Offset: 0x1F58DB4 bool get_adaptiveSfx(); // public EnvironmentEffectsFilterPreset get_environmentEffectsFilterDefaultPreset() // Offset: 0x1F58DBC GlobalNamespace::EnvironmentEffectsFilterPreset get_environmentEffectsFilterDefaultPreset(); // public EnvironmentEffectsFilterPreset get_environmentEffectsFilterExpertPlusPreset() // Offset: 0x1F58DC4 GlobalNamespace::EnvironmentEffectsFilterPreset get_environmentEffectsFilterExpertPlusPreset(); // public System.Void .ctor(System.Boolean leftHanded, System.Single playerHeight, System.Boolean automaticPlayerHeight, System.Single sfxVolume, System.Boolean reduceDebris, System.Boolean noTextsAndHuds, System.Boolean noFailEffects, System.Boolean advancedHud, System.Boolean autoRestart, System.Single saberTrailIntensity, System.Single noteJumpStartBeatOffset, System.Boolean hideNoteSpawnEffect, System.Boolean adaptiveSfx, EnvironmentEffectsFilterPreset environmentEffectsFilterDefaultPreset, EnvironmentEffectsFilterPreset environmentEffectsFilterExpertPlusPreset) // Offset: 0x1F55A94 template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static PlayerSpecificSettings* New_ctor(bool leftHanded, float playerHeight, bool automaticPlayerHeight, float sfxVolume, bool reduceDebris, bool noTextsAndHuds, bool noFailEffects, bool advancedHud, bool autoRestart, float saberTrailIntensity, float noteJumpStartBeatOffset, bool hideNoteSpawnEffect, bool adaptiveSfx, GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterDefaultPreset, GlobalNamespace::EnvironmentEffectsFilterPreset environmentEffectsFilterExpertPlusPreset) { static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::PlayerSpecificSettings::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<PlayerSpecificSettings*, creationType>(leftHanded, playerHeight, automaticPlayerHeight, sfxVolume, reduceDebris, noTextsAndHuds, noFailEffects, advancedHud, autoRestart, saberTrailIntensity, noteJumpStartBeatOffset, hideNoteSpawnEffect, adaptiveSfx, environmentEffectsFilterDefaultPreset, environmentEffectsFilterExpertPlusPreset))); } // public PlayerSpecificSettings CopyWith(System.Nullable`1<System.Boolean> leftHanded, System.Nullable`1<System.Single> playerHeight, System.Nullable`1<System.Boolean> automaticPlayerHeight, System.Nullable`1<System.Single> sfxVolume, System.Nullable`1<System.Boolean> reduceDebris, System.Nullable`1<System.Boolean> noTextsAndHuds, System.Nullable`1<System.Boolean> noFailEffects, System.Nullable`1<System.Boolean> advancedHud, System.Nullable`1<System.Boolean> autoRestart, System.Nullable`1<System.Single> saberTrailIntensity, System.Nullable`1<System.Single> noteJumpStartBeatOffset, System.Nullable`1<System.Boolean> hideNoteSpawnEffect, System.Nullable`1<System.Boolean> adaptiveSfx, System.Nullable`1<EnvironmentEffectsFilterPreset> environmentEffectsFilterDefaultPreset, System.Nullable`1<EnvironmentEffectsFilterPreset> environmentEffectsFilterExpertPlusPreset) // Offset: 0x1F55DC0 GlobalNamespace::PlayerSpecificSettings* CopyWith(System::Nullable_1<bool> leftHanded, System::Nullable_1<float> playerHeight, System::Nullable_1<bool> automaticPlayerHeight, System::Nullable_1<float> sfxVolume, System::Nullable_1<bool> reduceDebris, System::Nullable_1<bool> noTextsAndHuds, System::Nullable_1<bool> noFailEffects, System::Nullable_1<bool> advancedHud, System::Nullable_1<bool> autoRestart, System::Nullable_1<float> saberTrailIntensity, System::Nullable_1<float> noteJumpStartBeatOffset, System::Nullable_1<bool> hideNoteSpawnEffect, System::Nullable_1<bool> adaptiveSfx, System::Nullable_1<GlobalNamespace::EnvironmentEffectsFilterPreset> environmentEffectsFilterDefaultPreset, System::Nullable_1<GlobalNamespace::EnvironmentEffectsFilterPreset> environmentEffectsFilterExpertPlusPreset); // public System.Void .ctor() // Offset: 0x1F52620 // Implemented from: System.Object // Base method: System.Void Object::.ctor() template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary> static PlayerSpecificSettings* New_ctor() { static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::PlayerSpecificSettings::.ctor"); return THROW_UNLESS((::il2cpp_utils::New<PlayerSpecificSettings*, creationType>())); } }; // PlayerSpecificSettings #pragma pack(pop) static check_size<sizeof(PlayerSpecificSettings), 56 + sizeof(GlobalNamespace::EnvironmentEffectsFilterPreset)> __GlobalNamespace_PlayerSpecificSettingsSizeCheck; static_assert(sizeof(PlayerSpecificSettings) == 0x3C); } DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::PlayerSpecificSettings*, "", "PlayerSpecificSettings"); #include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp" // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_leftHanded // Il2CppName: get_leftHanded template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_leftHanded)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_leftHanded", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_playerHeight // Il2CppName: get_playerHeight template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_playerHeight)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_playerHeight", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_automaticPlayerHeight // Il2CppName: get_automaticPlayerHeight template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_automaticPlayerHeight)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_automaticPlayerHeight", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_sfxVolume // Il2CppName: get_sfxVolume template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_sfxVolume)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_sfxVolume", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_reduceDebris // Il2CppName: get_reduceDebris template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_reduceDebris)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_reduceDebris", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_noTextsAndHuds // Il2CppName: get_noTextsAndHuds template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_noTextsAndHuds)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_noTextsAndHuds", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_noFailEffects // Il2CppName: get_noFailEffects template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_noFailEffects)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_noFailEffects", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_advancedHud // Il2CppName: get_advancedHud template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_advancedHud)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_advancedHud", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_autoRestart // Il2CppName: get_autoRestart template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_autoRestart)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_autoRestart", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_saberTrailIntensity // Il2CppName: get_saberTrailIntensity template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_saberTrailIntensity)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_saberTrailIntensity", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_noteJumpStartBeatOffset // Il2CppName: get_noteJumpStartBeatOffset template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<float (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_noteJumpStartBeatOffset)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_noteJumpStartBeatOffset", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_hideNoteSpawnEffect // Il2CppName: get_hideNoteSpawnEffect template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_hideNoteSpawnEffect)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_hideNoteSpawnEffect", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_adaptiveSfx // Il2CppName: get_adaptiveSfx template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<bool (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_adaptiveSfx)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_adaptiveSfx", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_environmentEffectsFilterDefaultPreset // Il2CppName: get_environmentEffectsFilterDefaultPreset template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<GlobalNamespace::EnvironmentEffectsFilterPreset (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_environmentEffectsFilterDefaultPreset)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_environmentEffectsFilterDefaultPreset", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::get_environmentEffectsFilterExpertPlusPreset // Il2CppName: get_environmentEffectsFilterExpertPlusPreset template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<GlobalNamespace::EnvironmentEffectsFilterPreset (GlobalNamespace::PlayerSpecificSettings::*)()>(&GlobalNamespace::PlayerSpecificSettings::get_environmentEffectsFilterExpertPlusPreset)> { static const MethodInfo* get() { return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "get_environmentEffectsFilterExpertPlusPreset", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead! // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::CopyWith // Il2CppName: CopyWith template<> struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<GlobalNamespace::PlayerSpecificSettings* (GlobalNamespace::PlayerSpecificSettings::*)(System::Nullable_1<bool>, System::Nullable_1<float>, System::Nullable_1<bool>, System::Nullable_1<float>, System::Nullable_1<bool>, System::Nullable_1<bool>, System::Nullable_1<bool>, System::Nullable_1<bool>, System::Nullable_1<bool>, System::Nullable_1<float>, System::Nullable_1<float>, System::Nullable_1<bool>, System::Nullable_1<bool>, System::Nullable_1<GlobalNamespace::EnvironmentEffectsFilterPreset>, System::Nullable_1<GlobalNamespace::EnvironmentEffectsFilterPreset>)>(&GlobalNamespace::PlayerSpecificSettings::CopyWith)> { static const MethodInfo* get() { static auto* leftHanded = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* playerHeight = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Single")})->byval_arg; static auto* automaticPlayerHeight = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* sfxVolume = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Single")})->byval_arg; static auto* reduceDebris = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* noTextsAndHuds = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* noFailEffects = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* advancedHud = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* autoRestart = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* saberTrailIntensity = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Single")})->byval_arg; static auto* noteJumpStartBeatOffset = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Single")})->byval_arg; static auto* hideNoteSpawnEffect = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* adaptiveSfx = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("System", "Boolean")})->byval_arg; static auto* environmentEffectsFilterDefaultPreset = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("", "EnvironmentEffectsFilterPreset")})->byval_arg; static auto* environmentEffectsFilterExpertPlusPreset = &::il2cpp_utils::MakeGeneric(::il2cpp_utils::GetClassFromName("System", "Nullable`1"), ::std::vector<const Il2CppClass*>{::il2cpp_utils::GetClassFromName("", "EnvironmentEffectsFilterPreset")})->byval_arg; return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::PlayerSpecificSettings*), "CopyWith", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{leftHanded, playerHeight, automaticPlayerHeight, sfxVolume, reduceDebris, noTextsAndHuds, noFailEffects, advancedHud, autoRestart, saberTrailIntensity, noteJumpStartBeatOffset, hideNoteSpawnEffect, adaptiveSfx, environmentEffectsFilterDefaultPreset, environmentEffectsFilterExpertPlusPreset}); } }; // Writing MetadataGetter for method: GlobalNamespace::PlayerSpecificSettings::New_ctor // Il2CppName: .ctor // Cannot get method pointer of value based method overload from template for constructor! // Try using FindMethod instead!
71.636804
1,186
0.768945
marksteward
44f9102b7f6ad6f6c08ac29fbedbce4560e1480d
4,703
cpp
C++
GrpAdminGetFeatCmd/invalidFieldInCmd_r10b.cpp
NirmalaArun/tnvme
c5c929596c49f3e88947f42b3d8d42c95d95aca0
[ "Apache-2.0" ]
null
null
null
GrpAdminGetFeatCmd/invalidFieldInCmd_r10b.cpp
NirmalaArun/tnvme
c5c929596c49f3e88947f42b3d8d42c95d95aca0
[ "Apache-2.0" ]
null
null
null
GrpAdminGetFeatCmd/invalidFieldInCmd_r10b.cpp
NirmalaArun/tnvme
c5c929596c49f3e88947f42b3d8d42c95d95aca0
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2011, Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <boost/format.hpp> #include "invalidFieldInCmd_r10b.h" #include "globals.h" #include "grpDefs.h" #include "../Utils/kernelAPI.h" #include "../Utils/io.h" #include "../Cmds/getFeatures.h" namespace GrpAdminGetFeatCmd { InvalidFieldInCmd_r10b::InvalidFieldInCmd_r10b( string grpName, string testName) : Test(grpName, testName, SPECREV_10b) { // 63 chars allowed: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx mTestDesc.SetCompliance("revision 1.0b, section 5"); mTestDesc.SetShort( "Issue reserved FID's; SC = Invalid field in cmd"); // No string size limit for the long description mTestDesc.SetLong( "Create a baseline GetFeatures cmd, with no PRP payload. Issue cmd " "for all reserved DW10.FID = {0x00, 0x0C to 0x7F, 0x81 to 0xBF}, " "expect failure."); } InvalidFieldInCmd_r10b::~InvalidFieldInCmd_r10b() { /////////////////////////////////////////////////////////////////////////// // Allocations taken from the heap and not under the control of the // RsrcMngr need to be freed/deleted here. /////////////////////////////////////////////////////////////////////////// } InvalidFieldInCmd_r10b:: InvalidFieldInCmd_r10b(const InvalidFieldInCmd_r10b &other) : Test(other) { /////////////////////////////////////////////////////////////////////////// // All pointers in this object must be NULL, never allow shallow or deep // copies, see Test::Clone() header comment. /////////////////////////////////////////////////////////////////////////// } InvalidFieldInCmd_r10b & InvalidFieldInCmd_r10b::operator=(const InvalidFieldInCmd_r10b &other) { /////////////////////////////////////////////////////////////////////////// // All pointers in this object must be NULL, never allow shallow or deep // copies, see Test::Clone() header comment. /////////////////////////////////////////////////////////////////////////// Test::operator=(other); return *this; } Test::RunType InvalidFieldInCmd_r10b::RunnableCoreTest(bool preserve) { /////////////////////////////////////////////////////////////////////////// // All code contained herein must never permanently modify the state or // configuration of the DUT. Permanence is defined as state or configuration // changes that will not be restored after a cold hard reset. /////////////////////////////////////////////////////////////////////////// preserve = preserve; // Suppress compiler error/warning return RUN_TRUE; // This test is never destructive } void InvalidFieldInCmd_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; // Lookup objs which were created in a prior test within group SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID)) SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID)) LOG_NRM("Create Get features cmd"); SharedGetFeaturesPtr getFeaturesCmd = SharedGetFeaturesPtr(new GetFeatures()); LOG_NRM("Form a vector of invalid FID's"); vector<uint16_t> invalidFIDs; uint8_t invalFID; invalidFIDs.push_back(0x00); for (uint8_t invalFID = 0x0D; invalFID <= 0x7F; invalFID++) invalidFIDs.push_back(invalFID); if ((gInformative->GetIdentifyCmdCtrlr()->GetValue(IDCTRLRCAP_ONCS)) & ONCS_SUP_RSRV) invalFID = 0x84; else invalFID = 0x81; for (; invalFID <= 0xBF; invalFID++) invalidFIDs.push_back(invalFID); for (uint16_t i = 0; i < invalidFIDs.size(); i++) { if (invalidFIDs[i] == 0x81) continue; LOG_NRM("Issue get feat cmd using invalid FID = 0x%X", invalidFIDs[i]); getFeaturesCmd->SetFID(invalidFIDs[i]); work = str(boost::format("invalidFIDs.%xh") % invalidFIDs[i]); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getFeaturesCmd, work, true, CESTAT_INVAL_FIELD); } } } // namespace
35.097015
92
0.60068
NirmalaArun
44fffc6be088e66a3c3e4c46f2583fd7ef765bec
1,612
cpp
C++
Algorithms/1416.RestoreTheArray/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1416.RestoreTheArray/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
Algorithms/1416.RestoreTheArray/solution.cpp
stdstring/leetcode
84e6bade7d6fc1a737eb6796cb4e2565440db5e3
[ "MIT" ]
null
null
null
#include <cstdint> #include <string> #include <vector> #include "gtest/gtest.h" namespace { class Solution { public: int numberOfArrays(std::string const &s, int k) const { constexpr size_t modValue = 1000000007; std::vector<size_t> countData(s.size() + 1, 0); countData[0] = 1; for (size_t index = 0; index < s.size(); ++index) { int64_t number = 0; int64_t factor = 1; for (size_t shift = 0; shift <= index; ++shift) { if (factor > k) break; const int digit = s[index - shift] - '0'; number += (factor * digit); if (number > k) break; if (digit != 0) countData[index + 1] = (countData[index + 1] + countData[index - shift]) % modValue; factor *= 10; } } return static_cast<int>(countData.back()); } }; } namespace RestoreTheArrayTask { TEST(TwoSumTaskTests, Examples) { const Solution solution; ASSERT_EQ(1, solution.numberOfArrays("1000", 10000)); ASSERT_EQ(0, solution.numberOfArrays("1000", 10)); ASSERT_EQ(8, solution.numberOfArrays("1317", 2000)); ASSERT_EQ(1, solution.numberOfArrays("2020", 30)); ASSERT_EQ(34, solution.numberOfArrays("1234567890", 90)); } TEST(TwoSumTaskTests, FromWrongAnswers) { const Solution solution; ASSERT_EQ(4076, solution.numberOfArrays("1111111111111", 1000000000)); ASSERT_EQ(0, solution.numberOfArrays("100000000000000000000", 1000000000)); } }
26
104
0.57134
stdstring
78053a25ee1ec65194dbed359c92e08fdac12b52
16,179
cpp
C++
src/ofxShader.cpp
autr/ofxShader
5278af2a433cf5c8e5d97fffe5141f06147f1783
[ "MIT" ]
null
null
null
src/ofxShader.cpp
autr/ofxShader
5278af2a433cf5c8e5d97fffe5141f06147f1783
[ "MIT" ]
null
null
null
src/ofxShader.cpp
autr/ofxShader
5278af2a433cf5c8e5d97fffe5141f06147f1783
[ "MIT" ]
null
null
null
#define STRINGIFY(A) #A #include "ofxShader.h" ofxShader::ofxShader() { m_bWatchingFiles = false; m_bAutoVersionConversion = true; // TIME UNIFORMS // m_uniformsFunctions["u_time"] = UniformFunction( [](ofShader* _shader) { _shader->setUniform1f("u_time", ofGetElapsedTimef()); }); m_uniformsFunctions["u_delta"] = UniformFunction( [this](ofShader* _shader) { double now = ofGetElapsedTimef(); _shader->setUniform1f("u_delta", now - m_lastFrame); m_lastFrame = now; }); m_uniformsFunctions["u_date"] = UniformFunction( [](ofShader* _shader) { _shader->setUniform4f("u_date", ofGetYear(), ofGetMonth(), ofGetDay(), ofGetSeconds()); }); // MOUSE m_uniformsFunctions["u_mouse"] = UniformFunction( [](ofShader* _shader) { _shader->setUniform2f("u_mouse", ofGetMouseX(), ofGetMouseY()); } ); // VIEWPORT m_uniformsFunctions["u_resolution"]= UniformFunction( [](ofShader* _shader) { _shader->setUniform2f("u_resolution", ofGetWidth(), ofGetHeight()); }); } ofxShader::~ofxShader() { disableWatchFiles(); } void ofxShader::addIncludeFolder(const string &_folder) { m_includeFolders.push_back(_folder); m_loadShaderNextFrame = true; } void ofxShader::addDefineKeyword(const string &_define) { m_defines.push_back(_define); m_loadShaderNextFrame = true; } void ofxShader::delDefineKeyword(const string &_define) { for (int i = m_defines.size() - 1; i >= 0 ; i++) { if ( m_defines[i] == _define ) { m_defines.erase(m_defines.begin() + i); } } } string getAbsPath(const string& _str) { // string abs_path = realpath(_str.c_str(), NULL); string abs_path = ofFilePath::getAbsolutePath(_str); std::size_t found = abs_path.find_last_of("\\/"); if (found) { return abs_path.substr(0, found); } else { return ""; } } string urlResolve(const string& _path, const string& _pwd, const std::vector<string> _includeFolders) { string url = _pwd + '/' + _path; if (ofFile(url).exists()) { return url; } else { for (unsigned int i = 0; i < _includeFolders.size(); i++) { string new_path = _includeFolders[i] + "/" + _path; if (ofFile(new_path).exists()) { return new_path; } } return _path; } } bool loadFromPath(const string& _path, string* _into, const std::vector<string> _includeFolders) { std::ifstream file; string buffer; file.open(_path.c_str()); if (!file.is_open()) return false; string original_path = getAbsPath(_path); while (!file.eof()) { getline(file, buffer); if (buffer.find("#include ") == 0 || buffer.find("#pragma include ") == 0){ unsigned begin = buffer.find_first_of("\""); unsigned end = buffer.find_last_of("\""); if (begin != end) { string file_name = buffer.substr(begin+1,end-begin-1); file_name = urlResolve(file_name, original_path, _includeFolders); string newBuffer; if (loadFromPath(file_name, &newBuffer, _includeFolders)) { (*_into) += "\n" + newBuffer + "\n"; } else { std::cout << file_name << " not found at " << original_path << std::endl; } } } else { (*_into) += buffer + "\n"; } } file.close(); return true; } bool _find_id(const string& program, const char* id) { return std::strstr(program.c_str(), id) != 0; } bool ofxShader::load(const string &_shaderName ) { return load( _shaderName + ".vert", _shaderName + ".frag", _shaderName + ".geom" ); } bool ofxShader::load(const string &_vertName, const string &_fragName, const string &_geomName) { unload(); ofShader::setGeometryOutputCount( m_geometryOutputCount ); ofShader::setGeometryInputType( m_geometryInputType ); ofShader::setGeometryOutputType( m_geometryOutputType ); // hackety hack, clear errors or shader will fail to compile // GLuint err = glGetError(); m_lastTimeCheckMillis = ofGetElapsedTimeMillis(); setMillisBetweenFileCheck( 2 * 1000 ); enableWatchFiles(); m_loadShaderNextFrame = false; // Update filenames m_vertexShaderFilename = _vertName; m_fragmentShaderFilename = _fragName; m_geometryShaderFilename = _geomName; // Update last change time m_vertexShaderFile.clear(); m_fragmentShaderFile.clear(); m_geometryShaderFile.clear(); m_vertexShaderFile = ofFile( ofToDataPath( m_vertexShaderFilename ) ); m_fragmentShaderFile = ofFile( ofToDataPath( m_fragmentShaderFilename ) ); m_geometryShaderFile = ofFile( ofToDataPath( m_geometryShaderFilename ) ); m_fileChangedTimes.clear(); m_fileChangedTimes.push_back( _getLastModified( m_vertexShaderFile ) ); m_fileChangedTimes.push_back( _getLastModified( m_fragmentShaderFile ) ); m_fileChangedTimes.push_back( _getLastModified( m_geometryShaderFile ) ); // Update Sources string vertexSrc = ""; string fragmentSrc = ""; string geometrySrc = ""; // 1. Load shaders resolving #include to nested sources loadFromPath( ofToDataPath( m_vertexShaderFilename ), &vertexSrc, m_includeFolders ); loadFromPath( ofToDataPath( m_fragmentShaderFilename ), &fragmentSrc, m_includeFolders ); #ifndef TARGET_OPENGLES loadFromPath( ofToDataPath( m_geometryShaderFilename ), &geometrySrc, m_includeFolders ); #endif if (vertexSrc.size() == 0) { #ifdef TARGET_OPENGLES // GLSL 100 vertexSrc = STRINGIFY( uniform mat4 modelViewProjectionMatrix; attribute vec4 position; attribute vec4 color; attribute vec2 texcoord; varying vec4 v_position; varying vec4 v_color; varying vec2 v_texcoord; void main() { v_position = position; v_color = color; v_texcoord = texcoord; gl_Position = modelViewProjectionMatrix * position; } ); #else // GLSL 120 if ( !ofIsGLProgrammableRenderer() ) { vertexSrc = STRINGIFY( varying vec4 v_position; varying vec4 v_color; varying vec2 v_texcoord; void main() { gl_FrontColor = gl_Color; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; v_position = gl_Position; v_color = gl_Color; v_texcoord = vec2(gl_TextureMatrix[0]*gl_MultiTexCoord0); } ); } else { // GLSL 150 vertexSrc = STRINGIFY( uniform mat4 modelViewProjectionMatrix; attribute vec4 position; attribute vec4 color; attribute vec2 texcoord; varying vec4 v_position; varying vec4 v_color; varying vec2 v_texcoord; void main() { v_position = position; v_color = color; v_texcoord = texcoord; gl_Position = modelViewProjectionMatrix * position; } ); } #endif } //#extension GL_ARB_texture_rectangle : enable // 2. Add defines string defines_header = ""; for (unsigned int i = 0; i < m_defines.size(); i++) { defines_header += "#define " + m_defines[i] + "\n"; } defines_header += "#line 0 \n"; // 2. Check active default uniforms for (UniformFunctionsList::iterator it = m_uniformsFunctions.begin(); it != m_uniformsFunctions.end(); ++it) { it->second.present = ( _find_id(vertexSrc, it->first.c_str()) != 0 || _find_id(fragmentSrc, it->first.c_str()) != 0 || _find_id(geometrySrc, it->first.c_str()) != 0 ); } // 3. Add defines string version_vert_header = ""; string version_frag_header = ""; string version_geom_header = ""; if (m_bAutoVersionConversion) { #ifdef TARGET_OPENGLES // GLSL 100 // ---------------------------------------------- string version100 = "#version 100\n"; version100 += "#define texture(A,B) texture2D(A,B)\n"; version_vert_header = version100; version_frag_header = version100; if ( !_find_id(vertexSrc, "precision ") ) { version_vert_header += "#ifdef GL_ES\n\ precision highp float;\n\ #endif\n"; } if ( !_find_id(fragmentSrc, "precision ") ) { version_frag_header += "#ifdef GL_ES\n\ precision highp float;\n\ #endif\n"; } #else // GLSL 120 // ---------------------------------------------- if ( !ofIsGLProgrammableRenderer() ) { version_vert_header = "#version 120\n\ #define texture(A,B) texture2D(A,B)\n"; version_frag_header = "#version 120\n"; version_geom_header = "#version 120\n"; } else { // GLSL 150 // ---------------------------------------------- version_vert_header = "#version 150\n\ #define attribute in\n\ #define varying out\n\ #define texture2D(A,B) texture(A,B)\n\ #define textureCube(TEX, DIRECTION, LOD) texture(TEX, DIRECTION)\n"; version_frag_header = "#version 150\n\ #define varying in\n\ #define gl_FragColor fragColor\n\ #define texture2D(A,B) texture(A,B)\n\ #define textureCube(TEX, DIRECTION, LOD) texture(TEX, DIRECTION)\n\ out vec4 fragColor;\n"; version_geom_header = "#version 150\n"; } #endif } bool setup = true; if ( vertexSrc.size() > 0 ) { ofLogVerbose("") << "---------------------------"; ofLogVerbose("ofxShader") << "GL_VERTEX_SHADER\n\n" << version_vert_header << defines_header << vertexSrc; ofLogVerbose("") << "---------------------------"; setup &= setupShaderFromSource( GL_VERTEX_SHADER, version_vert_header + defines_header + vertexSrc ); } if ( fragmentSrc.size() > 0 ) { ofLogVerbose("") << "---------------------------"; ofLogVerbose("ofxShader") << "GL_FRAGMENT_SHADER\n\n" << version_frag_header << defines_header << fragmentSrc; ofLogVerbose("") << "---------------------------"; setup &= setupShaderFromSource( GL_FRAGMENT_SHADER, version_frag_header + defines_header + fragmentSrc ); } #ifndef TARGET_OPENGLES if ( geometrySrc.size() > 0 ) { ofLogVerbose("") << "---------------------------"; ofLogVerbose("ofxShader") << "GL_GEOMETRY_SHADER_EXT\n\n" << version_geom_header << defines_header << geometrySrc; ofLogVerbose("") << "---------------------------"; setup &= setupShaderFromSource( GL_GEOMETRY_SHADER_EXT, version_geom_header + defines_header + geometrySrc ); } #endif bindDefaults(); bool link = linkProgram(); link &= setup; ofNotifyEvent(onLoad, link); //, this); return link;; } void ofxShader::addUniformFunction(string uniformName, UniformFunction uniformFunction) { m_uniformsFunctions[uniformName] = uniformFunction; } void ofxShader::removeUniformFunction(string uniformName) { m_uniformsFunctions.erase(uniformName); } std::string ofxShader::getFilename(GLenum _type) { switch (_type) { case GL_FRAGMENT_SHADER: return m_fragmentShaderFilename; break; case GL_VERTEX_SHADER: return m_vertexShaderFilename; break; #ifndef TARGET_OPENGLES case GL_GEOMETRY_SHADER_EXT: return m_geometryShaderFilename; break; #endif default: return ""; break; } } void ofxShader::begin() { ofShader::begin(); for (UniformFunctionsList::iterator it = m_uniformsFunctions.begin(); it != m_uniformsFunctions.end(); ++it) { if (it->second.present) { if (it->second.assign) { it->second.assign((ofShader*)this); } } } } void ofxShader::_update (ofEventArgs &e) { if ( m_loadShaderNextFrame ) { reloadShaders(); m_loadShaderNextFrame = false; } int currTime = ofGetElapsedTimeMillis(); if (((currTime - m_lastTimeCheckMillis) > m_millisBetweenFileCheck) && !m_loadShaderNextFrame ) { if ( _filesChanged() ) { m_loadShaderNextFrame = true; ofNotifyEvent(onChange, m_loadShaderNextFrame, this); } m_lastTimeCheckMillis = currTime; } } bool ofxShader::reloadShaders() { return load( m_vertexShaderFilename, m_fragmentShaderFilename, m_geometryShaderFilename ); } void ofxShader::enableAutoVersionConversion() { if (!m_bAutoVersionConversion) { m_loadShaderNextFrame = true; } m_bAutoVersionConversion = true; } void ofxShader::disableAutoVersionConversion() { if (m_bAutoVersionConversion) { m_loadShaderNextFrame = true; } m_bAutoVersionConversion = false; } void ofxShader::enableWatchFiles() { if (!m_bWatchingFiles) { ofAddListener( ofEvents().update, this, &ofxShader::_update ); m_bWatchingFiles = true; } } void ofxShader::disableWatchFiles() { if (m_bWatchingFiles) { ofRemoveListener( ofEvents().update, this, &ofxShader::_update ); m_bWatchingFiles = false; } } bool ofxShader::_filesChanged() { bool fileChanged = false; if ( m_vertexShaderFile.exists() ) { std::time_t vertexShaderFileLastChangeTime = _getLastModified( m_vertexShaderFile ); if ( vertexShaderFileLastChangeTime != m_fileChangedTimes.at(0) ) { m_fileChangedTimes.at(0) = vertexShaderFileLastChangeTime; fileChanged = true; } } if ( m_fragmentShaderFile.exists() ) { std::time_t fragmentShaderFileLastChangeTime = _getLastModified( m_fragmentShaderFile ); if ( fragmentShaderFileLastChangeTime != m_fileChangedTimes.at(1) ) { m_fileChangedTimes.at(1) = fragmentShaderFileLastChangeTime; fileChanged = true; } } if ( m_geometryShaderFile.exists() ) { std::time_t geometryShaderFileLastChangeTime = _getLastModified( m_geometryShaderFile ); if ( geometryShaderFileLastChangeTime != m_fileChangedTimes.at(2) ) { m_fileChangedTimes.at(2) = geometryShaderFileLastChangeTime; fileChanged = true; } } return fileChanged; } std::time_t ofxShader::_getLastModified( ofFile& _file ) { if ( _file.exists() ) { return std::filesystem::last_write_time(_file.path()); } else { return 0; } } void ofxShader::setMillisBetweenFileCheck( int _millis ) { m_millisBetweenFileCheck = _millis; } void ofxShader::setGeometryInputType( GLenum _type ) { ofShader::setGeometryInputType(_type); m_geometryInputType = _type; } void ofxShader::setGeometryOutputType( GLenum _type ) { ofShader::setGeometryOutputType(_type); m_geometryOutputType = _type; } void ofxShader::setGeometryOutputCount( int _count ) { ofShader::setGeometryOutputCount(_count); m_geometryOutputCount = _count; } void ofxShader::setUniformTextureCube(const string & _name, const ofxTextureCube& _cubemap, int _textureLocation) const { glActiveTexture(GL_TEXTURE0 + _textureLocation); glBindTexture(GL_TEXTURE_CUBE_MAP, _cubemap.getId()); setUniform1i(_name, _textureLocation); glActiveTexture(GL_TEXTURE0); }
31.911243
122
0.592991
autr
7805a7b6cf0e968fe1f8420a326906ebef6e0882
237
cpp
C++
Source/examples/unused-parameter.cpp
nojhan/leathers
d8a2867a477baab515affdf320d872896e01a797
[ "BSD-2-Clause" ]
86
2015-05-11T22:47:52.000Z
2021-09-05T11:26:05.000Z
Source/examples/unused-parameter.cpp
nojhan/leathers
d8a2867a477baab515affdf320d872896e01a797
[ "BSD-2-Clause" ]
6
2015-07-03T12:34:26.000Z
2020-03-08T09:01:51.000Z
Source/examples/unused-parameter.cpp
nojhan/leathers
d8a2867a477baab515affdf320d872896e01a797
[ "BSD-2-Clause" ]
12
2015-09-01T11:36:37.000Z
2021-12-01T12:56:44.000Z
// Copyright (c) 2014, Ruslan Baratov // All rights reserved. void foo(int); #include <leathers/push> #if !defined(SHOW_WARNINGS) # include <leathers/unused-parameter> #endif void foo(int a) { } #include <leathers/pop> int main() { }
14.8125
37
0.700422
nojhan
78062198fb603680c9502c9cb0a876a157e3f205
5,144
cpp
C++
src/smartpeak/source/core/ConsoleHandler.cpp
ahmedskhalil/SmartPeak
3e0b137f2fec119d8c11e5450c80156576c36f3e
[ "MIT" ]
null
null
null
src/smartpeak/source/core/ConsoleHandler.cpp
ahmedskhalil/SmartPeak
3e0b137f2fec119d8c11e5450c80156576c36f3e
[ "MIT" ]
null
null
null
src/smartpeak/source/core/ConsoleHandler.cpp
ahmedskhalil/SmartPeak
3e0b137f2fec119d8c11e5450c80156576c36f3e
[ "MIT" ]
null
null
null
// -------------------------------------------------------------------------- // SmartPeak -- Fast and Accurate CE-, GC- and LC-MS(/MS) Data Processing // -------------------------------------------------------------------------- // Copyright The SmartPeak Team -- Novo Nordisk Foundation // Center for Biosustainability, Technical University of Denmark 2018-2021. // // 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 ANY OF THE AUTHORS OR THE CONTRIBUTING // INSTITUTIONS 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. // // -------------------------------------------------------------------------- // $Maintainer: Krzysztof Abram, Douglas McCloskey $ // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $ // -------------------------------------------------------------------------- #include <SmartPeak/core/ConsoleHandler.h> #include <SmartPeak/core/Utilities.h> #include <fstream> #include <filesystem> namespace SmartPeak { void ConsoleHandler::initialize(const std::string& welcome_msg) { if (is_initialized()) { throw std::runtime_error("plog instance already initialized"); } auto error_msg = std::string{}; m_log_filename = _get_log_filename(); auto log_location_correct = _initialize_log_location(m_log_filename, error_msg); _initialize_log_console(log_location_correct); // Log SmartPeak launch initiated: LOG_INFO << welcome_msg; if (error_msg.empty()) { if (m_logdir_created) LOG_DEBUG << "Log directory created: " << m_log_filepath; LOG_INFO << "Log file at: " << m_log_filepath; } else { // In this case it will only use console appender LOG_WARNING << error_msg; } m_is_initialized = true; } std::string ConsoleHandler::_get_log_filename() const { const std::time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); char filename[128]; strftime(filename, 128, "smartpeak_log_%Y-%m-%d_%H-%M-%S.csv", std::localtime(&t)); return std::string{filename}; } bool ConsoleHandler::_initialize_log_location(const std::string& filename, std::string& error_msg) { namespace fs = std::filesystem; m_logdir_created = false; try { auto fpath = fs::path(); if (m_log_dirpath.empty()) { std::tie(fpath, m_logdir_created) = Utilities::getLogFilepath(filename); m_log_filepath = fpath.string(); m_log_dirpath = fpath.parent_path().string(); } else { auto path = (fs::path(m_log_dirpath) / filename).string(); std::ofstream file(path); if (!file) { std::tie(fpath, m_logdir_created) = Utilities::getLogFilepath(filename); m_log_filepath = fpath.string(); m_log_dirpath = fpath.parent_path().string(); error_msg = static_cast<std::ostringstream&&>( std::ostringstream() << "Unable to create log file '" << path << "', directory does not exist or has insufficient access permissions. " << "Log to the default location instead: '" << m_log_filepath << "'").str(); } else { file.close(); m_log_filepath = path; } } } catch (const std::runtime_error& re) { error_msg = re.what(); return false; } return true; } void ConsoleHandler::_initialize_log_console(bool init_file_appender) { if (nullptr == m_file_appender && init_file_appender) { // Add .csv appender: 32 MiB per file, max. 100 log files m_file_appender = std::make_shared< plog::RollingFileAppender<plog::CsvFormatter>>( m_log_filepath.c_str(), 1024 * 1024 * 32, 100); } if (nullptr == m_console_appender) { if (m_enable_colors) { m_console_appender = std::make_shared< plog::ColorConsoleAppender<plog::TxtFormatter>>(); } else { m_console_appender = std::make_shared< plog::ConsoleAppender<plog::TxtFormatter>>(); } } if (nullptr == m_file_appender) { plog::init(plog::debug, m_console_appender.get()); } else { plog::init(plog::debug, m_file_appender.get()).addAppender(m_console_appender.get()); } } } /* namespace SmartPeak */
36.225352
100
0.591952
ahmedskhalil
78069a46457a8cb76a5c9427168acd6b2c1771b2
1,301
cpp
C++
src/algo/binary_search_tree.cpp
setyolegowo/ITB-IF5111-2019
4b53c9a69e49bb801fa65b633689670bf2edf4ff
[ "MIT" ]
null
null
null
src/algo/binary_search_tree.cpp
setyolegowo/ITB-IF5111-2019
4b53c9a69e49bb801fa65b633689670bf2edf4ff
[ "MIT" ]
null
null
null
src/algo/binary_search_tree.cpp
setyolegowo/ITB-IF5111-2019
4b53c9a69e49bb801fa65b633689670bf2edf4ff
[ "MIT" ]
null
null
null
/** * binary_search_tree.cpp file. * Implementation. * * @author Setyo Legowo <gw.tio145@gmail.com> * @since 2019.02.18 */ #include "binary_search_tree.hpp" BinarySearch::BinarySearch(char* _nama_bapak) { this->nama_bapak = std::string(_nama_bapak); } BinarySearch* BinarySearch::createFromConsoleArgument(int argc, char** argv) { if (argc < 5) { throw "Lack of argument for binary search: <nama_bapak>"; } return new BinarySearch(argv[4]); } bool BinarySearch::find(std::vector<House> * houseList) { uint32_t higher_bound = houseList->size() - 1; uint32_t lower_bound = 0; uint32_t selected_index; bool isFound = false; int compareResult; while (lower_bound < higher_bound && !isFound) { selected_index = (higher_bound + lower_bound)/2; compareResult = houseList->at(selected_index).nama_bapak.compare(this->nama_bapak); if (compareResult == 0) { isFound = true; } else if (compareResult < 0) { lower_bound = selected_index + 1; } else { // > 0 higher_bound = selected_index; } } if (lower_bound == higher_bound && !isFound) { isFound = houseList->at(selected_index).nama_bapak.compare(this->nama_bapak) == 0; } return isFound; }
26.55102
91
0.640277
setyolegowo
7807d254d1263eb8ca693f5cf40fd679129b6114
880
hpp
C++
core/Private/core/RootView.hpp
paxbun/dear-my-prof
a1e0032f17d9a62a58673b5dbe2de1446006e528
[ "MIT" ]
1
2020-01-19T14:14:13.000Z
2020-01-19T14:14:13.000Z
core/Private/core/RootView.hpp
paxbun/dear-my-prof
a1e0032f17d9a62a58673b5dbe2de1446006e528
[ "MIT" ]
null
null
null
core/Private/core/RootView.hpp
paxbun/dear-my-prof
a1e0032f17d9a62a58673b5dbe2de1446006e528
[ "MIT" ]
1
2020-11-18T05:24:38.000Z
2020-11-18T05:24:38.000Z
// Copyright (c) 2019 Dear My Professor Authors // Author: paxbun #ifndef __H_CORE_ROOT_VIEW__ #define __H_CORE_ROOT_VIEW__ #include <core/EmailListPresenter.hpp> #include <core/OpenDetailPresenter.hpp> #include <core/OpenSelectTemplatePresenter.hpp> #include <core/OpenTemplateListPresenter.hpp> #include <core/View.hpp> class RootView : public View { private: OpenTemplateListPresenter _openTemplateList; OpenSelectTemplatePresenter _openSelectTemplate; EmailListPresenter _emailList; OpenDetailPresenter _openDetail; public: RootView() : View("root.html", { { "create-templates-window", &_openTemplateList }, { "create-new-email-window", &_openSelectTemplate }, { "mail-refresh", &_emailList }, { "create-detail-window", &_openDetail } }) {} }; #endif
28.387097
69
0.678409
paxbun
78093858863459c67a0a02c949cca65864a2776d
17,975
cpp
C++
dev/ProjectReunion_BootstrapDLL/MddBootstrap.cpp
heechee3/WindowsAppSDK
71fad8337a656f712188944d70e8c0d1f467efb8
[ "CC-BY-4.0", "MIT" ]
1
2021-06-22T16:00:25.000Z
2021-06-22T16:00:25.000Z
dev/ProjectReunion_BootstrapDLL/MddBootstrap.cpp
oldnewthing/WindowsAppSDK
e82f072c131807765efd84f4d55ab4de3ecbb75c
[ "CC-BY-4.0", "MIT" ]
null
null
null
dev/ProjectReunion_BootstrapDLL/MddBootstrap.cpp
oldnewthing/WindowsAppSDK
e82f072c131807765efd84f4d55ab4de3ecbb75c
[ "CC-BY-4.0", "MIT" ]
null
null
null
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. #include "pch.h" #include "MddBootstrap.h" #include "MddBootstrapTest.h" #include "MsixDynamicDependency.h" #include "IDynamicDependencyLifetimeManager.h" wil::unique_cotaskmem_ptr<BYTE[]> GetFrameworkPackageInfoForPackage(PCWSTR packageFullName, const PACKAGE_INFO*& frameworkPackageInfo); DLL_DIRECTORY_COOKIE AddFrameworkToPath(PCWSTR path); void RemoveFrameworkFromPath(PCWSTR frameworkPath); CLSID FindDDLM( UINT32 majorMinorVersion, PCWSTR versionTag, PACKAGE_VERSION minVersion); CLSID GetClsid(const winrt::Windows::ApplicationModel::AppExtensions::AppExtension& appExtension); IDynamicDependencyLifetimeManager* g_lifetimeManager{}; wil::unique_hmodule g_projectReunionDll; wil::unique_process_heap_string g_packageDependencyId; MDD_PACKAGEDEPENDENCY_CONTEXT g_packageDependencyContext{}; static std::wstring g_test_ddlmPackageNamePrefix; static std::wstring g_test_ddlmPackagePublisherId; namespace MddCore { // Temporary check to prevent accidental misuse and false bug reports until we address Issue #567 https://github.com/microsoft/ProjectReunion/issues/567 void FailFastIfElevated() { FAIL_FAST_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), Security::IntegrityLevel::IsElevated() || Security::IntegrityLevel::IsElevated(GetCurrentProcessToken()), "DynamicDependencies Bootstrap doesn't support elevation. See Issue #567 https://github.com/microsoft/ProjectReunion/issues/567"); } } STDAPI MddBootstrapInitialize( UINT32 majorMinorVersion, PCWSTR versionTag, PACKAGE_VERSION minVersion) noexcept try { // Dynamic Dependencies doesn't support elevation. See Issue #567 https://github.com/microsoft/ProjectReunion/issues/567 MddCore::FailFastIfElevated(); // Dynamic Dependencies Bootstrap API requires a non-packaged process LOG_HR_IF(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), AppModel::Identity::IsPackagedProcess()); FAIL_FAST_HR_IF(HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED), g_lifetimeManager != nullptr); FAIL_FAST_HR_IF(HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED), g_projectReunionDll != nullptr); FAIL_FAST_HR_IF(HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED), g_packageDependencyId != nullptr); FAIL_FAST_HR_IF(HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED), g_packageDependencyContext != nullptr); const auto appDynamicDependencyLifetimeManagerClsid{ FindDDLM(majorMinorVersion, versionTag, minVersion) }; wil::com_ptr_nothrow<IDynamicDependencyLifetimeManager> lifetimeManager(wil::CoCreateInstance<IDynamicDependencyLifetimeManager>(appDynamicDependencyLifetimeManagerClsid, CLSCTX_LOCAL_SERVER)); THROW_IF_FAILED(lifetimeManager->Initialize()); wil::unique_cotaskmem_string packageFullName; THROW_IF_FAILED(lifetimeManager->GetPackageFullName(&packageFullName)); const PACKAGE_INFO* frameworkPackageInfo{}; auto packageInfoBuffer{ GetFrameworkPackageInfoForPackage(packageFullName.get(), frameworkPackageInfo) }; // Temporarily add the framework's package directory to PATH so LoadLibrary can find it and any colocated imports wil::unique_dll_directory_cookie dllDirectoryCookie{ AddFrameworkToPath(frameworkPackageInfo->path) }; auto projectReunionDllFilename{ std::wstring(frameworkPackageInfo->path) + L"\\Microsoft.ProjectReunion.dll" }; wil::unique_hmodule projectReunionDll(LoadLibraryEx(projectReunionDllFilename.c_str(), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH)); if (!projectReunionDll) { const auto lastError{ GetLastError() }; THROW_WIN32_MSG(lastError, "Error in LoadLibrary: %d (0x%X) loading %ls", lastError, lastError, projectReunionDllFilename.c_str()); } const MddPackageDependencyProcessorArchitectures architectureFilter{}; const auto lifetimeKind{ MddPackageDependencyLifetimeKind::Process }; const MddCreatePackageDependencyOptions createOptions{}; wil::unique_process_heap_string packageDependencyId; THROW_IF_FAILED(MddTryCreatePackageDependency(nullptr, frameworkPackageInfo->packageFamilyName, minVersion, architectureFilter, lifetimeKind, nullptr, createOptions, &packageDependencyId)); // const MddAddPackageDependencyOptions addOptions{}; MDD_PACKAGEDEPENDENCY_CONTEXT packageDependencyContext{}; THROW_IF_FAILED(MddAddPackageDependency(packageDependencyId.get(), MDD_PACKAGE_DEPENDENCY_RANK_DEFAULT, addOptions, &packageDependencyContext, nullptr)); // Remove out temporary path addition RemoveFrameworkFromPath(frameworkPackageInfo->path); dllDirectoryCookie.reset(); g_lifetimeManager = lifetimeManager.detach(); g_projectReunionDll = std::move(projectReunionDll); g_packageDependencyId = std::move(packageDependencyId); g_packageDependencyContext = packageDependencyContext; return S_OK; } CATCH_RETURN(); STDAPI_(void) MddBootstrapShutdown() noexcept { if (g_packageDependencyContext && g_projectReunionDll) { MddRemovePackageDependency(g_packageDependencyContext); g_packageDependencyContext = nullptr; } g_packageDependencyId.reset(); g_projectReunionDll.reset(); if (g_lifetimeManager) { (void)LOG_IF_FAILED(g_lifetimeManager->Shutdown()); g_lifetimeManager->Release(); g_lifetimeManager = nullptr; } } STDAPI MddBootstrapTestInitialize( _In_ PCWSTR ddlmPackageNamePrefix, _In_ PCWSTR ddlPackagePublisherId) noexcept try { RETURN_HR_IF(E_INVALIDARG, !ddlmPackageNamePrefix); RETURN_HR_IF(E_INVALIDARG, *ddlmPackageNamePrefix == L'0'); RETURN_HR_IF(E_INVALIDARG, !ddlPackagePublisherId); RETURN_HR_IF(E_INVALIDARG, *ddlPackagePublisherId == L'0'); g_test_ddlmPackageNamePrefix = ddlmPackageNamePrefix; g_test_ddlmPackagePublisherId = ddlPackagePublisherId; return S_OK; } CATCH_RETURN(); /// Determine the path for the Project Reunion Framework package wil::unique_cotaskmem_ptr<BYTE[]> GetFrameworkPackageInfoForPackage(PCWSTR packageFullName, const PACKAGE_INFO*& frameworkPackageInfo) { frameworkPackageInfo = nullptr; // We need to determine the exact Project Reunion Framework package // in the Dynamic Dependency Lifetime Manager package's dependencies, // as resolved by Windows. A user can have multiple framework packages // in a family registered at a time, for multiple reasons: // // * Multiple Architectures -- x86/x64 on an x64 machine, x86/arm/arm64/x86ona64 on an arm64 machine, etc // * Multiple Versions -- v1.0.0.0 in use by processes running as pkg1 and v1.0.0.1 in use by processes running as pkg2 // or v1.0.0.0 in use by running processes and v1.0.0.1 in package graphs for packages w/no running process // // Thus FindPackagesByPackageFamily(pkgfamilyname,...) and PackageManager.FindPackages(user="", pkgfamilyname) could be ambiguous. // We need the actual dependency graph known to Windows for the DDLM package where we got our LifetimeManager. // That leaves us few options: // // * PackageManager.FindPackage(user="", lifetimeManager->GetPackageFullName()).Dependencies // * GetPackageInfo(OpenPackageInfoByFullName(lifetimeManager->GetPackageFullName()) // // We'll go with the latter as the simpler (no COM/WinRT) and more performant solution. // Fetch the package graph for the package (per packageFullName) wil::unique_package_info_reference packageInfoReference; THROW_IF_WIN32_ERROR(OpenPackageInfoByFullName(packageFullName, 0, &packageInfoReference)); UINT32 bufferLength{}; UINT32 packageInfoCount{}; const auto hr{ HRESULT_FROM_WIN32(GetPackageInfo(packageInfoReference.get(), PACKAGE_FILTER_DIRECT, &bufferLength, nullptr, &packageInfoCount)) }; THROW_HR_IF(hr, hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)); THROW_HR_IF(E_UNEXPECTED, packageInfoCount == 0); auto buffer{ wil::make_unique_cotaskmem<BYTE[]>(bufferLength) }; THROW_IF_WIN32_ERROR(GetPackageInfo(packageInfoReference.get(), PACKAGE_FILTER_DIRECT, &bufferLength, buffer.get(), &packageInfoCount)); // Find the Project Reunion framework package in the package graph to determine its path // // NOTE: The Project Reunion DDLM package... // * ...has 1 framework package dependency // * ...its framework package dependency's name starts with "Microsoft.ProjectReunion" // * ...its publisher id is "8wekyb3d8bbwe" // Any failure to find the DDLM's package graph but not find the expected framework dependency // implies the DDLM is improperly built and cannot be used. Of course ThisShouldNeverHappen // but a little paranoia isn't a bad thing :-) // // Verify the package providing the LifetimeManager declares a <PackageDependency> on the Project Reunion framework package. THROW_HR_IF_MSG(E_UNEXPECTED, packageInfoCount != 1, "PRddlm:%ls PackageGraph.Count:%u", packageFullName, packageInfoCount); // const PACKAGE_INFO* packageInfo{ reinterpret_cast<const PACKAGE_INFO*>(buffer.get()) }; const WCHAR c_expectedNamePrefix[]{ L"Microsoft.ProjectReunion" }; const int c_expectedNamePrefixLength{ ARRAYSIZE(c_expectedNamePrefix) - 1 }; THROW_HR_IF_MSG(E_UNEXPECTED, CompareStringOrdinal(packageInfo->packageId.name, c_expectedNamePrefixLength, c_expectedNamePrefix, c_expectedNamePrefixLength, TRUE) != CSTR_EQUAL, "PRddlm:%ls Expected.Name:%ls PackageGraph[0].PackageFullName:%ls", packageFullName, c_expectedNamePrefix, packageInfo->packageFullName); // PCWSTR c_expectedPublisherId{ L"8wekyb3d8bbwe" }; THROW_HR_IF_MSG(E_UNEXPECTED, CompareStringOrdinal(packageInfo->packageId.publisherId, -1, c_expectedPublisherId, -1, TRUE) != CSTR_EQUAL, "PRddlm:%ls PackageGraph[0].PackageFullName:%ls", packageFullName, packageInfo->packageFullName); // Gotcha! frameworkPackageInfo = packageInfo; return buffer; } DLL_DIRECTORY_COOKIE AddFrameworkToPath(PCWSTR frameworkPath) { // Add the framework to the Loader's DllDirectory list wil::unique_dll_directory_cookie dllDirectoryCookie{ AddDllDirectory(frameworkPath) }; THROW_LAST_ERROR_IF_NULL(dllDirectoryCookie); // Add the framework the the PATH environment variable wil::unique_cotaskmem_string path; THROW_IF_FAILED(wil::GetEnvironmentVariableW(L"PATH", path)); if (path) { // PATH = frameworkPath + ";" + path auto newPath{ wil::str_concat<wil::unique_cotaskmem_string>(frameworkPath, L";", path) }; THROW_IF_WIN32_BOOL_FALSE(SetEnvironmentVariableW(L"PATH", newPath.get())); } else { const auto lastError{ GetLastError() }; THROW_HR_IF(HRESULT_FROM_WIN32(lastError), lastError != ERROR_ENVVAR_NOT_FOUND); THROW_IF_WIN32_BOOL_FALSE(SetEnvironmentVariableW(L"PATH", frameworkPath)); } return dllDirectoryCookie.release(); } void RemoveFrameworkFromPath(PCWSTR frameworkPath) { // Remove frameworkPath from PATH (previously added by AddFrameworkToPath()) // PATH should start with frameworkPath since we just prepended it. Remove it wil::unique_cotaskmem_string path; const auto hr{ wil::TryGetEnvironmentVariableW(L"PATH", path) }; if (SUCCEEDED(hr) && path) { const auto pathLength{ wcslen(path.get()) }; const auto frameworkPathLength{ wcslen(frameworkPath) }; if (pathLength >= frameworkPathLength) { if (CompareStringOrdinal(path.get(), static_cast<int>(frameworkPathLength), frameworkPath, static_cast<int>(frameworkPathLength), TRUE) == CSTR_EQUAL) { PCWSTR pathWithoutFrameworkPath{ path.get() + frameworkPathLength }; if (*pathWithoutFrameworkPath == L';') { ++pathWithoutFrameworkPath; } (void)LOG_IF_WIN32_BOOL_FALSE(SetEnvironmentVariableW(L"PATH", pathWithoutFrameworkPath)); } else { (void)LOG_HR_MSG(E_UNEXPECTED, "PATH doesn't start with %ls", frameworkPath); } } } } CLSID FindDDLM( UINT32 majorMinorVersion, PCWSTR versionTag, PACKAGE_VERSION minVersion) { // Find the best fit bool foundAny{}; PACKAGE_VERSION bestFitVersion{}; CLSID bestFitClsid{}; // Look for windows.appExtension with name="com.microsoft.reunion.ddlm-<majorversion>.<minorversion>-<architecture>[-shorttag]" WCHAR appExtensionName[100]{}; const UINT16 majorVersion{ HIWORD(majorMinorVersion) }; const UINT16 minorVersion{ LOWORD(majorMinorVersion) }; const auto versionShortTag{ AppModel::Identity::GetVersionShortTagFromVersionTag(versionTag) }; if (versionShortTag != L'\0') { wsprintf(appExtensionName, L"com.microsoft.reunion.ddlm-%hu.%hu-%s-%c", majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsString(), versionShortTag); } else { wsprintf(appExtensionName, L"com.microsoft.reunion.ddlm-%hu.%hu-%s", majorVersion, minorVersion, AppModel::Identity::GetCurrentArchitectureAsString()); } auto catalog{ winrt::Windows::ApplicationModel::AppExtensions::AppExtensionCatalog::Open(appExtensionName) }; auto appExtensions{ catalog.FindAllAsync().get() }; for (auto appExtension : appExtensions) { // Check the package identity against the package identity test qualifiers (if any) if (!g_test_ddlmPackageNamePrefix.empty()) { const auto packageId{ appExtension.Package().Id() }; std::wstring name{ packageId.Name().c_str() }; if ((name.rfind(g_test_ddlmPackageNamePrefix.c_str(), 0) != 0) || (CompareStringOrdinal(packageId.PublisherId().c_str(), -1, g_test_ddlmPackagePublisherId.c_str(), -1, TRUE) != CSTR_EQUAL)) { // The package's Name prefix or PublisherId don't match the expected value. Skip it continue; } } // appExtension.Id == "ddlm-<major.minor.build.revision>-<architecture>" const auto id{ appExtension.Id() }; PACKAGE_VERSION version{}; WCHAR architectureAsString[9 + 1]{}; const auto maxIdLength{ ARRAYSIZE(L"ddlm-12345.12345.12345.12345-abcdefghi") - 1 }; // -1 for length not counting null-terminator if ((id.size() >= maxIdLength) || (swscanf_s(id.c_str(), L"ddlm-%hu.%hu.%hu.%hu-%9s", &version.Major, &version.Minor, &version.Build, &version.Revision, architectureAsString, static_cast<unsigned>(ARRAYSIZE(architectureAsString))) != 5)) { (void)LOG_HR_MSG(ERROR_INVALID_DATA, "%ls", id.c_str()); continue; } // Does the version meet the minVersion criteria? if (version.Version < minVersion.Version) { continue; } // Does the architecture match? const auto architecture{ AppModel::Identity::ParseArchitecture(architectureAsString) }; if (architecture != AppModel::Identity::GetCurrentArchitecture()) { continue; } // Do we have a package under consideration? if (!foundAny) { bestFitVersion = version; bestFitClsid = GetClsid(appExtension); foundAny = true; continue; } // Do we already have a higher version under consideration? if (bestFitVersion.Version < version.Version) { bestFitVersion = version; bestFitClsid = GetClsid(appExtension); continue; } } THROW_HR_IF_MSG(HRESULT_FROM_WIN32(ERROR_NO_MATCH), !foundAny, "AppExtension.Name=%ls, Major=%hu, Minor=%hu, Tag=%ls, MinVersion=%hu.%hu.%hu.%hu", appExtensionName, majorVersion, minorVersion, (!versionTag ? L"" : versionTag), minVersion.Major, minVersion.Minor, minVersion.Build, minVersion.Revision); return bestFitClsid; } CLSID GetClsid(const winrt::Windows::ApplicationModel::AppExtensions::AppExtension& appExtension) { const auto properties{ appExtension.GetExtensionPropertiesAsync().get() }; auto propertiesClsid{ properties.Lookup(L"CLSID").as<winrt::Windows::Foundation::Collections::IPropertySet>() }; auto value{ propertiesClsid.Lookup(L"#text").as<winrt::Windows::Foundation::IPropertyValue>() }; THROW_HR_IF_NULL(E_UNEXPECTED, value); THROW_HR_IF(E_UNEXPECTED, value.Type() != winrt::Windows::Foundation::PropertyType::String); const auto text{ value.GetString() }; // Convert the CLSID as a string to a CLSID as a GUID // Problem: CLSIDFromString() also does a lookup for a registered object by the CLSID. // We just want the string->GUID conversion, not any additional work. // Workaround this by using UuidFromString() // Problem: UuidFromString() takes a RPC_WSTR but that's defined as unsigned short* // unless RPC_USE_NATIVE_WCHAR is defined. // Workaround this with casts. Include some asserts to verify we're not misusing memory. auto textString{ const_cast<PWSTR>(text.c_str()) }; auto textRpcString{ reinterpret_cast<RPC_WSTR>(textString) }; static_assert(sizeof(textString) == sizeof(textRpcString)); static_assert(sizeof(textString[0]) == sizeof(textRpcString[0])); UUID clsid{}; THROW_IF_WIN32_ERROR(UuidFromStringW(textRpcString, &clsid)); return clsid; }
48.712737
216
0.712267
heechee3
780c9cf5d79a525b9fe46bb937476a3bcb5538e7
813
hpp
C++
modules/gapi/src/streaming/onevpl/engine/preproc/vpp_preproc_defines.hpp
yash112-lang/opencv
be38d4ea932bc3a0d06845ed1a2de84acc2a09de
[ "Apache-2.0" ]
2
2022-03-26T11:12:18.000Z
2022-03-30T13:07:32.000Z
modules/gapi/src/streaming/onevpl/engine/preproc/vpp_preproc_defines.hpp
yash112-lang/opencv
be38d4ea932bc3a0d06845ed1a2de84acc2a09de
[ "Apache-2.0" ]
null
null
null
modules/gapi/src/streaming/onevpl/engine/preproc/vpp_preproc_defines.hpp
yash112-lang/opencv
be38d4ea932bc3a0d06845ed1a2de84acc2a09de
[ "Apache-2.0" ]
1
2022-03-05T16:32:04.000Z
2022-03-05T16:32:04.000Z
// This file is part of OpenCV project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at http://opencv.org/license.html. // // Copyright (C) 2022 Intel Corporation #ifdef HAVE_ONEVPL #ifndef VPP_PREPROC_ENGINE #define VPP_PREPROC_ENGINE #include "streaming/onevpl/onevpl_export.hpp" #include "streaming/onevpl/engine/engine_session.hpp" namespace cv { namespace gapi { namespace wip { namespace onevpl { struct vpp_pp_params { mfxSession handle; mfxFrameInfo info; void *reserved = nullptr; }; struct vpp_pp_session { std::shared_ptr<EngineSession> handle; void *reserved = nullptr; }; } // namespace onevpl } // namespace wip } // namespace gapi } // namespace cv #endif // VPP_PREPROC_ENGINE #endif // HAVE_ONEVPL
23.911765
90
0.745387
yash112-lang
780d53258f843a9a911c115bf7043d3c10fa6b92
2,575
cc
C++
src/utils/voyager_tcp_client.cc
pengdu/bubblefs
9b27e191a287b3a1d012adfd3bab6a30629a5f33
[ "BSD-3-Clause" ]
1
2021-01-11T14:19:51.000Z
2021-01-11T14:19:51.000Z
src/utils/voyager_tcp_client.cc
pengdu/bubblefs
9b27e191a287b3a1d012adfd3bab6a30629a5f33
[ "BSD-3-Clause" ]
null
null
null
src/utils/voyager_tcp_client.cc
pengdu/bubblefs
9b27e191a287b3a1d012adfd3bab6a30629a5f33
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2016 Mirants Lu. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // voyager/voyager/core/tcp_client.cc #include "platform/voyager_logging.h" #include "platform/voyager_tcp_connector.h" #include "utils/voyager_tcp_client.h" namespace bubblefs { namespace myvoyager { std::atomic<int> TcpClient::conn_id_(0); TcpClient::TcpClient(EventLoop* ev, const SockAddr& addr, const std::string& name) : ev_(VOYAGER_CHECK_NOTNULL(ev)), addr_(addr), name_(name), connector_(new TcpConnector(ev, addr)), connect_(false) { connector_->SetNewConnectionCallback( std::bind(&TcpClient::NewConnection, this, std::placeholders::_1)); VOYAGER_LOG(INFO) << "TcpClient::TcpClient [" << name_ << "] is running"; } TcpClient::~TcpClient() { VOYAGER_LOG(INFO) << "TcpClient::~TcpClient [" << name_ << "] is down"; } void TcpClient::Connect(bool retry) { if (!weak_ptr_.lock()) { // 表示已经经过连接建立和连接断开的过程 bool expected = true; connect_.compare_exchange_weak(expected, false); } if (!connect_) { VOYAGER_LOG(INFO) << "TcpClient::Connect [" << name_ << "] - connecting to " << addr_.Ipbuf(); connector_->Start(retry); connect_ = true; } } void TcpClient::Close() { // (1) 连接未成功 // (2)连接成功但未断开 if (connect_) { connector_->Stop(); TcpConnectionPtr ptr = weak_ptr_.lock(); if (ptr) { ptr->ShutDown(); } connect_ = false; } } void TcpClient::NewConnection(int fd) { ev_->AssertInMyLoop(); SockAddr local(SockAddr::LocalSockAddr(fd)); char conn_name[256]; snprintf(conn_name, sizeof(conn_name), "%s-%s#%d", addr_.Ipbuf().c_str(), local.Ipbuf().c_str(), ++conn_id_); VOYAGER_LOG(INFO) << "TcpClient::NewConnection[" << name_ << "] - new connection[" << conn_name << "] to " << addr_.Ipbuf(); TcpConnectionPtr ptr(new TcpConnection(conn_name, ev_, fd, local, addr_)); ptr->SetConnectionCallback(connection_cb_); ptr->SetMessageCallback(message_cb_); ptr->SetWriteCompleteCallback(writecomplete_cb_); ptr->SetCloseCallback(close_cb_); ptr->StartWorking(); weak_ptr_ = ptr; } void TcpClient::SetConnectFailureCallback(const ConnectFailureCallback& cb) { connector_->SetConnectFailureCallback(cb); } void TcpClient::SetConnectFailureCallback(ConnectFailureCallback&& cb) { connector_->SetConnectFailureCallback(std::move(cb)); } } // namespace myvoyager } // namespace bubblefs
28.611111
80
0.666408
pengdu
781174e06b6a9908884a400047b0b59cef32ec54
1,336
cpp
C++
src/exception/baseexceptions.cpp
daniel-blake/piio-server
fc0d9306343518c865c9bd1fb96fd70b693aaab1
[ "MIT" ]
null
null
null
src/exception/baseexceptions.cpp
daniel-blake/piio-server
fc0d9306343518c865c9bd1fb96fd70b693aaab1
[ "MIT" ]
null
null
null
src/exception/baseexceptions.cpp
daniel-blake/piio-server
fc0d9306343518c865c9bd1fb96fd70b693aaab1
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include "baseexceptions.hpp" /************************************ * * * MsgException * * * *************************************/ MsgException::MsgException() { } MsgException::MsgException(const std::string& message) { myMsg = message; } MsgException::MsgException(const std::string &format,...) { va_list argptr; va_start(argptr, format); init(format.c_str(),argptr); va_end(argptr); } MsgException::MsgException(const char * format,...) { va_list argptr; va_start(argptr, format); init(format,argptr); va_end(argptr); } void MsgException::init(const char * format,va_list mArgs) { uint32_t BUFFER_LEN = 256; char buffer[BUFFER_LEN]; // force buffer to zeroes memset(buffer, 0x00, BUFFER_LEN); // use vsnprintf to parse vsnprintf(buffer, BUFFER_LEN-1, format, mArgs); myMsg = std::string(buffer); } void MsgException::init(const char * s) { myMsg = std::string(s); } std::string MsgException::Message() { return myMsg; } const char* MsgException::what() { formattedMsg = type() + " - " + myMsg; return formattedMsg.c_str(); } MsgException::~MsgException() throw () { }
17.578947
58
0.578593
daniel-blake
7812583f5ab47b3b2ec7d09d2007a61eacd90264
2,627
cpp
C++
GrpGeneralCmds/grpGeneralCmds.cpp
jackeichen/Gaozh
b6dc87095ed3e90b596d69f31d8c0ed6dbc07d97
[ "Apache-2.0" ]
null
null
null
GrpGeneralCmds/grpGeneralCmds.cpp
jackeichen/Gaozh
b6dc87095ed3e90b596d69f31d8c0ed6dbc07d97
[ "Apache-2.0" ]
null
null
null
GrpGeneralCmds/grpGeneralCmds.cpp
jackeichen/Gaozh
b6dc87095ed3e90b596d69f31d8c0ed6dbc07d97
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2011, Intel Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "grpGeneralCmds.h" #include "createResources_r10b.h" #include "illegalNVMCmds_r10b.h" #include "illegalNVMCmds_r11.h" #include "illegalAdminCmds_r10b.h" #include "illegalAdminCmds_r12.h" #include "cidAcceptedASQ_r10b.h" #include "cidAcceptedIOSQ_r10b.h" namespace GrpGeneralCmds { GrpGeneralCmds::GrpGeneralCmds(size_t grpNum) : Group(grpNum, "GrpGeneralCmds", "General command tests.") { // For complete details about the APPEND_TEST_AT_?LEVEL() macros: // "https://github.com/nvmecompliance/tnvme/wiki/Test-Numbering" and // "https://github.com/nvmecompliance/tnvme/wiki/Test-Strategy switch (gCmdLine.rev) { case SPECREV_10b: APPEND_TEST_AT_XLEVEL(CreateResources_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalNVMCmds_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalAdminCmds_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(CIDAcceptedASQ_r10b, GrpGeneralCmds) APPEND_TEST_AT_XLEVEL(CIDAcceptedIOSQ_r10b, GrpGeneralCmds) break; case SPECREV_11: APPEND_TEST_AT_XLEVEL(CreateResources_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalNVMCmds_r11, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalAdminCmds_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(CIDAcceptedASQ_r10b, GrpGeneralCmds) APPEND_TEST_AT_XLEVEL(CIDAcceptedIOSQ_r10b, GrpGeneralCmds) break; case SPECREV_12: APPEND_TEST_AT_XLEVEL(CreateResources_r10b, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalNVMCmds_r11, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(IllegalAdminCmds_r12, GrpGeneralCmds) APPEND_TEST_AT_YLEVEL(CIDAcceptedASQ_r10b, GrpGeneralCmds) APPEND_TEST_AT_XLEVEL(CIDAcceptedIOSQ_r10b, GrpGeneralCmds) break; default: case SPECREVTYPE_FENCE: throw FrmwkEx(HERE, "Object created with an unknown SpecRev=%d", gCmdLine.rev); } } GrpGeneralCmds::~GrpGeneralCmds() { // mTests deallocated in parent } } // namespace
36.486111
76
0.748763
jackeichen
7815e62b75ead4787ecbfb98385f496f52504efe
17,713
cpp
C++
src/mbgl/tile/geometry_tile_worker.cpp
ulmongmbh/mapbox-gl-native
128da903c19c860e89be36bf67bd02cfa408a525
[ "BSL-1.0", "Apache-2.0" ]
1
2019-11-09T17:52:14.000Z
2019-11-09T17:52:14.000Z
src/mbgl/tile/geometry_tile_worker.cpp
ulmongmbh/mapbox-gl-native
128da903c19c860e89be36bf67bd02cfa408a525
[ "BSL-1.0", "Apache-2.0" ]
1
2020-11-21T06:55:47.000Z
2020-11-21T06:55:52.000Z
src/mbgl/tile/geometry_tile_worker.cpp
ulmongmbh/mapbox-gl-native
128da903c19c860e89be36bf67bd02cfa408a525
[ "BSL-1.0", "Apache-2.0" ]
1
2020-01-03T21:38:55.000Z
2020-01-03T21:38:55.000Z
#include <mbgl/tile/geometry_tile_worker.hpp> #include <mbgl/tile/geometry_tile_data.hpp> #include <mbgl/tile/geometry_tile.hpp> #include <mbgl/layermanager/layer_manager.hpp> #include <mbgl/layout/layout.hpp> #include <mbgl/layout/symbol_layout.hpp> #include <mbgl/layout/pattern_layout.hpp> #include <mbgl/renderer/bucket_parameters.hpp> #include <mbgl/renderer/group_by_layout.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/layers/symbol_layer_impl.hpp> #include <mbgl/renderer/layers/render_fill_layer.hpp> #include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp> #include <mbgl/renderer/layers/render_line_layer.hpp> #include <mbgl/renderer/layers/render_symbol_layer.hpp> #include <mbgl/renderer/buckets/symbol_bucket.hpp> #include <mbgl/util/logging.hpp> #include <mbgl/util/constants.hpp> #include <mbgl/util/string.hpp> #include <mbgl/util/exception.hpp> #include <mbgl/util/stopwatch.hpp> #include <unordered_set> #include <utility> namespace mbgl { using namespace style; GeometryTileWorker::GeometryTileWorker(ActorRef<GeometryTileWorker> self_, ActorRef<GeometryTile> parent_, OverscaledTileID id_, std::string sourceID_, const std::atomic<bool>& obsolete_, const MapMode mode_, const float pixelRatio_, const bool showCollisionBoxes_) : self(std::move(self_)), parent(std::move(parent_)), id(id_), sourceID(std::move(sourceID_)), obsolete(obsolete_), mode(mode_), pixelRatio(pixelRatio_), showCollisionBoxes(showCollisionBoxes_) {} GeometryTileWorker::~GeometryTileWorker() = default; /* GeometryTileWorker is a state machine. This is its transition diagram. States are indicated by [state], lines are transitions triggered by messages, (parentheses) are actions taken on transition. [Idle] <-------------------------. | | set{Data,Layers}, symbolDependenciesChanged, | setShowCollisionBoxes | | | (do parse and/or symbol layout; self-send "coalesced") | v | [Coalescing] --- coalesced ---------. | | .-----------. .---------------------. | | .--- set{Data,Layers} setShowCollisionBoxes, | | symbolDependenciesChanged --. | | | | | v v | .-- [NeedsParse] <-- set{Data,Layers} -- [NeedsSymbolLayout] ---. | | coalesced coalesced | | v v (do parse or symbol layout; self-send "coalesced"; goto [coalescing]) The idea is that in the [idle] state, parsing happens immediately in response to a "set" message, and symbol layout happens once all symbol dependencies are met. During this processing, multiple "set" messages might get queued in the mailbox. At the end of processing, we self-send "coalesced", read all the queued messages until we get to "coalesced", and then re-parse if there were one or more "set"s or return to the [idle] state if not. One important goal of the design is to prevent starvation. Under heavy load new requests for tiles should not prevent in progress request from completing. It is nevertheless possible to restart an in-progress request: - [Idle] setData -> parse() sends getGlyphs, hasPendingDependencies() is true enters [Coalescing], sends coalesced - [Coalescing] coalesced -> [Idle] - [Idle] setData -> new parse(), interrupts old parse() sends getGlyphs, hasPendingDependencies() is true enters [Coalescing], sends coalesced - [Coalescing] onGlyphsAvailable -> [NeedsSymbolLayout] hasPendingDependencies() may or may not be true - [NeedsSymbolLayout] coalesced -> finalizeLayout() Generates result depending on whether dependencies are met -> [Idle] In this situation, we are counting on the idea that even with rapid changes to the tile's data, the set of glyphs/images it requires will not keep growing without limit. Although parsing (which populates all non-symbol buckets and requests dependencies for symbol buckets) is internally separate from symbol layout, we only return results to the foreground when we have completed both steps. Because we _move_ the result buckets to the foreground, it is necessary to re-generate all buckets from scratch for `setShowCollisionBoxes`, even though it only affects symbol layers. The GL JS equivalent (in worker_tile.js and vector_tile_worker_source.js) is somewhat simpler because it relies on getGlyphs/getImages calls that transfer an entire set of glyphs/images on every tile load, while the native logic maintains a local state that can be incrementally updated. Because each tile load call becomes self-contained, the equivalent of the coalescing logic is handled by 'reloadTile' queueing a single extra 'reloadTile' callback to run after the next completed parse. */ void GeometryTileWorker::setData(std::unique_ptr<const GeometryTileData> data_, bool resetLayers_, uint64_t correlationID_) { try { data = std::move(data_); correlationID = correlationID_; if (resetLayers_) layers = nullopt; switch (state) { case Idle: parse(); coalesce(); break; case Coalescing: case NeedsParse: case NeedsSymbolLayout: state = NeedsParse; break; } } catch (...) { parent.invoke(&GeometryTile::onError, std::current_exception(), correlationID); } } void GeometryTileWorker::setLayers(std::vector<Immutable<LayerProperties>> layers_, uint64_t correlationID_) { try { layers = std::move(layers_); correlationID = correlationID_; switch (state) { case Idle: parse(); coalesce(); break; case Coalescing: case NeedsSymbolLayout: state = NeedsParse; break; case NeedsParse: break; } } catch (...) { parent.invoke(&GeometryTile::onError, std::current_exception(), correlationID); } } void GeometryTileWorker::setShowCollisionBoxes(bool showCollisionBoxes_, uint64_t correlationID_) { try { showCollisionBoxes = showCollisionBoxes_; correlationID = correlationID_; switch (state) { case Idle: if (!hasPendingParseResult()) { // Trigger parse if nothing is in flight, otherwise symbol layout will automatically // pick up the change parse(); coalesce(); } break; case Coalescing: state = NeedsSymbolLayout; break; case NeedsSymbolLayout: case NeedsParse: break; } } catch (...) { parent.invoke(&GeometryTile::onError, std::current_exception(), correlationID); } } void GeometryTileWorker::symbolDependenciesChanged() { try { switch (state) { case Idle: if (!layouts.empty()) { // Layouts are created only by parsing and the parse result can only be // cleared by performLayout, which also clears the layouts. assert(hasPendingParseResult()); finalizeLayout(); coalesce(); } break; case Coalescing: if (!layouts.empty()) { state = NeedsSymbolLayout; } break; case NeedsSymbolLayout: case NeedsParse: break; } } catch (...) { parent.invoke(&GeometryTile::onError, std::current_exception(), correlationID); } } void GeometryTileWorker::coalesced() { try { switch (state) { case Idle: assert(false); break; case Coalescing: state = Idle; break; case NeedsParse: parse(); coalesce(); break; case NeedsSymbolLayout: // We may have entered NeedsSymbolLayout while coalescing // after a performLayout. In that case, we need to // start over with parsing in order to do another layout. hasPendingParseResult() ? finalizeLayout() : parse(); coalesce(); break; } } catch (...) { parent.invoke(&GeometryTile::onError, std::current_exception(), correlationID); } } void GeometryTileWorker::coalesce() { state = Coalescing; self.invoke(&GeometryTileWorker::coalesced); } void GeometryTileWorker::onGlyphsAvailable(GlyphMap newGlyphMap) { for (auto& newFontGlyphs : newGlyphMap) { FontStackHash fontStack = newFontGlyphs.first; Glyphs& newGlyphs = newFontGlyphs.second; Glyphs& glyphs = glyphMap[fontStack]; for (auto& pendingGlyphDependency : pendingGlyphDependencies) { // Linear lookup here to handle reverse of FontStackHash -> FontStack, // since dependencies need the full font stack name to make a request // There should not be many fontstacks to look through if (FontStackHasher()(pendingGlyphDependency.first) == fontStack) { GlyphIDs& pendingGlyphIDs = pendingGlyphDependency.second; for (auto& newGlyph : newGlyphs) { const GlyphID& glyphID = newGlyph.first; optional<Immutable<Glyph>>& glyph = newGlyph.second; if (pendingGlyphIDs.erase(glyphID)) { glyphs.emplace(glyphID, std::move(glyph)); } } } } } symbolDependenciesChanged(); } void GeometryTileWorker::onImagesAvailable(ImageMap newIconMap, ImageMap newPatternMap, ImageVersionMap newVersionMap, uint64_t imageCorrelationID_) { if (imageCorrelationID != imageCorrelationID_) { return; // Ignore outdated image request replies. } imageMap = std::move(newIconMap); patternMap = std::move(newPatternMap); versionMap = std::move(newVersionMap); pendingImageDependencies.clear(); symbolDependenciesChanged(); } void GeometryTileWorker::requestNewGlyphs(const GlyphDependencies& glyphDependencies) { for (auto& fontDependencies : glyphDependencies) { auto fontGlyphs = glyphMap.find(FontStackHasher()(fontDependencies.first)); for (auto glyphID : fontDependencies.second) { if (fontGlyphs == glyphMap.end() || fontGlyphs->second.find(glyphID) == fontGlyphs->second.end()) { pendingGlyphDependencies[fontDependencies.first].insert(glyphID); } } } if (!pendingGlyphDependencies.empty()) { parent.invoke(&GeometryTile::getGlyphs, pendingGlyphDependencies); } } void GeometryTileWorker::requestNewImages(const ImageDependencies& imageDependencies) { pendingImageDependencies = imageDependencies; if (!pendingImageDependencies.empty()) { parent.invoke(&GeometryTile::getImages, std::make_pair(pendingImageDependencies, ++imageCorrelationID)); } } void GeometryTileWorker::parse() { if (!data || !layers) { return; } MBGL_TIMING_START(watch) std::unordered_map<std::string, std::unique_ptr<SymbolLayout>> symbolLayoutMap; renderData.clear(); layouts.clear(); featureIndex = std::make_unique<FeatureIndex>(*data ? (*data)->clone() : nullptr); GlyphDependencies glyphDependencies; ImageDependencies imageDependencies; // Create render layers and group by layout std::unordered_map<std::string, std::vector<Immutable<style::LayerProperties>>> groupMap; for (auto layer : *layers) { groupMap[layoutKey(*layer->baseImpl)].push_back(std::move(layer)); } for (auto& pair : groupMap) { const auto& group = pair.second; if (obsolete) { return; } if (!*data) { continue; // Tile has no data. } const style::Layer::Impl& leaderImpl = *(group.at(0)->baseImpl); BucketParameters parameters { id, mode, pixelRatio, leaderImpl.getTypeInfo() }; auto geometryLayer = (*data)->getLayer(leaderImpl.sourceLayer); if (!geometryLayer) { continue; } std::vector<std::string> layerIDs(group.size()); for (const auto& layer : group) { layerIDs.push_back(layer->baseImpl->id); } featureIndex->setBucketLayerIDs(leaderImpl.id, layerIDs); // Symbol layers and layers that support pattern properties have an extra step at layout time to figure out what images/glyphs // are needed to render the layer. They use the intermediate Layout data structure to accomplish this, // and either immediately create a bucket if no images/glyphs are used, or the Layout is stored until // the images/glyphs are available to add the features to the buckets. if (leaderImpl.getTypeInfo()->layout == LayerTypeInfo::Layout::Required) { std::unique_ptr<Layout> layout = LayerManager::get()->createLayout({parameters, glyphDependencies, imageDependencies}, std::move(geometryLayer), group); if (layout->hasDependencies()) { layouts.push_back(std::move(layout)); } else { layout->createBucket({}, featureIndex, renderData, firstLoad, showCollisionBoxes); } } else { const Filter& filter = leaderImpl.filter; const std::string& sourceLayerID = leaderImpl.sourceLayer; std::shared_ptr<Bucket> bucket = LayerManager::get()->createBucket(parameters, group); for (std::size_t i = 0; !obsolete && i < geometryLayer->featureCount(); i++) { std::unique_ptr<GeometryTileFeature> feature = geometryLayer->getFeature(i); if (!filter(expression::EvaluationContext { static_cast<float>(this->id.overscaledZ), feature.get() })) continue; const GeometryCollection& geometries = feature->getGeometries(); bucket->addFeature(*feature, geometries, {}, PatternLayerMap(), i); featureIndex->insert(geometries, i, sourceLayerID, leaderImpl.id); } if (!bucket->hasData()) { continue; } for (const auto& layer : group) { renderData.emplace(layer->baseImpl->id, LayerRenderData{bucket, layer}); } } } requestNewGlyphs(glyphDependencies); requestNewImages(imageDependencies); MBGL_TIMING_FINISH(watch, " Action: " << "Parsing," << " SourceID: " << sourceID.c_str() << " Canonical: " << static_cast<int>(id.canonical.z) << "/" << id.canonical.x << "/" << id.canonical.y << " Time"); finalizeLayout(); } bool GeometryTileWorker::hasPendingDependencies() const { for (auto& glyphDependency : pendingGlyphDependencies) { if (!glyphDependency.second.empty()) { return true; } } return !pendingImageDependencies.empty(); } bool GeometryTileWorker::hasPendingParseResult() const { return bool(featureIndex); } void GeometryTileWorker::finalizeLayout() { if (!data || !layers || !hasPendingParseResult() || hasPendingDependencies()) { return; } MBGL_TIMING_START(watch) optional<AlphaImage> glyphAtlasImage; ImageAtlas iconAtlas = makeImageAtlas(imageMap, patternMap, versionMap); if (!layouts.empty()) { GlyphAtlas glyphAtlas = makeGlyphAtlas(glyphMap); glyphAtlasImage = std::move(glyphAtlas.image); for (auto& layout : layouts) { if (obsolete) { return; } layout->prepareSymbols(glyphMap, glyphAtlas.positions, imageMap, iconAtlas.iconPositions); if (!layout->hasSymbolInstances()) { continue; } // layout adds the bucket to buckets layout->createBucket(iconAtlas.patternPositions, featureIndex, renderData, firstLoad, showCollisionBoxes); } } layouts.clear(); firstLoad = false; MBGL_TIMING_FINISH(watch, " Action: " << "SymbolLayout," << " SourceID: " << sourceID.c_str() << " Canonical: " << static_cast<int>(id.canonical.z) << "/" << id.canonical.x << "/" << id.canonical.y << " Time"); parent.invoke(&GeometryTile::onLayout, std::make_shared<GeometryTile::LayoutResult>( std::move(renderData), std::move(featureIndex), std::move(glyphAtlasImage), std::move(iconAtlas) ), correlationID); } } // namespace mbgl
37.527542
164
0.599447
ulmongmbh
7816b4c6654bfcea3d0cc9964b40da427a5cfda4
1,471
cpp
C++
math/Vector3.cpp
Andrewich/deadjustice
48bea56598e79a1a10866ad41aa3517bf7d7c724
[ "BSD-3-Clause" ]
3
2019-04-20T10:16:36.000Z
2021-03-21T19:51:38.000Z
math/Vector3.cpp
Andrewich/deadjustice
48bea56598e79a1a10866ad41aa3517bf7d7c724
[ "BSD-3-Clause" ]
null
null
null
math/Vector3.cpp
Andrewich/deadjustice
48bea56598e79a1a10866ad41aa3517bf7d7c724
[ "BSD-3-Clause" ]
2
2020-04-18T20:04:24.000Z
2021-09-19T05:07:41.000Z
#include "Vector3.h" #include <assert.h> #include "config.h" //---------------------------------------------------------------------------- namespace math { Vector3 Vector3::rotate( const Vector3& axis, float angle ) const { assert( finite() ); assert( axis.length() > Vector3::valueMin() ); // ensure that Axis isn't null vector const Vector3 vector = *this; Vector3 unitAxis = axis.normalize(); const float halfAngle = angle/float(2); const float s = VectorN::valueSin(halfAngle); const float c = VectorN::valueCos(halfAngle); const float x = unitAxis.x * s; const float y = unitAxis.y * s; const float z = unitAxis.z * s; const float w = c; const float xx = x*x; const float xy = y*x; const float xz = z*x; const float yy = y*y; const float yz = z*y; const float zz = z*z; const float wx = w*x; const float wy = w*y; const float wz = w*z; const float M[3][3] = { {float(1)-float(2)*(yy+zz), float(2)*(xy-wz), float(2)*(xz+wy)}, {float(2)*(xy+wz), float(1)-float(2)*(xx+zz), float(2)*(yz-wx)}, {float(2)*(xz-wy), float(2)*(yz+wx), float(1)-float(2)*(xx+yy)}, }; return Vector3( vector.x*M[0][0] + vector.y*M[0][1] + vector.z*M[0][2], vector.x*M[1][0] + vector.y*M[1][1] + vector.z*M[1][2], vector.x*M[2][0] + vector.y*M[2][1] + vector.z*M[2][2] ); } } // math
29.42
86
0.514616
Andrewich
781837c3f580461b072359bbe4215f27ec9becdf
1,350
cpp
C++
src/game/game.cpp
GEEKiDoS/open-iw5
a26809f69e55105d1eff15e3006c50523fa4f1f7
[ "MIT" ]
2
2020-11-21T14:37:40.000Z
2020-11-21T14:54:33.000Z
src/game/game.cpp
GEEKiDoS/open-iw5
a26809f69e55105d1eff15e3006c50523fa4f1f7
[ "MIT" ]
5
2020-11-25T11:27:57.000Z
2020-11-25T11:33:39.000Z
src/game/game.cpp
GEEKiDoS/mw2-mod
a26809f69e55105d1eff15e3006c50523fa4f1f7
[ "MIT" ]
null
null
null
#include <std_include.hpp> #include "game.hpp" namespace game { namespace enviroment { launcher::mode mode = launcher::mode::none; launcher::mode get_mode() { if (mode == launcher::mode::none) { throw std::runtime_error("Launcher mode not valid. Something must be wrong."); } return mode; } bool is_mp() { return get_mode() == launcher::mode::multiplayer; } bool is_sp() { return get_mode() == launcher::mode::singleplayer; } bool is_dedi() { return get_mode() == launcher::mode::server; } void initialize(const launcher::mode _mode) { mode = _mode; } } Glyph* R_GetCharacterGlyph(Font_s* font, unsigned int letter) { Glyph* result = nullptr; if (letter < 0x20 || letter > 0x7F) { int top = font->glyphCount - 1; int bottom = 96; while (bottom <= top) { int mid = (bottom + top) / 2; if (font->glyphs[mid].letter == letter) return &font->glyphs[mid]; if (font->glyphs[mid].letter >= letter) top = mid - 1; else bottom = mid + 1; } result = font->glyphs + 14; } else { result = &font->glyphs[letter - 32]; } return result; } int R_LetterWidth(unsigned int letter, Font_s* font) { return R_GetCharacterGlyph(font, letter)->dx; } }
18.493151
83
0.576296
GEEKiDoS
781a6fe3c3aacfca94c74dfc3a8846e0fcaf1fce
492
hpp
C++
stringify/jss_renamed.hpp
5cript/SimpleJSON
878a6341baed91c29630447f6bd480391f563045
[ "MIT" ]
4
2015-06-25T02:06:13.000Z
2018-07-11T13:20:24.000Z
stringify/jss_renamed.hpp
5cript/SimpleJSON
878a6341baed91c29630447f6bd480391f563045
[ "MIT" ]
14
2015-03-29T10:32:21.000Z
2018-01-25T16:45:08.000Z
stringify/jss_renamed.hpp
5cript/SimpleJSON
878a6341baed91c29630447f6bd480391f563045
[ "MIT" ]
2
2017-07-16T09:43:22.000Z
2020-08-30T09:33:40.000Z
#pragma once #include "jss_core.hpp" #include "../utility/rename.hpp" namespace JSON { template <typename T, typename Name> std::ostream& stringify(std::ostream& stream, std::string const&, rename <T, Name> const& value, StringificationOptions options = {}) { constexpr const auto name = Name::c_str; SJSON_WRITE_NAME(stream); options.ignore_name = true; return JSON::stringify(stream, name, value.getValue(), options); } }
27.333333
138
0.642276
5cript
781dbffc987ddaad554dc01fafe06c174be3e709
195,639
cpp
C++
SampleQRCodes/TestBuild/Il2CppOutputProject/Source/il2cppOutput/Photon3Unity3D_Attr.cpp
Dooyoung-Kim/QRTracking
ba519f0a10a0b897b2e324430c52d58efa9b31c0
[ "MIT" ]
null
null
null
SampleQRCodes/TestBuild/Il2CppOutputProject/Source/il2cppOutput/Photon3Unity3D_Attr.cpp
Dooyoung-Kim/QRTracking
ba519f0a10a0b897b2e324430c52d58efa9b31c0
[ "MIT" ]
null
null
null
SampleQRCodes/TestBuild/Il2CppOutputProject/Source/il2cppOutput/Photon3Unity3D_Attr.cpp
Dooyoung-Kim/QRTracking
ba519f0a10a0b897b2e324430c52d58efa9b31c0
[ "MIT" ]
null
null
null
#include "pch-cpp.hpp" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <limits> #include <stdint.h> // System.Char[] struct CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34; // System.Reflection.AssemblyCompanyAttribute struct AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4; // System.Reflection.AssemblyConfigurationAttribute struct AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C; // System.Reflection.AssemblyCopyrightAttribute struct AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC; // System.Reflection.AssemblyDescriptionAttribute struct AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3; // System.Reflection.AssemblyFileVersionAttribute struct AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F; // System.Reflection.AssemblyInformationalVersionAttribute struct AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0; // System.Reflection.AssemblyProductAttribute struct AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA; // System.Reflection.AssemblyTitleAttribute struct AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7; // System.Runtime.CompilerServices.CompilationRelaxationsAttribute struct CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF; // System.Runtime.CompilerServices.CompilerGeneratedAttribute struct CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C; // System.Diagnostics.DebuggableAttribute struct DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B; // System.Diagnostics.DebuggerBrowsableAttribute struct DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53; // System.Reflection.DefaultMemberAttribute struct DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5; // System.Runtime.CompilerServices.ExtensionAttribute struct ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC; // System.FlagsAttribute struct FlagsAttribute_t511C558FACEF1CC64702A8FAB67CAF3CBA65DF36; // System.ObsoleteAttribute struct ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671; // ExitGames.Client.Photon.PreserveAttribute struct PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2; // System.Runtime.CompilerServices.RuntimeCompatibilityAttribute struct RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80; // System.String struct String_t; // System.Runtime.Versioning.TargetFrameworkAttribute struct TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517; IL2CPP_EXTERN_C_BEGIN IL2CPP_EXTERN_C_END #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Object // System.Attribute struct Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 : public RuntimeObject { public: public: }; // System.String struct String_t : public RuntimeObject { public: // System.Int32 System.String::m_stringLength int32_t ___m_stringLength_0; // System.Char System.String::m_firstChar Il2CppChar ___m_firstChar_1; public: inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); } inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; } inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; } inline void set_m_stringLength_0(int32_t value) { ___m_stringLength_0 = value; } inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); } inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; } inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; } inline void set_m_firstChar_1(Il2CppChar value) { ___m_firstChar_1 = value; } }; struct String_t_StaticFields { public: // System.String System.String::Empty String_t* ___Empty_5; public: inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); } inline String_t* get_Empty_5() const { return ___Empty_5; } inline String_t** get_address_of_Empty_5() { return &___Empty_5; } inline void set_Empty_5(String_t* value) { ___Empty_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___Empty_5), (void*)value); } }; // System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 : public RuntimeObject { public: public: }; // Native definition for P/Invoke marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_pinvoke { }; // Native definition for COM marshalling of System.ValueType struct ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52_marshaled_com { }; // System.Reflection.AssemblyCompanyAttribute struct AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyCompanyAttribute::m_company String_t* ___m_company_0; public: inline static int32_t get_offset_of_m_company_0() { return static_cast<int32_t>(offsetof(AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4, ___m_company_0)); } inline String_t* get_m_company_0() const { return ___m_company_0; } inline String_t** get_address_of_m_company_0() { return &___m_company_0; } inline void set_m_company_0(String_t* value) { ___m_company_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_company_0), (void*)value); } }; // System.Reflection.AssemblyConfigurationAttribute struct AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyConfigurationAttribute::m_configuration String_t* ___m_configuration_0; public: inline static int32_t get_offset_of_m_configuration_0() { return static_cast<int32_t>(offsetof(AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C, ___m_configuration_0)); } inline String_t* get_m_configuration_0() const { return ___m_configuration_0; } inline String_t** get_address_of_m_configuration_0() { return &___m_configuration_0; } inline void set_m_configuration_0(String_t* value) { ___m_configuration_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_configuration_0), (void*)value); } }; // System.Reflection.AssemblyCopyrightAttribute struct AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyCopyrightAttribute::m_copyright String_t* ___m_copyright_0; public: inline static int32_t get_offset_of_m_copyright_0() { return static_cast<int32_t>(offsetof(AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC, ___m_copyright_0)); } inline String_t* get_m_copyright_0() const { return ___m_copyright_0; } inline String_t** get_address_of_m_copyright_0() { return &___m_copyright_0; } inline void set_m_copyright_0(String_t* value) { ___m_copyright_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_copyright_0), (void*)value); } }; // System.Reflection.AssemblyDescriptionAttribute struct AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyDescriptionAttribute::m_description String_t* ___m_description_0; public: inline static int32_t get_offset_of_m_description_0() { return static_cast<int32_t>(offsetof(AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3, ___m_description_0)); } inline String_t* get_m_description_0() const { return ___m_description_0; } inline String_t** get_address_of_m_description_0() { return &___m_description_0; } inline void set_m_description_0(String_t* value) { ___m_description_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_description_0), (void*)value); } }; // System.Reflection.AssemblyFileVersionAttribute struct AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyFileVersionAttribute::_version String_t* ____version_0; public: inline static int32_t get_offset_of__version_0() { return static_cast<int32_t>(offsetof(AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F, ____version_0)); } inline String_t* get__version_0() const { return ____version_0; } inline String_t** get_address_of__version_0() { return &____version_0; } inline void set__version_0(String_t* value) { ____version_0 = value; Il2CppCodeGenWriteBarrier((void**)(&____version_0), (void*)value); } }; // System.Reflection.AssemblyInformationalVersionAttribute struct AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyInformationalVersionAttribute::m_informationalVersion String_t* ___m_informationalVersion_0; public: inline static int32_t get_offset_of_m_informationalVersion_0() { return static_cast<int32_t>(offsetof(AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0, ___m_informationalVersion_0)); } inline String_t* get_m_informationalVersion_0() const { return ___m_informationalVersion_0; } inline String_t** get_address_of_m_informationalVersion_0() { return &___m_informationalVersion_0; } inline void set_m_informationalVersion_0(String_t* value) { ___m_informationalVersion_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_informationalVersion_0), (void*)value); } }; // System.Reflection.AssemblyProductAttribute struct AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyProductAttribute::m_product String_t* ___m_product_0; public: inline static int32_t get_offset_of_m_product_0() { return static_cast<int32_t>(offsetof(AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA, ___m_product_0)); } inline String_t* get_m_product_0() const { return ___m_product_0; } inline String_t** get_address_of_m_product_0() { return &___m_product_0; } inline void set_m_product_0(String_t* value) { ___m_product_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_product_0), (void*)value); } }; // System.Reflection.AssemblyTitleAttribute struct AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.AssemblyTitleAttribute::m_title String_t* ___m_title_0; public: inline static int32_t get_offset_of_m_title_0() { return static_cast<int32_t>(offsetof(AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7, ___m_title_0)); } inline String_t* get_m_title_0() const { return ___m_title_0; } inline String_t** get_address_of_m_title_0() { return &___m_title_0; } inline void set_m_title_0(String_t* value) { ___m_title_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_title_0), (void*)value); } }; // System.Boolean struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37 { public: // System.Boolean System.Boolean::m_value bool ___m_value_0; public: inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37, ___m_value_0)); } inline bool get_m_value_0() const { return ___m_value_0; } inline bool* get_address_of_m_value_0() { return &___m_value_0; } inline void set_m_value_0(bool value) { ___m_value_0 = value; } }; struct Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields { public: // System.String System.Boolean::TrueString String_t* ___TrueString_5; // System.String System.Boolean::FalseString String_t* ___FalseString_6; public: inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___TrueString_5)); } inline String_t* get_TrueString_5() const { return ___TrueString_5; } inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; } inline void set_TrueString_5(String_t* value) { ___TrueString_5 = value; Il2CppCodeGenWriteBarrier((void**)(&___TrueString_5), (void*)value); } inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_t07D1E3F34E4813023D64F584DFF7B34C9D922F37_StaticFields, ___FalseString_6)); } inline String_t* get_FalseString_6() const { return ___FalseString_6; } inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; } inline void set_FalseString_6(String_t* value) { ___FalseString_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___FalseString_6), (void*)value); } }; // System.Runtime.CompilerServices.CompilationRelaxationsAttribute struct CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.Int32 System.Runtime.CompilerServices.CompilationRelaxationsAttribute::m_relaxations int32_t ___m_relaxations_0; public: inline static int32_t get_offset_of_m_relaxations_0() { return static_cast<int32_t>(offsetof(CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF, ___m_relaxations_0)); } inline int32_t get_m_relaxations_0() const { return ___m_relaxations_0; } inline int32_t* get_address_of_m_relaxations_0() { return &___m_relaxations_0; } inline void set_m_relaxations_0(int32_t value) { ___m_relaxations_0 = value; } }; // System.Runtime.CompilerServices.CompilerGeneratedAttribute struct CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: public: }; // System.Reflection.DefaultMemberAttribute struct DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Reflection.DefaultMemberAttribute::m_memberName String_t* ___m_memberName_0; public: inline static int32_t get_offset_of_m_memberName_0() { return static_cast<int32_t>(offsetof(DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5, ___m_memberName_0)); } inline String_t* get_m_memberName_0() const { return ___m_memberName_0; } inline String_t** get_address_of_m_memberName_0() { return &___m_memberName_0; } inline void set_m_memberName_0(String_t* value) { ___m_memberName_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___m_memberName_0), (void*)value); } }; // System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA : public ValueType_tDBF999C1B75C48C68621878250DBF6CDBCF51E52 { public: public: }; struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields { public: // System.Char[] System.Enum::enumSeperatorCharArray CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* ___enumSeperatorCharArray_0; public: inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t23B90B40F60E677A8025267341651C94AE079CDA_StaticFields, ___enumSeperatorCharArray_0)); } inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; } inline CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; } inline void set_enumSeperatorCharArray_0(CharU5BU5D_t7B7FC5BC8091AA3B9CB0B29CDD80B5EE9254AA34* value) { ___enumSeperatorCharArray_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___enumSeperatorCharArray_0), (void*)value); } }; // Native definition for P/Invoke marshalling of System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_pinvoke { }; // Native definition for COM marshalling of System.Enum struct Enum_t23B90B40F60E677A8025267341651C94AE079CDA_marshaled_com { }; // System.Runtime.CompilerServices.ExtensionAttribute struct ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: public: }; // System.FlagsAttribute struct FlagsAttribute_t511C558FACEF1CC64702A8FAB67CAF3CBA65DF36 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: public: }; // System.ObsoleteAttribute struct ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.ObsoleteAttribute::_message String_t* ____message_0; // System.Boolean System.ObsoleteAttribute::_error bool ____error_1; public: inline static int32_t get_offset_of__message_0() { return static_cast<int32_t>(offsetof(ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671, ____message_0)); } inline String_t* get__message_0() const { return ____message_0; } inline String_t** get_address_of__message_0() { return &____message_0; } inline void set__message_0(String_t* value) { ____message_0 = value; Il2CppCodeGenWriteBarrier((void**)(&____message_0), (void*)value); } inline static int32_t get_offset_of__error_1() { return static_cast<int32_t>(offsetof(ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671, ____error_1)); } inline bool get__error_1() const { return ____error_1; } inline bool* get_address_of__error_1() { return &____error_1; } inline void set__error_1(bool value) { ____error_1 = value; } }; // ExitGames.Client.Photon.PreserveAttribute struct PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: public: }; // System.Runtime.CompilerServices.RuntimeCompatibilityAttribute struct RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.Boolean System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::m_wrapNonExceptionThrows bool ___m_wrapNonExceptionThrows_0; public: inline static int32_t get_offset_of_m_wrapNonExceptionThrows_0() { return static_cast<int32_t>(offsetof(RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80, ___m_wrapNonExceptionThrows_0)); } inline bool get_m_wrapNonExceptionThrows_0() const { return ___m_wrapNonExceptionThrows_0; } inline bool* get_address_of_m_wrapNonExceptionThrows_0() { return &___m_wrapNonExceptionThrows_0; } inline void set_m_wrapNonExceptionThrows_0(bool value) { ___m_wrapNonExceptionThrows_0 = value; } }; // System.Runtime.Versioning.TargetFrameworkAttribute struct TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.String System.Runtime.Versioning.TargetFrameworkAttribute::_frameworkName String_t* ____frameworkName_0; // System.String System.Runtime.Versioning.TargetFrameworkAttribute::_frameworkDisplayName String_t* ____frameworkDisplayName_1; public: inline static int32_t get_offset_of__frameworkName_0() { return static_cast<int32_t>(offsetof(TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517, ____frameworkName_0)); } inline String_t* get__frameworkName_0() const { return ____frameworkName_0; } inline String_t** get_address_of__frameworkName_0() { return &____frameworkName_0; } inline void set__frameworkName_0(String_t* value) { ____frameworkName_0 = value; Il2CppCodeGenWriteBarrier((void**)(&____frameworkName_0), (void*)value); } inline static int32_t get_offset_of__frameworkDisplayName_1() { return static_cast<int32_t>(offsetof(TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517, ____frameworkDisplayName_1)); } inline String_t* get__frameworkDisplayName_1() const { return ____frameworkDisplayName_1; } inline String_t** get_address_of__frameworkDisplayName_1() { return &____frameworkDisplayName_1; } inline void set__frameworkDisplayName_1(String_t* value) { ____frameworkDisplayName_1 = value; Il2CppCodeGenWriteBarrier((void**)(&____frameworkDisplayName_1), (void*)value); } }; // System.Void struct Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5 { public: union { struct { }; uint8_t Void_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5__padding[1]; }; public: }; // System.Diagnostics.DebuggerBrowsableState struct DebuggerBrowsableState_t2A824ECEB650CFABB239FD0918FCC88A09B45091 { public: // System.Int32 System.Diagnostics.DebuggerBrowsableState::value__ int32_t ___value___2; public: inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(DebuggerBrowsableState_t2A824ECEB650CFABB239FD0918FCC88A09B45091, ___value___2)); } inline int32_t get_value___2() const { return ___value___2; } inline int32_t* get_address_of_value___2() { return &___value___2; } inline void set_value___2(int32_t value) { ___value___2 = value; } }; // System.Diagnostics.DebuggableAttribute/DebuggingModes struct DebuggingModes_t279D5B9C012ABA935887CB73C5A63A1F46AF08A8 { public: // System.Int32 System.Diagnostics.DebuggableAttribute/DebuggingModes::value__ int32_t ___value___2; public: inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(DebuggingModes_t279D5B9C012ABA935887CB73C5A63A1F46AF08A8, ___value___2)); } inline int32_t get_value___2() const { return ___value___2; } inline int32_t* get_address_of_value___2() { return &___value___2; } inline void set_value___2(int32_t value) { ___value___2 = value; } }; // System.Diagnostics.DebuggableAttribute struct DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.Diagnostics.DebuggableAttribute/DebuggingModes System.Diagnostics.DebuggableAttribute::m_debuggingModes int32_t ___m_debuggingModes_0; public: inline static int32_t get_offset_of_m_debuggingModes_0() { return static_cast<int32_t>(offsetof(DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B, ___m_debuggingModes_0)); } inline int32_t get_m_debuggingModes_0() const { return ___m_debuggingModes_0; } inline int32_t* get_address_of_m_debuggingModes_0() { return &___m_debuggingModes_0; } inline void set_m_debuggingModes_0(int32_t value) { ___m_debuggingModes_0 = value; } }; // System.Diagnostics.DebuggerBrowsableAttribute struct DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 : public Attribute_t037CA9D9F3B742C063DB364D2EEBBF9FC5772C71 { public: // System.Diagnostics.DebuggerBrowsableState System.Diagnostics.DebuggerBrowsableAttribute::state int32_t ___state_0; public: inline static int32_t get_offset_of_state_0() { return static_cast<int32_t>(offsetof(DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53, ___state_0)); } inline int32_t get_state_0() const { return ___state_0; } inline int32_t* get_address_of_state_0() { return &___state_0; } inline void set_state_0(int32_t value) { ___state_0 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif // System.Void System.Reflection.AssemblyFileVersionAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyFileVersionAttribute__ctor_mF855AEBC51CB72F4FF913499256741AE57B0F13D (AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F * __this, String_t* ___version0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyCopyrightAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyCopyrightAttribute__ctor_mB0B5F5C1A7A8B172289CC694E2711F07A37CE3F3 (AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC * __this, String_t* ___copyright0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyTitleAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyTitleAttribute__ctor_mE239F206B3B369C48AE1F3B4211688778FE99E8D (AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7 * __this, String_t* ___title0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyProductAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyProductAttribute__ctor_m26DF1EBC1C86E7DA4786C66B44123899BE8DBCB8 (AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA * __this, String_t* ___product0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyInformationalVersionAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyInformationalVersionAttribute__ctor_m9BF349D8F980B0ABAB2A6312E422915285FA1678 (AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0 * __this, String_t* ___informationalVersion0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyConfigurationAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyConfigurationAttribute__ctor_m6EE76F5A155EDEA71967A32F78D777038ADD0757 (AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C * __this, String_t* ___configuration0, const RuntimeMethod* method); // System.Void System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute__ctor_m551DDF1438CE97A984571949723F30F44CF7317C (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, const RuntimeMethod* method); // System.Void System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::set_WrapNonExceptionThrows(System.Boolean) IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, bool ___value0, const RuntimeMethod* method); // System.Void System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(System.Int32) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void CompilationRelaxationsAttribute__ctor_mAC3079EBC4EEAB474EED8208EF95DB39C922333B (CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF * __this, int32_t ___relaxations0, const RuntimeMethod* method); // System.Void System.Runtime.CompilerServices.ExtensionAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ExtensionAttribute__ctor_mB331519C39C4210259A248A4C629DF934937C1FA (ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC * __this, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyCompanyAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyCompanyAttribute__ctor_m435C9FEC405646617645636E67860598A0C46FF0 (AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4 * __this, String_t* ___company0, const RuntimeMethod* method); // System.Void System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void TargetFrameworkAttribute__ctor_m0F8E5550F9199AC44F2CBCCD3E968EC26731187D (TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 * __this, String_t* ___frameworkName0, const RuntimeMethod* method); // System.Void System.Runtime.Versioning.TargetFrameworkAttribute::set_FrameworkDisplayName(System.String) IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void TargetFrameworkAttribute_set_FrameworkDisplayName_mB89F1A63CB77A414AF46D5695B37CD520EAB52AB_inline (TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 * __this, String_t* ___value0, const RuntimeMethod* method); // System.Void System.Diagnostics.DebuggableAttribute::.ctor(System.Diagnostics.DebuggableAttribute/DebuggingModes) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void DebuggableAttribute__ctor_m7FF445C8435494A4847123A668D889E692E55550 (DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B * __this, int32_t ___modes0, const RuntimeMethod* method); // System.Void System.Reflection.AssemblyDescriptionAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void AssemblyDescriptionAttribute__ctor_m3A0BD500FF352A67235FBA499FBA58EFF15B1F25 (AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3 * __this, String_t* ___description0, const RuntimeMethod* method); // System.Void System.Reflection.DefaultMemberAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7 (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * __this, String_t* ___memberName0, const RuntimeMethod* method); // System.Void System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35 (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * __this, const RuntimeMethod* method); // System.Void System.Diagnostics.DebuggerBrowsableAttribute::.ctor(System.Diagnostics.DebuggerBrowsableState) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5 (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * __this, int32_t ___state0, const RuntimeMethod* method); // System.Void System.ObsoleteAttribute::.ctor(System.String) IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868 (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * __this, String_t* ___message0, const RuntimeMethod* method); // System.Void System.FlagsAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void FlagsAttribute__ctor_mE8DCBA1BE0E6B0424FEF5E5F249733CF6A0E1229 (FlagsAttribute_t511C558FACEF1CC64702A8FAB67CAF3CBA65DF36 * __this, const RuntimeMethod* method); // System.Void ExitGames.Client.Photon.PreserveAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6 (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * __this, const RuntimeMethod* method); // System.Void System.ObsoleteAttribute::.ctor() IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void ObsoleteAttribute__ctor_m9BC17A80675E9013AA71F9FB38D89FEF56883853 (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * __this, const RuntimeMethod* method); static void Photon3Unity3D_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F * tmp = (AssemblyFileVersionAttribute_tCC1036D0566155DC5688D9230EF3C07D82A1896F *)cache->attributes[0]; AssemblyFileVersionAttribute__ctor_mF855AEBC51CB72F4FF913499256741AE57B0F13D(tmp, il2cpp_codegen_string_new_wrapper("\x34\x2E\x31\x2E\x36\x2E\x37"), NULL); } { AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC * tmp = (AssemblyCopyrightAttribute_tA6A09319EF50B48D962810032000DEE7B12904EC *)cache->attributes[1]; AssemblyCopyrightAttribute__ctor_mB0B5F5C1A7A8B172289CC694E2711F07A37CE3F3(tmp, il2cpp_codegen_string_new_wrapper("\x28\x63\x29\x20\x45\x78\x69\x74\x20\x47\x61\x6D\x65\x73\x20\x47\x6D\x62\x48\x2C\x20\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x65\x78\x69\x74\x67\x61\x6D\x65\x73\x2E\x63\x6F\x6D"), NULL); } { AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7 * tmp = (AssemblyTitleAttribute_tABB894D0792C7F307694CC796C8AE5D6A20382E7 *)cache->attributes[2]; AssemblyTitleAttribute__ctor_mE239F206B3B369C48AE1F3B4211688778FE99E8D(tmp, il2cpp_codegen_string_new_wrapper("\x50\x68\x6F\x74\x6F\x6E\x33\x55\x6E\x69\x74\x79\x33\x44"), NULL); } { AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA * tmp = (AssemblyProductAttribute_t6BB0E0F76C752E14A4C26B4D1E230019068601CA *)cache->attributes[3]; AssemblyProductAttribute__ctor_m26DF1EBC1C86E7DA4786C66B44123899BE8DBCB8(tmp, il2cpp_codegen_string_new_wrapper("\x50\x68\x6F\x74\x6F\x6E\x20\x2E\x4E\x65\x74\x20\x43\x6C\x69\x65\x6E\x74\x20\x4C\x69\x62\x72\x61\x72\x79\x2E\x20\x44\x65\x62\x75\x67\x2E"), NULL); } { AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0 * tmp = (AssemblyInformationalVersionAttribute_t962229DBE84C4A66FB0B542E9AEBC510F55950D0 *)cache->attributes[4]; AssemblyInformationalVersionAttribute__ctor_m9BF349D8F980B0ABAB2A6312E422915285FA1678(tmp, il2cpp_codegen_string_new_wrapper("\x34\x2E\x31\x2E\x36\x2E\x37"), NULL); } { AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C * tmp = (AssemblyConfigurationAttribute_t071B324A83314FBA14A43F37BE7206C420218B7C *)cache->attributes[5]; AssemblyConfigurationAttribute__ctor_m6EE76F5A155EDEA71967A32F78D777038ADD0757(tmp, il2cpp_codegen_string_new_wrapper("\x55\x6E\x69\x74\x79\x2D\x44\x65\x62\x75\x67"), NULL); } { RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * tmp = (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 *)cache->attributes[6]; RuntimeCompatibilityAttribute__ctor_m551DDF1438CE97A984571949723F30F44CF7317C(tmp, NULL); RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline(tmp, true, NULL); } { CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF * tmp = (CompilationRelaxationsAttribute_t661FDDC06629BDA607A42BD660944F039FE03AFF *)cache->attributes[7]; CompilationRelaxationsAttribute__ctor_mAC3079EBC4EEAB474EED8208EF95DB39C922333B(tmp, 8LL, NULL); } { ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC * tmp = (ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC *)cache->attributes[8]; ExtensionAttribute__ctor_mB331519C39C4210259A248A4C629DF934937C1FA(tmp, NULL); } { AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4 * tmp = (AssemblyCompanyAttribute_t642AAB097D7DEAAB623BEBE4664327E9B01D1DE4 *)cache->attributes[9]; AssemblyCompanyAttribute__ctor_m435C9FEC405646617645636E67860598A0C46FF0(tmp, il2cpp_codegen_string_new_wrapper("\x45\x78\x69\x74\x20\x47\x61\x6D\x65\x73\x20\x47\x6D\x62\x48"), NULL); } { TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 * tmp = (TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 *)cache->attributes[10]; TargetFrameworkAttribute__ctor_m0F8E5550F9199AC44F2CBCCD3E968EC26731187D(tmp, il2cpp_codegen_string_new_wrapper("\x2E\x4E\x45\x54\x53\x74\x61\x6E\x64\x61\x72\x64\x2C\x56\x65\x72\x73\x69\x6F\x6E\x3D\x76\x32\x2E\x30"), NULL); TargetFrameworkAttribute_set_FrameworkDisplayName_mB89F1A63CB77A414AF46D5695B37CD520EAB52AB_inline(tmp, il2cpp_codegen_string_new_wrapper(""), NULL); } { DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B * tmp = (DebuggableAttribute_tA8054EBD0FC7511695D494B690B5771658E3191B *)cache->attributes[11]; DebuggableAttribute__ctor_m7FF445C8435494A4847123A668D889E692E55550(tmp, 263LL, NULL); } { AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3 * tmp = (AssemblyDescriptionAttribute_tF4460CCB289F6E2F71841792BBC7E6907DF612B3 *)cache->attributes[12]; AssemblyDescriptionAttribute__ctor_m3A0BD500FF352A67235FBA499FBA58EFF15B1F25(tmp, il2cpp_codegen_string_new_wrapper("\x50\x68\x6F\x74\x6F\x6E\x20\x2E\x4E\x65\x74\x20\x43\x6C\x69\x65\x6E\x74\x20\x4C\x69\x62\x72\x61\x72\x79\x2E\x20\x44\x65\x62\x75\x67\x2E"), NULL); } } static void NonAllocDictionary_2_t494108AA5392585175363DC011E0A8548B83D323_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * tmp = (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 *)cache->attributes[0]; DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7(tmp, il2cpp_codegen_string_new_wrapper("\x49\x74\x65\x6D"), NULL); } } static void Hashtable_t43276794A006CD84952AFAB156E51DD9D331596D_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * tmp = (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 *)cache->attributes[0]; DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7(tmp, il2cpp_codegen_string_new_wrapper("\x49\x74\x65\x6D"), NULL); } } static void EnetPeer_t5AD13D3D19967EEBDC6E6ABF4014FEABA9B91A11_CustomAttributesCacheGenerator_EnetPeer_U3CExecuteCommandU3Eb__67_0_m8F605FA9632A74152FB5A72722CCA847943F531A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CStateU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerAddressU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CProxyServerAddressU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerIpAddressU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerPortU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CAddressResolvedAsIpv6U3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CUrlProtocolU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CUrlPathU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_State_mDAFB23564FCDD0B908349615A9F89F7B8A8BFCB7(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_State_mEB1A3E332871058C2AE41245B3E4F0E244634352(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerAddress_m56C64D66D3113ABC6FB69CA60197FF4133521634(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerAddress_m77C312F7EE07976DCFE34E8764640322DD2DD8F6(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ProxyServerAddress_mA402452D1BAD9BFB332C18380F119F387FD67196(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ProxyServerAddress_m293884170C06E3EE7CBE34D7F8B929804947D477(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerIpAddress_m876B5EC11C76C6E9D791940C83B623543E2E0BC3(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerIpAddress_m25917C1E33695DD3DBAAC3987F51B8C68EF5A8AB(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerPort_mA1212F90468B45FBAD6595D8B6DF7843F7D9083D(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerPort_mD58933D87186FD560F2EC043A08C05C0E656EA18(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_AddressResolvedAsIpv6_m38D2AA58774AE12096CC08949B7E1657FE7B09B1(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_AddressResolvedAsIpv6_m3D040A7D67865B70B446B04DF6D4E6643314FBF7(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_UrlProtocol_m208EDECA0FCDD3BC72B2E4DE3023F17FAB49D208(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_UrlProtocol_mF3ACCBDEF01E64D438B5B068D9E825F585829995(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_UrlPath_m9C0611FCF989016E5DC593F96C00C10121541EBE(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_UrlPath_m17E864630E823F853EC4C43CF114460538A2522C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_GetIpAddress_m996B87B3843D000F9C531ABC0EC95D9CEE11E6BC(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x47\x65\x74\x49\x70\x41\x64\x64\x72\x65\x73\x73\x65\x73\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_U3CHandleExceptionU3Eb__52_0_mB01D02D1DE74230127CA24ED9AF9869CE383161F(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void U3CU3Ec_t9A2BC021C4A880E8D16586B3CD40A858C1011163_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void IProtocol_t97CF065A514B86E8246F81F94877443594E66C4D_CustomAttributesCacheGenerator_IProtocol_SerializeOperationRequest_mBBD6586715541B9E0A0F4B50A74E15A775AEBDAF(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_U3CDelayU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_SimulationItem_get_Delay_m141FE4B8806BDA19F6A73DCF04037305882F2990(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_SimulationItem_set_Delay_m90CF81EE0138EC226B93F3F2508AE0F67FE316C4(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_U3CLostPackagesOutU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_U3CLostPackagesInU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_get_LostPackagesOut_m46194E80E8FBCC649A17BBDEDDC87D8B1284741C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_set_LostPackagesOut_mFE8310FE3BD579497025DBEDBF004AE1501A414F(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_get_LostPackagesIn_m909AC17AEDCD0B59F2CBF9B91164CE24482DBE0C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_set_LostPackagesIn_mF715AE42E56240A47D69943588D8163AB64CB159(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void ParameterDictionary_tB15EFEE2CDF94EA8CCB2E555C303C2E9B881FC48_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * tmp = (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 *)cache->attributes[0]; DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7(tmp, il2cpp_codegen_string_new_wrapper("\x49\x74\x65\x6D"), NULL); } } static void InitV3Flags_tEDF20BE4B3CD3397F82FFB6818803AA2B6C79972_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { FlagsAttribute_t511C558FACEF1CC64702A8FAB67CAF3CBA65DF36 * tmp = (FlagsAttribute_t511C558FACEF1CC64702A8FAB67CAF3CBA65DF36 *)cache->attributes[0]; FlagsAttribute__ctor_mE8DCBA1BE0E6B0424FEF5E5F249733CF6A0E1229(tmp, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_U3CServerAddressU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_U3CProxyServerAddressU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_get_ServerAddress_mBA00E051166380F8610D8AAA35432B582A10744B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_set_ServerAddress_m828DE274DD25D5997E245F747954432CFDFB4B8A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_get_ProxyServerAddress_m5DB6BE58131FFA09158D375D136FD75AA9100286(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_set_ProxyServerAddress_m8E8947B118B0A71272D4563E44C155A53A1D7E99(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void U3CU3Ec__DisplayClass108_0_tBB05E30A677ADB956D2883A292F69D17A0FF2F93_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void U3CU3Ec__DisplayClass109_0_t1E66B11CA652319C771043F6270FD73F48258A37_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonClientWebSocket_t430BF4D7E528165DAEFCA5095D4B0AF0ECA46634_CustomAttributesCacheGenerator_PhotonClientWebSocket__ctor_m98E546896B93412B98162E1A9C515F51D0945FD1(CustomAttributesCache* cache) { { PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * tmp = (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 *)cache->attributes[0]; PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CCommandBufferSizeU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CLimitOfUnreliableCommandsU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_WarningSize(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x43\x68\x65\x63\x6B\x20\x51\x75\x65\x75\x65\x64\x4F\x75\x74\x67\x6F\x69\x6E\x67\x43\x6F\x6D\x6D\x61\x6E\x64\x73\x20\x61\x6E\x64\x20\x51\x75\x65\x75\x65\x64\x49\x6E\x63\x6F\x6D\x69\x6E\x67\x43\x6F\x6D\x6D\x61\x6E\x64\x73\x20\x6F\x6E\x20\x64\x65\x6D\x61\x6E\x64\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeDatagramEncrypt(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x57\x68\x65\x72\x65\x20\x64\x79\x6E\x61\x6D\x69\x63\x20\x6C\x69\x6E\x6B\x69\x6E\x67\x20\x69\x73\x20\x61\x76\x61\x69\x6C\x61\x62\x6C\x65\x2C\x20\x74\x68\x69\x73\x20\x6C\x69\x62\x72\x61\x72\x79\x20\x77\x69\x6C\x6C\x20\x61\x74\x74\x65\x6D\x70\x74\x20\x74\x6F\x20\x6C\x6F\x61\x64\x20\x69\x74\x20\x61\x6E\x64\x20\x66\x61\x6C\x6C\x62\x61\x63\x6B\x20\x74\x6F\x20\x61\x20\x6D\x61\x6E\x61\x67\x65\x64\x20\x69\x6D\x70\x6C\x65\x6D\x65\x6E\x74\x61\x74\x69\x6F\x6E\x2E\x20\x54\x68\x69\x73\x20\x76\x61\x6C\x75\x65\x20\x69\x73\x20\x61\x6C\x77\x61\x79\x73\x20\x74\x72\x75\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_CommandLogSize(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x74\x68\x65\x20\x49\x54\x72\x61\x66\x66\x69\x63\x52\x65\x63\x6F\x72\x64\x65\x72\x20\x74\x6F\x20\x63\x61\x70\x74\x75\x72\x65\x20\x61\x6C\x6C\x20\x74\x72\x61\x66\x66\x69\x63\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeSocketLibAvailable(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x41\x20\x4E\x61\x74\x69\x76\x65\x20\x53\x6F\x63\x6B\x65\x74\x20\x69\x6D\x70\x6C\x65\x6D\x65\x6E\x74\x61\x74\x69\x6F\x6E\x20\x69\x73\x20\x6E\x6F\x20\x6C\x6F\x6E\x67\x65\x72\x20\x70\x61\x72\x74\x20\x6F\x66\x20\x74\x68\x69\x73\x20\x44\x4C\x4C\x20\x62\x75\x74\x20\x64\x65\x6C\x69\x76\x65\x72\x65\x64\x20\x69\x6E\x20\x61\x20\x73\x65\x70\x61\x72\x61\x74\x65\x20\x61\x64\x64\x2D\x6F\x6E\x2E\x20\x54\x68\x69\x73\x20\x76\x61\x6C\x75\x65\x20\x61\x6C\x77\x61\x79\x73\x20\x72\x65\x74\x75\x72\x6E\x73\x20\x66\x61\x6C\x73\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativePayloadEncryptionLibAvailable(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x4E\x61\x74\x69\x76\x65\x20\x50\x61\x79\x6C\x6F\x61\x64\x20\x45\x6E\x63\x72\x79\x70\x74\x69\x6F\x6E\x20\x69\x73\x20\x6E\x6F\x20\x6C\x6F\x6E\x67\x65\x72\x20\x70\x61\x72\x74\x20\x6F\x66\x20\x74\x68\x69\x73\x20\x44\x4C\x4C\x20\x62\x75\x74\x20\x64\x65\x6C\x69\x76\x65\x72\x65\x64\x20\x69\x6E\x20\x61\x20\x73\x65\x70\x61\x72\x61\x74\x65\x20\x61\x64\x64\x2D\x6F\x6E\x2E\x20\x54\x68\x69\x73\x20\x76\x61\x6C\x75\x65\x20\x61\x6C\x77\x61\x79\x73\x20\x72\x65\x74\x75\x72\x6E\x73\x20\x66\x61\x6C\x73\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeDatagramEncryptionLibAvailable(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x4E\x61\x74\x69\x76\x65\x20\x44\x61\x74\x61\x67\x72\x61\x6D\x20\x45\x6E\x63\x72\x79\x70\x74\x69\x6F\x6E\x20\x69\x73\x20\x6E\x6F\x20\x6C\x6F\x6E\x67\x65\x72\x20\x70\x61\x72\x74\x20\x6F\x66\x20\x74\x68\x69\x73\x20\x44\x4C\x4C\x20\x62\x75\x74\x20\x64\x65\x6C\x69\x76\x65\x72\x65\x64\x20\x69\x6E\x20\x61\x20\x73\x65\x70\x61\x72\x61\x74\x65\x20\x61\x64\x64\x2D\x6F\x6E\x2E\x20\x54\x68\x69\x73\x20\x76\x61\x6C\x75\x65\x20\x61\x6C\x77\x61\x79\x73\x20\x72\x65\x74\x75\x72\x6E\x73\x20\x66\x61\x6C\x73\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CSerializationProtocolTypeU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CSocketImplementationU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CListenerU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_OnDisconnectMessage(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CEnableServerTracingU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTransportProtocolU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CIsSendingOnlyAcksU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsIncomingU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsOutgoingU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsGameLevelU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CCountDiscardedU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CDeltaUnreliableNumberU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_CommandBufferSize_mED4A67BEA18EFDD5E442F220D30251B5E955F053(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_CommandBufferSize_mDC4867BD684A8EEF618FF803DF926041176EB7CC(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_LimitOfUnreliableCommands_m63A949D0F66E1B4A8B5D2F1966B0620ABC278760(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_LimitOfUnreliableCommands_m7FD97CDEEB91D1093EFE9D91084BD6B7946447CE(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_CommandLogToString_m2AD468802CC562162E6A4C4D96C1F707E513C9F8(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x74\x68\x65\x20\x49\x54\x72\x61\x66\x66\x69\x63\x52\x65\x63\x6F\x72\x64\x65\x72\x20\x74\x6F\x20\x63\x61\x70\x74\x75\x72\x65\x20\x61\x6C\x6C\x20\x74\x72\x61\x66\x66\x69\x63\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_SerializationProtocolType_mF60E595723244B0D51488DC7ED439BBD91D9691D(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_SerializationProtocolType_m0D0AF7D18EBB0BDB86758603974F08E573709C97(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_SocketImplementation_mAC4A1FC38B0992934D9EB4FC6EC12021D2C07602(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_SocketImplementation_mCB5F277B27CE41B02711F7CA8DA13BD23206480B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_Listener_m32A614E05D4B4FA72290C3053E76FF9806D6ED40(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_Listener_m3B9D9064882296A931EBF0825985F3E972B71484(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_add_OnDisconnectMessage_m258A7479574B12A2AB747ACE1AA231715047E75A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_remove_OnDisconnectMessage_mA8AC170F3AAF9C3E554AE8DD54A5BA74BCE8A107(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_EnableServerTracing_m073F7619DBFAD33E5F268BBC7529C8EF09C83993(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_EnableServerTracing_m605F93EC9C46490BA7F423D3BF65295BAF467FF0(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TransportProtocol_m01550D021FF3018EA1C26EA5D03FB28E8E48B976(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TransportProtocol_mD0C65EA0EAFE8C4B5B97F0AB1C78901B7FD21C7C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_IsSendingOnlyAcks_m144C45758C3A22E01F075F36A116027386AFB59A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_IsSendingOnlyAcks_mA963C7F1BDC2679771389686C2DC80BEF036226C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsIncoming_m48CFA163E760CF4E49E4D6114D480BCF3F14242B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsIncoming_mFCDB22308CA59E52318FE926DF2E18567A3488A0(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsOutgoing_m8C84A20B4F544DD19AD1D89DBE7C758C32BAC859(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsOutgoing_m897667F27CC4D49576C2ED11DB156D49DBA98E89(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsGameLevel_m547273B4F799F32F340414A92D4685096C723651(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsGameLevel_m2F9D814A65DC82B1FC89422CB6A64AF2260C4C4B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_CountDiscarded_mEFBE5D76A731B7BB4C99839C1B2161E1A43AA661(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_CountDiscarded_m9F48EC3A68D7E463D29CA1C5F400EB4F96F72B6B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_DeltaUnreliableNumber_mE51DC4246011A2B0D9C50246508D52C64D2E75ED(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_DeltaUnreliableNumber_mB6BCB6E8E2F601C09D21383D952446869C599829(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_U3CEstablishEncryptionU3Eb__220_0_mE667CAA31466463CCFCB6084061770CA57F3F67B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____CommandBufferSize_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x53\x65\x65\x20\x72\x65\x6D\x61\x72\x6B\x73\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LimitOfUnreliableCommands_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x53\x65\x65\x20\x72\x65\x6D\x61\x72\x6B\x73\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LocalTimeInMilliSeconds_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x52\x65\x74\x75\x72\x6E\x73\x20\x53\x75\x70\x70\x6F\x72\x74\x43\x6C\x61\x73\x73\x2E\x47\x65\x74\x54\x69\x63\x6B\x43\x6F\x75\x6E\x74\x28\x29\x2E\x20\x53\x68\x6F\x75\x6C\x64\x20\x62\x65\x20\x72\x65\x70\x6C\x61\x63\x65\x64\x20\x62\x79\x20\x61\x20\x53\x74\x6F\x70\x57\x61\x74\x63\x68\x20\x6F\x72\x20\x74\x68\x65\x20\x70\x65\x72\x20\x70\x65\x65\x72\x20\x50\x68\x6F\x74\x6F\x6E\x50\x65\x65\x72\x2E\x43\x6C\x69\x65\x6E\x74\x54\x69\x6D\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____ClientVersion_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x54\x68\x65\x20\x73\x74\x61\x74\x69\x63\x20\x73\x74\x72\x69\x6E\x67\x20\x56\x65\x72\x73\x69\x6F\x6E\x20\x73\x68\x6F\x75\x6C\x64\x20\x62\x65\x20\x70\x72\x65\x66\x65\x72\x72\x65\x64\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LocalMsTimestampDelegate_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x54\x68\x65\x20\x50\x68\x6F\x74\x6F\x6E\x50\x65\x65\x72\x20\x77\x69\x6C\x6C\x20\x6E\x6F\x20\x6C\x6F\x6E\x67\x65\x72\x20\x75\x73\x65\x20\x74\x68\x69\x73\x20\x64\x65\x6C\x65\x67\x61\x74\x65\x2E\x20\x49\x74\x20\x75\x73\x65\x73\x20\x61\x20\x53\x74\x6F\x70\x77\x61\x74\x63\x68\x20\x69\x6E\x20\x61\x6C\x6C\x20\x63\x61\x73\x65\x73\x2E\x20\x59\x6F\x75\x20\x63\x61\x6E\x20\x61\x63\x63\x65\x73\x73\x20\x50\x68\x6F\x74\x6F\x6E\x50\x65\x65\x72\x2E\x43\x6F\x6E\x6E\x65\x63\x74\x69\x6F\x6E\x54\x69\x6D\x65\x2E"), NULL); } } static void PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____IsSendingOnlyAcks_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x49\x6E\x74\x65\x72\x6E\x61\x6C\x6C\x79\x20\x6E\x6F\x74\x20\x75\x73\x65\x64\x20\x61\x6E\x79\x6D\x6F\x72\x65\x2E\x20\x43\x61\x6C\x6C\x20\x53\x65\x6E\x64\x41\x63\x6B\x73\x4F\x6E\x6C\x79\x28\x29\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void OperationResponse_t9F45DBD05141C2572E1B7C2BB11FCC67539B2339_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * tmp = (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 *)cache->attributes[0]; DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7(tmp, il2cpp_codegen_string_new_wrapper("\x49\x74\x65\x6D"), NULL); } } static void EventData_t41CAA5D795431288640D65BE20D34F143095CAA0_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 * tmp = (DefaultMemberAttribute_t8C9B3330DEA69EE364962477FF14FD2CFE30D4B5 *)cache->attributes[0]; DefaultMemberAttribute__ctor_mA025B6F5B3A9292696E01108027840C8DFF7F4D7(tmp, il2cpp_codegen_string_new_wrapper("\x49\x74\x65\x6D"), NULL); } } static void Protocol_tAAF1E6CCEDD412DC75640BB2ABFFE544B77BE426_CustomAttributesCacheGenerator_Protocol_Serialize_m12B5F68DCE95A73EEF827614659747445BDA181E(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_m9BC17A80675E9013AA71F9FB38D89FEF56883853(tmp, NULL); } } static void Protocol_tAAF1E6CCEDD412DC75640BB2ABFFE544B77BE426_CustomAttributesCacheGenerator_Protocol_Deserialize_m39BBF69941057724F92A9888606F11C7FD066E3A(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_m9BC17A80675E9013AA71F9FB38D89FEF56883853(tmp, NULL); } } static void Protocol16_t596EA8306EB75FE816B67296ED3BE02D27E8EB28_CustomAttributesCacheGenerator_Protocol16_SerializeOperationRequest_m312D6090797204076EC3A44AE3E18EDF3A7B6B3E(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void Protocol16_t596EA8306EB75FE816B67296ED3BE02D27E8EB28_CustomAttributesCacheGenerator_Protocol16_SerializeParameterTable_mA119FFA12DAC30EAC196877B1129335A850965C5(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x20\x69\x6E\x73\x74\x65\x61\x64\x20\x6F\x66\x20\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x3C\x62\x79\x74\x65\x2C\x20\x6F\x62\x6A\x65\x63\x74\x3E\x2E"), NULL); } } static void Protocol18_tEB062EBABDD1F23701CFC8C61840F02645BA1A6A_CustomAttributesCacheGenerator_Protocol18_ReadParameterTable_mBB8059C8855D4F068EF4751E6B81E4CDD633AD9D(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void Protocol18_tEB062EBABDD1F23701CFC8C61840F02645BA1A6A_CustomAttributesCacheGenerator_Protocol18_SerializeOperationRequest_m43DF94330632DB5856291F6F2D725B2745FAF456(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x50\x61\x72\x61\x6D\x65\x74\x65\x72\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void SocketTcp_t01C6083F9CEF0FADEB60D2E707AAAAB86CAB785D_CustomAttributesCacheGenerator_SocketTcp__ctor_mD141A944D060CD6D5B3CA236FEEE3EDA841DA5F1(CustomAttributesCache* cache) { { PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * tmp = (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 *)cache->attributes[0]; PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6(tmp, NULL); } } static void SocketTcpAsync_t207303B13BC1A92F2D1CEF472F7B192AD88E53F9_CustomAttributesCacheGenerator_SocketTcpAsync__ctor_m3B5F4CB21E1B9B3E619553571AE611B073AC805E(CustomAttributesCache* cache) { { PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * tmp = (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 *)cache->attributes[0]; PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6(tmp, NULL); } } static void SocketUdp_tF59E237D5B40CF2580FA3A9A8393A922F3050103_CustomAttributesCacheGenerator_SocketUdp__ctor_mDECBE74F464FA5BACFE8919B950045B93720F75C(CustomAttributesCache* cache) { { PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * tmp = (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 *)cache->attributes[0]; PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6(tmp, NULL); } } static void SocketUdpAsync_t5493EC69082FE106C9585E489CDC7037FD837D2A_CustomAttributesCacheGenerator_SocketUdpAsync__ctor_m1BAFB585CA8F1E06FB40C7155D14AA71D7101323(CustomAttributesCache* cache) { { PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 * tmp = (PreserveAttribute_tCC0AA2F199BC71EE6BEE5F51262C0D71CFFAB9F2 *)cache->attributes[0]; PreserveAttribute__ctor_m95DB539C9E0501CD6252873B6032F8CD594F5FC6(tmp, NULL); } } static void SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_IntegerMilliseconds(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x61\x20\x53\x74\x6F\x70\x77\x61\x74\x63\x68\x20\x28\x6F\x72\x20\x65\x71\x75\x69\x76\x61\x6C\x65\x6E\x74\x29\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_SupportClass_GetTickCount_m6E96AA7752CB48A847EB37373F8FE7C5743C02BC(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x61\x20\x53\x74\x6F\x70\x77\x61\x74\x63\x68\x20\x28\x6F\x72\x20\x65\x71\x75\x69\x76\x61\x6C\x65\x6E\x74\x29\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_SupportClass_HashtableToString_m0BC17B78D5F62D25534E44AC31562B83719A0863(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x44\x69\x63\x74\x69\x6F\x6E\x61\x72\x79\x54\x6F\x53\x74\x72\x69\x6E\x67\x28\x29\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void IntegerMillisecondsDelegate_t3B747A2EE4B95236BD820C0D9B70C2CF2FCAE750_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x61\x20\x53\x74\x6F\x70\x77\x61\x74\x63\x68\x20\x28\x6F\x72\x20\x65\x71\x75\x69\x76\x61\x6C\x65\x6E\x74\x29\x20\x69\x6E\x73\x74\x65\x61\x64\x2E"), NULL); } } static void U3CU3Ec__DisplayClass6_0_tF85F03854BAA5BA374F696C56DDD9BF298D75001_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void U3CU3Ec_tAC8414720601A183308D2AA65AD7F08279081DEF_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void Pool_1_t311BD0ECBB5BF708792FFCBAA59B394033DC9223_CustomAttributesCacheGenerator_Pool_1_Push_m8C4FB6D02D497F6C30295FDF505BCE9755A0F22F(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x52\x65\x6C\x65\x61\x73\x65\x28\x29\x20\x72\x61\x74\x68\x65\x72\x20\x74\x68\x61\x6E\x20\x50\x75\x73\x68\x28\x29"), NULL); } } static void Pool_1_t311BD0ECBB5BF708792FFCBAA59B394033DC9223_CustomAttributesCacheGenerator_Pool_1_Pop_m5BD13FE3A4DA03BC98D0783A0A6273358E66FC94(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x41\x63\x71\x75\x69\x72\x65\x28\x29\x20\x72\x61\x74\x68\x65\x72\x20\x74\x68\x61\x6E\x20\x50\x6F\x70\x28\x29"), NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3COperationByteCountU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3COperationCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CResultByteCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CResultCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CEventByteCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CEventCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestOpResponseCallbackU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestOpResponseCallbackOpCodeU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestEventCallbackU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestMessageCallbackU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestRawMessageCallbackU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestEventCallbackCodeU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestDeltaBetweenDispatchingU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestDeltaBetweenSendingU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CDispatchIncomingCommandsCallsU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CSendOutgoingCommandsCallsU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_OperationByteCount_mEAEA6746A0E37D562347595A41576E1866DCAB6E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_OperationByteCount_mDBA2636180CB4B0875CC0E9146908C4290AF49A7(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_OperationCount_m6A5540472A3E756325282101AAE3C131BEBD77DF(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_OperationCount_m9E168CEE3D5A9CF7E3EE71C3C2561EAB1837454A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_ResultByteCount_mD463A4DEAE994194240AF24FAD525A923990122A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_ResultByteCount_m4D8E9C2CC2F78A544B1D19D249ACE9047AAFB720(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_ResultCount_m90665579E797420B1D859E82181D963AE423A1BB(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_ResultCount_m4E0F96A38ED3DEC0803CF53AB337A589F8932D78(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_EventByteCount_m82BE4C6CC4E3F3C2FF8243BB2F9113B9853CDB39(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_EventByteCount_m44C38C2A6834322C46145DDEE5F67E80C85D8390(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_EventCount_m1D1BB997DCC0E6028583BB61AADDBC721E107F5F(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_EventCount_m3EFD81CFDAD6B23A3D38DD975C79C40BEE394ADD(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestOpResponseCallback_m89C4A1997BD56FC19FFD7E104A78A8CA328BD031(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestOpResponseCallback_m114807F3D0DD6BD4FDDD3CB62B87857BD226BC95(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestOpResponseCallbackOpCode_mE4EF2EA1B28D3CBCADBED4CDED5E997D4983C3D3(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestOpResponseCallbackOpCode_mA9A1B11FAAD6969A5826A2E0C9A631DF7DBC2B20(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestEventCallback_mA58215CA362E5A376906B8770F7C437E90AB0C00(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestEventCallback_mB42ECC6E81E9F64F758E738644844CEE9D382877(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestMessageCallback_m98E3D06E66D21D50676AEF0B0F96EBF93F2C0085(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestMessageCallback_mD79BDA14591257A8AB1A6FA356717ECA67063DF9(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestRawMessageCallback_m1EAA1C2717808D7692F5B7C349B8AA31979A020D(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestRawMessageCallback_m8E337CE4AAC5C504BABA0746C2946590AB40BE5B(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestEventCallbackCode_m83BC5AAF7C4BB8FDFFE77E7D5EC6777B45FBC084(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestEventCallbackCode_m5B0C5BC84316A4A3099C8361918371BFB2EFAFA9(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestDeltaBetweenDispatching_m2138CCC0FB816757A149D23A841B684B1332C52C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestDeltaBetweenDispatching_mF79FC622793ACE1A05FD00755226B15964D1E3D7(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestDeltaBetweenSending_mA240841A234D13776BC922E471DBDD56102CD1DF(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestDeltaBetweenSending_m51D0312C6ED647FCFD69579C5E5A7DE60E690F75(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_DispatchIncomingCommandsCalls_m67FE1757E48B20BD5BDED5D15445A404EBDA8186(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_DispatchIncomingCommandsCalls_m5432A40E4A84CBD756AA97E29ED6C60D537D4715(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_SendOutgoingCommandsCalls_m06F333C2230987AEE7BA61181492B3EEA9487460(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_SendOutgoingCommandsCalls_m68F95A69F7E28629D5AA6BBDBAF8D45E735A4860(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE____DispatchCalls_PropertyInfo(CustomAttributesCache* cache) { { ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 * tmp = (ObsoleteAttribute_t14BAC1669C0409EB9F28D72D664FFA6764ACD671 *)cache->attributes[0]; ObsoleteAttribute__ctor_mAC32A5CCD287DA84CDA9F08282C1C8B0DB7B9868(tmp, il2cpp_codegen_string_new_wrapper("\x55\x73\x65\x20\x44\x69\x73\x70\x61\x74\x63\x68\x49\x6E\x63\x6F\x6D\x69\x6E\x67\x43\x6F\x6D\x6D\x61\x6E\x64\x73\x43\x61\x6C\x6C\x73\x2C\x20\x77\x68\x69\x63\x68\x20\x68\x61\x73\x20\x70\x72\x6F\x70\x65\x72\x20\x6E\x61\x6D\x69\x6E\x67\x2E"), NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CPackageHeaderSizeU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CReliableCommandCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CUnreliableCommandCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CFragmentCommandCountU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CControlCommandCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTotalPacketCountU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTotalCommandsInPacketsU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CReliableCommandBytesU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CUnreliableCommandBytesU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CFragmentCommandBytesU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CControlCommandBytesU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTimestampOfLastAckU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTimestampOfLastReliableCommandU3Ek__BackingField(CustomAttributesCache* cache) { { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[0]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[1]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_PackageHeaderSize_m6E7967C05DC07B5CEE066B7592958FBA38AEE2AE(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_PackageHeaderSize_m0A546780848D3DE78AF09AAF3ECF3B6D9FD35EEE(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ReliableCommandCount_m3A00B8B87206F07D3349C4BD10C171C1E4F43D8A(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ReliableCommandCount_m688661290C1B82D59EBE55E67DFC9D51BAEE2CA2(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_UnreliableCommandCount_mD2101C26EDE2021AAA0C22153E3980D28F2001EF(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_UnreliableCommandCount_m9A154B152B89094F71D03B9A734E29572587D64E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_FragmentCommandCount_m7A2C94AB9548C5D78BE04732C5F42FB69E894AEF(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_FragmentCommandCount_m9A9706E97A88FACCDB9597649E3CB22349E54718(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ControlCommandCount_mD536B0DE0D5027299A83057B9F902634172620F6(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ControlCommandCount_mAFA53CF50631B403C5A8578C1D6BB404B5AA312E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TotalPacketCount_m18F47303C566612B682A48DA17A363D1D5B5B36C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TotalPacketCount_mA7661F711C01B043943C70168C2242E62C53669E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TotalCommandsInPackets_m210E35991B39DD61B66310627B783D09E8CE2FA7(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TotalCommandsInPackets_m7A4FABB9CB8D5ABC2F4554519DDF019CD4D0E75E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ReliableCommandBytes_m0FD14CACEEBE0873883D979D803D7D8F0894C3A6(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ReliableCommandBytes_mFD53F673FAFC9D362BE59DDFCF54782159C551E8(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_UnreliableCommandBytes_m4355182C66C5863229FA674D3029587CD1C08363(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_UnreliableCommandBytes_m0438CEB34B857617B95751EDC8357F48124C3F51(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_FragmentCommandBytes_m396E7AFE87DCF40B2133E3C031A8C4BF34287909(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_FragmentCommandBytes_m8AA50DAAB78996AFBB9AE2EF7FB1A815232458B6(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ControlCommandBytes_m2CDF35F035C14FB76CCB6E451835B4F1D010401E(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ControlCommandBytes_m0CB11A574B1A810EBB1C801B42DFCB98BE9D6400(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TimestampOfLastAck_m113A8659BEF193FF510165B59EC45C0575162A3F(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TimestampOfLastAck_m05F177031BE76494F61D4237379263A61A58FE8C(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TimestampOfLastReliableCommand_mB0CD45E41D3574C46A4DBCF6DBC02C5F0D01AB53(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TimestampOfLastReliableCommand_mB6AA07D8D13D5299AE8423CACE824E8686A5AAAB(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_U3CReturnPoolU3Ek__BackingField(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } { DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 * tmp = (DebuggerBrowsableAttribute_t2FA4793AD1982F5150E07D26822ED5953CD90F53 *)cache->attributes[1]; DebuggerBrowsableAttribute__ctor_mAA8BCC1E418754685F320B14A08AC226E76346E5(tmp, 0LL, NULL); } } static void StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_StructWrapper_1_get_ReturnPool_mF536F2866FD01E6A644324C8FD1F4A2662D08B30(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_StructWrapper_1_set_ReturnPool_m3CF9F57E151517FB6476BD558307481DC2A7BD49(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } static void StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC * tmp = (ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC *)cache->attributes[0]; ExtensionAttribute__ctor_mB331519C39C4210259A248A4C629DF934937C1FA(tmp, NULL); } } static void StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator_StructWrapperUtility_Unwrap_mF4BC8FACE3F9788E56E0B8273FD0B9804358D5B1(CustomAttributesCache* cache) { { ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC * tmp = (ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC *)cache->attributes[0]; ExtensionAttribute__ctor_mB331519C39C4210259A248A4C629DF934937C1FA(tmp, NULL); } } static void StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator_StructWrapperUtility_Get_m17BAD71EF24025677616E71865C1ACEA8DCD2907(CustomAttributesCache* cache) { { ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC * tmp = (ExtensionAttribute_t917F3F92E717DC8B2D7BC03967A9790B1B8EF7CC *)cache->attributes[0]; ExtensionAttribute__ctor_mB331519C39C4210259A248A4C629DF934937C1FA(tmp, NULL); } } static void U3CPrivateImplementationDetailsU3E_t875A03481A7463178D9107FBC6E9B99ABC484045_CustomAttributesCacheGenerator(CustomAttributesCache* cache) { { CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C * tmp = (CompilerGeneratedAttribute_t39106AB982658D7A94C27DEF3C48DB2F5F7CD75C *)cache->attributes[0]; CompilerGeneratedAttribute__ctor_m9DC3E4E2DA76FE93948D44199213E2E924DCBE35(tmp, NULL); } } IL2CPP_EXTERN_C const CustomAttributesCacheGenerator g_Photon3Unity3D_AttributeGenerators[]; const CustomAttributesCacheGenerator g_Photon3Unity3D_AttributeGenerators[223] = { NonAllocDictionary_2_t494108AA5392585175363DC011E0A8548B83D323_CustomAttributesCacheGenerator, Hashtable_t43276794A006CD84952AFAB156E51DD9D331596D_CustomAttributesCacheGenerator, U3CU3Ec_t9A2BC021C4A880E8D16586B3CD40A858C1011163_CustomAttributesCacheGenerator, ParameterDictionary_tB15EFEE2CDF94EA8CCB2E555C303C2E9B881FC48_CustomAttributesCacheGenerator, InitV3Flags_tEDF20BE4B3CD3397F82FFB6818803AA2B6C79972_CustomAttributesCacheGenerator, U3CU3Ec__DisplayClass108_0_tBB05E30A677ADB956D2883A292F69D17A0FF2F93_CustomAttributesCacheGenerator, U3CU3Ec__DisplayClass109_0_t1E66B11CA652319C771043F6270FD73F48258A37_CustomAttributesCacheGenerator, OperationResponse_t9F45DBD05141C2572E1B7C2BB11FCC67539B2339_CustomAttributesCacheGenerator, EventData_t41CAA5D795431288640D65BE20D34F143095CAA0_CustomAttributesCacheGenerator, IntegerMillisecondsDelegate_t3B747A2EE4B95236BD820C0D9B70C2CF2FCAE750_CustomAttributesCacheGenerator, U3CU3Ec__DisplayClass6_0_tF85F03854BAA5BA374F696C56DDD9BF298D75001_CustomAttributesCacheGenerator, U3CU3Ec_tAC8414720601A183308D2AA65AD7F08279081DEF_CustomAttributesCacheGenerator, StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator, U3CPrivateImplementationDetailsU3E_t875A03481A7463178D9107FBC6E9B99ABC484045_CustomAttributesCacheGenerator, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CStateU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerAddressU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CProxyServerAddressU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerIpAddressU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CServerPortU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CAddressResolvedAsIpv6U3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CUrlProtocolU3Ek__BackingField, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_U3CUrlPathU3Ek__BackingField, SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_U3CDelayU3Ek__BackingField, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_U3CLostPackagesOutU3Ek__BackingField, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_U3CLostPackagesInU3Ek__BackingField, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_U3CServerAddressU3Ek__BackingField, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_U3CProxyServerAddressU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CCommandBufferSizeU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CLimitOfUnreliableCommandsU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_WarningSize, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeDatagramEncrypt, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_CommandLogSize, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeSocketLibAvailable, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativePayloadEncryptionLibAvailable, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_NativeDatagramEncryptionLibAvailable, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CSerializationProtocolTypeU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CSocketImplementationU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CListenerU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_OnDisconnectMessage, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CEnableServerTracingU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTransportProtocolU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CIsSendingOnlyAcksU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsIncomingU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsOutgoingU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CTrafficStatsGameLevelU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CCountDiscardedU3Ek__BackingField, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_U3CDeltaUnreliableNumberU3Ek__BackingField, SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_IntegerMilliseconds, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3COperationByteCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3COperationCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CResultByteCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CResultCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CEventByteCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CEventCountU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestOpResponseCallbackU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestOpResponseCallbackOpCodeU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestEventCallbackU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestMessageCallbackU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestRawMessageCallbackU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestEventCallbackCodeU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestDeltaBetweenDispatchingU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CLongestDeltaBetweenSendingU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CDispatchIncomingCommandsCallsU3Ek__BackingField, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_U3CSendOutgoingCommandsCallsU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CPackageHeaderSizeU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CReliableCommandCountU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CUnreliableCommandCountU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CFragmentCommandCountU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CControlCommandCountU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTotalPacketCountU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTotalCommandsInPacketsU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CReliableCommandBytesU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CUnreliableCommandBytesU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CFragmentCommandBytesU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CControlCommandBytesU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTimestampOfLastAckU3Ek__BackingField, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_U3CTimestampOfLastReliableCommandU3Ek__BackingField, StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_U3CReturnPoolU3Ek__BackingField, EnetPeer_t5AD13D3D19967EEBDC6E6ABF4014FEABA9B91A11_CustomAttributesCacheGenerator_EnetPeer_U3CExecuteCommandU3Eb__67_0_m8F605FA9632A74152FB5A72722CCA847943F531A, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_State_mDAFB23564FCDD0B908349615A9F89F7B8A8BFCB7, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_State_mEB1A3E332871058C2AE41245B3E4F0E244634352, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerAddress_m56C64D66D3113ABC6FB69CA60197FF4133521634, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerAddress_m77C312F7EE07976DCFE34E8764640322DD2DD8F6, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ProxyServerAddress_mA402452D1BAD9BFB332C18380F119F387FD67196, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ProxyServerAddress_m293884170C06E3EE7CBE34D7F8B929804947D477, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerIpAddress_m876B5EC11C76C6E9D791940C83B623543E2E0BC3, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerIpAddress_m25917C1E33695DD3DBAAC3987F51B8C68EF5A8AB, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_ServerPort_mA1212F90468B45FBAD6595D8B6DF7843F7D9083D, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_ServerPort_mD58933D87186FD560F2EC043A08C05C0E656EA18, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_AddressResolvedAsIpv6_m38D2AA58774AE12096CC08949B7E1657FE7B09B1, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_AddressResolvedAsIpv6_m3D040A7D67865B70B446B04DF6D4E6643314FBF7, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_UrlProtocol_m208EDECA0FCDD3BC72B2E4DE3023F17FAB49D208, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_UrlProtocol_mF3ACCBDEF01E64D438B5B068D9E825F585829995, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_get_UrlPath_m9C0611FCF989016E5DC593F96C00C10121541EBE, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_set_UrlPath_m17E864630E823F853EC4C43CF114460538A2522C, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_GetIpAddress_m996B87B3843D000F9C531ABC0EC95D9CEE11E6BC, IPhotonSocket_tD67DD59253FDB038A799E32DC55BC4DE917D311B_CustomAttributesCacheGenerator_IPhotonSocket_U3CHandleExceptionU3Eb__52_0_mB01D02D1DE74230127CA24ED9AF9869CE383161F, IProtocol_t97CF065A514B86E8246F81F94877443594E66C4D_CustomAttributesCacheGenerator_IProtocol_SerializeOperationRequest_mBBD6586715541B9E0A0F4B50A74E15A775AEBDAF, SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_SimulationItem_get_Delay_m141FE4B8806BDA19F6A73DCF04037305882F2990, SimulationItem_t6E9C1A0B0B5553624C07719111B7B4F85948B6C7_CustomAttributesCacheGenerator_SimulationItem_set_Delay_m90CF81EE0138EC226B93F3F2508AE0F67FE316C4, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_get_LostPackagesOut_m46194E80E8FBCC649A17BBDEDDC87D8B1284741C, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_set_LostPackagesOut_mFE8310FE3BD579497025DBEDBF004AE1501A414F, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_get_LostPackagesIn_m909AC17AEDCD0B59F2CBF9B91164CE24482DBE0C, NetworkSimulationSet_t060FC4D6F11CBEC8256836EF4214FA5E85297C94_CustomAttributesCacheGenerator_NetworkSimulationSet_set_LostPackagesIn_mF715AE42E56240A47D69943588D8163AB64CB159, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_get_ServerAddress_mBA00E051166380F8610D8AAA35432B582A10744B, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_set_ServerAddress_m828DE274DD25D5997E245F747954432CFDFB4B8A, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_get_ProxyServerAddress_m5DB6BE58131FFA09158D375D136FD75AA9100286, PeerBase_t0434FE9EB58DFED6DB6E034A71351A7D4BF7C1CC_CustomAttributesCacheGenerator_PeerBase_set_ProxyServerAddress_m8E8947B118B0A71272D4563E44C155A53A1D7E99, PhotonClientWebSocket_t430BF4D7E528165DAEFCA5095D4B0AF0ECA46634_CustomAttributesCacheGenerator_PhotonClientWebSocket__ctor_m98E546896B93412B98162E1A9C515F51D0945FD1, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_CommandBufferSize_mED4A67BEA18EFDD5E442F220D30251B5E955F053, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_CommandBufferSize_mDC4867BD684A8EEF618FF803DF926041176EB7CC, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_LimitOfUnreliableCommands_m63A949D0F66E1B4A8B5D2F1966B0620ABC278760, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_LimitOfUnreliableCommands_m7FD97CDEEB91D1093EFE9D91084BD6B7946447CE, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_CommandLogToString_m2AD468802CC562162E6A4C4D96C1F707E513C9F8, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_SerializationProtocolType_mF60E595723244B0D51488DC7ED439BBD91D9691D, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_SerializationProtocolType_m0D0AF7D18EBB0BDB86758603974F08E573709C97, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_SocketImplementation_mAC4A1FC38B0992934D9EB4FC6EC12021D2C07602, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_SocketImplementation_mCB5F277B27CE41B02711F7CA8DA13BD23206480B, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_Listener_m32A614E05D4B4FA72290C3053E76FF9806D6ED40, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_Listener_m3B9D9064882296A931EBF0825985F3E972B71484, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_add_OnDisconnectMessage_m258A7479574B12A2AB747ACE1AA231715047E75A, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_remove_OnDisconnectMessage_mA8AC170F3AAF9C3E554AE8DD54A5BA74BCE8A107, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_EnableServerTracing_m073F7619DBFAD33E5F268BBC7529C8EF09C83993, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_EnableServerTracing_m605F93EC9C46490BA7F423D3BF65295BAF467FF0, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TransportProtocol_m01550D021FF3018EA1C26EA5D03FB28E8E48B976, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TransportProtocol_mD0C65EA0EAFE8C4B5B97F0AB1C78901B7FD21C7C, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_IsSendingOnlyAcks_m144C45758C3A22E01F075F36A116027386AFB59A, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_IsSendingOnlyAcks_mA963C7F1BDC2679771389686C2DC80BEF036226C, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsIncoming_m48CFA163E760CF4E49E4D6114D480BCF3F14242B, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsIncoming_mFCDB22308CA59E52318FE926DF2E18567A3488A0, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsOutgoing_m8C84A20B4F544DD19AD1D89DBE7C758C32BAC859, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsOutgoing_m897667F27CC4D49576C2ED11DB156D49DBA98E89, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_TrafficStatsGameLevel_m547273B4F799F32F340414A92D4685096C723651, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_TrafficStatsGameLevel_m2F9D814A65DC82B1FC89422CB6A64AF2260C4C4B, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_CountDiscarded_mEFBE5D76A731B7BB4C99839C1B2161E1A43AA661, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_CountDiscarded_m9F48EC3A68D7E463D29CA1C5F400EB4F96F72B6B, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_get_DeltaUnreliableNumber_mE51DC4246011A2B0D9C50246508D52C64D2E75ED, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_set_DeltaUnreliableNumber_mB6BCB6E8E2F601C09D21383D952446869C599829, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_U3CEstablishEncryptionU3Eb__220_0_mE667CAA31466463CCFCB6084061770CA57F3F67B, Protocol_tAAF1E6CCEDD412DC75640BB2ABFFE544B77BE426_CustomAttributesCacheGenerator_Protocol_Serialize_m12B5F68DCE95A73EEF827614659747445BDA181E, Protocol_tAAF1E6CCEDD412DC75640BB2ABFFE544B77BE426_CustomAttributesCacheGenerator_Protocol_Deserialize_m39BBF69941057724F92A9888606F11C7FD066E3A, Protocol16_t596EA8306EB75FE816B67296ED3BE02D27E8EB28_CustomAttributesCacheGenerator_Protocol16_SerializeOperationRequest_m312D6090797204076EC3A44AE3E18EDF3A7B6B3E, Protocol16_t596EA8306EB75FE816B67296ED3BE02D27E8EB28_CustomAttributesCacheGenerator_Protocol16_SerializeParameterTable_mA119FFA12DAC30EAC196877B1129335A850965C5, Protocol18_tEB062EBABDD1F23701CFC8C61840F02645BA1A6A_CustomAttributesCacheGenerator_Protocol18_ReadParameterTable_mBB8059C8855D4F068EF4751E6B81E4CDD633AD9D, Protocol18_tEB062EBABDD1F23701CFC8C61840F02645BA1A6A_CustomAttributesCacheGenerator_Protocol18_SerializeOperationRequest_m43DF94330632DB5856291F6F2D725B2745FAF456, SocketTcp_t01C6083F9CEF0FADEB60D2E707AAAAB86CAB785D_CustomAttributesCacheGenerator_SocketTcp__ctor_mD141A944D060CD6D5B3CA236FEEE3EDA841DA5F1, SocketTcpAsync_t207303B13BC1A92F2D1CEF472F7B192AD88E53F9_CustomAttributesCacheGenerator_SocketTcpAsync__ctor_m3B5F4CB21E1B9B3E619553571AE611B073AC805E, SocketUdp_tF59E237D5B40CF2580FA3A9A8393A922F3050103_CustomAttributesCacheGenerator_SocketUdp__ctor_mDECBE74F464FA5BACFE8919B950045B93720F75C, SocketUdpAsync_t5493EC69082FE106C9585E489CDC7037FD837D2A_CustomAttributesCacheGenerator_SocketUdpAsync__ctor_m1BAFB585CA8F1E06FB40C7155D14AA71D7101323, SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_SupportClass_GetTickCount_m6E96AA7752CB48A847EB37373F8FE7C5743C02BC, SupportClass_t46830F4C99606EB80D0E3B11502460A06782A012_CustomAttributesCacheGenerator_SupportClass_HashtableToString_m0BC17B78D5F62D25534E44AC31562B83719A0863, Pool_1_t311BD0ECBB5BF708792FFCBAA59B394033DC9223_CustomAttributesCacheGenerator_Pool_1_Push_m8C4FB6D02D497F6C30295FDF505BCE9755A0F22F, Pool_1_t311BD0ECBB5BF708792FFCBAA59B394033DC9223_CustomAttributesCacheGenerator_Pool_1_Pop_m5BD13FE3A4DA03BC98D0783A0A6273358E66FC94, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_OperationByteCount_mEAEA6746A0E37D562347595A41576E1866DCAB6E, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_OperationByteCount_mDBA2636180CB4B0875CC0E9146908C4290AF49A7, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_OperationCount_m6A5540472A3E756325282101AAE3C131BEBD77DF, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_OperationCount_m9E168CEE3D5A9CF7E3EE71C3C2561EAB1837454A, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_ResultByteCount_mD463A4DEAE994194240AF24FAD525A923990122A, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_ResultByteCount_m4D8E9C2CC2F78A544B1D19D249ACE9047AAFB720, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_ResultCount_m90665579E797420B1D859E82181D963AE423A1BB, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_ResultCount_m4E0F96A38ED3DEC0803CF53AB337A589F8932D78, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_EventByteCount_m82BE4C6CC4E3F3C2FF8243BB2F9113B9853CDB39, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_EventByteCount_m44C38C2A6834322C46145DDEE5F67E80C85D8390, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_EventCount_m1D1BB997DCC0E6028583BB61AADDBC721E107F5F, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_EventCount_m3EFD81CFDAD6B23A3D38DD975C79C40BEE394ADD, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestOpResponseCallback_m89C4A1997BD56FC19FFD7E104A78A8CA328BD031, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestOpResponseCallback_m114807F3D0DD6BD4FDDD3CB62B87857BD226BC95, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestOpResponseCallbackOpCode_mE4EF2EA1B28D3CBCADBED4CDED5E997D4983C3D3, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestOpResponseCallbackOpCode_mA9A1B11FAAD6969A5826A2E0C9A631DF7DBC2B20, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestEventCallback_mA58215CA362E5A376906B8770F7C437E90AB0C00, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestEventCallback_mB42ECC6E81E9F64F758E738644844CEE9D382877, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestMessageCallback_m98E3D06E66D21D50676AEF0B0F96EBF93F2C0085, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestMessageCallback_mD79BDA14591257A8AB1A6FA356717ECA67063DF9, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestRawMessageCallback_m1EAA1C2717808D7692F5B7C349B8AA31979A020D, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestRawMessageCallback_m8E337CE4AAC5C504BABA0746C2946590AB40BE5B, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestEventCallbackCode_m83BC5AAF7C4BB8FDFFE77E7D5EC6777B45FBC084, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestEventCallbackCode_m5B0C5BC84316A4A3099C8361918371BFB2EFAFA9, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestDeltaBetweenDispatching_m2138CCC0FB816757A149D23A841B684B1332C52C, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestDeltaBetweenDispatching_mF79FC622793ACE1A05FD00755226B15964D1E3D7, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_LongestDeltaBetweenSending_mA240841A234D13776BC922E471DBDD56102CD1DF, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_LongestDeltaBetweenSending_m51D0312C6ED647FCFD69579C5E5A7DE60E690F75, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_DispatchIncomingCommandsCalls_m67FE1757E48B20BD5BDED5D15445A404EBDA8186, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_DispatchIncomingCommandsCalls_m5432A40E4A84CBD756AA97E29ED6C60D537D4715, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_get_SendOutgoingCommandsCalls_m06F333C2230987AEE7BA61181492B3EEA9487460, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_set_SendOutgoingCommandsCalls_m68F95A69F7E28629D5AA6BBDBAF8D45E735A4860, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_PackageHeaderSize_m6E7967C05DC07B5CEE066B7592958FBA38AEE2AE, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_PackageHeaderSize_m0A546780848D3DE78AF09AAF3ECF3B6D9FD35EEE, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ReliableCommandCount_m3A00B8B87206F07D3349C4BD10C171C1E4F43D8A, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ReliableCommandCount_m688661290C1B82D59EBE55E67DFC9D51BAEE2CA2, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_UnreliableCommandCount_mD2101C26EDE2021AAA0C22153E3980D28F2001EF, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_UnreliableCommandCount_m9A154B152B89094F71D03B9A734E29572587D64E, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_FragmentCommandCount_m7A2C94AB9548C5D78BE04732C5F42FB69E894AEF, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_FragmentCommandCount_m9A9706E97A88FACCDB9597649E3CB22349E54718, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ControlCommandCount_mD536B0DE0D5027299A83057B9F902634172620F6, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ControlCommandCount_mAFA53CF50631B403C5A8578C1D6BB404B5AA312E, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TotalPacketCount_m18F47303C566612B682A48DA17A363D1D5B5B36C, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TotalPacketCount_mA7661F711C01B043943C70168C2242E62C53669E, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TotalCommandsInPackets_m210E35991B39DD61B66310627B783D09E8CE2FA7, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TotalCommandsInPackets_m7A4FABB9CB8D5ABC2F4554519DDF019CD4D0E75E, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ReliableCommandBytes_m0FD14CACEEBE0873883D979D803D7D8F0894C3A6, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ReliableCommandBytes_mFD53F673FAFC9D362BE59DDFCF54782159C551E8, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_UnreliableCommandBytes_m4355182C66C5863229FA674D3029587CD1C08363, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_UnreliableCommandBytes_m0438CEB34B857617B95751EDC8357F48124C3F51, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_FragmentCommandBytes_m396E7AFE87DCF40B2133E3C031A8C4BF34287909, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_FragmentCommandBytes_m8AA50DAAB78996AFBB9AE2EF7FB1A815232458B6, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_ControlCommandBytes_m2CDF35F035C14FB76CCB6E451835B4F1D010401E, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_ControlCommandBytes_m0CB11A574B1A810EBB1C801B42DFCB98BE9D6400, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TimestampOfLastAck_m113A8659BEF193FF510165B59EC45C0575162A3F, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TimestampOfLastAck_m05F177031BE76494F61D4237379263A61A58FE8C, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_get_TimestampOfLastReliableCommand_mB0CD45E41D3574C46A4DBCF6DBC02C5F0D01AB53, TrafficStats_tD0749D381A0995A317FB0FD8F1196D4E8F1E4871_CustomAttributesCacheGenerator_TrafficStats_set_TimestampOfLastReliableCommand_mB6AA07D8D13D5299AE8423CACE824E8686A5AAAB, StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_StructWrapper_1_get_ReturnPool_mF536F2866FD01E6A644324C8FD1F4A2662D08B30, StructWrapper_1_tA516629CF7BF2DA777AB08048CC5DA56731EA178_CustomAttributesCacheGenerator_StructWrapper_1_set_ReturnPool_m3CF9F57E151517FB6476BD558307481DC2A7BD49, StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator_StructWrapperUtility_Unwrap_mF4BC8FACE3F9788E56E0B8273FD0B9804358D5B1, StructWrapperUtility_t3DCB5F594B52C3FD2FAC20B70A1917F0CE382447_CustomAttributesCacheGenerator_StructWrapperUtility_Get_m17BAD71EF24025677616E71865C1ACEA8DCD2907, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____CommandBufferSize_PropertyInfo, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LimitOfUnreliableCommands_PropertyInfo, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LocalTimeInMilliSeconds_PropertyInfo, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____ClientVersion_PropertyInfo, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____LocalMsTimestampDelegate_PropertyInfo, PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD_CustomAttributesCacheGenerator_PhotonPeer_tA9416F27EB935317E1AFD34031CEA28BF957CADD____IsSendingOnlyAcks_PropertyInfo, TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE_CustomAttributesCacheGenerator_TrafficStatsGameLevel_t058AE246B0BBFC65A16C16D2FB5631204E603CFE____DispatchCalls_PropertyInfo, Photon3Unity3D_CustomAttributesCacheGenerator, }; IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void RuntimeCompatibilityAttribute_set_WrapNonExceptionThrows_m8562196F90F3EBCEC23B5708EE0332842883C490_inline (RuntimeCompatibilityAttribute_tFF99AB2963098F9CBCD47A20D9FD3D51C17C1C80 * __this, bool ___value0, const RuntimeMethod* method) { { bool L_0 = ___value0; __this->set_m_wrapNonExceptionThrows_0(L_0); return; } } IL2CPP_MANAGED_FORCE_INLINE IL2CPP_METHOD_ATTR void TargetFrameworkAttribute_set_FrameworkDisplayName_mB89F1A63CB77A414AF46D5695B37CD520EAB52AB_inline (TargetFrameworkAttribute_t9FA66D5D5B274F0E1A4FE20162AA70F62BFFB517 * __this, String_t* ___value0, const RuntimeMethod* method) { { String_t* L_0 = ___value0; __this->set__frameworkDisplayName_1(L_0); return; } }
71.297012
682
0.902167
Dooyoung-Kim
781ee03ddaa4e79f6900af724fd934dc47a86601
1,443
cpp
C++
src/Triangle.cpp
RdlP/RTal
584a2da78a3545c659d6d084e0c2adbed982e302
[ "MIT" ]
null
null
null
src/Triangle.cpp
RdlP/RTal
584a2da78a3545c659d6d084e0c2adbed982e302
[ "MIT" ]
null
null
null
src/Triangle.cpp
RdlP/RTal
584a2da78a3545c659d6d084e0c2adbed982e302
[ "MIT" ]
null
null
null
#include "Triangle.hpp" Triangle::Triangle(vec3 a, vec3 b, vec3 c, mat4 transform): m_a(a), m_b(b), m_c(c), Geometry(transform) { } Triangle::~Triangle() { } Intersection Triangle::hit(Ray ray) { ray.setOrigin(vec3(getInverseTransform() * vec4(ray.getOrigin(),1))); ray.setDirection(glm::normalize(vec3(getInverseTransform() * vec4(ray.getDirection(),0)))); // R(t) = o + td; // ax + by + cz = d => n·X=d // n·R(t) = d // n · [o + td] = d // n·o + nt·d = d // t = (d-n·o)/(n·d) vec3 ab = m_b-m_a; vec3 ac = m_c-m_a; vec3 normal = glm::normalize(glm::cross(ab,ac)); float nd = glm::dot(normal,ray.getDirection()); if (nd == 0) // PARAREL { return Intersection(false); } float d = glm::dot(normal, m_a); float t = (d-glm::dot(normal,ray.getOrigin())) / nd; if (t < 0) { return Intersection(false); } vec3 pointq = ray.getOrigin() + t * ray.getDirection(); vec3 ap = pointq - m_a; vec3 bp = pointq - m_b; vec3 cp = pointq - m_c; vec3 bc = m_c - m_b; vec3 ca = m_a - m_c; float e1 = glm::dot(glm::cross(ab, ap),normal); float e2 = glm::dot(glm::cross(bc, bp),normal); float e3 = glm::dot(glm::cross(ca, cp),normal); if (e1 < 0 || e2 < 0 || e3 < 0) { return Intersection(false); } float dom = glm::dot(glm::cross(ab, ac),normal); float alpha = e2 /dom; float beta = e3/dom; float gamma = e1/dom; vec3 point = m_a*alpha + m_b*beta + m_c*gamma; return Intersection(true, point, normal); }
22.546875
92
0.607762
RdlP
782115b7a4771756746f2a5afebf38b0b10aca80
1,738
hpp
C++
nano/secure/versioning.hpp
orhanhenrik/nano-node
5cbc9fb773cb3836f20f44d189ea333cfdd55279
[ "BSD-2-Clause" ]
null
null
null
nano/secure/versioning.hpp
orhanhenrik/nano-node
5cbc9fb773cb3836f20f44d189ea333cfdd55279
[ "BSD-2-Clause" ]
null
null
null
nano/secure/versioning.hpp
orhanhenrik/nano-node
5cbc9fb773cb3836f20f44d189ea333cfdd55279
[ "BSD-2-Clause" ]
null
null
null
#pragma once #include <nano/lib/blocks.hpp> #include <nano/node/lmdb.hpp> #include <nano/secure/utility.hpp> namespace nano { class account_info_v1 final { public: account_info_v1 () = default; explicit account_info_v1 (MDB_val const &); account_info_v1 (nano::block_hash const &, nano::block_hash const &, nano::amount const &, uint64_t); nano::mdb_val val () const; nano::block_hash head{ 0 }; nano::block_hash rep_block{ 0 }; nano::amount balance{ 0 }; uint64_t modified{ 0 }; }; class pending_info_v3 final { public: pending_info_v3 () = default; explicit pending_info_v3 (MDB_val const &); pending_info_v3 (nano::account const &, nano::amount const &, nano::account const &); nano::mdb_val val () const; nano::account source{ 0 }; nano::amount amount{ 0 }; nano::account destination{ 0 }; }; class account_info_v5 final { public: account_info_v5 () = default; explicit account_info_v5 (MDB_val const &); account_info_v5 (nano::block_hash const &, nano::block_hash const &, nano::block_hash const &, nano::amount const &, uint64_t); nano::mdb_val val () const; nano::block_hash head{ 0 }; nano::block_hash rep_block{ 0 }; nano::block_hash open_block{ 0 }; nano::amount balance{ 0 }; uint64_t modified{ 0 }; }; class account_info_v13 final { public: account_info_v13 () = default; account_info_v13 (nano::block_hash const &, nano::block_hash const &, nano::block_hash const &, nano::amount const &, uint64_t, uint64_t block_count, nano::epoch epoch_a); size_t db_size () const; nano::block_hash head{ 0 }; nano::block_hash rep_block{ 0 }; nano::block_hash open_block{ 0 }; nano::amount balance{ 0 }; uint64_t modified{ 0 }; uint64_t block_count{ 0 }; nano::epoch epoch{ nano::epoch::epoch_0 }; }; }
28.966667
172
0.716341
orhanhenrik
7821d87b35aeb23be003dd9610164e5f36bc4e58
8,692
cpp
C++
oskar/apps/src/oskar_sim_tec_screen.cpp
ChenxiSSS/OSKAR
35b15f90778644ecb3190273ee3d09734da99420
[ "BSD-3-Clause" ]
null
null
null
oskar/apps/src/oskar_sim_tec_screen.cpp
ChenxiSSS/OSKAR
35b15f90778644ecb3190273ee3d09734da99420
[ "BSD-3-Clause" ]
null
null
null
oskar/apps/src/oskar_sim_tec_screen.cpp
ChenxiSSS/OSKAR
35b15f90778644ecb3190273ee3d09734da99420
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2013-2016, The University of Oxford * 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 University of Oxford 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. */ #include "oskar_sim_tec_screen.h" #include "convert/oskar_convert_mjd_to_gast_fast.h" #include "convert/oskar_convert_apparent_ra_dec_to_enu_directions.h" #include "convert/oskar_convert_offset_ecef_to_ecef.h" #include "math/oskar_evaluate_image_lm_grid.h" #include "math/oskar_evaluate_image_lon_lat_grid.h" #include "sky/oskar_evaluate_tec_tid.h" #include "telescope/station/oskar_evaluate_pierce_points.h" #include "telescope/oskar_telescope.h" #include "oskar_settings_to_telescope.h" #include "oskar_Settings_old.h" #include "math/oskar_cmath.h" #include <cstdlib> #include <cstdio> static void evaluate_station_beam_pp(const oskar_Telescope* tel, int stationID, const oskar_Settings_old* settings, double* pp_lon0, double* pp_lat0, int* status); extern "C" oskar_Mem* oskar_sim_tec_screen(const oskar_Settings_old* settings, const oskar_Telescope* telescope, double* pp_lon0, double* pp_lat0, int* status) { oskar_Mem* TEC_screen = 0; const oskar_SettingsIonosphere* MIM = &settings->ionosphere; if (*status) return 0; int im_size = MIM->TECImage.size; int num_pixels = im_size * im_size; int type = settings->sim.double_precision ? OSKAR_DOUBLE : OSKAR_SINGLE; double fov = MIM->TECImage.fov_rad; // Evaluate the p.p. coordinates of the beam phase centre. int id = MIM->TECImage.stationID; if (MIM->TECImage.beam_centred) { evaluate_station_beam_pp(telescope, id, settings, pp_lon0, pp_lat0, status); } else { const oskar_Station* s = oskar_telescope_station_const(telescope, id); *pp_lon0 = oskar_station_beam_lon_rad(s); *pp_lat0 = oskar_station_beam_lat_rad(s); } int num_times = settings->obs.num_time_steps; double t0 = settings->obs.start_mjd_utc; double tinc = settings->obs.dt_dump_days; // Generate the lon, lat grid used for the TEC values. oskar_Mem *pp_lon, *pp_lat, *pp_rel_path; pp_lon = oskar_mem_create(type, OSKAR_CPU, num_pixels, status); pp_lat = oskar_mem_create(type, OSKAR_CPU, num_pixels, status); oskar_evaluate_image_lon_lat_grid(im_size, im_size, fov, fov, *pp_lon0, *pp_lat0, pp_lon, pp_lat, status); // Relative path in direction of p.p. (1.0 here as we are not using // any stations) pp_rel_path = oskar_mem_create(type, OSKAR_CPU, num_pixels, status); oskar_mem_set_value_real(pp_rel_path, 1.0, 0, num_pixels, status); // Initialise return values TEC_screen = oskar_mem_create(type, OSKAR_CPU, num_pixels * num_times, status); oskar_Mem *tec_screen_snapshot = oskar_mem_create_alias(0, 0, 0, status); for (int i = 0; i < num_times; ++i) { double gast = t0 + tinc * (double)i; int offset = num_pixels * i; oskar_mem_set_alias(tec_screen_snapshot, TEC_screen, offset, num_pixels, status); oskar_evaluate_tec_tid(tec_screen_snapshot, num_pixels, pp_lon, pp_lat, pp_rel_path, MIM->TEC0, &(MIM->TID[0]), gast); } oskar_mem_free(pp_lon, status); oskar_mem_free(pp_lat, status); oskar_mem_free(pp_rel_path, status); oskar_mem_free(tec_screen_snapshot, status); return TEC_screen; } void evaluate_station_beam_pp(const oskar_Telescope* tel, int stationID, const oskar_Settings_old* settings, double* pp_lon0, double* pp_lat0, int* status) { int type = oskar_telescope_precision(tel); const oskar_Station* station = oskar_telescope_station_const(tel, stationID); // oskar_Mem holding beam pierce point horizontal coordinates. oskar_Mem *hor_x, *hor_y, *hor_z; hor_x = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); hor_y = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); hor_z = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); // Offset geocentric cartesian station position double st_x, st_y, st_z; // ECEF coordinates of the station for which the beam p.p. is being evaluated. double st_x_ecef, st_y_ecef, st_z_ecef; double st_lon = oskar_station_lon_rad(station); double st_lat = oskar_station_lat_rad(station); double st_alt = oskar_station_alt_metres(station); double beam_ra = oskar_station_beam_lon_rad(station); double beam_dec = oskar_station_beam_lat_rad(station); // Time at which beam pierce point is evaluated. int t = 0; double obs_start_mjd_utc = settings->obs.start_mjd_utc; double dt_dump = settings->obs.dt_dump_days; double t_dump = obs_start_mjd_utc + t * dt_dump; // MJD UTC double gast = oskar_convert_mjd_to_gast_fast(t_dump + dt_dump / 2.0); double last = gast + st_lon; // Get the true ECEF station coordinates. if (type == OSKAR_DOUBLE) { st_x = (oskar_mem_double_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 0), status))[stationID]; st_y = (oskar_mem_double_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 1), status))[stationID]; st_z = (oskar_mem_double_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 2), status))[stationID]; } else { st_x = (double)(oskar_mem_float_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 0), status))[stationID]; st_y = (double)(oskar_mem_float_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 1), status))[stationID]; st_z = (double)(oskar_mem_float_const( oskar_telescope_station_true_offset_ecef_metres_const(tel, 2), status))[stationID]; } oskar_convert_offset_ecef_to_ecef(1, &st_x, &st_y, &st_z, st_lon, st_lat, st_alt, &st_x_ecef, &st_y_ecef, &st_z_ecef); // Obtain horizontal coordinates of beam pierce point. oskar_convert_apparent_ra_dec_to_enu_directions_d(1, &beam_ra, &beam_dec, last, st_lat, oskar_mem_double(hor_x, status), oskar_mem_double(hor_y, status), oskar_mem_double(hor_z, status)); // Pierce point of the observation phase centre - i.e. beam direction oskar_Mem *m_pp_lon0, *m_pp_lat0, *m_pp_rel_path; m_pp_lon0 = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); m_pp_lat0 = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); m_pp_rel_path = oskar_mem_create(OSKAR_DOUBLE, OSKAR_CPU, 1, status); oskar_evaluate_pierce_points(m_pp_lon0, m_pp_lat0, m_pp_rel_path, st_x_ecef, st_y_ecef, st_z_ecef, settings->ionosphere.TID[0].height_km * 1000., 1, hor_x, hor_y, hor_z, status); *pp_lon0 = oskar_mem_double(m_pp_lon0, status)[0]; *pp_lat0 = oskar_mem_double(m_pp_lat0, status)[0]; oskar_mem_free(m_pp_lon0, status); oskar_mem_free(m_pp_lat0, status); oskar_mem_free(m_pp_rel_path, status); oskar_mem_free(hor_x, status); oskar_mem_free(hor_y, status); oskar_mem_free(hor_y, status); }
41.990338
82
0.712379
ChenxiSSS
7822e0f041a0b6bc726ed967783a8af1e34d6f49
4,141
cpp
C++
cpp/tests/testscore.cpp
lpuchallafiore/KataGo
ded79dc1b6f3736c1a5274021f0dc463fad2b5c2
[ "MIT" ]
4
2020-02-12T01:42:29.000Z
2021-05-13T06:49:30.000Z
cpp/tests/testscore.cpp
lpuchallafiore/KataGo
ded79dc1b6f3736c1a5274021f0dc463fad2b5c2
[ "MIT" ]
null
null
null
cpp/tests/testscore.cpp
lpuchallafiore/KataGo
ded79dc1b6f3736c1a5274021f0dc463fad2b5c2
[ "MIT" ]
1
2020-08-19T18:05:58.000Z
2020-08-19T18:05:58.000Z
#include "../tests/tests.h" #include "../neuralnet/nninputs.h" using namespace std; using namespace TestCommon; void Tests::runScoreTests() { cout << "Running score and utility tests" << endl; ostringstream out; auto printScoreStats = [&out](const Board& board, const BoardHistory& hist) { out << "Black self komi wins/draw=0.5: " << hist.currentSelfKomi(P_BLACK, 0.5) << endl; out << "White self komi wins/draw=0.5: " << hist.currentSelfKomi(P_WHITE, 0.5) << endl; out << "Black self komi wins/draw=0.25: " << hist.currentSelfKomi(P_BLACK, 0.25) << endl; out << "White self komi wins/draw=0.25: " << hist.currentSelfKomi(P_WHITE, 0.25) << endl; out << "Black self komi wins/draw=0.75: " << hist.currentSelfKomi(P_BLACK, 0.75) << endl; out << "White self komi wins/draw=0.75: " << hist.currentSelfKomi(P_WHITE, 0.75) << endl; out << "Winner: " << colorToChar(hist.winner) << endl; double score = hist.finalWhiteMinusBlackScore; out << "Final score: " << score << endl; double drawEquivsToTry[4] = {0.5, 0.3, 0.7, 1.0}; for(int i = 0; i<4; i++) { double drawEquiv = drawEquivsToTry[i]; string s = Global::strprintf("%.1f", drawEquiv); double scoreAdjusted = ScoreValue::whiteScoreDrawAdjust(score, drawEquiv, hist); double stdev = sqrt(std::max(0.0,ScoreValue::whiteScoreMeanSqOfScoreGridded(score,drawEquiv,hist) - scoreAdjusted * scoreAdjusted)); double expectedScoreValue = ScoreValue::expectedWhiteScoreValue(scoreAdjusted, stdev, 0.0, 2.0, board); out << "WL Wins wins/draw=" << s << ": " << ScoreValue::whiteWinsOfWinner(hist.winner, drawEquiv) << endl; out << "Score wins/draw=" << s << ": " << scoreAdjusted << endl; out << "Score Stdev wins/draw=" << s << ": " << stdev << endl; out << "Score Util Smooth wins/draw=" << s << ": " << ScoreValue::whiteScoreValueOfScoreSmooth(score, 0.0, 2.0, drawEquiv, board, hist) << endl; out << "Score Util SmootND wins/draw=" << s << ": " << ScoreValue::whiteScoreValueOfScoreSmoothNoDrawAdjust(score, 0.0, 2.0, board) << endl; out << "Score Util Gridded wins/draw=" << s << ": " << expectedScoreValue << endl; out << "Score Util GridInv wins/draw=" << s << ": " << ScoreValue::approxWhiteScoreOfScoreValueSmooth(expectedScoreValue,0.0,2.0,board) << endl; } }; { const char* name = "On-board even 9x9, komi 7.5"; Board board = Board::parseBoard(9,9,R"%%( ......... ......... ooooooooo ......... ......... ......... xxxxxxxxx ......... ......... )%%"); Rules rules = Rules::getTrompTaylorish(); BoardHistory hist(board,P_BLACK,rules,0); hist.endAndScoreGameNow(board); printScoreStats(board,hist); cout << name << endl; cout << out.str() << endl; cout << endl; } { const char* name = "On-board even 9x9, komi 7"; Board board = Board::parseBoard(9,9,R"%%( ......... ......... ooooooooo ......... ......... ......... xxxxxxxxx ......... ......... )%%"); Rules rules = Rules::getTrompTaylorish(); rules.komi = 7.0; BoardHistory hist(board,P_BLACK,rules,0); hist.endAndScoreGameNow(board); printScoreStats(board,hist); cout << name << endl; cout << out.str() << endl; cout << endl; } { const char* name = "On-board black ahead 7 9x9, komi 7"; Board board = Board::parseBoard(9,9,R"%%( ......... ......... ooooooooo ......... ......... xxxxxxx.. xxxxxxxxx ......... ......... )%%"); Rules rules = Rules::getTrompTaylorish(); rules.komi = 7.0; BoardHistory hist(board,P_BLACK,rules,0); hist.endAndScoreGameNow(board); printScoreStats(board,hist); cout << name << endl; cout << out.str() << endl; cout << endl; } { const char* name = "On-board even 5x5, komi 7"; Board board = Board::parseBoard(5,5,R"%%( ..... ooooo ..... xxxxx ..... )%%"); Rules rules = Rules::getTrompTaylorish(); rules.komi = 7.0; BoardHistory hist(board,P_BLACK,rules,0); hist.endAndScoreGameNow(board); printScoreStats(board,hist); cout << name << endl; cout << out.str() << endl; cout << endl; } }
28.558621
151
0.595025
lpuchallafiore
78266d11bd7fe30913d809fd2e266738d257295f
15,749
cpp
C++
src/ApplicationDatabase.cpp
vdm-dev/gpsinformer
d7943401808fd9233a1287ddc989ea95bf674edb
[ "BSL-1.0", "Apache-2.0", "MIT" ]
2
2018-07-05T11:34:04.000Z
2020-01-16T20:11:17.000Z
src/ApplicationDatabase.cpp
vdm-dev/gpsinformer
d7943401808fd9233a1287ddc989ea95bf674edb
[ "BSL-1.0", "Apache-2.0", "MIT" ]
null
null
null
src/ApplicationDatabase.cpp
vdm-dev/gpsinformer
d7943401808fd9233a1287ddc989ea95bf674edb
[ "BSL-1.0", "Apache-2.0", "MIT" ]
null
null
null
// // Copyright (c) 2017 Dmitry Lavygin (vdm.inbox@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 "StdAfx.h" #include "Application.h" #include "GpsMessage.h" #include "ChatCommand.h" #include "User.h" #include <sqlite3.h> inline boost::posix_time::ptime fromUnixTime(uint64_t t) { boost::posix_time::ptime start(boost::gregorian::date(1970, 1, 1)); return start + boost::posix_time::seconds(static_cast<long>(t)); } inline uint64_t toUnixTime(const boost::posix_time::ptime& pt) { boost::posix_time::time_duration dur = pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)); return uint64_t(dur.total_seconds()); } void Application::openDatabase() { int result = 0; const char* sqlUsers = "CREATE TABLE IF NOT EXISTS users ( \ id INTEGER NOT NULL PRIMARY KEY, \ firstname TEXT NOT NULL, \ lastname TEXT NOT NULL, \ nickname TEXT NOT NULL, \ access INTEGER NOT NULL DEFAULT 0)"; const char* sqlData = "CREATE TABLE IF NOT EXISTS data ( \ imei TEXT NOT NULL, \ keyword TEXT NOT NULL, \ phone TEXT NOT NULL, \ tracker_time INTEGER NOT NULL DEFAULT 0, \ host_time INTEGER NOT NULL DEFAULT 0, \ latitude REAL NOT NULL DEFAULT 0.0, \ longitude REAL NOT NULL DEFAULT 0.0, \ speed REAL NOT NULL DEFAULT 0.0, \ valid INTEGER NOT NULL DEFAULT 0)"; const char* sqlSettings = "CREATE TABLE IF NOT EXISTS settings ( \ id INTEGER NOT NULL PRIMARY KEY, \ status INTEGER NOT NULL DEFAULT 0)"; std::string fileName = _settings.get("database.file", std::string()); if (fileName.empty()) { filesystem::path filePath = _applicationPath; filePath.replace_extension(".db"); fileName = filePath.string(); } result = sqlite3_open(fileName.c_str(), &_database); if (result != SQLITE_OK) goto error; result = sqlite3_exec(_database, sqlUsers, 0, 0, 0); if (result != SQLITE_OK) goto error; result = sqlite3_exec(_database, sqlData, 0, 0, 0); if (result != SQLITE_OK) goto error; result = sqlite3_exec(_database, sqlSettings, 0, 0, 0); if (result != SQLITE_OK) goto error; return; error: BOOST_LOG_TRIVIAL(error) << "Database error: " << sqlite3_errmsg(_database); sqlite3_close(_database); _database = 0; } void Application::closeDatabase() { sqlite3_close(_database); _database = 0; } void Application::dbRestoreSettings() { std::vector<GpsMessage> data; if (dbGetGpsData(data, 1, false)) { if (!data.empty()) _lastMessage = data[0]; } _userSettings.clear(); UserSettings settingsRow; int result = 0; sqlite3_stmt *stmt = 0; const char* sql = "SELECT * FROM settings"; result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); while (result == SQLITE_ROW) { int columns = sqlite3_column_count(stmt); for (int column = 0; column < columns; ++column) { std::string columnName = sqlite3_column_name(stmt, column); if (columnName == "id") { settingsRow.id = sqlite3_column_int64(stmt, column); } else if (columnName == "status") { settingsRow.status = sqlite3_column_int(stmt, column); } } _userSettings.push_back(settingsRow); result = sqlite3_step(stmt); } if ((result != SQLITE_DONE) && (result != SQLITE_OK)) goto error; result = sqlite3_finalize(stmt); if (result != SQLITE_OK) goto error; return; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); } bool Application::dbSaveSettings() { int result = 0; sqlite3_stmt *stmt = 0; const char* sql = "INSERT INTO settings (id, status) VALUES (?, ?)"; result = sqlite3_exec(_database, "DELETE FROM settings", 0, 0, 0); if (result != SQLITE_OK) goto error; for (size_t i = 0; i < _userSettings.size(); ++i) { result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int64(stmt, 1, _userSettings[i].id); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int(stmt, 2, _userSettings[i].status); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); if ((result != SQLITE_OK) && (result != SQLITE_DONE)) goto error; sqlite3_finalize(stmt); } return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; } bool Application::dbAddGpsData(const GpsMessage& data) { int result = 0; sqlite3_stmt *stmt = 0; uint64_t trackerTime = 0; uint64_t hostTime = 0; int valid = 0; const char* sql = "INSERT INTO data (imei, keyword, phone, tracker_time, host_time, latitude, longitude, speed, valid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 1, data.imei.c_str(), data.imei.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 2, data.keyword.c_str(), data.keyword.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 3, data.phone.c_str(), data.phone.size(), 0); if (result != SQLITE_OK) goto error; if (!data.trackerTime.is_special()) trackerTime = toUnixTime(data.trackerTime); result = sqlite3_bind_int64(stmt, 4, trackerTime); if (result != SQLITE_OK) goto error; if (!data.hostTime.is_special()) hostTime = toUnixTime(data.hostTime); result = sqlite3_bind_int64(stmt, 5, hostTime); if (result != SQLITE_OK) goto error; result = sqlite3_bind_double(stmt, 6, data.latitude); if (result != SQLITE_OK) goto error; result = sqlite3_bind_double(stmt, 7, data.longitude); if (result != SQLITE_OK) goto error; result = sqlite3_bind_double(stmt, 8, data.speed); if (result != SQLITE_OK) goto error; valid = data.valid ? 1 : 0; result = sqlite3_bind_int(stmt, 9, valid); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); if ((result != SQLITE_OK) && (result != SQLITE_DONE)) goto error; sqlite3_finalize(stmt); return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; } bool Application::dbCreateUser(const User& user) { int result = 0; sqlite3_stmt *stmt = 0; const char* sql = "INSERT INTO users (id, firstname, lastname, nickname, access) VALUES (?, ?, ?, ?, ?)"; if (!user.valid || !user.tg) return false; result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int64(stmt, 1, user.tg->id); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 2, user.tg->firstName.c_str(), user.tg->firstName.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 3, user.tg->lastName.c_str(), user.tg->lastName.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 4, user.tg->username.c_str(), user.tg->username.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int(stmt, 5, user.access); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); if ((result != SQLITE_OK) && (result != SQLITE_DONE)) goto error; sqlite3_finalize(stmt); return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; } bool Application::dbGetGpsData(std::vector<GpsMessage>& data, unsigned int limit, bool validOnly) { int result = 0; sqlite3_stmt *stmt = 0; GpsMessage gpsMessage; std::string sql = "SELECT * FROM data"; data.clear(); if (validOnly) sql += " WHERE valid = 1"; sql += " ORDER BY host_time DESC"; if (limit) sql += " LIMIT ?"; result = sqlite3_prepare_v2(_database, sql.c_str(), -1, &stmt, 0); if (result != SQLITE_OK) goto error; if (limit) { result = sqlite3_bind_int(stmt, 1, limit); if (result != SQLITE_OK) goto error; } result = sqlite3_step(stmt); while (result == SQLITE_ROW) { int columns = sqlite3_column_count(stmt); for (int column = 0; column < columns; ++column) { std::string columnName = sqlite3_column_name(stmt, column); if (columnName == "imei") { gpsMessage.imei = (const char*) sqlite3_column_text(stmt, column); } else if (columnName == "keyword") { gpsMessage.keyword = (const char*) sqlite3_column_text(stmt, column); } else if (columnName == "phone") { gpsMessage.phone = (const char*) sqlite3_column_text(stmt, column); } else if (columnName == "tracker_time") { uint64_t value = sqlite3_column_int64(stmt, column); if (value) gpsMessage.trackerTime = fromUnixTime(value); } else if (columnName == "host_time") { uint64_t value = sqlite3_column_int64(stmt, column); if (value) gpsMessage.hostTime = fromUnixTime(value); } else if (columnName == "latitude") { gpsMessage.latitude = sqlite3_column_double(stmt, column); } else if (columnName == "longitude") { gpsMessage.longitude = sqlite3_column_double(stmt, column); } else if (columnName == "speed") { gpsMessage.speed = sqlite3_column_double(stmt, column); } else if (columnName == "valid") { gpsMessage.valid = sqlite3_column_int(stmt, column) != 0; } } data.push_back(gpsMessage); result = sqlite3_step(stmt); } if ((result != SQLITE_DONE) && (result != SQLITE_OK)) goto error; result = sqlite3_finalize(stmt); if (result != SQLITE_OK) goto error; return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; } bool Application::dbSearchUser(User& user) { int result = 0; sqlite3_stmt *stmt = 0; const char* sql = "SELECT * FROM users WHERE id = ? LIMIT 1"; bool needUpdate = false; user.access = ChatCommand::Default; user.valid = false; if (!user.tg) return false; result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int64(stmt, 1, user.tg->id); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); while (result == SQLITE_ROW) { int columns = sqlite3_column_count(stmt); for (int column = 0; column < columns; ++column) { std::string columnName = sqlite3_column_name(stmt, column); if (columnName == "firstname") { std::string text = (const char*) sqlite3_column_text(stmt, column); needUpdate |= (text != user.tg->firstName); } else if (columnName == "lastname") { std::string text = (const char*) sqlite3_column_text(stmt, column); needUpdate |= (text != user.tg->lastName); } else if (columnName == "nickname") { std::string text = (const char*) sqlite3_column_text(stmt, column); needUpdate |= (text != user.tg->username); } else if (columnName == "access") { user.access = sqlite3_column_int(stmt, column); } user.valid = true; } result = sqlite3_step(stmt); } if ((result != SQLITE_DONE) && (result != SQLITE_OK)) goto error; result = sqlite3_finalize(stmt); if (result != SQLITE_OK) goto error; if (needUpdate) dbUpdateUser(user); return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; } bool Application::dbUpdateUser(const User& user) { int result = 0; sqlite3_stmt *stmt = 0; const char* sql = "UPDATE users SET firstname = ?, lastname = ?, nickname = ?, access = ? WHERE id = ?"; if (!user.valid || !user.tg) return false; result = sqlite3_prepare_v2(_database, sql, -1, &stmt, 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 1, user.tg->firstName.c_str(), user.tg->firstName.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 2, user.tg->lastName.c_str(), user.tg->lastName.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_text(stmt, 3, user.tg->username.c_str(), user.tg->username.size(), 0); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int(stmt, 4, user.access); if (result != SQLITE_OK) goto error; result = sqlite3_bind_int64(stmt, 5, user.tg->id); if (result != SQLITE_OK) goto error; result = sqlite3_step(stmt); if ((result != SQLITE_OK) && (result != SQLITE_DONE)) goto error; sqlite3_finalize(stmt); return true; error: BOOST_LOG_TRIVIAL(debug) << "Database error: " << sqlite3_errmsg(_database); return false; }
28.224014
159
0.579973
vdm-dev
78274f7951c1f2bbe82a9630f82ca4f23c8af862
23,826
cpp
C++
dev/so_5/rt/environment.cpp
eao197/so-5-5
fa0c31c84d2637dce04e13a155040150d505fbbd
[ "BSL-1.0" ]
76
2016-03-25T15:22:03.000Z
2022-02-03T15:11:43.000Z
dev/so_5/rt/environment.cpp
eao197/so-5-5
fa0c31c84d2637dce04e13a155040150d505fbbd
[ "BSL-1.0" ]
19
2017-03-09T19:21:53.000Z
2021-02-24T13:02:18.000Z
dev/so_5/rt/environment.cpp
eao197/so-5-5
fa0c31c84d2637dce04e13a155040150d505fbbd
[ "BSL-1.0" ]
21
2016-09-23T10:01:09.000Z
2020-08-31T12:01:10.000Z
/* SObjectizer 5. */ #include <so_5/rt/h/environment.hpp> #include <string> #include <so_5/rt/impl/h/internal_env_iface.hpp> #include <so_5/rt/impl/h/mbox_core.hpp> #include <so_5/rt/impl/h/disp_repository.hpp> #include <so_5/rt/impl/h/layer_core.hpp> #include <so_5/rt/impl/h/stop_guard_repo.hpp> #include <so_5/rt/impl/h/std_msg_tracer_holder.hpp> #include <so_5/rt/impl/h/run_stage.hpp> #include <so_5/rt/stats/impl/h/std_controller.hpp> #include <so_5/rt/stats/impl/h/ds_mbox_core_stats.hpp> #include <so_5/rt/stats/impl/h/ds_agent_core_stats.hpp> #include <so_5/rt/stats/impl/h/ds_timer_thread_stats.hpp> #include <so_5/rt/h/env_infrastructures.hpp> #include <so_5/details/h/rollback_on_exception.hpp> #include <so_5/h/stdcpp.hpp> namespace so_5 { // // environment_params_t // environment_params_t::environment_params_t() : m_event_exception_logger( create_std_event_exception_logger() ) , m_exception_reaction( abort_on_exception ) , m_autoshutdown_disabled( false ) , m_error_logger( create_stderr_logger() ) , m_work_thread_activity_tracking( work_thread_activity_tracking_t::unspecified ) , m_infrastructure_factory( env_infrastructures::default_mt::factory() ) , m_event_queue_hook( make_empty_event_queue_hook_unique_ptr() ) { } environment_params_t::environment_params_t( environment_params_t && other ) : m_named_dispatcher_map( std::move( other.m_named_dispatcher_map ) ) , m_timer_thread_factory( std::move( other.m_timer_thread_factory ) ) , m_so_layers( std::move( other.m_so_layers ) ) , m_coop_listener( std::move( other.m_coop_listener ) ) , m_event_exception_logger( std::move( other.m_event_exception_logger ) ) , m_exception_reaction( other.m_exception_reaction ) , m_autoshutdown_disabled( other.m_autoshutdown_disabled ) , m_error_logger( std::move( other.m_error_logger ) ) , m_message_delivery_tracer( std::move( other.m_message_delivery_tracer ) ) , m_message_delivery_tracer_filter( std::move( other.m_message_delivery_tracer_filter ) ) , m_work_thread_activity_tracking( work_thread_activity_tracking_t::unspecified ) , m_queue_locks_defaults_manager( std::move( other.m_queue_locks_defaults_manager ) ) , m_infrastructure_factory( std::move(other.m_infrastructure_factory) ) , m_event_queue_hook( std::move(other.m_event_queue_hook) ) {} environment_params_t::~environment_params_t() { } environment_params_t & environment_params_t::operator=( environment_params_t && other ) { environment_params_t tmp( std::move( other ) ); this->swap( tmp ); return *this; } void environment_params_t::swap( environment_params_t & other ) { m_named_dispatcher_map.swap( other.m_named_dispatcher_map ); m_timer_thread_factory.swap( other.m_timer_thread_factory ); m_so_layers.swap( other.m_so_layers ); m_coop_listener.swap( other.m_coop_listener ); m_event_exception_logger.swap( other.m_event_exception_logger ); std::swap( m_exception_reaction, other.m_exception_reaction ); std::swap( m_autoshutdown_disabled, other.m_autoshutdown_disabled ); m_error_logger.swap( other.m_error_logger ); m_message_delivery_tracer.swap( other.m_message_delivery_tracer ); m_message_delivery_tracer_filter.swap( other.m_message_delivery_tracer_filter ); std::swap( m_work_thread_activity_tracking, other.m_work_thread_activity_tracking ); std::swap( m_queue_locks_defaults_manager, other.m_queue_locks_defaults_manager ); std::swap( m_infrastructure_factory, other.m_infrastructure_factory ); std::swap( m_event_queue_hook, other.m_event_queue_hook ); } environment_params_t & environment_params_t::add_named_dispatcher( nonempty_name_t name, dispatcher_unique_ptr_t dispatcher ) { m_named_dispatcher_map[ name.query_name() ] = dispatcher_ref_t( dispatcher.release() ); return *this; } environment_params_t & environment_params_t::timer_thread( so_5::timer_thread_factory_t factory ) { m_timer_thread_factory = std::move( factory ); return *this; } environment_params_t & environment_params_t::coop_listener( coop_listener_unique_ptr_t coop_listener ) { m_coop_listener = std::move( coop_listener ); return *this; } environment_params_t & environment_params_t::event_exception_logger( event_exception_logger_unique_ptr_t logger ) { if( nullptr != logger.get() ) m_event_exception_logger = std::move( logger ); return *this; } void environment_params_t::add_layer( const std::type_index & type, layer_unique_ptr_t layer_ptr ) { m_so_layers[ type ] = layer_ref_t( layer_ptr.release() ); } namespace { /*! * \brief A bunch of data sources for core objects. * \since * v.5.5.4 */ class core_data_sources_t { public : core_data_sources_t( outliving_reference_t< stats::repository_t > ds_repository, impl::mbox_core_t & mbox_repository, so_5::environment_infrastructure_t & infrastructure ) : m_mbox_repository( ds_repository, mbox_repository ) , m_coop_repository( ds_repository, infrastructure ) , m_timer_thread( ds_repository, infrastructure ) {} private : //! Data source for mboxes repository. stats::auto_registered_source_holder_t< stats::impl::ds_mbox_core_stats_t > m_mbox_repository; //! Data source for cooperations repository. stats::auto_registered_source_holder_t< stats::impl::ds_agent_core_stats_t > m_coop_repository; //! Data source for timer thread. stats::auto_registered_source_holder_t< stats::impl::ds_timer_thread_stats_t > m_timer_thread; }; /*! * \brief Helper function for creation of appropriate manager * object if necessary. * * \since * v.5.5.18 */ queue_locks_defaults_manager_unique_ptr_t ensure_locks_defaults_manager_exists( //! The current value. Note: can be nullptr. queue_locks_defaults_manager_unique_ptr_t current ) { queue_locks_defaults_manager_unique_ptr_t result( std::move(current) ); if( !result ) result = make_defaults_manager_for_combined_locks(); return result; } // // default_event_queue_hook_t // /*! * \brief Default implementation of event_queue_hook. * * Do nothing. * * \since * v.5.5.24 */ class default_event_queue_hook_t final : public event_queue_hook_t { public : SO_5_NODISCARD event_queue_t * on_bind( agent_t * /*agent*/, event_queue_t * original_queue ) SO_5_NOEXCEPT override { return original_queue; } void on_unbind( agent_t * /*agent*/, event_queue_t * /*queue*/ ) SO_5_NOEXCEPT override { } }; /*! * \brief Helper function for creation of appropriate event_queue_hook * object if necessary. * * \since * v.5.5.24 */ SO_5_NODISCARD event_queue_hook_unique_ptr_t ensure_event_queue_hook_exists( //! The current value. Note: can be nullptr. event_queue_hook_unique_ptr_t current ) { event_queue_hook_unique_ptr_t result( std::move(current) ); if( !result ) result = make_event_queue_hook< default_event_queue_hook_t >( &event_queue_hook_t::default_deleter ); return result; } } /* namespace anonymous */ // // environment_t::internals_t // /*! * \since * v.5.5.0 * * \brief Internal details of SObjectizer Environment object. */ struct environment_t::internals_t { /*! * \since * v.5.5.0 * * \brief Error logger object for this environment. * * \attention Must be the first attribute of the object! * It must be created and initilized first and destroyed last. */ error_logger_shptr_t m_error_logger; /*! * \brief Holder of stuff related to message delivery tracing. * * \attention This field must be declared and initialized * before m_mbox_core because a reference to that object will be passed * to the constructor of m_mbox_core. * * \since * v.5.5.22 */ so_5::msg_tracing::impl::std_holder_t m_msg_tracing_stuff; //! An utility for mboxes. impl::mbox_core_ref_t m_mbox_core; /*! * \brief A repository of stop_guards. * * \since * v.5.5.19.2 */ impl::stop_guard_repository_t m_stop_guards; /*! * \brief A specific infrastructure for environment. * * Note: infrastructure takes care about coop repository, * timer threads/managers and default dispatcher. * * \since * v.5.5.19 */ environment_infrastructure_unique_ptr_t m_infrastructure; //! A repository of dispatchers. impl::disp_repository_t m_dispatchers; //! An utility for layers. impl::layer_core_t m_layer_core; /*! * \brief An exception reaction for the whole SO Environment. * \since * v.5.3.0 */ const exception_reaction_t m_exception_reaction; /*! * \brief Is autoshutdown when there is no more cooperation disabled? * * \see environment_params_t::disable_autoshutdown() * * \since * v.5.4.0 */ const bool m_autoshutdown_disabled; /*! * \brief A counter for automatically generated cooperation names. * * \since * v.5.5.1 */ std::atomic_uint_fast64_t m_autoname_counter = { 0 }; /*! * \brief Data sources for core objects. * * \attention This instance must be created after stats_controller * and destroyed before it. Because of that m_core_data_sources declared * after m_stats_controller and after all corresponding objects. * NOTE: since v.5.5.19 stats_controller and stats_repository are parts * of environment_infrastructure. Because of that m_core_data_sources * declared and created after m_infrastructure. * * \since * v.5.5.4 */ core_data_sources_t m_core_data_sources; /*! * \brief Work thread activity tracking for the whole Environment. * \since * v.5.5.18 */ work_thread_activity_tracking_t m_work_thread_activity_tracking; /*! * \brief Manager for defaults of queue locks. * * \since * v.5.5.18 */ queue_locks_defaults_manager_unique_ptr_t m_queue_locks_defaults_manager; /*! * \brief Actual event_queue_hook. * * \note * If there is no event_queue_hook in environment_params_t then * an instance of default_event_queue_hook_t will be created and used. * * \since * v.5.5.24 */ event_queue_hook_unique_ptr_t m_event_queue_hook; //! Constructor. internals_t( environment_t & env, environment_params_t && params ) : m_error_logger( params.so5__error_logger() ) , m_msg_tracing_stuff{ params.so5__giveout_message_delivery_tracer_filter(), params.so5__giveout_message_delivery_tracer() } , m_mbox_core( new impl::mbox_core_t{ outliving_mutable( m_msg_tracing_stuff ) } ) , m_infrastructure( (params.infrastructure_factory())( env, params, // A special mbox for distributing monitoring information // must be created and passed to stats_controller. m_mbox_core->create_mbox() ) ) , m_dispatchers( env, params.so5__giveout_named_dispatcher_map(), params.so5__giveout_event_exception_logger() ) , m_layer_core( env, params.so5__layers_map() ) , m_exception_reaction( params.exception_reaction() ) , m_autoshutdown_disabled( params.autoshutdown_disabled() ) , m_core_data_sources( outliving_mutable(m_infrastructure->stats_repository()), *m_mbox_core, *m_infrastructure ) , m_work_thread_activity_tracking( params.work_thread_activity_tracking() ) , m_queue_locks_defaults_manager( ensure_locks_defaults_manager_exists( params.so5__giveout_queue_locks_defaults_manager() ) ) , m_event_queue_hook( ensure_event_queue_hook_exists( params.so5__giveout_event_queue_hook() ) ) {} }; // // environment_t // environment_t & environment_t::self_ref() { return *this; } environment_t::environment_t( environment_params_t && params ) : m_impl( new internals_t( self_ref(), std::move(params) ) ) { } environment_t::~environment_t() { } mbox_t environment_t::create_mbox( ) { return m_impl->m_mbox_core->create_mbox(); } mbox_t environment_t::create_mbox( nonempty_name_t nonempty_name ) { return m_impl->m_mbox_core->create_mbox( std::move(nonempty_name) ); } mchain_t environment_t::create_mchain( const mchain_params_t & params ) { return m_impl->m_mbox_core->create_mchain( *this, params ); } dispatcher_t & environment_t::query_default_dispatcher() { return m_impl->m_infrastructure->query_default_dispatcher(); } dispatcher_ref_t environment_t::query_named_dispatcher( const std::string & disp_name ) { return m_impl->m_dispatchers.query_named_dispatcher( disp_name ); } dispatcher_ref_t environment_t::add_dispatcher_if_not_exists( const std::string & disp_name, std::function< dispatcher_unique_ptr_t() > disp_factory ) { return m_impl->m_dispatchers.add_dispatcher_if_not_exists( disp_name, disp_factory ); } void environment_t::install_exception_logger( event_exception_logger_unique_ptr_t logger ) { m_impl->m_dispatchers.install_exception_logger( std::move( logger ) ); } coop_unique_ptr_t environment_t::create_coop( nonempty_name_t name ) { return create_coop( std::move(name), create_default_disp_binder() ); } coop_unique_ptr_t environment_t::create_coop( autoname_indicator_t indicator() ) { return create_coop( indicator, create_default_disp_binder() ); } coop_unique_ptr_t environment_t::create_coop( nonempty_name_t name, disp_binder_unique_ptr_t disp_binder ) { return coop_unique_ptr_t( new coop_t( std::move(name), std::move(disp_binder), self_ref() ) ); } coop_unique_ptr_t environment_t::create_coop( autoname_indicator_t (*)(), disp_binder_unique_ptr_t disp_binder ) { auto counter = ++(m_impl->m_autoname_counter); nonempty_name_t name( "__so5_autoname_" + std::to_string(counter) + "__" ); return coop_unique_ptr_t( new coop_t( std::move(name), std::move(disp_binder), self_ref() ) ); } void environment_t::register_coop( coop_unique_ptr_t agent_coop ) { m_impl->m_infrastructure->register_coop( std::move( agent_coop ) ); } void environment_t::deregister_coop( nonempty_name_t name, int reason ) { m_impl->m_infrastructure->deregister_coop( std::move(name), coop_dereg_reason_t( reason ) ); } so_5::timer_id_t environment_t::schedule_timer( const std::type_index & type_wrapper, const message_ref_t & msg, const mbox_t & mbox, std::chrono::steady_clock::duration pause, std::chrono::steady_clock::duration period ) { // Since v.5.5.21 pause and period should be checked for negative // values. using duration = std::chrono::steady_clock::duration; if( pause < duration::zero() ) SO_5_THROW_EXCEPTION( so_5::rc_negative_value_for_pause, "an attempt to call schedule_timer() with negative pause value" ); if( period < duration::zero() ) SO_5_THROW_EXCEPTION( so_5::rc_negative_value_for_period, "an attempt to call schedule_timer() with negative period value" ); // If it is a mutable message then there must be some restrictions: if( message_mutability_t::mutable_message == message_mutability(msg) ) { // Mutable message can be sent only as delayed message. if( std::chrono::steady_clock::duration::zero() != period ) SO_5_THROW_EXCEPTION( so_5::rc_mutable_msg_cannot_be_periodic, "unable to schedule periodic timer for mutable message," " msg_type=" + std::string(type_wrapper.name()) ); // Mutable message can't be passed to MPMC-mbox. else if( mbox_type_t::multi_producer_multi_consumer == mbox->type() ) SO_5_THROW_EXCEPTION( so_5::rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox, "unable to schedule timer for mutable message and " "MPMC mbox, msg_type=" + std::string(type_wrapper.name()) ); } return m_impl->m_infrastructure->schedule_timer( type_wrapper, msg, mbox, pause, period ); } void environment_t::single_timer( const std::type_index & type_wrapper, const message_ref_t & msg, const mbox_t & mbox, std::chrono::steady_clock::duration pause ) { // Since v.5.5.21 pause should be checked for negative values. using duration = std::chrono::steady_clock::duration; if( pause < duration::zero() ) SO_5_THROW_EXCEPTION( so_5::rc_negative_value_for_pause, "an attempt to call single_timer() with negative pause value" ); // Mutable message can't be passed to MPMC-mbox. if( message_mutability_t::mutable_message == message_mutability(msg) && mbox_type_t::multi_producer_multi_consumer == mbox->type() ) SO_5_THROW_EXCEPTION( so_5::rc_mutable_msg_cannot_be_delivered_via_mpmc_mbox, "unable to schedule single timer for mutable message and " "MPMC mbox, msg_type=" + std::string(type_wrapper.name()) ); m_impl->m_infrastructure->single_timer( type_wrapper, msg, mbox, pause ); } layer_t * environment_t::query_layer( const std::type_index & type ) const { return m_impl->m_layer_core.query_layer( type ); } void environment_t::add_extra_layer( const std::type_index & type, const layer_ref_t & layer ) { m_impl->m_layer_core.add_extra_layer( type, layer ); } void environment_t::run() { try { impl__run_stats_controller_and_go_further(); } catch( const so_5::exception_t & ) { // Rethrow our exception because it already has all information. throw; } catch( const std::exception & x ) { SO_5_THROW_EXCEPTION( rc_environment_error, std::string( "some unexpected error during " "environment launching: " ) + x.what() ); } } void environment_t::stop() { // Since v.5.5.19.2 there is a new shutdown procedure: const auto action = m_impl->m_stop_guards.initiate_stop(); if( impl::stop_guard_repository_t::action_t::do_actual_stop == action ) m_impl->m_infrastructure->stop(); } void environment_t::call_exception_logger( const std::exception & event_exception, const std::string & coop_name ) { m_impl->m_dispatchers.call_exception_logger( event_exception, coop_name ); } exception_reaction_t environment_t::exception_reaction() const { return m_impl->m_exception_reaction; } error_logger_t & environment_t::error_logger() const { return *(m_impl->m_error_logger); } stats::controller_t & environment_t::stats_controller() { return m_impl->m_infrastructure->stats_controller(); } stats::repository_t & environment_t::stats_repository() { return m_impl->m_infrastructure->stats_repository(); } work_thread_activity_tracking_t environment_t::work_thread_activity_tracking() const { return m_impl->m_work_thread_activity_tracking; } disp_binder_unique_ptr_t environment_t::so_make_default_disp_binder() { return m_impl->m_infrastructure->make_default_disp_binder(); } bool environment_t::autoshutdown_disabled() const { return m_impl->m_autoshutdown_disabled; } mbox_t environment_t::do_make_custom_mbox( custom_mbox_details::creator_iface_t & creator ) { return m_impl->m_mbox_core->create_custom_mbox( creator ); } stop_guard_t::setup_result_t environment_t::setup_stop_guard( stop_guard_shptr_t guard, stop_guard_t::what_if_stop_in_progress_t reaction_on_stop_in_progress ) { const auto result = m_impl->m_stop_guards.setup_guard( std::move(guard) ); if( stop_guard_t::setup_result_t::stop_already_in_progress == result && stop_guard_t::what_if_stop_in_progress_t::throw_exception == reaction_on_stop_in_progress ) { SO_5_THROW_EXCEPTION( rc_cannot_set_stop_guard_when_stop_is_started, "stop_guard can't be set because the stop operation is " "already in progress" ); } return result; } void environment_t::remove_stop_guard( stop_guard_shptr_t guard ) { const auto action = m_impl->m_stop_guards.remove_guard( std::move(guard) ); if( impl::stop_guard_repository_t::action_t::do_actual_stop == action ) m_impl->m_infrastructure->stop(); } void environment_t::change_message_delivery_tracer_filter( so_5::msg_tracing::filter_shptr_t filter ) { if( !m_impl->m_msg_tracing_stuff.is_msg_tracing_enabled() ) SO_5_THROW_EXCEPTION( rc_msg_tracing_disabled, "msg_tracing's filter can't be changed when msg_tracing " "is disabled" ); m_impl->m_msg_tracing_stuff.change_filter( std::move(filter) ); } void environment_t::impl__run_stats_controller_and_go_further() { impl::run_stage( "run_stats_controller", [] { /* there is no need to turn_on controller automatically */ }, [this] { m_impl->m_infrastructure->stats_controller().turn_off(); }, [this] { impl__run_layers_and_go_further(); } ); } void environment_t::impl__run_layers_and_go_further() { impl::run_stage( "run_layers", [this] { m_impl->m_layer_core.start(); }, [this] { m_impl->m_layer_core.finish(); }, [this] { impl__run_dispatcher_and_go_further(); } ); } void environment_t::impl__run_dispatcher_and_go_further() { impl::run_stage( "run_dispatcher", [this] { m_impl->m_dispatchers.start(); }, [this] { m_impl->m_dispatchers.finish(); }, [this] { impl__run_infrastructure(); } ); } namespace autoshutdown_guard { //! An empty agent for the special cooperation for protection of //! init function from autoshutdown feature. class a_empty_agent_t : public agent_t { public : a_empty_agent_t( environment_t & env ) : agent_t( env ) {} }; #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmissing-prototypes" #endif void register_init_guard_cooperation( environment_t & env, bool autoshutdown_disabled ) { if( !autoshutdown_disabled ) env.register_agent_as_coop( "__so_5__init_autoshutdown_guard__", new a_empty_agent_t( env ) ); } void deregistr_init_guard_cooperation( environment_t & env, bool autoshutdown_disabled ) { if( !autoshutdown_disabled ) env.deregister_coop( "__so_5__init_autoshutdown_guard__", dereg_reason::normal ); } #if defined(__clang__) #pragma clang diagnostic pop #endif } void environment_t::impl__run_infrastructure() { m_impl->m_infrastructure->launch( [this]() { // init method must be protected from autoshutdown feature. autoshutdown_guard::register_init_guard_cooperation( *this, m_impl->m_autoshutdown_disabled ); // Initilizing environment. init(); // Protection is no more needed. autoshutdown_guard::deregistr_init_guard_cooperation( *this, m_impl->m_autoshutdown_disabled ); } ); } namespace impl { mbox_t internal_env_iface_t::create_mpsc_mbox( agent_t * single_consumer, const message_limit::impl::info_storage_t * limits_storage ) { return m_env.m_impl->m_mbox_core->create_mpsc_mbox( single_consumer, limits_storage ); } void internal_env_iface_t::ready_to_deregister_notify( coop_t * coop ) { m_env.m_impl->m_infrastructure->ready_to_deregister_notify( coop ); } void internal_env_iface_t::final_deregister_coop( const std::string & coop_name ) { bool any_cooperation_alive = m_env.m_impl->m_infrastructure->final_deregister_coop( coop_name ); if( !any_cooperation_alive && !m_env.m_impl->m_autoshutdown_disabled ) m_env.stop(); } bool internal_env_iface_t::is_msg_tracing_enabled() const { return m_env.m_impl->m_msg_tracing_stuff.is_msg_tracing_enabled(); } so_5::msg_tracing::holder_t & internal_env_iface_t::msg_tracing_stuff() const { if( !is_msg_tracing_enabled() ) SO_5_THROW_EXCEPTION( rc_msg_tracing_disabled, "msg_tracer cannot be accessed because msg_tracing is disabled" ); return m_env.m_impl->m_msg_tracing_stuff; } so_5::disp::mpsc_queue_traits::lock_factory_t internal_env_iface_t::default_mpsc_queue_lock_factory() const { return m_env.m_impl->m_queue_locks_defaults_manager-> mpsc_queue_lock_factory(); } so_5::disp::mpmc_queue_traits::lock_factory_t internal_env_iface_t::default_mpmc_queue_lock_factory() const { return m_env.m_impl->m_queue_locks_defaults_manager-> mpmc_queue_lock_factory(); } SO_5_NODISCARD event_queue_t * internal_env_iface_t::event_queue_on_bind( agent_t * agent, event_queue_t * original_queue ) SO_5_NOEXCEPT { return m_env.m_impl->m_event_queue_hook->on_bind( agent, original_queue ); } void internal_env_iface_t::event_queue_on_unbind( agent_t * agent, event_queue_t * queue ) SO_5_NOEXCEPT { m_env.m_impl->m_event_queue_hook->on_unbind( agent, queue ); } } /* namespace impl */ } /* namespace so_5 */
24.896552
86
0.755183
eao197
782990ae4897611ecaa5a0fd86b1a17ccf2226c1
3,342
cpp
C++
Examples/MontiHall.cpp
LuisRGameloft/nana-demo
05e05dbc1ee8eb5d94b31282290dae0c7e2e3620
[ "BSL-1.0" ]
null
null
null
Examples/MontiHall.cpp
LuisRGameloft/nana-demo
05e05dbc1ee8eb5d94b31282290dae0c7e2e3620
[ "BSL-1.0" ]
null
null
null
Examples/MontiHall.cpp
LuisRGameloft/nana-demo
05e05dbc1ee8eb5d94b31282290dae0c7e2e3620
[ "BSL-1.0" ]
null
null
null
#include <nana/gui/wvl.hpp> #include <nana/gui/widgets/label.hpp> #include <nana/gui/widgets/button.hpp> #include <nana/system/platform.hpp> class monty_hall : public nana::form { enum state_t{state_begin, state_picked, state_over}; public: monty_hall(); private: void _m_pick_door (const nana::arg_click& ei); void _m_play (int door); void _m_remove_door(int exclude); private: state_t state_{state_begin}; int door_has_car_; nana::label label_; nana::button door_[3]; }; int main() { monty_hall mh; mh.show(); nana::exec(); } monty_hall::monty_hall() : nana::form( nana::API::make_center(400, 150) , appear::decorate<appear::taskbar>() ) { this->caption( ("The Monty Hall Problem")); std::string text = "Hi, I am the host, you are on a Game Show:\n" "You are given the choice of one of tree Doors.\n" "One door has a new Car behind it and the other two: Goats.\n" "Now pick a door to win the Car."; label_.create(*this, nana::rectangle(nana::size(400, 100))); label_.caption(text); std::string door_name[3] = { ("Door No.&1"), ("Door No.&2"), ("Door No.&3")}; for(int i = 0; i < 3; ++i) { door_[i].create(*this, nana::rectangle(50 + 110 * i, 110, 100, 24)); door_[i].caption(door_name[i]); door_[i].events().click([this](const nana::arg_click& ei){ _m_pick_door(ei); }); } } void monty_hall::_m_pick_door(const nana::arg_click& ei) { int index = 0; for(; index < 3; ++index) { if(door_[index] == ei.window_handle) break; } _m_play(index); } void monty_hall::_m_play(int door) { switch(state_) { case state_begin: door_has_car_ = (nana::system::timestamp() / 1000) % 3; _m_remove_door(door); state_ = state_picked; break; case state_picked: label_.caption(door_has_car_ == door ? ("Yes, you win the new Car!!") : ("Sign, you are lost!")); state_ = state_over; break; } } void monty_hall::_m_remove_door(int exclude) { std::vector<int> doors; for(int i = 0; i < 3; ++i) { if(i != exclude) doors.push_back(i); } unsigned ts = (nana::system::timestamp() / 1000) % 2; if(door_has_car_ == doors[ts]) ts = (ts ? 0: 1); door_[doors[ts]].enabled(false); doors.erase(doors.begin() + ts); std::string text = "I know what's behind all the doors and" "I remove a door which a goat behind it. \n" "And now, do you want to stick with your decision" " of Door No.X or do you want to change your choice" " to Door No.Y?"; char door_char = '1' + exclude; std::string::size_type pos = text.find( ("Door No.X")); text.replace(pos + 8, 1, 1, door_char); door_char = '1' + doors[0]; pos = text.find( ("Door No.Y")); text.replace(pos + 8, 1, 1, door_char); label_.caption(text); }
33.757576
100
0.52304
LuisRGameloft
782a19bc3c6639b82add00ed21bd7700d1f0bef2
11,405
hpp
C++
sparta/sparta/statistics/CycleCounter.hpp
debjyoti0891/map
abdae67964420d7d36255dcbf83e4240a1ef4295
[ "MIT" ]
44
2019-12-13T06:39:13.000Z
2022-03-29T23:09:28.000Z
sparta/sparta/statistics/CycleCounter.hpp
debjyoti0891/map
abdae67964420d7d36255dcbf83e4240a1ef4295
[ "MIT" ]
222
2020-01-14T21:58:56.000Z
2022-03-31T20:05:12.000Z
sparta/sparta/statistics/CycleCounter.hpp
debjyoti0891/map
abdae67964420d7d36255dcbf83e4240a1ef4295
[ "MIT" ]
19
2020-01-03T19:03:22.000Z
2022-01-09T08:36:20.000Z
// <Counter> -*- C++ -*- #pragma once #include "sparta/simulation/TreeNode.hpp" #include "sparta/functional/DataView.hpp" #include "sparta/utils/ByteOrder.hpp" #include "sparta/statistics/Counter.hpp" #include "sparta/utils/SpartaException.hpp" #include "sparta/utils/SpartaAssert.hpp" #include "sparta/simulation/Clock.hpp" namespace sparta { /*! * \brief Represents a cycle counter * \note CycleCounters are completely passive and not checkointable * \note This is not a subclass because virtual set/increment methods * introduce much overhead in Counters. * * The purpose of this Counter is to start a count at particular * point (with a call to startCounting()) and close it at another * point (with a call to stopCounting()). By default, the counter * is \b not started. This type of Counter is used for * utilization counts where it's useful to start counting when a * threshold is hit and a record of \i how \i long it was at that * threshold. */ class CycleCounter : public CounterBase { public: //! \name Construction & Initialization //! @{ //////////////////////////////////////////////////////////////////////// /*! * \brief CycleCounter constructor * \param parent parent node. Must not be nullptr. Must have an ArchData * accessible through getArchData_ * \param name Name of this counter. Must be a valid TreeNode name * \param group Group of this counter. Must be a valid TreeNode group * when paired with group_idx. * \param group_idx Group index. Must be a valid TreeNode group_idx * when paired with group. * \param desc Description of this node. Required to be a valid * TreeNode description. * \param behave Behavior of this counter. This is not * enforced for CycleCounter but used as a hint * for the sparta report and statistics * infrastructure * \param visibility Visibility level of this counter */ CycleCounter(TreeNode* parent, const std::string& name, const std::string& group, TreeNode::group_idx_type group_idx, const std::string& desc, CounterBehavior behave, const sparta::Clock * clk, visibility_t visibility) : CounterBase(parent, name, group, group_idx, desc, behave, visibility), clk_(clk) { sparta_assert(clk_ != nullptr, "CycleCounter must be given a clock through it's parent node"); } // Alternate constructor CycleCounter(TreeNode* parent, const std::string& name, const std::string& desc, CounterBehavior behave, const sparta::Clock * clk, visibility_t visibility) : CycleCounter(parent, name, TreeNode::GROUP_NAME_NONE, TreeNode::GROUP_IDX_NONE, desc, behave, clk, visibility) { // Initialization handled in delegated constructor } // Alternate Constructor CycleCounter(TreeNode* parent, const std::string& name, const std::string& group, TreeNode::group_idx_type group_idx, const std::string& desc, CounterBehavior behave, const sparta::Clock * clk) : CycleCounter(parent, name, group, group_idx, desc, behave, clk, DEFAULT_VISIBILITY) { sparta_assert(clk_ != nullptr, "CycleCounter must be given a clock through it's parent node"); } // Alternate constructor CycleCounter(TreeNode* parent, const std::string& name, const std::string& desc, CounterBehavior behave, const sparta::Clock * clk) : CycleCounter(parent, name, TreeNode::GROUP_NAME_NONE, TreeNode::GROUP_IDX_NONE, desc, behave, clk, DEFAULT_VISIBILITY) { // Initialization handled in delegated constructor } /*! * \brief Move constructor * \pre See CounterBase move constructor */ CycleCounter(CycleCounter&& rhp) : CounterBase(std::move(rhp)), clk_(rhp.clk_), count_(0), start_count_(0), counting_(false) { TreeNode* parent = rhp.getParent(); if(parent != nullptr){ parent->addChild(this); } } /*! * \brief Destructor * \note CycleCounter is not intended to be overloaded */ ~CycleCounter() {} //////////////////////////////////////////////////////////////////////// //! @} //! \name CycleCounter use methods //! @{ //////////////////////////////////////////////////////////////////////// /*! * \brief Start counting, taking into account the specified delay * \param delay Begin incrementing counter after this number of cycles * has elapsed on the clock associated with this Counter (see * sparta::CounterBase::getClock) * \pre Must not be counting already (see stopCounting) */ void startCounting(uint32_t delay = 0) { sparta_assert(counting_ == false); mult_ = 1; start_count_ = clk_->elapsedCycles() + delay; counting_ = true; } /*! * \brief Start counting, taking into account the specified delay * \param delay Begin incrementing counter after this number of cycles * has elapsed on the clock associated with this Counter (see * sparta::CounterBase::getClock) * \param add_per_cycle Amount to add to the counter each cycle. This * is generally used when this counter is constructed with a behavior of * COUNT_INTEGRAL counter. Then the counter is incremented by some * value every cycle to effectively take the integral of some value over time. * \pre Must not be counting already (see stopCounting) */ void startCountingWithMultiplier(uint32_t add_per_cycle, uint32_t delay = 0) { sparta_assert(counting_ == false); mult_ = add_per_cycle; start_count_ = clk_->elapsedCycles() + delay; counting_ = true; } /*! * Update the current multiplier used for counting without * requiring a stop/start of the counter. */ void updateCountingMultiplier(uint32_t add_per_cycle) { if (isCounting()) { stopCounting(); } startCountingWithMultiplier(add_per_cycle); } //! Stop counting and increment internal count, taking into account the specified delay void stopCounting(uint32_t delay = 0) { sparta_assert(counting_ == true); sparta_assert ((clk_->elapsedCycles() + delay) >= start_count_); count_ += (clk_->elapsedCycles() + delay - start_count_) * mult_; counting_ = false; } //! Return whether this counter is counting or not. bool isCounting() const { return counting_; } //! Return the current multipler uint32_t getCurrentMultiplier() const { return mult_; } //////////////////////////////////////////////////////////////////////// //! @} //! \name Access Methods //! @{ //////////////////////////////////////////////////////////////////////// /*! * \brief Gets the value of this counter * \return Current value of this counter * \note Must be overridden if this class is constructed with * ref=nullptr * \todo Allow indexed accesses if larger counters are supported. */ virtual counter_type get() const override { counter_type count = count_; if(counting_) { Clock::Cycle elapsed = clk_->elapsedCycles(); if (elapsed > start_count_) { count += (elapsed - start_count_) * mult_; } } return count; } /*! * \brief Cast operator to get value of the counter */ operator counter_type() const { return get(); } /*! * \brief Comparison against another counter */ bool operator==(const Counter& rhp) const { return get() == rhp.get(); } /*! * \brief Comparison against another counter */ bool operator==(const CycleCounter& rhp) const { return get() == rhp.get(); } //////////////////////////////////////////////////////////////////////// //! @} //! CycleCounters track integral values, and are good //! candidates for compression virtual bool supportsCompression() const override { return true; } //! \name Printing Methods //! @{ //////////////////////////////////////////////////////////////////////// // Override from TreeNode virtual std::string stringize(bool pretty=false) const override { (void) pretty; std::stringstream ss; ss << '<' << getLocation() << " val:" << std::dec; ss << get() << ' '; ss << Counter::getBehaviorName(getBehavior()); ss << " vis:" << getVisibility() << '>'; return ss.str(); } protected: /*! * \brief React to child registration * * Overrides TreeNode::onAddingChild_ */ virtual void onAddingChild_(TreeNode* child) override { (void) child; throw SpartaException("Cannot add children to a CycleCounter"); } private: //! Clock this counter uses for differences const sparta::Clock * clk_ = nullptr; //! Multiplier (amount added for each cycle) uint32_t mult_ = 1; //! Counters from which value will be read/calculated counter_type count_ = 0; counter_type start_count_ = 0; //! Counter on or off? bool counting_ = false; }; // class CycleCounter } // namespace sparta
34.984663
106
0.497676
debjyoti0891
782b5030e897d387635a46ba10725c92e03d35b4
1,698
hpp
C++
src/util/allocator.hpp
BigDataAnalyticsGroup/RewiredCracking
b12bf39b54672d28175f4608d266c505e3611459
[ "Apache-2.0" ]
3
2019-04-21T07:23:03.000Z
2019-12-04T02:10:04.000Z
src/util/allocator.hpp
BigDataAnalyticsGroup/RewiredCracking
b12bf39b54672d28175f4608d266c505e3611459
[ "Apache-2.0" ]
null
null
null
src/util/allocator.hpp
BigDataAnalyticsGroup/RewiredCracking
b12bf39b54672d28175f4608d266c505e3611459
[ "Apache-2.0" ]
null
null
null
#pragma once #include <algorithm> #include <cstdint> #include <cstdlib> #include <cstring> #include <sys/mman.h> struct default_allocator { template<typename T> T * allocate(std::size_t n) const { return static_cast<T*>(malloc(sizeof(T) * n)); } template<typename T> void deallocate(T *p, std::size_t n) const { (void) n; free(p); } template<typename T> T * reallocate(T *p, std::size_t old_size, std::size_t new_size) const { (void) old_size; return static_cast<T*>(realloc(p, sizeof(T) * new_size)); } }; template<std::size_t Align> struct aligned_allocator { static_assert((Align & (Align - 1)) == 0, "not a power of 2"); template<typename T> T * allocate(std::size_t n) const { return static_cast<T*>(aligned_alloc(Align, sizeof(T) * n)); } template<typename T> void deallocate(T *p, std::size_t n) const { (void) n; free(p); } template<typename T> T * reallocate(T *p, std::size_t old_size, std::size_t new_size) const { T *dst = allocate<T>(new_size); std::memcpy(dst, p, sizeof(T) * old_size); deallocate(p, old_size); return dst; } }; struct mremap_allocator { template<typename T> T * allocate(std::size_t n) const { return static_cast<T*>(mmap(nullptr, sizeof(T) * n, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); } template<typename T> void deallocate(T *p, std::size_t n) const { munmap(p, sizeof(T) * n); } template<typename T> T * reallocate(T *p, std::size_t old_size, std::size_t new_size) const { return static_cast<T*>(mremap(p, sizeof(T) * old_size, sizeof(T) * new_size, MREMAP_MAYMOVE)); } };
28.3
121
0.633687
BigDataAnalyticsGroup
782fb12b3326725efe627b723d60416a61c408f4
2,362
cc
C++
riscv-tools/riscv-isa-sim/riscv/clint.cc
programokey/e200_opensource
83980f1732f922629163e09abff4dcf76abe7e8d
[ "Apache-2.0" ]
null
null
null
riscv-tools/riscv-isa-sim/riscv/clint.cc
programokey/e200_opensource
83980f1732f922629163e09abff4dcf76abe7e8d
[ "Apache-2.0" ]
null
null
null
riscv-tools/riscv-isa-sim/riscv/clint.cc
programokey/e200_opensource
83980f1732f922629163e09abff4dcf76abe7e8d
[ "Apache-2.0" ]
1
2019-01-10T11:51:55.000Z
2019-01-10T11:51:55.000Z
#include "devices.h" #include "processor.h" clint_t::clint_t(std::vector<processor_t*>& procs) : procs(procs), mtimecmp(procs.size()) { } /* 0000 msip hart 0 * 0004 msip hart 1 * 4000 mtimecmp hart 0 lo * 4004 mtimecmp hart 0 hi * 4008 mtimecmp hart 1 lo * 400c mtimecmp hart 1 hi * bff8 mtime lo * bffc mtime hi */ #define MSIP_BASE 0x0 #define MTIMECMP_BASE 0x4000 #define MTIME_BASE 0xbff8 bool clint_t::load(reg_t addr, size_t len, uint8_t* bytes) { if (addr >= MSIP_BASE && addr + len <= MSIP_BASE + procs.size()*sizeof(msip_t)) { std::vector<msip_t> msip(procs.size()); for (size_t i = 0; i < procs.size(); ++i) msip[i] = !!(procs[i]->state.mip & MIP_MSIP); memcpy(bytes, (uint8_t*)&msip[0] + addr - MSIP_BASE, len); } else if (addr >= MTIMECMP_BASE && addr + len <= MTIMECMP_BASE + procs.size()*sizeof(mtimecmp_t)) { memcpy(bytes, (uint8_t*)&mtimecmp[0] + addr - MTIMECMP_BASE, len); } else if (addr >= MTIME_BASE && addr + len <= MTIME_BASE + sizeof(mtime_t)) { memcpy(bytes, (uint8_t*)&mtime + addr - MTIME_BASE, len); } else { return false; } return true; } bool clint_t::store(reg_t addr, size_t len, const uint8_t* bytes) { if (addr >= MSIP_BASE && addr + len <= MSIP_BASE + procs.size()*sizeof(msip_t)) { std::vector<msip_t> msip(procs.size()); std::vector<msip_t> mask(procs.size(), 0); memcpy((uint8_t*)&msip[0] + addr - MSIP_BASE, bytes, len); memset((uint8_t*)&mask[0] + addr - MSIP_BASE, 0xff, len); for (size_t i = 0; i < procs.size(); ++i) { if (!(mask[i] & 0xFF)) continue; procs[i]->state.mip &= ~MIP_MSIP; if (!!(msip[i] & 1)) procs[i]->state.mip |= MIP_MSIP; } } else if (addr >= MTIMECMP_BASE && addr + len <= MTIMECMP_BASE + procs.size()*sizeof(mtimecmp_t)) { memcpy((uint8_t*)&mtimecmp[0] + addr - MTIMECMP_BASE, bytes, len); } else if (addr >= MTIME_BASE && addr + len <= MTIME_BASE + sizeof(mtime_t)) { memcpy((uint8_t*)&mtime + addr - MTIME_BASE, bytes, len); } else { return false; } increment(0); return true; } void clint_t::increment(reg_t inc) { mtime += inc; for (size_t i = 0; i < procs.size(); i++) { procs[i]->state.mip &= ~MIP_MTIP; if (mtime >= mtimecmp[i]) procs[i]->state.mip |= MIP_MTIP; } }
32.356164
103
0.600339
programokey
7836225b7dda48aedcebb2dd9f72bbccf112be74
3,831
cpp
C++
course1/laba7/H_parking/main.cpp
flydzen/ITMO_algo
ea251dca0fddb0d4d212377c6785cdc3667ece89
[ "MIT" ]
null
null
null
course1/laba7/H_parking/main.cpp
flydzen/ITMO_algo
ea251dca0fddb0d4d212377c6785cdc3667ece89
[ "MIT" ]
null
null
null
course1/laba7/H_parking/main.cpp
flydzen/ITMO_algo
ea251dca0fddb0d4d212377c6785cdc3667ece89
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <cassert> #define mid lt + (rt-lt)/2 #define vx Element * #define ll long long using namespace std; struct Element { ll mini = LONG_LONG_MAX; vx minEl = nullptr; ll set = LONG_LONG_MIN; int pos; vx right = nullptr; vx left = nullptr; }; void setMin(vx v) { if (!v) return; if (v->left && v->right) { if (v->left->mini <= v->right->mini) { v->mini = v->left->mini; v->minEl = v->left->minEl; } else { v->mini = v->right->mini; v->minEl = v->right->minEl; } } else if (v->left) { v->mini = v->left->mini; v->minEl = v->left->minEl; } else if (v->right) { v->mini = v->right->mini; v->minEl = v->right->minEl; } } class SegTree { public: SegTree(int n) : size(n) { counter = 0; ptr = nullptr; ptr = (Element *) std::malloc((n * 2) * sizeof(Element)); assert(ptr); root = build(0, size - 1); } ~SegTree() { free(ptr); } pair<ll, vx> get(int l, int r) { return get(root, l, r, 0, size - 1); } void set(int l, int r, ll value) { set(root, value, 0, size - 1, l, r); } private: int size; vx root; Element *ptr; int counter; void toDown(vx v) { if (v->set != LONG_LONG_MIN) { if (v->left) { v->left->set = v->set; v->left->mini = v->set; } if (v->right) { v->right->set = v->set; v->right->mini = v->set; } v->set = LONG_LONG_MIN; } } vx make_list(int pos) { vx node = &ptr[counter++]; node->right = nullptr; node->left = nullptr; node->mini = 0; node->pos = pos; node->set = LONG_LONG_MIN; node->minEl = node; return node; } vx make_vertex(vx left, vx right) { vx node = &ptr[counter++]; node->right = right; node->left = left; node->mini = LONG_LONG_MAX; node->set = LONG_LONG_MIN; setMin(node); return node; } vx build(int lt, int rt) { if (lt == rt) return make_list(lt); return make_vertex(build(lt, mid), build(mid + 1, rt)); } void set(vx v, ll value, int lt, int rt, int l, int r) { if (lt > r || rt < l) return; toDown(v); if (l <= lt && rt <= r) { v->set = value; v->mini = value; } else { set(v->left, value, lt, mid, l, r); set(v->right, value, mid + 1, rt, l, r); setMin(v); } } pair<ll, vx> get(vx v, int l, int r, int lt, int rt) { toDown(v); setMin(v); if (lt > r || rt < l) return {LONG_LONG_MAX, v}; if (l <= lt && rt <= r) return {v->mini, v->minEl}; auto g1 = get(v->left, l, r, lt, mid); auto g2 = get(v->right, l, r, mid + 1, rt); if (g1.first <= g2.first) return g1; else return g2; } }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; SegTree tree(n); string oper; int l; for (int i = 0; i < m; i++) { cin >> oper >> l; if (oper == "enter") { auto v = tree.get(l - 1, n - 1); if (v.first == 1) v = tree.get(0, l - 1); int pos = v.second->pos; cout << pos + 1 << endl; tree.set(pos, pos, 1); } else { tree.set(l - 1, l - 1, 0); } } return 0; }
24.716129
66
0.426782
flydzen
783728c568feffe52ccb8fcae70d7ca623c72e00
5,500
cpp
C++
15/path_finder.t.cpp
ComicSansMS/AdventOfCode2019
7ca0c57bf28ee8edab04c31a36dbd34d66d7f816
[ "Unlicense" ]
3
2019-12-01T17:37:33.000Z
2021-12-14T10:12:09.000Z
15/path_finder.t.cpp
ComicSansMS/AdventOfCode2019
7ca0c57bf28ee8edab04c31a36dbd34d66d7f816
[ "Unlicense" ]
null
null
null
15/path_finder.t.cpp
ComicSansMS/AdventOfCode2019
7ca0c57bf28ee8edab04c31a36dbd34d66d7f816
[ "Unlicense" ]
null
null
null
#include <path_finder.hpp> #include <catch.hpp> #include <sstream> TEST_CASE("Path Finder") { SECTION("Vector2") { CHECK(Vector2().x == 0); CHECK(Vector2().y == 0); CHECK(Vector2(1, 2).x == 1); CHECK(Vector2(1, 2).y == 2); CHECK(Vector2(1, 2) == Vector2(1, 2)); CHECK_FALSE(Vector2(1, 2) == Vector2(0, 2)); CHECK_FALSE(Vector2(1, 2) == Vector2(1, 0)); CHECK_FALSE(Vector2(1, 2) == Vector2(0, 0)); std::stringstream sstr; sstr << Vector2(5, -12); CHECK(sstr.str() == "[5,-12]"); } char const test_map[] = " \n" " ## \n" " #O.#\n" " #X.# \n" " ## \n"; SECTION("Mock Construction") { MockProgram const m = MockProgram::fromString(test_map); CHECK(m.position == Vector2(0, 0)); CHECK(m.map.find(Vector2(0, 0))->second == Tile::Empty); // first row CHECK(m.map.find(Vector2(-3, 2))->second == Tile::Empty); CHECK(m.map.find(Vector2(-2, 2))->second == Tile::Empty); CHECK(m.map.find(Vector2(-1, 2))->second == Tile::Empty); CHECK(m.map.find(Vector2( 0, 2))->second == Tile::Empty); CHECK(m.map.find(Vector2( 1, 2))->second == Tile::Empty); CHECK(m.map.find(Vector2( 2, 2))->second == Tile::Empty); // second row CHECK(m.map.find(Vector2(-3, 1))->second == Tile::Empty); CHECK(m.map.find(Vector2(-2, 1))->second == Tile::Empty); CHECK(m.map.find(Vector2(-1, 1))->second == Tile::Empty); CHECK(m.map.find(Vector2( 0, 1))->second == Tile::Wall); CHECK(m.map.find(Vector2( 1, 1))->second == Tile::Wall); CHECK(m.map.find(Vector2( 2, 1))->second == Tile::Empty); // third row CHECK(m.map.find(Vector2(-3, 0))->second == Tile::Empty); CHECK(m.map.find(Vector2(-2, 0))->second == Tile::Empty); CHECK(m.map.find(Vector2(-1, 0))->second == Tile::Wall); CHECK(m.map.find(Vector2( 0, 0))->second == Tile::Empty); CHECK(m.map.find(Vector2( 1, 0))->second == Tile::Empty); CHECK(m.map.find(Vector2( 2, 0))->second == Tile::Wall); // fourth row CHECK(m.map.find(Vector2(-3, -1))->second == Tile::Empty); CHECK(m.map.find(Vector2(-2, -1))->second == Tile::Wall); CHECK(m.map.find(Vector2(-1, -1))->second == Tile::Target); CHECK(m.map.find(Vector2( 0, -1))->second == Tile::Empty); CHECK(m.map.find(Vector2( 1, -1))->second == Tile::Wall); CHECK(m.map.find(Vector2( 2, -1))->second == Tile::Empty); // fifth row CHECK(m.map.find(Vector2(-3, -2))->second == Tile::Empty); CHECK(m.map.find(Vector2(-2, -2))->second == Tile::Empty); CHECK(m.map.find(Vector2(-1, -2))->second == Tile::Wall); CHECK(m.map.find(Vector2( 0, -2))->second == Tile::Wall); CHECK(m.map.find(Vector2( 1, -2))->second == Tile::Empty); CHECK(m.map.find(Vector2( 2, -2))->second == Tile::Empty); } SECTION("Mocking") { MockProgram const m = MockProgram::fromString(test_map); Scanner s(m); CHECK(s.pc() == 0); s.executeProgram(); CHECK(s.pc() == ResultCode::MissingInput); CHECK(s.output().empty()); std::vector<Word> directions = toInput({ Direction::North, Direction::East, Direction::North, Direction::East, Direction::South }); s.input().insert(s.input().begin(), directions.begin(), directions.end()); s.resumeProgram(); CHECK(s.pc() == ResultCode::MissingInput); CHECK(s.input().empty()); CHECK(s.output() == std::vector<Word>{ 0, 1, 0, 0, 0 }); s.output().clear(); CHECK(std::get<MockProgram>(s.vp).position == Vector2{1, 0}); directions = toInput({ Direction::West, Direction::West, Direction::South, Direction::West }); s.input().insert(s.input().begin(), directions.begin(), directions.end()); s.resumeProgram(); CHECK(s.pc() == ResultCode::MissingInput); CHECK(s.input().empty()); CHECK(s.output() == std::vector<Word>{ 1, 0, 1, 2 }); s.output().clear(); CHECK(std::get<MockProgram>(s.vp).position == Vector2{-1, -1}); } SECTION("Simple Maze") { MockProgram const m = MockProgram::fromString(test_map); Scanner s(m); auto const map = floodFill(s); CHECK(s.pc() == ResultCode::MissingInput); std::stringstream sstr; sstr << map; CHECK(sstr.str() == " ## \n" " #O.#\n" "#X.# \n" " ## \n"); CHECK(find_target(map)->first == Vector2(-1, -1)); } char const test_map2[] = " ## \n" "#.O## \n" "#.#..#\n" "#.X.# \n" " ### \n"; SECTION("Flood Fill #2") { { MockProgram const m = MockProgram::fromString(test_map); Scanner s(m); auto const map = floodFill(s); CHECK(floodFill2(map) == 3); } { MockProgram const m = MockProgram::fromString(test_map2); Scanner s(m); auto const map = floodFill(s); CHECK(floodFill2(map) == 4); } } }
37.162162
112
0.496727
ComicSansMS
783d8ab95f7f2e28de99ff138a37d7db43199243
6,305
cc
C++
logga/population.cc
wahibium/KFF
609e5afac8a9477dd1af31eacadbcd5b61530113
[ "MIT" ]
11
2015-06-08T22:16:47.000Z
2022-03-19T15:11:14.000Z
logga/population.cc
wahibium/KFF
609e5afac8a9477dd1af31eacadbcd5b61530113
[ "MIT" ]
null
null
null
logga/population.cc
wahibium/KFF
609e5afac8a9477dd1af31eacadbcd5b61530113
[ "MIT" ]
4
2015-06-12T21:24:47.000Z
2021-04-23T09:58:33.000Z
#include <stdio.h> #include <string.h> #include <vector.h> #include "population.h" #include "random.h" #include "memalloc.h" #include "fitness.h" #include "originalkernel.h" #include "sharingset.h" using namespace std; void Population::Population(int len) { N = len; chromosomes = (Chromosome*) Calloc(N,sizeof(Chromosome)); f = (double*) Calloc(N,sizeof(double)); for (int i=0;i<N;i++) { chromosomes[i].chromoLen = 0; chromosomes[i].chromoIdx = i; } return; } void Population::~Population() { for(int j=0;j<len;j++) for(int i=0;i< chromosome->chromoLen;i++) Free(chromosomes[j]->groupArr[i]); Free(f); Free(chromosomes); return; } void Population::GeneratePopulation() { // TWO METHODS FOR INITIALIZATION // METHOD 1 // Each choromosome has x% unfused original kernels. x in [5,30]. Remaining kernels are fused at a rate of z in [2,4] original kernels per new kernel /* Algorithm: Generate Population -for each choromosome -choose (numOriginalKernels-(x))% of original kernels from bag -For each kernel K in chosen -set value of z -search sharing sets of K for z kernels to fuse -validate, if not valid repeat the previous step -fit new kernel group randomly to chromosome -remove the fused original kernels from bag -fit remaining original kernels in bag to chromosome randomly */ // METHOD 2 /* Algorithm: Generate Population - shuffle original kernels randmoly - For each kernel - Fuse to the first group such that no constraints are violated - If no suck group exists, create a new group and insert the kernel into it */ // use vector as a bag for original kernels int randIdx, spotID; vector<int> bagOriginalKernels(numOriginalKernels); //choromosome tempChromosome; //for (int k = 0; k < numOriginalKernels; k++) //bagOriginalKernels.push_back(originalKernels[k].originalKernelID); // for each choromosome in the population for (int i=0;i<N;i++) { //fill(bagOriginalKernels.begin(),numOriginalKernels,-1); for (int k = 0; k < numOriginalKernels; k++) bagOriginalKernels.push_back(k+1); std::srand(i); random_shuffle(bagOriginalKernels.begin(), bagOriginalKernels.end()); //x = intRand(26) + 5; // add each original kernel to the current chromosome for (int j = 0; j < numOriginalKernels; j++) { spotID = 0; isSpotFound = false; while (spotID < chromosomes[i].chromoLen) { if (isFeasibleToAddOriginalKernel(&(chromosomes[i].groupArr[spotID]), bagOriginalKernels[j])) { addOriginalKernelToGroup(&(chromosomes[i].groupArr[spotID]), bagOriginalKernels[j]); break; } spotID++; } if (spotID == chromosomes[i].chromoLen) { addEmptyGrouptoChromosome(chromosomes[i]); //addGrouptoChromosome(Chromosome *chromosome, Group *group); addOriginalKernelToGroup(&(chromosomes[i].groupArr[spotID]), bagOriginalKernels[j]); } //randIdx = intRand(numOriginalKernels) + 1; //bagOriginalKernels[randIdx] = j; //z = intRand(3) + 2; //y = intRand(bagOriginalKernels.size()); //bagOriginalKernels.at(y); // Find a valid sharing set containing original kernel with ID bagOriginalKernels.at(y) //SharingSet //int numSharingSets; } // original kernel loop } // chromosome loop return; } void Population::EvaluatePopulation() { for (int i=0; i<N; i++) f[i] = EvaluateChromosome(chromosomes[i]); return; } double Population::EvaluateChromosome(int Idx) { return GetFitnessValue(chromosomes[Idx]); } bool Population::IsChromosomeFeasible(int Idx) { if(GetFitnessValue(chromosomes[Idx]) > 0) return true; else return false; } void Population::SwapGroups(int srcGroupIdx, int srcChromosomeIdx, int destGroupIdx, int destChromosomeIdx) { // Allocate temp. Copy src to tempGroup Group tempGroup; AllocateGroup(tempGroup, (chromosomes+srcChromosomeIdx)->(groupArr+srcGroupIdx)->groupLen, (chromosomes+srcChromosomeIdx)->(groupArr+srcGroupIdx)->groupVal); // dest to src FreeGroup((chromosomes+srcChromosomeIdx)->(groupArr+srcGroupIdx)); AllocateGroup((chromosomes+srcChromosomeIdx)->(groupArr+srcGroupIdx), (chromosomes+destChromosomeIdx)->(groupArr+destGroupIdx)->groupLen, (chromosomes+destChromosomeIdx)->(groupArr+destGroupIdx)->groupVal); // tmp to dest FreeGroup((chromosomes+destChromosomeIdx)->(groupArr+destGroupIdx)); AllocateGroup((chromosomes+destChromosomeIdx)->(groupArr+destGroupIdx), tempGroup.groupLen, tempGroup.groupVal); return; } void Population::PrintPopulation(FILE *out) { if (out==NULL) { strcpy(errorMsg,"No output stream to print Population"); err_exit(); } for(int j=0;j<N;j++){ fprintf(out,"\nChromosome: %d\n",j); PrintChromosome(chromosomes+j,out); } } return; } int Population::GetBestChromosomeID() { double topFitnessValue = EvaluateChromosome(0); int topFitnessIdx = 0; for(int i=1;i<N) if(EvaluateChromosome(i)<topFitnessValue) { topFitnessValue = EvaluateChromosome(i); topFitnessIdx = i; } return topFitnessIdx; } bool Population::Initialize(GGAParams *ggaParams) { char filename[200]; // set the fitness function to be optimized SetFitness(ggaParams->fitnessNumber); // initialize fitness InitializeFitness(ggaParams); // initialize metric InitializeMetric(ggaParams); // reset the counter for fitness calls ResetFitnessCalls(); // set random seed SetSeed(ggaParams->randSeed); // initialize statistics IntializeBasicStatistics(&populationStatistics,ggaParams); // open output files (if the base of the output file names specified) if (ggaParams->outputFilename) { sprintf(filename,"%s.log",ggaParams->outputFilename); logFile = fopen(filename,"w"); sprintf(filename,"%s.fitness",ggaParams->outputFilename); fitnessFile = fopen(filename,"w"); sprintf(filename,"%s.model",ggaParams->outputFilename); modelFile = fopen(filename,"w"); } else logFile = fitnessFile = modelFile = NULL; return true; }
25.321285
210
0.677082
wahibium
78421c856c1997c84be13066b1fda4f0d9876eac
5,268
hpp
C++
modules/test/benchmark/include/nt2/sdk/bench/details/process_functor.hpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
34
2017-05-19T18:10:17.000Z
2022-01-04T02:18:13.000Z
modules/test/benchmark/include/nt2/sdk/bench/details/process_functor.hpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
null
null
null
modules/test/benchmark/include/nt2/sdk/bench/details/process_functor.hpp
psiha/nt2
5e829807f6b57b339ca1be918a6b60a2507c54d0
[ "BSL-1.0" ]
7
2017-12-02T12:59:17.000Z
2021-07-31T12:46:14.000Z
#ifndef BOOST_PP_IS_ITERATING //============================================================================== // Copyright 2003 - 2012 LASMEA UMR 6602 CNRS/Univ. Clermont II // Copyright 2009 - 2012 LRI UMR 8623 CNRS/Univ Paris Sud XI // Copyright 2012 MetaScale SAS // Copyright 2012 Domagoj Saric, Little Endian Ltd. // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt //============================================================================== #ifndef NM4_SDK_BENCH_WORKBENCH_PROCESS_FUCNTOR_HPP_INCLUDED #define NM4_SDK_BENCH_WORKBENCH_PROCESS_FUCNTOR_HPP_INCLUDED #include <nt2/sdk/bench/benchmark.hpp> #include <nt2/sdk/unit/details/prng.hpp> #include <nt2/sdk/meta/scalar_of.hpp> #include <boost/simd/memory/allocator.hpp> #include <boost/dispatch/functor/preprocessor/dispatch.hpp> #include <boost/dispatch/meta/strip.hpp> #include <nt2/include/functions/aligned_load.hpp> #include <nt2/include/functions/aligned_store.hpp> #include <boost/fusion/include/at_c.hpp> #include <vector> #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_binary_params.hpp> #include <boost/preprocessor/punctuation/comma_if.hpp> #include <boost/preprocessor/repetition/repeat.hpp> #include <boost/preprocessor/iteration/iterate.hpp> #include <boost/preprocessor/repetition/enum.hpp> namespace nt2 { namespace details { /* process_functor is an Experiment used to bench arbitrary functor */ template< typename Function, std::size_t Arity , typename Arg0 , typename Arg1 = void, typename Arg2 = void , typename Arg3 = void, typename Arg4 = void, typename Arg5 = void > struct process_functor; #define BOOST_PP_ITERATION_PARAMS_1 (3,(1,6,"nt2/sdk/bench/details/process_functor.hpp")) #include BOOST_PP_ITERATE() template< typename Function, std::size_t Arity , typename Arg0, typename Arg1, typename Arg2 , typename Arg3, typename Arg4, typename Arg5 > std::ostream& operator<<( std::ostream& os , process_functor < Function,Arity , Arg0, Arg1, Arg2, Arg3, Arg4, Arg5 > const& p ) { return os << "(" << p.size() << ")"; } } } #endif #else #define N BOOST_PP_ITERATION() #define M0(z,n,t) \ typedef typename boost::dispatch::meta::scalar_of<Arg##n>::type type_##n; \ typedef boost::simd::allocator<type_##n> alloc_##n; \ /**/ #define M1(z,n,t) \ (boost::simd::meta::cardinal_of<Arg##n>::value != 1) \ ? boost::simd::meta::cardinal_of<Arg##n>::value \ : \ /**/ #define M2(z,n,t) in##n(size_) #define M3(z,n,t) nt2::roll ( in##n \ , boost::fusion::at_c<n+1>(args).first \ , boost::fusion::at_c<n+1>(args).second \ ); \ /**/ \ #define M4(z,n,t) nt2::aligned_load<Arg##n>(&in##n[i]) #define M5(z,n,t) std::vector<type_##n,alloc_##n> in##n; template< typename Function,BOOST_PP_ENUM_PARAMS(N,typename Arg)> struct process_functor<Function,N,BOOST_PP_ENUM_PARAMS(N,Arg)> { typedef void experiment_is_immutable; // Computes scalar version of Args so we know what to store in in_i BOOST_PP_REPEAT(N,M0,~) // Result type typedef typename boost::dispatch::meta:: strip< typename boost::dispatch::meta:: result_of<Function(BOOST_PP_ENUM_PARAMS(N,Arg))>::type >::type out_t; typedef boost::simd::allocator<out_t> alloc_out; // How many stuff to process static const std::size_t card = BOOST_PP_REPEAT(N, M1, ~) 1; template<typename Args> process_functor ( Args const& args ) : size_(boost::fusion::at_c<0>(args)) , result_(size_/card) , BOOST_PP_ENUM(N,M2,~) { BOOST_PP_REPEAT(N,M3,~) } void operator()() { for(std::size_t i=0, j=0;i<size_;i+=card, j++) result_[j] = f_( BOOST_PP_ENUM( N, M4, ~) ); } std::size_t size() const { return size_; } friend std::ostream& operator<<( std::ostream& os , process_functor<Function,N,BOOST_PP_ENUM_PARAMS(N,Arg)> const& p ) { return os << p.size_; } private: Function f_; std::size_t size_; std::vector<out_t, alloc_out> result_; BOOST_PP_REPEAT(N,M5,~) }; #undef N #undef M0 #undef M1 #undef M2 #undef M3 #undef M4 #undef M5 #endif
35.594595
91
0.539484
psiha
7842e64ca96a35bafaf7e3aa1332c81ad4630528
9,113
hpp
C++
src/Client/Connector.hpp
Korablev77/tntcxx
30f7bcd661dd701c1f084b188b43e72b72c391d8
[ "BSD-2-Clause" ]
null
null
null
src/Client/Connector.hpp
Korablev77/tntcxx
30f7bcd661dd701c1f084b188b43e72b72c391d8
[ "BSD-2-Clause" ]
null
null
null
src/Client/Connector.hpp
Korablev77/tntcxx
30f7bcd661dd701c1f084b188b43e72b72c391d8
[ "BSD-2-Clause" ]
null
null
null
#pragma once /* * Copyright 2010-2020, Tarantool AUTHORS, please see AUTHORS file. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``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 * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "Connection.hpp" #include "NetworkEngine.hpp" #include "../Utils/Timer.hpp" #include <set> /** * MacOS does not have epoll so let's use Libev as default network provider. */ #ifdef __linux__ #include "EpollNetProvider.hpp" template<class BUFFER> using DefaultNetProvider = EpollNetProvider<BUFFER, NetworkEngine>; #else #include "LibevNetProvider.hpp" template<class BUFFER> using DefaultNetProvider = LibevNetProvider<BUFFER, NetworkEngine>; #endif template<class BUFFER, class NetProvider = DefaultNetProvider<BUFFER>> class Connector { public: Connector(); ~Connector(); Connector(const Connector& connector) = delete; Connector& operator = (const Connector& connector) = delete; //////////////////////////////Main API////////////////////////////////// int connect(Connection<BUFFER, NetProvider> &conn, const std::string_view& addr, unsigned port, size_t timeout = DEFAULT_CONNECT_TIMEOUT); int wait(Connection<BUFFER, NetProvider> &conn, rid_t future, int timeout = 0, Response<BUFFER> *result = nullptr); int waitAll(Connection<BUFFER, NetProvider> &conn, const std::vector<rid_t > &futures, int timeout = 0); int waitCount(Connection<BUFFER, NetProvider> &conn, size_t feature_count, int timeout = 0); ////////////////////////////Service interfaces////////////////////////// std::optional<Connection<BUFFER, NetProvider>> waitAny(int timeout = 0); void readyToDecode(const Connection<BUFFER, NetProvider> &conn); void readyToSend(const Connection<BUFFER, NetProvider> &conn); void finishSend(const Connection<BUFFER, NetProvider> &conn); std::set<Connection<BUFFER, NetProvider>> m_ReadyToSend; void close(int socket); void close(Connection<BUFFER, NetProvider> &conn); private: //Timeout of Connector::connect() method. constexpr static size_t DEFAULT_CONNECT_TIMEOUT = 2; NetProvider m_NetProvider; std::set<Connection<BUFFER, NetProvider>> m_ReadyToDecode; }; template<class BUFFER, class NetProvider> Connector<BUFFER, NetProvider>::Connector() : m_NetProvider(*this) { } template<class BUFFER, class NetProvider> Connector<BUFFER, NetProvider>::~Connector() { } template<class BUFFER, class NetProvider> int Connector<BUFFER, NetProvider>::connect(Connection<BUFFER, NetProvider> &conn, const std::string_view& addr, unsigned port, size_t timeout) { //Make sure that connection is not yet established. assert(conn.getSocket() < 0); if (m_NetProvider.connect(conn, addr, port, timeout) != 0) { LOG_ERROR("Failed to connect to ", addr, ':', port); return -1; } LOG_DEBUG("Connection to ", addr, ':', port, " has been established"); return 0; } template<class BUFFER, class NetProvider> void Connector<BUFFER, NetProvider>::close(int socket) { m_NetProvider.close(socket); } template<class BUFFER, class NetProvider> void Connector<BUFFER, NetProvider>::close(Connection<BUFFER, NetProvider> &conn) { assert(conn.getSocket() >= 0); m_NetProvider.close(conn.getSocket()); conn.setSocket(-1); } template<class BUFFER, class NetProvider> int connectionDecodeResponses(Connection<BUFFER, NetProvider> &conn, Response<BUFFER> *result) { while (hasDataToDecode(conn)) { DecodeStatus rc = processResponse(conn, result); if (rc == DECODE_ERR) return -1; //In case we've received only a part of response //we should wait until the rest arrives - otherwise //we can't properly decode response. */ if (rc == DECODE_NEEDMORE) return 0; assert(rc == DECODE_SUCC); } return 0; } template<class BUFFER, class NetProvider> int Connector<BUFFER, NetProvider>::wait(Connection<BUFFER, NetProvider> &conn, rid_t future, int timeout, Response<BUFFER> *result) { LOG_DEBUG("Waiting for the future ", future, " with timeout ", timeout); Timer timer{timeout}; timer.start(); if (connectionDecodeResponses(conn, result) != 0) return -1; while (! conn.futureIsReady(future) && !timer.isExpired()) { if (m_NetProvider.wait(timeout - timer.elapsed()) != 0) { conn.setError("Failed to poll: " + std::to_string(errno)); return -1; } if (hasDataToDecode(conn)) { assert(m_ReadyToDecode.find(conn) != m_ReadyToDecode.end()); if (connectionDecodeResponses(conn, result) != 0) return -1; /* * In case we've handled whole data in input buffer - * mark connection as completed. */ if (!hasDataToDecode(conn)) m_ReadyToDecode.erase(conn); } } if (! conn.futureIsReady(future)) { LOG_ERROR("Connection has been timed out: future ", future, " is not ready"); return -1; } LOG_DEBUG("Feature ", future, " is ready and decoded"); return 0; } template<class BUFFER, class NetProvider> int Connector<BUFFER, NetProvider>::waitAll(Connection<BUFFER, NetProvider> &conn, const std::vector<rid_t> &futures, int timeout) { Timer timer{timeout}; timer.start(); size_t last_not_ready = 0; while (!timer.isExpired()) { if (m_NetProvider.wait(timeout - timer.elapsed()) != 0) { conn.setError("Failed to poll: " + std::to_string(errno)); return -1; } if (hasDataToDecode(conn)) { assert(m_ReadyToDecode.find(conn) != m_ReadyToDecode.end()); if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0) return -1; if (!hasDataToDecode(conn)) m_ReadyToDecode.erase(conn); } bool finish = true; for (size_t i = last_not_ready; i < futures.size(); ++i) { if (!conn.futureIsReady(futures[i])) { finish = false; last_not_ready = i; break; } } if (finish) return 0; } LOG_ERROR("Connection has been timed out: not all futures are ready"); return -1; } template<class BUFFER, class NetProvider> std::optional<Connection<BUFFER, NetProvider>> Connector<BUFFER, NetProvider>::waitAny(int timeout) { Timer timer{timeout}; timer.start(); while (m_ReadyToDecode.empty() && !timer.isExpired()) m_NetProvider.wait(timeout - timer.elapsed()); if (m_ReadyToDecode.empty()) { LOG_ERROR("wait() has been timed out! No responses are received"); return std::nullopt; } Connection<BUFFER, NetProvider> conn = *m_ReadyToDecode.begin(); assert(hasDataToDecode(conn)); if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0) return std::nullopt; if (!hasDataToDecode(conn)) m_ReadyToDecode.erase(conn); return conn; } template<class BUFFER, class NetProvider> int Connector<BUFFER, NetProvider>::waitCount(Connection<BUFFER, NetProvider> &conn, size_t future_count, int timeout) { Timer timer{timeout}; timer.start(); size_t ready_futures = conn.getFutureCount(); while (!timer.isExpired()) { if (m_NetProvider.wait(timeout - timer.elapsed()) != 0) { conn.setError("Failed to poll: " + std::to_string(errno)); return -1; } if (hasDataToDecode(conn)) { assert(m_ReadyToDecode.find(conn) != m_ReadyToDecode.end()); if (connectionDecodeResponses(conn, static_cast<Response<BUFFER>*>(nullptr)) != 0) return -1; if (!hasDataToDecode(conn)) m_ReadyToDecode.erase(conn); } if ((conn.getFutureCount() - ready_futures) >= future_count) return 0; } LOG_ERROR("Connection has been timed out: only ", conn.getFutureCount() - ready_futures, " are ready"); return -1; } template<class BUFFER, class NetProvider> void Connector<BUFFER, NetProvider>::readyToSend(const Connection<BUFFER, NetProvider> &conn) { m_ReadyToSend.insert(conn); } template<class BUFFER, class NetProvider> void Connector<BUFFER, NetProvider>::readyToDecode(const Connection<BUFFER, NetProvider> &conn) { m_ReadyToDecode.insert(conn); } template<class BUFFER, class NetProvider> void Connector<BUFFER, NetProvider>::finishSend(const Connection<BUFFER, NetProvider> &conn) { m_ReadyToSend.erase(conn); }
31.532872
90
0.7159
Korablev77
784417a513ee0af7b57051e15a48b9eeae3e4ba7
11,519
cpp
C++
CS2810/MidSem/CS19B021_midsem.cpp
vikram-kv/CS2810-LabWork
1190c14d08d0aa1e8143df338766a6d075c47182
[ "Apache-2.0" ]
null
null
null
CS2810/MidSem/CS19B021_midsem.cpp
vikram-kv/CS2810-LabWork
1190c14d08d0aa1e8143df338766a6d075c47182
[ "Apache-2.0" ]
null
null
null
CS2810/MidSem/CS19B021_midsem.cpp
vikram-kv/CS2810-LabWork
1190c14d08d0aa1e8143df338766a6d075c47182
[ "Apache-2.0" ]
null
null
null
/************************ * $ID$ * File: CS19B021_midsem.cpp - create a class Refrigerator with a few data members, define a comparison operator on it, * perform a O(nlogn) sort on a Refrigerator array and find the "newVariance" of the sorted * refrigerator array. * * Purpose: We create a class with attributes - integers: model number, price and capacity; real numbers: energy rating and customer * rating. We define some member functions of Refrigerator. Now, '<' operator is overloaded to apply to this class. We * say, for fridges a and b, a < b iff one of the following conditions apply: 1) b has higher energy rating than a <or> 2) a * and b have the same energy rating but b has higher customer rating than a <or> 3) a and b have equal energy and customer ratings * but b has lower price/capacity ratio than a. We then define a mergesort procedure on an array of Refrigerators using '<' operator * to sort the array in descending order. Finally, we define a function to find "newVariance" = average of squares of deviations * of model numbers of array entries from median's(floor(N/2)th element) model number. * * Author: K V VIKRAM * * Created: [2021-03-15 14:23] by vikram * * Last Modified: [2021-03-15 21:35] by vikram * * Input Format: * Line 1: number N that will represent number of Refrigerators * Next N lines will contain the records in the order(model number, price, capacity, energy rating, consumer rating). * * Constraints: * 0 <= N <= 100 * The maximum value of any entry will be 200000 * * Output Format: * Line 1: model numbers of sorted array of refrigerators separated by ' ' * Line 2: ceil(newVariance) * * Practice: Array iterators in loops are typically named i or j. Sort implicitly means "sort in descending order" anywhere in the code. * * Compilation: g++ CS19B021_midsem.cpp -o solution, ./solution. * * Bugs: No major bugfixes or new releases *************/ #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; /* Begin {Definition of class Refrigerator} */ /* Refrigerator - defines a class Refrigerator with attributes as in documentation and a few member functions Data Members - modelNo(int), price(int), capacity(int), eRating(float) and cRating(float) public accessors - retModelNo() public mutators - getDetails() constructor - Default: Refrigerator() friend operator - operator <() */ class Refrigerator { int modelNo; //model number int price; //price int capacity; //capacity float eRating; //energy rating float cRating; //customer rating public: Refrigerator(); //default constructor - sets all data members to illegal values void getDetails(); //gets all data members from stdin int retModelNo(); //returns the model number friend bool operator<(const Refrigerator&,const Refrigerator&); //friend operator '<' overloaded to apply to this class }; /* End {Definition of class Refrigerator} */ /* Prototypes of Other Functions */ void Merge(Refrigerator*,Refrigerator*,size_t,size_t,size_t); //merge routine in mergesort procedure void MergeSortRange(Refrigerator*,Refrigerator*,size_t,size_t); //performs mergesort on given range of array elements void MergeSort(Refrigerator*,size_t); //wrapper function of MergeSortRange. does mergesort on whole array float ComputeNewVariance(Refrigerator*,size_t); //computes newVariance bool operator<(const Refrigerator&,const Refrigerator&); //defines a '<' ordering on class of Refrigerators /* Begin {Implementation of class Refrigerator} */ /* Refrigerator() - constructor to set all data members to illegal values(-1 in case of integer fields and -1.0 otherwise) ARGS - void */ Refrigerator::Refrigerator() { modelNo = price = capacity = -1; eRating = cRating = -1.0; } /* getDetails() - gets all data members from stdin. order of input is acc. to input format ARGS - void RET - void */ void Refrigerator::getDetails() { cin >> modelNo >> price >> capacity; cin >> eRating >> cRating; } /* retModelNo() - returns modelNo(model number) ARGS - void RET - int */ int Refrigerator::retModelNo() { return modelNo; } /* End {Implementation of class Refrigerator} */ /* operator<() - relational operator on Refrigerator class. We say a < b when a,b satisfy one of the conditions in documentation. ARGS - const Refrigerator& a and const Refrigerator& b RET - bool */ bool operator<(const Refrigerator& a,const Refrigerator& b) { if(a.eRating < b.eRating) //condition 1 for a < b return true; else if(a.eRating > b.eRating) return false; else { if(a.cRating < b.cRating) //condition 2 for a < b return true; else if(a.cRating > b.cRating) return false; else { if(((float)a.price)/a.capacity > ((float)b.price)/b.capacity) //condition 3 for a < b return true; else return false; } } } /* Merge() - merges the sorted segments arr[bIndex..mIndex] (left) and arr[mIndex+1..eIndex] (right) into a single sorted arr[bIndex..eIndex]. ARG - Refrigerator* arr, Refrigerator* tempArr, size_t bIndex,size_t mIndex, size_t eIndex RET - void */ void Merge(Refrigerator* arr,Refrigerator* tempArr,size_t bIndex,size_t mIndex,size_t eIndex) { size_t leftPtr = bIndex; //ptr to left portion of arr size_t rightPtr = mIndex + 1; //ptr to right portion of arr size_t tempPtr = bIndex; //ptr to tempArr while(leftPtr <= mIndex && rightPtr <= eIndex) //while both left and right portions are not exhausted { if(arr[leftPtr] < arr[rightPtr]) //if current element in left is smaller than that of right { tempArr[tempPtr++] = arr[rightPtr++]; //current element of right is inserted in tempArr } else { tempArr[tempPtr++] = arr[leftPtr++]; //current element of left is inserted in tempArr } } while(leftPtr <= mIndex) //remaining elements of left(if any) are put into tempArr tempArr[tempPtr++] = arr[leftPtr++]; while(rightPtr <= eIndex) //remaining elements of right(if any) are put into tempArr tempArr[tempPtr++] = arr[rightPtr++]; for(size_t i = bIndex;i<=eIndex;i++) //tempArr[bIndex..eIndex] is copied into arr[bIndex..eIndex] { arr[i] = tempArr[i]; } return ; } /* MergeSortRange() - Sorts arr[bIndex..eIndex]. Uses tempArr as an auxiliary array to pass to Merge() function. It divides arr[bIndex..eIndex] into two segments, arr[bIndex..mIndex](left) and arr[mIndex+1..eIndex](right) where mIndex = int avg of bIndex and eIndex. It then sorts the two segments. Now, in the conquering phase, the function Merge() merges left and right into a single sorted portion arr[bIndex..eIndex]. ARG - Refrigerator* arr, Refrigerator* tempArr, size_t bIndex, size_t eIndex RET - void */ void MergeSortRange(Refrigerator* arr,Refrigerator* tempArr,size_t bIndex,size_t eIndex) { if(bIndex==eIndex) //termination criteria. array of size 1 is sorted return ; else { size_t mIndex = (bIndex+eIndex)/2; //mIndex is computed MergeSortRange(arr,tempArr,bIndex,mIndex); //left is sorted MergeSortRange(arr,tempArr,mIndex+1,eIndex); //right is sorted Merge(arr,tempArr,bIndex,mIndex,eIndex); //left and right are merged return; } } /* MergeSort() - Sorts arr completely. Creates an auxiliary array to facilitate merging and then calls MergeSortRange() to do this. ARG - Refrigerator* arr, size_t arrSize RET - void */ void MergeSort(Refrigerator* arr,size_t arrSize) { Refrigerator* tempArr = new Refrigerator[arrSize]{}; //aux array for merging purpose MergeSortRange(arr,tempArr,0,arrSize-1); //arr is sorted delete[] tempArr; //aux array is deleted return ; } /* ComputeNewVariance() - Computes newVariance(as in documentation) of a sorted array arr of size arrSize. ARG - Refrigerator* arr, size_t arrSize RET - float */ float ComputeNewVariance(Refrigerator* arr,size_t arrSize) { int medPos = arrSize/2; //median's index int medModelNo = arr[medPos].retModelNo(); //median's model number int sumSqrDeviation = 0; //sum of squares of deviations of model numbers from medModelNo int difference; //deviation of current(in loop) model no from median model no for(size_t i = 0;i<arrSize;i++) { difference = (arr[i].retModelNo()-medModelNo); //current element's deviation is computed sumSqrDeviation += difference*difference; //sumSqrDeviation is updated } float retValue = ((float)sumSqrDeviation/arrSize); //newVariance is found and returned return retValue; } int main() { Refrigerator* fridgeArr; //array to store inputted refrigerators size_t noOfModels; //number of models of refrigerators float newVariance; //var to store newVariance //Stmts to get INPUT cin >> noOfModels; //number of models is obtained fridgeArr = new Refrigerator[noOfModels]{}; //required space for fridgeArr is allocated for(size_t i=0;i<noOfModels;i++) //values of attributes of every fridge is obtained fridgeArr[i].getDetails(); //Stmts to perform computations MergeSort(fridgeArr,noOfModels); //fridgeArr is sorted newVariance = ComputeNewVariance(fridgeArr,noOfModels); //newVariance is computed //Stmts to display OUTPUT for(size_t i=0;i<noOfModels;i++) //model mumbers of sorted fridgeArr is printed cout << fridgeArr[i].retModelNo() << ' '; cout << endl; cout << ceil(newVariance) << endl; //ceil(newVariance) is displayed delete[] fridgeArr; //frees space used by fridgeArr return 0; }
47.209016
153
0.589114
vikram-kv
7844e517a6ab6ce912680324fb25bde0f640cf10
8,103
cpp
C++
tests/validation/NEON/GEMM.cpp
odinshen/ComputeLibrary_17.9_BareMetal
3ee4553b4cdbbfec09e9ddeb57f3d7b2f4f31c80
[ "MIT" ]
2
2021-08-02T16:34:11.000Z
2021-11-17T11:00:33.000Z
tests/validation/NEON/GEMM.cpp
10imaging/ComputeLibrary
e6bbd2b302eb9d229554ec3a02ceb20901459d8c
[ "MIT" ]
null
null
null
tests/validation/NEON/GEMM.cpp
10imaging/ComputeLibrary
e6bbd2b302eb9d229554ec3a02ceb20901459d8c
[ "MIT" ]
null
null
null
/* * Copyright (c) 2017 ARM Limited. * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "arm_compute/core/Types.h" #include "arm_compute/runtime/NEON/functions/NEGEMM.h" #include "arm_compute/runtime/Tensor.h" #include "arm_compute/runtime/TensorAllocator.h" #include "tests/NEON/Accessor.h" #include "tests/PaddingCalculator.h" #include "tests/datasets/LargeGEMMDataset.h" #include "tests/datasets/SmallGEMMDataset.h" #include "tests/framework/Asserts.h" #include "tests/framework/Macros.h" #include "tests/framework/datasets/Datasets.h" #include "tests/validation/Validation.h" #include "tests/validation/fixtures/GEMMFixture.h" namespace arm_compute { namespace test { namespace validation { namespace { constexpr AbsoluteTolerance<float> tolerance_f(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */ constexpr AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */ /** CNN data types */ const auto CNNDataTypes = framework::dataset::make("DataType", { #ifdef ARM_COMPUTE_ENABLE_FP16 DataType::F16, #endif /* ARM_COMPUTE_ENABLE_FP16 */ DataType::F32, DataType::QS8, DataType::QS16, }); } // namespace TEST_SUITE(NEON) TEST_SUITE(GEMM) DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(framework::dataset::concat(datasets::SmallGEMMDataset(), datasets::LargeGEMMDataset()), CNNDataTypes), shape_a, shape_b, shape_c, output_shape, alpha, beta, data_type) { // Set fixed point position data type allowed const int fixed_point_position = is_data_type_fixed_point(data_type) ? 3 : 0; // Create tensors Tensor a = create_tensor<Tensor>(shape_a, data_type, 1, fixed_point_position); Tensor b = create_tensor<Tensor>(shape_b, data_type, 1, fixed_point_position); Tensor c = create_tensor<Tensor>(shape_c, data_type, 1, fixed_point_position); Tensor dst = create_tensor<Tensor>(output_shape, data_type, 1, fixed_point_position); ARM_COMPUTE_EXPECT(a.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(b.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(c.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function NEGEMM gemm; gemm.configure(&a, &b, &c, &dst, alpha, beta); } template <typename T> using NEGEMMFixture = GEMMValidationFixture<Tensor, Accessor, NEGEMM, T>; TEST_SUITE(Float) #ifdef ARM_COMPUTE_ENABLE_FP16 TEST_SUITE(FP16) FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixture<half>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F16))) { // Validate output validate(Accessor(_target), _reference, tolerance_f); } FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixture<half>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::F16))) { // Validate output validate(Accessor(_target), _reference, tolerance_f); } TEST_SUITE_END() #endif /* ARM_COMPUTE_ENABLE_FP16 */ TEST_SUITE(FP32) FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixture<float>, framework::DatasetMode::PRECOMMIT, combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::F32))) { // Validate output validate(Accessor(_target), _reference, tolerance_f); } FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::F32))) { // Validate output validate(Accessor(_target), _reference, tolerance_f); } TEST_SUITE_END() TEST_SUITE_END() template <typename T> using NEGEMMFixedPointFixture = GEMMValidationFixedPointFixture<Tensor, Accessor, NEGEMM, T>; TEST_SUITE(Quantized) TEST_SUITE(QS8) FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixedPointFixture<int8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FractionalBits", 1, 7))) { // Validate output validate(Accessor(_target), _reference, tolerance_q); } FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixedPointFixture<int8_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::QS8)), framework::dataset::make("FractionalBits", 1, 7))) { // Validate output validate(Accessor(_target), _reference, tolerance_q); } TEST_SUITE_END() TEST_SUITE(QS16) FIXTURE_DATA_TEST_CASE(RunSmall, NEGEMMFixedPointFixture<int16_t>, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::SmallGEMMDataset(), framework::dataset::make("DataType", DataType::QS16)), framework::dataset::make("FractionalBits", 1, 14))) { // Validate output validate(Accessor(_target), _reference, tolerance_q); } FIXTURE_DATA_TEST_CASE(RunLarge, NEGEMMFixedPointFixture<int16_t>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::QS16)), framework::dataset::make("FractionalBits", 1, 14))) { // Validate output validate(Accessor(_target), _reference, tolerance_q); } TEST_SUITE_END() TEST_SUITE_END() TEST_SUITE_END() TEST_SUITE_END() } // namespace validation } // namespace test } // namespace arm_compute
48.232143
181
0.623473
odinshen
7845eb7b94745385e868b7113deb7ed2b006dfdc
14,385
cpp
C++
Source/AllProjects/CQCIntf/CQCIntfView/CQCIntfView_ExtCtrlServerImpl.cpp
MarkStega/CQC
c1d0e01ec2abcaa5b8eb1899b9f0522fecee4b07
[ "MIT" ]
51
2020-12-26T18:17:16.000Z
2022-03-15T04:29:35.000Z
Source/AllProjects/CQCIntf/CQCIntfView/CQCIntfView_ExtCtrlServerImpl.cpp
MarkStega/CQC
c1d0e01ec2abcaa5b8eb1899b9f0522fecee4b07
[ "MIT" ]
null
null
null
Source/AllProjects/CQCIntf/CQCIntfView/CQCIntfView_ExtCtrlServerImpl.cpp
MarkStega/CQC
c1d0e01ec2abcaa5b8eb1899b9f0522fecee4b07
[ "MIT" ]
4
2020-12-28T07:24:39.000Z
2021-12-29T12:09:37.000Z
// // FILE NAME: CQCIntfView_ExtCtrlServerImpl.cpp // // AUTHOR: Dean Roddey // // CREATED: 07/01/2004 // // COPYRIGHT: Charmed Quark Systems, Ltd @ 2020 // // This software is copyrighted by 'Charmed Quark Systems, Ltd' and // the author (Dean Roddey.) It is licensed under the MIT Open Source // license: // // https://opensource.org/licenses/MIT // // DESCRIPTION: // // The // // CAVEATS/GOTCHAS: // // LOG: // // $Log$ // // --------------------------------------------------------------------------- // Includes // --------------------------------------------------------------------------- #include "CQCIntfView.hpp" // --------------------------------------------------------------------------- // Magic macros // --------------------------------------------------------------------------- RTTIDecls(TIntfCtrlServer,TIntfCtrlServerBase) RTTIDecls(TIntfCtrlEv,TObject) RTTIDecls(TIntfCtrlExtKeyEv,TIntfCtrlEv) RTTIDecls(TIntfCtrlFrameOp,TIntfCtrlEv) RTTIDecls(TIntfCtrlLoadEv,TIntfCtrlEv) RTTIDecls(TIntfCtrlMiscEv,TIntfCtrlEv) RTTIDecls(TIntfCtrlSetVarEv,TIntfCtrlEv) // --------------------------------------------------------------------------- // CLASS: TIntfCtrlEv // PREFIX: aue // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlEv: Destructor // --------------------------------------------------------------------------- TIntfCtrlEv::~TIntfCtrlEv() { } // --------------------------------------------------------------------------- // TIntfCtrlEv: Hidden constructors // --------------------------------------------------------------------------- TIntfCtrlEv::TIntfCtrlEv() { } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlExtKeyEv // PREFIX: aue // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlExtKeyEv: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlExtKeyEv::TIntfCtrlExtKeyEv(const tCIDCtrls::EExtKeys eToSend , const tCIDLib::TBoolean bAltShift , const tCIDLib::TBoolean bCtrlShift , const tCIDLib::TBoolean bShift) : TIntfCtrlEv() , m_bAltShift(bAltShift) , m_bCtrlShift(bCtrlShift) , m_bShift(bShift) , m_eToSend(eToSend) { } TIntfCtrlExtKeyEv::~TIntfCtrlExtKeyEv() { } // --------------------------------------------------------------------------- // TIntfCtrlExtKeyEv: Public, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlExtKeyEv::ProcessEv(TMainFrameWnd& wndMainFrame) { // Make sure this guy is the foreground window wndMainFrame.ForceToFront(); if (facCQCIntfView.bLogInfo()) { facCQCIntfView.LogMsg ( CID_FILE , CID_LINE , L"Sending a remote ctrl key event" , tCIDLib::ESeverities::Info , tCIDLib::EErrClasses::AppStatus ); } // And send the key stroke facCIDCtrls().SendExtKey(m_eToSend, m_bAltShift, m_bCtrlShift, m_bShift); } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlFrameOp // PREFIX: ice // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlFrameOp: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlFrameOp::TIntfCtrlFrameOp(const tCQCKit::EIVFrmOps eOp) : TIntfCtrlEv() , m_eOp(eOp) { } TIntfCtrlFrameOp::~TIntfCtrlFrameOp() { } // --------------------------------------------------------------------------- // TIntfCtrlFrameOp: Public, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlFrameOp::ProcessEv(TMainFrameWnd& wndMainFrame) { switch(m_eOp) { case tCQCKit::EIVFrmOps::FSMode : // If not alreayd in full screen mode, then do it if (!facCQCIntfView.bFullScreen()) { wndMainFrame.StartFSMode(); wndMainFrame.ForceToFront(); } break; case tCQCKit::EIVFrmOps::Hide : wndMainFrame.SetVisibility(kCIDLib::False); break; case tCQCKit::EIVFrmOps::Maximize : wndMainFrame.Maximize(); break; case tCQCKit::EIVFrmOps::Minimize : wndMainFrame.Minimize(); break; case tCQCKit::EIVFrmOps::Restore : // If in fulls creen, exit that, else do a regular restore if (facCQCIntfView.bFullScreen()) wndMainFrame.EndFSMode(); else wndMainFrame.Restore(); break; case tCQCKit::EIVFrmOps::Show : wndMainFrame.SetVisibility(kCIDLib::True); break; case tCQCKit::EIVFrmOps::ToBack : wndMainFrame.ToBottom(); break; case tCQCKit::EIVFrmOps::ToFront: wndMainFrame.ForceToFront(); break; }; } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlLoadEv // PREFIX: ice // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlLoadEv: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlLoadEv::TIntfCtrlLoadEv(const TString& strTemplate) : TIntfCtrlEv() , m_bOverlay(kCIDLib::False) , m_strTemplate(strTemplate) { } TIntfCtrlLoadEv::TIntfCtrlLoadEv(const TString& strOvrName , const TString& strTemplate) : TIntfCtrlEv() , m_bOverlay(kCIDLib::True) , m_strOvrName(strOvrName) , m_strTemplate(strTemplate) { } TIntfCtrlLoadEv::~TIntfCtrlLoadEv() { } // --------------------------------------------------------------------------- // TIntfCtrlLoadEv: Public, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlLoadEv::ProcessEv(TMainFrameWnd& wndMainFrame) { wndMainFrame.DoRemLoadOp(m_bOverlay, m_strOvrName, m_strTemplate); } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlMiscEv // PREFIX: ice // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlMiscEv: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlMiscEv::TIntfCtrlMiscEv(const tCQCKit::EIVMiscOps eOp) : TIntfCtrlEv() , m_eOp(eOp) { } TIntfCtrlMiscEv::~TIntfCtrlMiscEv() { } // --------------------------------------------------------------------------- // TIntfCtrlMiscEv: Public, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlMiscEv::ProcessEv(TMainFrameWnd& wndMainFrame) { wndMainFrame.DoRemMiscOp(m_eOp); } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlSetVarEv // PREFIX: ice // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlSetVarEv: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlSetVarEv::TIntfCtrlSetVarEv(const TString& strVarName , const TString& strValue) : TIntfCtrlEv() , m_strVarName(strVarName) , m_strValue(strValue) { } TIntfCtrlSetVarEv::~TIntfCtrlSetVarEv() { } // --------------------------------------------------------------------------- // TIntfCtrlSetVarEv: Public, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlSetVarEv::ProcessEv(TMainFrameWnd& wndMainFrame) { wndMainFrame.SetVariable(m_strVarName, m_strValue); } // --------------------------------------------------------------------------- // CLASS: TIntfCtrlServer // PREFIX: orbs // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TIntfCtrlServer: Constructors and Destructor // --------------------------------------------------------------------------- TIntfCtrlServer::TIntfCtrlServer() : m_bMaximized(kCIDLib::False) , m_c4LayerCount(0) { } TIntfCtrlServer::~TIntfCtrlServer() { } // --------------------------------------------------------------------------- // TIntfCtrlServer: Public, inherited methods // --------------------------------------------------------------------------- // Pass it on to the facility class to queue up for processing tCIDLib::TBoolean TIntfCtrlServer::bSpeakText(const TString& strToSpeak) { return facCQCIntfView.bQueueTTS(strToSpeak); } // // We just give back the late status info that the main frame window stored // on us via the StoreStatus() method below. // tCIDLib::TCard4 TIntfCtrlServer::c4Poll(TString& strBaseTmpl , TString& strTopTmpl , tCIDLib::TBoolean& bMaximized) { // Synchronize and store the data TLocker lockrSync(&m_mtxSync); bMaximized = m_bMaximized; strBaseTmpl = m_strBaseTemplate; strTopTmpl = m_strTopTemplate; return m_c4LayerCount; } // Just add it to the viewer's queue of things to process tCIDLib::TVoid TIntfCtrlServer::DoFrameOp(const tCQCKit::EIVFrmOps eOp) { facCQCIntfView.wndMain().AddCtrlEvent(new TIntfCtrlFrameOp(eOp)); } // Just add it to the viewer's queue of things to process tCIDLib::TVoid TIntfCtrlServer::DoMiscOp(const tCQCKit::EIVMiscOps eOp) { facCQCIntfView.wndMain().AddCtrlEvent(new TIntfCtrlMiscEv(eOp)); } tCIDLib::TVoid TIntfCtrlServer::Invoke() { // Queue up an enter key event facCQCIntfView.wndMain().AddCtrlEvent ( new TIntfCtrlExtKeyEv ( tCIDCtrls::EExtKeys::Enter , kCIDLib::False , kCIDLib::False , kCIDLib::False ) ); } tCIDLib::TVoid TIntfCtrlServer::LoadOverlay(const TString& strOvrName , const TString& strToLoad) { facCQCIntfView.wndMain().AddCtrlEvent ( new TIntfCtrlLoadEv(strOvrName, strToLoad) ); } tCIDLib::TVoid TIntfCtrlServer::LoadTemplate(const TString& strToLoad) { facCQCIntfView.wndMain().AddCtrlEvent(new TIntfCtrlLoadEv(strToLoad)); } tCIDLib::TVoid TIntfCtrlServer::Navigation(const tCQCKit::EScrNavOps eOp) { // Convert from a direction to a key tCIDLib::TBoolean bShift = kCIDLib::False; tCIDCtrls::EExtKeys eKey; switch(eOp) { case tCQCKit::EScrNavOps::Down : eKey = tCIDCtrls::EExtKeys::Down; break; case tCQCKit::EScrNavOps::End : eKey = tCIDCtrls::EExtKeys::End; break; case tCQCKit::EScrNavOps::Home : eKey = tCIDCtrls::EExtKeys::Home; break; case tCQCKit::EScrNavOps::Left : eKey = tCIDCtrls::EExtKeys::Left; break; case tCQCKit::EScrNavOps::Next : eKey = tCIDCtrls::EExtKeys::Tab; break; case tCQCKit::EScrNavOps::NextPage : eKey = tCIDCtrls::EExtKeys::PageDown; break; case tCQCKit::EScrNavOps::Prev : eKey = tCIDCtrls::EExtKeys::Tab; bShift = kCIDLib::True; break; case tCQCKit::EScrNavOps::PrevPage : eKey = tCIDCtrls::EExtKeys::PageUp; break; case tCQCKit::EScrNavOps::Right : eKey = tCIDCtrls::EExtKeys::Right; break; case tCQCKit::EScrNavOps::Up : eKey = tCIDCtrls::EExtKeys::Up; break; default : return; }; // And queue up a key event for it facCQCIntfView.wndMain().AddCtrlEvent ( new TIntfCtrlExtKeyEv ( eKey, kCIDLib::False, kCIDLib::False, bShift ) ); } // // This one we can just handle here. We just queue it up to be played // and return. // tCIDLib::TVoid TIntfCtrlServer::PlayWAV(const TString& strPath) { TAudio::PlayWAVFile(strPath, tCIDLib::EWaitModes::NoWait); } // Just add it to the viewer's queue of things to process tCIDLib::TVoid TIntfCtrlServer::SetGlobalVar( const TString& strVarName , const TString& strValue) { facCQCIntfView.wndMain().AddCtrlEvent ( new TIntfCtrlSetVarEv(strVarName, strValue) ); } // --------------------------------------------------------------------------- // TIntfCtrlServer: Public, non-virtual methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlServer::StoreStatus(const TString& strBaseTmpl , const TString& strTopTmpl , const tCIDLib::TCard4 c4LayerCnt , const tCIDLib::TBoolean bMaximized) { // Synchronize and store the data TLocker lockrSync(&m_mtxSync); m_bMaximized = bMaximized; m_c4LayerCount = c4LayerCnt; m_strBaseTemplate = strBaseTmpl; m_strTopTemplate = strTopTmpl; } // --------------------------------------------------------------------------- // TIntfCtrlServer: Protected, inherited methods // --------------------------------------------------------------------------- tCIDLib::TVoid TIntfCtrlServer::Initialize() { // Nothing to do at this time } tCIDLib::TVoid TIntfCtrlServer::Terminate() { // Nothing to do at this time }
27.50478
78
0.462496
MarkStega
784a15c6ff9851c28eb8a3c2d6df5ad72c054631
11,807
hh
C++
Tests/BFieldMapTest.hh
KFTrack/KinKal
cb18132f2fe5ec74ccdc6d01eb7bdad986082083
[ "Apache-1.1" ]
2
2020-04-21T18:24:55.000Z
2020-09-24T19:01:47.000Z
Tests/BFieldMapTest.hh
KFTrack/KinKal
cb18132f2fe5ec74ccdc6d01eb7bdad986082083
[ "Apache-1.1" ]
45
2020-03-16T18:27:59.000Z
2022-01-13T05:18:35.000Z
Tests/BFieldMapTest.hh
KFTrack/KinKal
cb18132f2fe5ec74ccdc6d01eb7bdad986082083
[ "Apache-1.1" ]
15
2020-02-21T01:10:49.000Z
2022-03-24T12:13:35.000Z
// // test basic functions of BFieldMap class // #include "KinKal/Trajectory/ParticleTrajectory.hh" #include "KinKal/Trajectory/Line.hh" #include "KinKal/Trajectory/ClosestApproach.hh" #include "KinKal/General/BFieldMap.hh" #include "KinKal/General/Vectors.hh" #include "KinKal/General/PhysicalConstants.h" #include "KinKal/Tests/ToyMC.hh" #include <iostream> #include <stdio.h> #include <iostream> #include <getopt.h> #include "TFile.h" #include "TH1F.h" #include "TSystem.h" #include "THelix.h" #include "TPolyLine3D.h" #include "TAxis3D.h" #include "TCanvas.h" #include "TStyle.h" #include "TVector3.h" #include "TPolyLine3D.h" #include "TPolyMarker3D.h" #include "TLegend.h" #include "TGraph.h" #include "TRandom3.h" #include "TH2F.h" #include "TDirectory.h" using namespace KinKal; using namespace std; void print_usage() { printf("Usage: BFieldMapTest --momentum f --charge i --dBz f --dBx f --dBy f --Bgrad f --Tol f n"); } template <class KTRAJ> int BFieldMapTest(int argc, char **argv) { using PKTRAJ = ParticleTrajectory<KTRAJ>; using HIT = Hit<KTRAJ>; using HITPTR = std::shared_ptr<HIT>; using EXING = ElementXing<KTRAJ>; using EXINGPTR = std::shared_ptr<EXING>; using EXINGCOL = std::vector<EXINGPTR>; using HITCOL = std::vector<HITPTR>; double mom(105.0); int icharge(-1); int iseed(124223); double pmass(0.511); BFieldMap *BF(0); double Bgrad(0.0), dBx(0.0), dBy(0.0), dBz(0.0); double tol(0.1); double zrange(3000.0); // tracker dimension static struct option long_options[] = { {"momentum", required_argument, 0, 'm' }, {"charge", required_argument, 0, 'q' }, {"dBx", required_argument, 0, 'x' }, {"dBy", required_argument, 0, 'y' }, {"dBz", required_argument, 0, 'Z' }, {"Bgrad", required_argument, 0, 'g' }, {"Tol", required_argument, 0, 't' }, {NULL, 0,0,0} }; int opt; int long_index =0; while ((opt = getopt_long_only(argc, argv,"", long_options, &long_index )) != -1) { switch (opt) { case 'm' : mom = atof(optarg); break; case 'x' : dBx = atof(optarg); break; case 'y' : dBy = atof(optarg); break; case 'Z' : dBz = atof(optarg); break; case 'g' : Bgrad = atof(optarg); break; case 't' : tol = atof(optarg); break; case 'q' : icharge = atoi(optarg); break; default: print_usage(); exit(EXIT_FAILURE); } } VEC3 bnom(0.0,0.0,1.0); VEC3 bsim; if(Bgrad != 0){ BF = new GradientBFieldMap(1.0-0.5*Bgrad,1.0+0.5*Bgrad,-0.5*zrange,0.5*zrange); bnom = BF->fieldVect(VEC3(0.0,0.0,0.0)); } else { VEC3 bsim(dBx,dBy,1.0+dBz); BF = new UniformBFieldMap(bsim); bnom = VEC3(0.0,0.0,1.0); } // first, create a traj based on the actual field at this point KKTest::ToyMC<KTRAJ> toy(*BF, mom, icharge, zrange, iseed, 0, false, false,false, -1.0, pmass ); toy.setTolerance(tol); PKTRAJ tptraj; HITCOL thits; EXINGCOL dxings; toy.simulateParticle(tptraj, thits, dxings); // then, create a piecetraj around the nominal field with corrections, auto pos = tptraj.position4(tptraj.range().begin()); auto momv = tptraj.momentum4(pos.T()); KTRAJ start(pos,momv,icharge,bnom,tptraj.range()); PKTRAJ xptraj(start); PKTRAJ lptraj(start); // see how far I can go within tolerance TimeRange prange = start.range(); do { auto const& piece = xptraj.back(); prange.end() = BF->rangeInTolerance(piece,prange.begin(), tol); // integrate the momentum change over this range VEC3 dp = BF->integrate(piece,prange); // approximate change in position // VEC3 dpos = 0.5*dp*piece.speed(prange.mid())*prange.range()/piece.momentum4(prange.mid()); // create a new trajectory piece at this point, correcting for the momentum change pos = piece.position4(prange.end()); momv = piece.momentum4(pos.T()); // cout << "BFieldMap integral dP " << dp.R() << " dpos " << dpos.R() << " range " << prange.range() << " pos " << pos << endl; prange = TimeRange(prange.end(),std::max(prange.end()+double(0.1),xptraj.range().end())); // clumsy code to modify a vector auto mom = momv.Vect(); mom += dp; momv.SetPx(mom.X()); momv.SetPy(mom.Y()); momv.SetPz(mom.Z()); KTRAJ xnew(pos,momv,icharge,bnom,prange); // append this xptraj.append(xnew); double gap = xptraj.gap(xptraj.pieces().size()-1); if(gap > 1e-6) cout << "Apended traj gap " << gap << endl; // same thing, but using the linear parameter corrections VEC3 t1hat = lptraj.back().direction(pos.T(),MomBasis::perpdir_); VEC3 t2hat = lptraj.back().direction(pos.T(),MomBasis::phidir_); DVEC dpdt1 = lptraj.back().momDeriv(pos.T(),MomBasis::perpdir_); DVEC dpdt2 = lptraj.back().momDeriv(pos.T(),MomBasis::phidir_); auto dpfrac = dp/mom.R(); DVEC dpars = dpfrac.Dot(t1hat)*dpdt1 + dpfrac.Dot(t2hat)*dpdt2; KTRAJ lnew = lptraj.back(); lnew.params() += dpars; lnew.setRange(prange); lptraj.append(lnew); gap = xptraj.gap(xptraj.pieces().size()-1); if(gap > 1e-6) cout << "Apended traj gap " << gap << endl; } while(prange.begin() < tptraj.range().end()); // test integrating the field over the corrected trajectories: this should be small VEC3 tdp, xdp, ldp, ndp; tdp = BF->integrate( tptraj, tptraj.range()); xdp = BF->integrate( xptraj, xptraj.range()); ldp = BF->integrate( lptraj, lptraj.range()); ndp = BF->integrate( start, start.range()); cout << "TTraj " << tptraj << " integral " << tdp << endl; cout << "XTraj " << xptraj << " integral " << xdp << endl; cout << "LTraj " << lptraj << " integral " << ldp << endl; cout << "Nominal " << start << " integral " << ndp << endl; // setup histograms TFile tpfile((KTRAJ::trajName()+"BFieldMap.root").c_str(),"RECREATE"); TH1F *dxmomt1, *dxmomt2, *dxmommd; TH1F *dlmomt1, *dlmomt2, *dlmommd; TH1F *dxpost1, *dxpost2, *dxposmd; TH1F *dlpost1, *dlpost2, *dlposmd; dxmomt1 = new TH1F("dxmomt1","#Delta mom, T1 Dir",100,-2.0,2.0); dxmomt2 = new TH1F("dxmomt2","#Delta mom, T2 Dir",100,-2.0,2.0); dxmommd = new TH1F("dxmommd","#Delta mom, M Dir",100,-2.0,2.0); dlmomt1 = new TH1F("dlmomt1","#Delta mom, T1 Dir",100,-2.0,2.0); dlmomt2 = new TH1F("dlmomt2","#Delta mom, T2 Dir",100,-2.0,2.0); dlmommd = new TH1F("dlmommd","#Delta mom, M Dir",100,-2.0,2.0); dxpost1 = new TH1F("dxpost1","#Delta Pos, T1 Dir",100,-5.0,5.0); dxpost2 = new TH1F("dxpost2","#Delta Pos, T2 Dir",100,-5.0,5.0); dxposmd = new TH1F("dxposmd","#Delta Pos, M Dir",100,-5.0,5.0); dlpost1 = new TH1F("dlpost1","#Delta Pos, T1 Dir",100,-5.0,5.0); dlpost2 = new TH1F("dlpost2","#Delta Pos, T2 Dir",100,-5.0,5.0); dlposmd = new TH1F("dlposmd","#Delta Pos, M Dir",100,-5.0,5.0); // draw the true helix TCanvas* hcan = new TCanvas("hcan","Traj",1000,1000); TPolyLine3D* ttrue = new TPolyLine3D(200); TPolyLine3D* tpx = new TPolyLine3D(200); TPolyLine3D* tpl = new TPolyLine3D(200); TPolyLine3D* tnom = new TPolyLine3D(200); VEC3 tpos, xpos, lpos, npos; VEC3 tvel, xvel, lvel; VEC3 t1dir, t2dir, mdir; VEC3 tmom, xmom, lmom; double tstep = tptraj.range().range()/200.0; for(int istep=0;istep<201;++istep){ // compute the position from the time double ttime = tptraj.range().begin() + tstep*istep; tpos = tptraj.position3(ttime); t1dir = tptraj.direction(ttime,MomBasis::perpdir_); t2dir = tptraj.direction(ttime,MomBasis::phidir_); mdir = tptraj.direction(ttime,MomBasis::momdir_); ttrue->SetPoint(istep, tpos.X(), tpos.Y(), tpos.Z()); xpos = xptraj.position3(ttime); tpx->SetPoint(istep, xpos.X(), xpos.Y(), xpos.Z()); lpos = lptraj.position3(ttime); tpl->SetPoint(istep, lpos.X(), lpos.Y(), lpos.Z()); npos = start.position3(ttime); tnom->SetPoint(istep, npos.X(), npos.Y(), npos.Z()); dxpost1->Fill( (xpos-tpos).Dot(t1dir)); dxpost2->Fill( (xpos-tpos).Dot(t2dir)); dxposmd->Fill( (xpos-tpos).Dot(mdir)); dlpost1->Fill( (lpos-tpos).Dot(t1dir)); dlpost2->Fill( (lpos-tpos).Dot(t2dir)); dlposmd->Fill( (lpos-tpos).Dot(mdir)); tmom = tptraj.momentum3(ttime); xmom = xptraj.momentum3(ttime); lmom = lptraj.momentum3(ttime); dxmomt1->Fill( (xmom-tmom).Dot(t1dir)); dxmomt2->Fill( (xmom-tmom).Dot(t2dir)); dxmommd->Fill( (xmom-tmom).Dot(mdir)); dlmomt1->Fill( (lmom-tmom).Dot(t1dir)); dlmomt2->Fill( (lmom-tmom).Dot(t2dir)); dlmommd->Fill( (lmom-tmom).Dot(mdir)); } // draw the true trajectory ttrue->SetLineColor(kBlue); ttrue->Draw(); // draw the nominal (unadjusted) trajectory tnom->SetLineColor(kBlack); tnom->SetLineStyle(9); tnom->Draw(); // draw the 'exact' (rotated) adjusted trajectory tpx->SetLineColor(kGreen); tpx->SetLineStyle(6); tpx->Draw(); // linear adjusted trajectory tpl->SetLineColor(kRed); tpl->SetLineStyle(7); tpl->Draw(); // draw the origin and axes TAxis3D* rulers = new TAxis3D(); rulers->GetXaxis()->SetAxisColor(kBlue); rulers->GetXaxis()->SetLabelColor(kBlue); rulers->GetYaxis()->SetAxisColor(kCyan); rulers->GetYaxis()->SetLabelColor(kCyan); rulers->GetZaxis()->SetAxisColor(kOrange); rulers->GetZaxis()->SetLabelColor(kOrange); rulers->Draw(); TLegend* hleg = new TLegend(0.7,0.7,1.0,1.0); hleg->AddEntry(ttrue,"True Trajectory","L"); hleg->AddEntry(tnom,"Nominal Trajectory","L"); hleg->AddEntry(tpx,"Rotated Correction Trajectory","L"); hleg->AddEntry(tpl,"Fixed Correction Trajectory","L"); hleg->Draw(); hcan->Draw(); hcan->Write(); TCanvas* dxcan = new TCanvas("dxcan","dxcan",800,1200); dxcan->Divide(3,2); dxcan->cd(1); dxpost1->Draw(); dxcan->cd(2); dxpost2->Draw(); dxcan->cd(3); dxposmd->Draw(); dxcan->cd(4); dxmomt1->Draw(); dxcan->cd(5); dxmomt2->Draw(); dxcan->cd(6); dxmommd->Draw(); dxcan->Draw(); dxcan->Write(); TCanvas* dlcan = new TCanvas("dlcan","dlcan",800,1200); dlcan->Divide(3,2); dlcan->cd(1); dlpost1->Draw(); dlcan->cd(2); dlpost2->Draw(); dlcan->cd(3); dlposmd->Draw(); dlcan->cd(4); dlmomt1->Draw(); dlcan->cd(5); dlmomt2->Draw(); dlcan->cd(6); dlmommd->Draw(); dlcan->Draw(); dlcan->Write(); // test the BFieldMap rotation by expressing a simple helix. This doesn't simulate a true // particle path, it just tests mechanics // loop over the time ranges given by the 'sim' trajectory KTRAJ const& sktraj = tptraj.front(); PKTRAJ rsktraj(sktraj); for (auto const& piece : tptraj.pieces()) { // rotate the parameters at the end of this piece to form the next. Sample B in the middle of that range KTRAJ newpiece(piece,BF->fieldVect(sktraj.position3(piece.range().mid())),piece.range().begin()); rsktraj.append(newpiece); } // draw the trajs TCanvas* hcandb = new TCanvas("hcandb","#Delta B Traj",1000,1000); TPolyLine3D* original = new TPolyLine3D(200); TPolyLine3D* rotated = new TPolyLine3D(200); tstep = tptraj.range().range()/200.0; for(int istep=0;istep<201;++istep){ double tplot = sktraj.range().begin()+tstep*istep; auto opos = sktraj.position3(tplot); original->SetPoint(istep, opos.X(), opos.Y(), opos.Z()); auto rpos = rsktraj.position3(tplot); rotated->SetPoint(istep, rpos.X(), rpos.Y(), rpos.Z()); } original->SetLineColor(kBlack); original->SetLineStyle(9); original->Draw(); rotated->SetLineColor(kRed); rotated->SetLineStyle(6); rotated->Draw(); TLegend* bleg = new TLegend(0.7,0.7,1.0,1.0); bleg->AddEntry(original,"Original Trajectory","L"); bleg->AddEntry(rotated,"Rotated Trajectory","L"); bleg->Draw(); hcandb->Draw(); hcandb->Write(); return 0; }
34.422741
135
0.634539
KFTrack
784cc8aa698f50870bf21669ea42ebbd23ce6572
4,762
cpp
C++
remodet_repository_wdh_part/src/caffe/layers/detection_evaluate_layer.cpp
UrwLee/Remo_experience
a59d5b9d6d009524672e415c77d056bc9dd88c72
[ "MIT" ]
null
null
null
remodet_repository_wdh_part/src/caffe/layers/detection_evaluate_layer.cpp
UrwLee/Remo_experience
a59d5b9d6d009524672e415c77d056bc9dd88c72
[ "MIT" ]
null
null
null
remodet_repository_wdh_part/src/caffe/layers/detection_evaluate_layer.cpp
UrwLee/Remo_experience
a59d5b9d6d009524672e415c77d056bc9dd88c72
[ "MIT" ]
null
null
null
#include <algorithm> #include <map> #include <string> #include <vector> #include "caffe/layers/detection_evaluate_layer.hpp" #include "caffe/util/bbox_util.hpp" namespace caffe { template <typename Dtype> void DetectionEvaluateLayer<Dtype>::LayerSetUp( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { // 获取该层的参数 const DetectionEvaluateParameter& detection_evaluate_param = this->layer_param_.detection_evaluate_param(); background_label_id_ = detection_evaluate_param.background_label_id(); CHECK_EQ(background_label_id_, 0); // 是否评估diff项 evaluate_difficult_gt_ = detection_evaluate_param.evaluate_difficult_gt(); CHECK(detection_evaluate_param.has_num_classes()) << "num_classes must be specified."; num_classes_ = detection_evaluate_param.num_classes(); // 获取size_thre_ CHECK_EQ(detection_evaluate_param.boxsize_threshold_size(), 7) << "7 levels should be defined."; size_thre_[0] = detection_evaluate_param.boxsize_threshold(0); size_thre_[1] = detection_evaluate_param.boxsize_threshold(1); size_thre_[2] = detection_evaluate_param.boxsize_threshold(2); size_thre_[3] = detection_evaluate_param.boxsize_threshold(3); size_thre_[4] = detection_evaluate_param.boxsize_threshold(4); size_thre_[5] = detection_evaluate_param.boxsize_threshold(5); size_thre_[6] = detection_evaluate_param.boxsize_threshold(6); // 获取iou_thre_ CHECK_EQ(detection_evaluate_param.iou_threshold_size(), 3) << "3 diff_levels should be defined."; iou_thre_[0] = detection_evaluate_param.iou_threshold(0); iou_thre_[1] = detection_evaluate_param.iou_threshold(1); iou_thre_[2] = detection_evaluate_param.iou_threshold(2); } template <typename Dtype> void DetectionEvaluateLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { CHECK_EQ(bottom[0]->num(), 1); CHECK_EQ(bottom[0]->channels(), 1); CHECK_EQ(bottom[0]->width(), 7); CHECK_EQ(bottom[1]->num(), 1); CHECK_EQ(bottom[1]->channels(), 1); CHECK_EQ(bottom[1]->width(), 8); vector<int> top_shape(4, 1); top_shape[0] = 1; // top_shape[1] = 1; //diff: @IOU top_shape[2] = 1; //level: @size top_shape[3] = 7; //(num_classes_ - 1 + num_dets) * 5 top[0]->Reshape(top_shape); } template <typename Dtype> void DetectionEvaluateLayer<Dtype>::Forward_cpu( const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top) { const Dtype* det_data = bottom[0]->cpu_data(); const Dtype* gt_data = bottom[1]->cpu_data(); CHECK_EQ(bottom[0]->width(), 7) << "detection results-width must be 7."; CHECK_EQ(bottom[1]->width(), 8) << "ground-truth width must be 8."; // =========================================================================== // Get Det results map<int, map<int, vector<NormalizedBBox> > > all_detections; GetDetectionResults(det_data, bottom[0]->height(), background_label_id_, &all_detections); // =========================================================================== // Get GT results // LOG(INFO) << "====================OUTPUT======================"; map<int, map<int, vector<NormalizedBBox> > > all_gt_bboxes; GetGroundTruth(gt_data, bottom[1]->height(), background_label_id_, evaluate_difficult_gt_, &all_gt_bboxes); // Get leveld GT results vector<map<int, map<int, vector<NormalizedBBox> > > > leveld_gtboxes; leveld_gtboxes.resize(7); //7-levels get_leveld_gtboxes(size_thre_,all_gt_bboxes,&leveld_gtboxes); // all res [diff][level] map<int, map<int, vector<vector<float> > > > all_res; for (int d = 0; d < 3; ++d) { for (int l = 0; l < 7; ++l) { leveld_eval_detections(leveld_gtboxes[l],all_detections,size_thre_[l],iou_thre_[d], num_classes_,background_label_id_,l,d,&all_res[d][l]); } } // output Top[0] int num_out = 0; for (int d = 0; d < 3; ++d) { for (int l = 0; l < 7; ++l) { num_out += all_res[d][l].size(); } } vector<int> top_shape(4, 1); top_shape[0] = 1; // top_shape[1] = 1; //diff: @IOU top_shape[2] = num_out; //level: @size top_shape[3] = 7; //(num_classes_ - 1 + num_dets) * 5 top[0]->Reshape(top_shape); Dtype* top_data = top[0]->mutable_cpu_data(); int count = 0; for (int d = 0; d < 3; ++d) { for (int l = 0; l < 7; ++l) { vector<vector<float> >& l_res = all_res[d][l]; for (int i = 0; i < l_res.size(); ++i) { CHECK_EQ(l_res[i].size(), 7); for (int j = 0; j < l_res[i].size(); ++j) { top_data[count++] = l_res[i][j]; } } } } CHECK_EQ(count, 7*num_out); } INSTANTIATE_CLASS(DetectionEvaluateLayer); REGISTER_LAYER_CLASS(DetectionEvaluate); } // namespace caffe
36.914729
89
0.643847
UrwLee
784cf79825a0378b42bdd90f7d3bac5c33f1630f
736
cpp
C++
main/PISupervisor/linux/src/PISecFilterDeviceStub.cpp
minku1024/endpointdlp
931ab140eef053498907d1db74a5c055bea8ef93
[ "Apache-2.0" ]
33
2020-11-18T09:30:13.000Z
2022-03-03T17:56:24.000Z
main/PISupervisor/linux/src/PISecFilterDeviceStub.cpp
s4ngsuk-sms/endpointdlp
9e87e352e23bff3b5e0701dd278756aadc8a0539
[ "Apache-2.0" ]
25
2020-07-31T01:43:17.000Z
2020-11-27T12:32:09.000Z
main/PISupervisor/linux/src/PISecFilterDeviceStub.cpp
s4ngsuk-sms/endpointdlp
9e87e352e23bff3b5e0701dd278756aadc8a0539
[ "Apache-2.0" ]
26
2020-11-18T09:30:15.000Z
2022-01-18T08:24:01.000Z
#ifndef _PISECFILTERDEVICESTUB_CPP #define _PISECFILTERDEVICESTUB_CPP #include"PISecFilterDeviceStub.h" CPISecFilterDeviceStub::CPISecFilterDeviceStub() { } CPISecFilterDeviceStub::~CPISecFilterDeviceStub() { } bool CPISecFilterDeviceStub::initialize(KERNEL_EVENTHANDLER kernel_eventhandler) { return true; } bool CPISecFilterDeviceStub::finalize(void) { return true; } void CPISecFilterDeviceStub::clear(void) { } bool CPISecFilterDeviceStub::applyPolicy(unsigned long command, void* in, unsigned long size) { return true; } void CPISecFilterDeviceStub::load(void) { } void CPISecFilterDeviceStub::unload(void) { } bool CPISecFilterDeviceStub::isActive(void) { return false; } #endif
19.891892
96
0.76087
minku1024
784eec0a02944bede305cf257cead79ccf6959a0
245
cpp
C++
Practice/Down Of Programming Contest/Loops/prob 2.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
Practice/Down Of Programming Contest/Loops/prob 2.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
Practice/Down Of Programming Contest/Loops/prob 2.cpp
Sohelr360/my_codes
9bdd28f62d3850aad8f8af2a253ba66138a7057c
[ "MIT" ]
null
null
null
//1 2 + 2 2 + 3 2 + . . . + n 2 #include <iostream> #include <math.h> using namespace std; int main() { long n,sum = 0; cin>>n; for(long i = 1; i <= n; i++) { sum += pow(i,2); } cout<<sum<<endl; return 0; }
13.611111
32
0.44898
Sohelr360
784f5761bd573483fc83142c88b8c8aad80ac1d8
1,872
cpp
C++
src/umpire/op/HostReallocateOperation.cpp
td-mpcdf/Umpire
3f1701e2dab2dce426f93206c8f5ba96af07e0cb
[ "MIT-0", "MIT" ]
null
null
null
src/umpire/op/HostReallocateOperation.cpp
td-mpcdf/Umpire
3f1701e2dab2dce426f93206c8f5ba96af07e0cb
[ "MIT-0", "MIT" ]
null
null
null
src/umpire/op/HostReallocateOperation.cpp
td-mpcdf/Umpire
3f1701e2dab2dce426f93206c8f5ba96af07e0cb
[ "MIT-0", "MIT" ]
null
null
null
////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2016-22, Lawrence Livermore National Security, LLC and Umpire // project contributors. See the COPYRIGHT file for details. // // SPDX-License-Identifier: (MIT) ////////////////////////////////////////////////////////////////////////////// #include "umpire/op/HostReallocateOperation.hpp" #include <cstdlib> #include "umpire/ResourceManager.hpp" #include "umpire/strategy/mixins/Inspector.hpp" #include "umpire/util/Macros.hpp" namespace umpire { namespace op { void HostReallocateOperation::transform(void* current_ptr, void** new_ptr, util::AllocationRecord* current_allocation, util::AllocationRecord* new_allocation, std::size_t new_size) { auto allocator = umpire::Allocator(new_allocation->strategy); const std::size_t old_size = current_allocation->size; // // Since Umpire implements its own semantics for zero-length allocations, we // cannot simply call ::realloc() with a pointer to a zero-length allocation. // if (old_size == 0) { *new_ptr = allocator.allocate(new_size); const std::size_t copy_size = (old_size > new_size) ? new_size : old_size; ResourceManager::getInstance().copy(*new_ptr, current_ptr, copy_size); allocator.deallocate(current_ptr); } else { auto old_record = ResourceManager::getInstance().deregisterAllocation(current_ptr); *new_ptr = ::realloc(current_ptr, new_size); if (!*new_ptr) { UMPIRE_ERROR("::realloc(current_ptr=" << current_ptr << ", old_size=" << old_record.size << ", new_size=" << new_size << ") failed"); } ResourceManager::getInstance().registerAllocation(*new_ptr, {*new_ptr, new_size, new_allocation->strategy}); } } } // end of namespace op } // end of namespace umpire
38.204082
118
0.633547
td-mpcdf
7852c919280429ecea3af128bd6c207a39245953
1,441
cpp
C++
ExternalCallbacks.cpp
Rus08/mandarin-vm
9cb2af3d1698414b70f431629ee6124f64885677
[ "MIT" ]
null
null
null
ExternalCallbacks.cpp
Rus08/mandarin-vm
9cb2af3d1698414b70f431629ee6124f64885677
[ "MIT" ]
null
null
null
ExternalCallbacks.cpp
Rus08/mandarin-vm
9cb2af3d1698414b70f431629ee6124f64885677
[ "MIT" ]
null
null
null
#include <stdlib.h> #include "WebVM.h" #include "Execute32Bit.h" #include "SysCall.h" uint32_t PerformCall(struct VirtualMachine* pVM) { pVM->CurrentStackTop = pVM->CurrentStackTop + 1; CheckStackSize(); MakeCall(); return VM_OK; } uint32_t VMOnKeyDown(struct VirtualMachine* pVM, uint32_t Key) { uint32_t SC; struct CallbacksBuffer* pBuf = 0; if(pVM->DispatchFlag == false){ assert(false); return VM_NOTINTIME_CALLBACK_CALL; } if(pVM->Callbacks[VM_ONKEYDOWN] == 0){ assert(false); return VM_CALLBACK_NOT_REGISTERED; } SC = PerformCall(pVM); if(SC != VM_OK){ return SC; } pBuf = (struct CallbacksBuffer*)(pVM->pGlobalMemory + pVM->CallbacksBuffersOffset); pBuf->vm_key_down_buf[0] = Key; // this is broken now pVM->Registers.PC = pVM->Callbacks[VM_ONKEYDOWN]; return VM_OK; } uint32_t VMOnKeyUp(struct VirtualMachine* pVM, uint32_t Key) { uint32_t SC; struct CallbacksBuffer* pBuf = 0; if(pVM->DispatchFlag == false){ assert(false); return VM_NOTINTIME_CALLBACK_CALL; } if(pVM->Callbacks[VM_ONKEYUP] == 0){ assert(false); return VM_CALLBACK_NOT_REGISTERED; } SC = PerformCall(pVM); if(SC != VM_OK){ return SC; } pBuf = (struct CallbacksBuffer*)(pVM->pGlobalMemory + pVM->CallbacksBuffersOffset); pBuf->vm_key_up_buf[0] = Key; // this is broken now pVM->Registers.PC = pVM->Callbacks[VM_ONKEYUP]; return VM_OK; }
21.833333
85
0.684247
Rus08
785324442352f72208bceee27f1f13395f50ff02
1,304
hpp
C++
ext/src/java/util/Set.hpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
ext/src/java/util/Set.hpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
ext/src/java/util/Set.hpp
pebble2015/cpoi
6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6
[ "Apache-2.0" ]
null
null
null
// Generated from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar #pragma once #include <fwd-POI.hpp> #include <java/lang/fwd-POI.hpp> #include <java/util/fwd-POI.hpp> #include <java/util/Collection.hpp> struct java::util::Set : public virtual Collection { /*bool add(::java::lang::Object* e); (already declared) */ /*bool addAll(Collection* c); (already declared) */ /*void clear(); (already declared) */ /*bool contains(::java::lang::Object* o); (already declared) */ /*bool containsAll(Collection* c); (already declared) */ /*bool equals(::java::lang::Object* o); (already declared) */ /*int32_t hashCode(); (already declared) */ /*bool isEmpty(); (already declared) */ /*Iterator* iterator(); (already declared) */ /*bool remove(::java::lang::Object* o); (already declared) */ /*bool removeAll(Collection* c); (already declared) */ /*bool retainAll(Collection* c); (already declared) */ /*int32_t size(); (already declared) */ /*Spliterator* spliterator(); (already declared) */ /*::java::lang::ObjectArray* toArray_(); (already declared) */ /*::java::lang::ObjectArray* toArray_(::java::lang::ObjectArray* a); (already declared) */ // Generated static ::java::lang::Class *class_(); };
38.352941
97
0.64954
pebble2015
785839ffbabb7d32aec5a4fc14a2372049c63df5
6,246
cpp
C++
metro_mini_firmware/lcd.cpp
aeleos/ISWSD
bbf937d7d914307b52536fcf5d369422bb8f216d
[ "MIT" ]
null
null
null
metro_mini_firmware/lcd.cpp
aeleos/ISWSD
bbf937d7d914307b52536fcf5d369422bb8f216d
[ "MIT" ]
null
null
null
metro_mini_firmware/lcd.cpp
aeleos/ISWSD
bbf937d7d914307b52536fcf5d369422bb8f216d
[ "MIT" ]
null
null
null
#include "LiquidCrystal_I2C.h" #include "lcd.h" #include <Arduino.h> #include "pinout.h" // LCD Functions #if defined(ARDUINO) && ARDUINO >= 100 #define printByte(args) write(args); #else #define printByte(args) print(args, BYTE); #endif //const PROGMEM uint16_t MAX_VOLT = 860; //const PROGMEM uint16_t MID_VOLT = 778; //const PROGMEM uint16_t MIN_VOLT = 756; //const PROGMEM uint8_t OFFSET_VOLTH = 50; //const PROGMEM uint8_t OFFSET_VOLTL = 21; //const PROGMEM float SCALE_VOLTH = 0.60975609756; //const PROGMEM float SCALE_VOLTL = 1.27272727273; #define MAX_VOLT 860 #define MID_VOLT 778 #define MIN_VOLT 756 #define OFFSET_VOLTH 50 #define OFFSET_VOLTL 21 #define SCALE_VOLTH 0.60975609756 #define SCALE_VOLTL 1.27272727273 #define LEFT_BUTTON_CURSOR 0 #define RIGHT_BUTTON_CURSOR 12 uint8_t voltage_to_percent() { uint16_t volt = (uint16_t)analogRead(BAT_PIN); //Serial.print(F("Battery voltage: ")); //Serial.print(volt); uint8_t percent; if (volt >= MAX_VOLT) { percent = 100; } else if (volt < MIN_VOLT) { percent = 0; } else if (volt >= MID_VOLT) { percent = (uint8_t)(((volt - MID_VOLT) * SCALE_VOLTH) + OFFSET_VOLTH); } else { percent = (uint8_t)(((volt - MIN_VOLT) * SCALE_VOLTL) + OFFSET_VOLTL); } //Serial.print(F(" - ")); //Serial.println(percent); return percent; } // const PROGMEM uint8_t delta[] = { // 0x04, // 0x04, // 0x0A, // 0x0A, // 0x0A, // 0x11, // 0x1F, // 0x00}; const PROGMEM uint8_t backslash[] = { 0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00 }; LCD::LCD(uint8_t addr, uint8_t cols, uint8_t rows) : LiquidCrystal_I2C(addr, cols, rows) { } void LCD::setup() { LCD::init(); LCD::backlight(); // LCD::createChar(0, delta); LCD::createChar(1, backslash); LCD::noCursor(); LCD::noBlink(); return; } void LCD::setTopStatusIndiciators(char* text, uint8_t sat) { uint8_t percent = voltage_to_percent(); LCD::setCursor(8, 0); LCD::print(text); LCD::setCursor(15, 0); LCD::print(F("C")); LCD::setCursor(17, 0); if (percent == 0) { LCD::print(F("LOW")); } else { LCD::print(percent); if (percent < 100) { LCD::print(F("%")); } } return; } void LCD::setTopStatusText(const __FlashStringHelper* status_text) { LCD::setCursor(0, 0); LCD::print(status_text); } void LCD::setTopStatusNumber(uint8_t num_zero, uint8_t num_measurements) { LCD::setCursor(0, 0); LCD::print(num_zero); LCD::print(F(":")); LCD::print(num_measurements); } void LCD::writing_screen() { LCD::clear(); LCD::setCursor(0,1); LCD::print(F("Saving data point...")); } void LCD::progress_loop(uint8_t col, uint8_t row, int loops) { if (loopcount < loops - 1) { loopcount++; return; } if (loopcount >= loops) { loopcount = 0; } else { LCD::setCursor(col, row); if (loop == '/') { LCD::print('-'); loop = '-'; } else if (loop == '-') { LCD::printByte(1); loop = '\\'; } else if (loop == '\\') { LCD::print('|'); loop = '|'; } else { LCD::print('/'); loop = '/'; } loopcount = 0; } } void LCD::startup_screen() { LCD::clear(); LCD::setCursor(0, 0); LCD::print(F("System startup")); return; } void LCD::gpslock_screen() { LCD::clear(); LCD::setCursor(0, 0); LCD::print(F("GPS Search")); LCD::setCursor(0, 1); LCD::print(F("Satellites: ")); LCD::print(F("No Lock")); return; } void LCD::no_sd_screen() { LCD::clear(); LCD::setCursor(0, 1); LCD::print(F("Insert SD Card")); return; } void LCD::ready_to_start_screen() { LCD::clear(); LCD::setCursor(0, 1); LCD::print(F("Press start on both")); LCD::setCursor(0, 2); LCD::print(F("devices to take data")); LCD::ask_for_start(); return; } // void LCD::zero_prompt_screen(char *preset) // { // LCD::clear(); // LCD::setCursor(0, 0); // LCD::print(F("Set Origin")); // LCD::setCursor(0, 1); // LCD::print(F("Hold to set.")); // if (preset) // { // LCD::setCursor(0, 2); // LCD::print(F("Zero point: ")); // LCD::print(*preset); // } // LCD::input_zero(); // return; // } // void LCD::standard_screen(uint8_t zero, uint8_t meas, char *preset) // { // LCD::clear(); // LCD::setCursor(0, 0); // LCD::print(zero); // LCD::print(F(":")); // if (preset) // { // LCD::print(*preset); // } // else // { // LCD::print(meas); // } // return; // } // void LCD::zero_max(uint8_t meas) // { // LCD::standard_screen(99, meas); // LCD::setCursor(0, 1); // LCD::print(F("SD card full.")); // LCD::setCursor(0, 2); // LCD::print(F("Data not stored.")); // LCD::input_acknowledge(); // return; // } void LCD::print_measurement(float x, float y, float z, float w, bool is_zero, char *preset) { LCD::setCursor(0, 1); LCD::print(F("h: ")); LCD::print(z); if (is_zero) { LCD::print(F("hPa ")); } else { LCD::print(F("m ")); } LCD::print(w); LCD::print(F("m")); LCD::setCursor(0, 2); LCD::print(x, 5); LCD::print(F(",")); LCD::print(y, 5); return; } void LCD::take_measurement() { LCD::setCursor(LEFT_BUTTON_CURSOR, 3); LCD::print(F("Measure")); return; } void LCD::confirm_measurement() { LCD::setCursor(LEFT_BUTTON_CURSOR, 3); LCD::print(F("Confirm")); LCD::setCursor(RIGHT_BUTTON_CURSOR, 3); LCD::print(F("Back")); return; } void LCD::ask_for_start() { LCD::setCursor(LEFT_BUTTON_CURSOR, 3); LCD::print(F("Start")); return; } // void LCD::input_zero() // { // LCD::setCursor(RIGHT_BUTTON_CURSOR, 3); // LCD::print(F("Zero")); // return; // } // void LCD::input_yes_no() // { // LCD::setCursor(LEFT_BUTTON_CURSOR, 3); // LCD::print(F("Yes")); // LCD::setCursor(RIGHT_BUTTON_CURSOR, 3); // LCD::print(F("No")); // return; // } // void LCD::input_measure_zero() // { // LCD::setCursor(LEFT_BUTTON_CURSOR, 3); // LCD::print(F("Measure")); // LCD::setCursor(RIGHT_BUTTON_CURSOR, 3); // LCD::print(F("Zero")); // return; // } // bool LCD::preset_select() // { // LCD::setCursor(0, 2); // LCD::print(F("Use presets?")); // LCD::input_yes_no(); // return; // }
18.370588
91
0.585335
aeleos
785d3922c2d40db887d7f0047d3137157b133143
18,075
cpp
C++
Source/GASShooter/Private/Characters/Abilities/GSGATA_Trace.cpp
Ritchiezhao/GASShooter
4bd4ef5f926f3729a75f4dd991b33186c496adb9
[ "MIT" ]
506
2020-02-22T20:41:11.000Z
2022-03-28T03:34:00.000Z
Source/GASShooter/Private/Characters/Abilities/GSGATA_Trace.cpp
Ritchiezhao/GASShooter
4bd4ef5f926f3729a75f4dd991b33186c496adb9
[ "MIT" ]
26
2020-03-08T14:29:56.000Z
2021-12-17T06:18:01.000Z
Source/GASShooter/Private/Characters/Abilities/GSGATA_Trace.cpp
Ritchiezhao/GASShooter
4bd4ef5f926f3729a75f4dd991b33186c496adb9
[ "MIT" ]
165
2020-02-23T07:19:48.000Z
2022-03-18T21:14:42.000Z
// Copyright 2020 Dan Kestranek. #include "Characters/Abilities/GSGATA_Trace.h" #include "AbilitySystemComponent.h" #include "DrawDebugHelpers.h" #include "GameFramework/PlayerController.h" #include "GameplayAbilitySpec.h" AGSGATA_Trace::AGSGATA_Trace() { bDestroyOnConfirmation = false; PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.TickGroup = TG_PostUpdateWork; MaxHitResultsPerTrace = 1; NumberOfTraces = 1; bIgnoreBlockingHits = false; bTraceAffectsAimPitch = true; bTraceFromPlayerViewPoint = false; MaxRange = 999999.0f; bUseAimingSpreadMod = false; BaseSpread = 0.0f; AimingSpreadMod = 0.0f; TargetingSpreadIncrement = 0.0f; TargetingSpreadMax = 0.0f; CurrentTargetingSpread = 0.0f; bUsePersistentHitResults = false; } void AGSGATA_Trace::ResetSpread() { bUseAimingSpreadMod = false; BaseSpread = 0.0f; AimingSpreadMod = 0.0f; TargetingSpreadIncrement = 0.0f; TargetingSpreadMax = 0.0f; CurrentTargetingSpread = 0.0f; } float AGSGATA_Trace::GetCurrentSpread() const { float FinalSpread = BaseSpread + CurrentTargetingSpread; if (bUseAimingSpreadMod && AimingTag.IsValid() && AimingRemovalTag.IsValid()) { UAbilitySystemComponent* ASC = OwningAbility->GetCurrentActorInfo()->AbilitySystemComponent.Get(); if (ASC && (ASC->GetTagCount(AimingTag) > ASC->GetTagCount(AimingRemovalTag))) { FinalSpread *= AimingSpreadMod; } } return FinalSpread; } void AGSGATA_Trace::SetStartLocation(const FGameplayAbilityTargetingLocationInfo& InStartLocation) { StartLocation = InStartLocation; } void AGSGATA_Trace::SetShouldProduceTargetDataOnServer(bool bInShouldProduceTargetDataOnServer) { ShouldProduceTargetDataOnServer = bInShouldProduceTargetDataOnServer; } void AGSGATA_Trace::SetDestroyOnConfirmation(bool bInDestroyOnConfirmation) { bDestroyOnConfirmation = bDestroyOnConfirmation; } void AGSGATA_Trace::StartTargeting(UGameplayAbility* Ability) { // Don't call to Super because we can have more than one Reticle SetActorTickEnabled(true); OwningAbility = Ability; SourceActor = Ability->GetCurrentActorInfo()->AvatarActor.Get(); // This is a lazy way of emptying and repopulating the ReticleActors. // We could come up with a solution that reuses them. DestroyReticleActors(); if (ReticleClass) { for (int32 i = 0; i < MaxHitResultsPerTrace * NumberOfTraces; i++) { SpawnReticleActor(GetActorLocation(), GetActorRotation()); } } if (bUsePersistentHitResults) { PersistentHitResults.Empty(); } } void AGSGATA_Trace::ConfirmTargetingAndContinue() { check(ShouldProduceTargetData()); if (SourceActor) { TArray<FHitResult> HitResults = PerformTrace(SourceActor); FGameplayAbilityTargetDataHandle Handle = MakeTargetData(HitResults); TargetDataReadyDelegate.Broadcast(Handle); #if ENABLE_DRAW_DEBUG if (bDebug) { ShowDebugTrace(HitResults, EDrawDebugTrace::Type::ForDuration, 2.0f); } #endif } if (bUsePersistentHitResults) { PersistentHitResults.Empty(); } } void AGSGATA_Trace::CancelTargeting() { const FGameplayAbilityActorInfo* ActorInfo = (OwningAbility ? OwningAbility->GetCurrentActorInfo() : nullptr); UAbilitySystemComponent* ASC = (ActorInfo ? ActorInfo->AbilitySystemComponent.Get() : nullptr); if (ASC) { ASC->AbilityReplicatedEventDelegate(EAbilityGenericReplicatedEvent::GenericCancel, OwningAbility->GetCurrentAbilitySpecHandle(), OwningAbility->GetCurrentActivationInfo().GetActivationPredictionKey()).Remove(GenericCancelHandle); } else { ABILITY_LOG(Warning, TEXT("AGameplayAbilityTargetActor::CancelTargeting called with null ASC! Actor %s"), *GetName()); } CanceledDelegate.Broadcast(FGameplayAbilityTargetDataHandle()); SetActorTickEnabled(false); if (bUsePersistentHitResults) { PersistentHitResults.Empty(); } } void AGSGATA_Trace::BeginPlay() { Super::BeginPlay(); // Start with Tick disabled. We'll enable it in StartTargeting() and disable it again in StopTargeting(). // For instant confirmations, tick will never happen because we StartTargeting(), ConfirmTargeting(), and immediately StopTargeting(). SetActorTickEnabled(false); } void AGSGATA_Trace::EndPlay(const EEndPlayReason::Type EndPlayReason) { DestroyReticleActors(); Super::EndPlay(EndPlayReason); } void AGSGATA_Trace::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); TArray<FHitResult> HitResults; if (bDebug || bUsePersistentHitResults) { // Only need to trace on Tick if we're showing debug or if we use persistent hit results, otherwise we just use the confirmation trace HitResults = PerformTrace(SourceActor); } #if ENABLE_DRAW_DEBUG if (SourceActor && bDebug) { ShowDebugTrace(HitResults, EDrawDebugTrace::Type::ForOneFrame); } #endif } void AGSGATA_Trace::LineTraceWithFilter(TArray<FHitResult>& OutHitResults, const UWorld* World, const FGameplayTargetDataFilterHandle FilterHandle, const FVector& Start, const FVector& End, FName ProfileName, const FCollisionQueryParams Params) { check(World); TArray<FHitResult> HitResults; World->LineTraceMultiByProfile(HitResults, Start, End, ProfileName, Params); TArray<FHitResult> FilteredHitResults; // Start param could be player ViewPoint. We want HitResult to always display the StartLocation. FVector TraceStart = StartLocation.GetTargetingTransform().GetLocation(); for (int32 HitIdx = 0; HitIdx < HitResults.Num(); ++HitIdx) { FHitResult& Hit = HitResults[HitIdx]; if (!Hit.Actor.IsValid() || FilterHandle.FilterPassesForActor(Hit.Actor)) { Hit.TraceStart = TraceStart; Hit.TraceEnd = End; FilteredHitResults.Add(Hit); } } OutHitResults = FilteredHitResults; return; } void AGSGATA_Trace::AimWithPlayerController(const AActor* InSourceActor, FCollisionQueryParams Params, const FVector& TraceStart, FVector& OutTraceEnd, bool bIgnorePitch) { if (!OwningAbility) // Server and launching client only { return; } // Default values in case of AI Controller FVector ViewStart = TraceStart; FRotator ViewRot = StartLocation.GetTargetingTransform().GetRotation().Rotator(); if (MasterPC) { MasterPC->GetPlayerViewPoint(ViewStart, ViewRot); } const FVector ViewDir = ViewRot.Vector(); FVector ViewEnd = ViewStart + (ViewDir * MaxRange); ClipCameraRayToAbilityRange(ViewStart, ViewDir, TraceStart, MaxRange, ViewEnd); // Use first hit TArray<FHitResult> HitResults; LineTraceWithFilter(HitResults, InSourceActor->GetWorld(), Filter, ViewStart, ViewEnd, TraceProfile.Name, Params); CurrentTargetingSpread = FMath::Min(TargetingSpreadMax, CurrentTargetingSpread + TargetingSpreadIncrement); const bool bUseTraceResult = HitResults.Num() > 0 && (FVector::DistSquared(TraceStart, HitResults[0].Location) <= (MaxRange * MaxRange)); const FVector AdjustedEnd = (bUseTraceResult) ? HitResults[0].Location : ViewEnd; FVector AdjustedAimDir = (AdjustedEnd - TraceStart).GetSafeNormal(); if (AdjustedAimDir.IsZero()) { AdjustedAimDir = ViewDir; } if (!bTraceAffectsAimPitch && bUseTraceResult) { FVector OriginalAimDir = (ViewEnd - TraceStart).GetSafeNormal(); if (!OriginalAimDir.IsZero()) { // Convert to angles and use original pitch const FRotator OriginalAimRot = OriginalAimDir.Rotation(); FRotator AdjustedAimRot = AdjustedAimDir.Rotation(); AdjustedAimRot.Pitch = OriginalAimRot.Pitch; AdjustedAimDir = AdjustedAimRot.Vector(); } } const float CurrentSpread = GetCurrentSpread(); const float ConeHalfAngle = FMath::DegreesToRadians(CurrentSpread * 0.5f); const int32 RandomSeed = FMath::Rand(); FRandomStream WeaponRandomStream(RandomSeed); const FVector ShootDir = WeaponRandomStream.VRandCone(AdjustedAimDir, ConeHalfAngle, ConeHalfAngle); OutTraceEnd = TraceStart + (ShootDir * MaxRange); } bool AGSGATA_Trace::ClipCameraRayToAbilityRange(FVector CameraLocation, FVector CameraDirection, FVector AbilityCenter, float AbilityRange, FVector& ClippedPosition) { FVector CameraToCenter = AbilityCenter - CameraLocation; float DotToCenter = FVector::DotProduct(CameraToCenter, CameraDirection); if (DotToCenter >= 0) //If this fails, we're pointed away from the center, but we might be inside the sphere and able to find a good exit point. { float DistanceSquared = CameraToCenter.SizeSquared() - (DotToCenter * DotToCenter); float RadiusSquared = (AbilityRange * AbilityRange); if (DistanceSquared <= RadiusSquared) { float DistanceFromCamera = FMath::Sqrt(RadiusSquared - DistanceSquared); float DistanceAlongRay = DotToCenter + DistanceFromCamera; //Subtracting instead of adding will get the other intersection point ClippedPosition = CameraLocation + (DistanceAlongRay * CameraDirection); //Cam aim point clipped to range sphere return true; } } return false; } void AGSGATA_Trace::StopTargeting() { SetActorTickEnabled(false); DestroyReticleActors(); // Clear added callbacks TargetDataReadyDelegate.Clear(); CanceledDelegate.Clear(); if (GenericDelegateBoundASC) { GenericDelegateBoundASC->GenericLocalConfirmCallbacks.RemoveDynamic(this, &AGameplayAbilityTargetActor::ConfirmTargeting); GenericDelegateBoundASC->GenericLocalCancelCallbacks.RemoveDynamic(this, &AGameplayAbilityTargetActor::CancelTargeting); GenericDelegateBoundASC = nullptr; } } FGameplayAbilityTargetDataHandle AGSGATA_Trace::MakeTargetData(const TArray<FHitResult>& HitResults) const { FGameplayAbilityTargetDataHandle ReturnDataHandle; for (int32 i = 0; i < HitResults.Num(); i++) { /** Note: These are cleaned up by the FGameplayAbilityTargetDataHandle (via an internal TSharedPtr) */ FGameplayAbilityTargetData_SingleTargetHit* ReturnData = new FGameplayAbilityTargetData_SingleTargetHit(); ReturnData->HitResult = HitResults[i]; ReturnDataHandle.Add(ReturnData); } return ReturnDataHandle; } TArray<FHitResult> AGSGATA_Trace::PerformTrace(AActor* InSourceActor) { bool bTraceComplex = false; TArray<AActor*> ActorsToIgnore; ActorsToIgnore.Add(InSourceActor); FCollisionQueryParams Params(SCENE_QUERY_STAT(AGSGATA_LineTrace), bTraceComplex); Params.bReturnPhysicalMaterial = true; Params.AddIgnoredActors(ActorsToIgnore); Params.bIgnoreBlocks = bIgnoreBlockingHits; FVector TraceStart = StartLocation.GetTargetingTransform().GetLocation(); FVector TraceEnd; if (MasterPC) { FVector ViewStart; FRotator ViewRot; MasterPC->GetPlayerViewPoint(ViewStart, ViewRot); TraceStart = bTraceFromPlayerViewPoint ? ViewStart : TraceStart; } if (bUsePersistentHitResults) { // Clear any blocking hit results, invalid Actors, or actors out of range //TODO Check for visibility if we add AIPerceptionComponent in the future for (int32 i = PersistentHitResults.Num() - 1; i >= 0; i--) { FHitResult& HitResult = PersistentHitResults[i]; if (HitResult.bBlockingHit || !HitResult.Actor.IsValid() || FVector::DistSquared(TraceStart, HitResult.Actor.Get()->GetActorLocation()) > (MaxRange * MaxRange)) { PersistentHitResults.RemoveAt(i); } } } TArray<FHitResult> ReturnHitResults; for (int32 TraceIndex = 0; TraceIndex < NumberOfTraces; TraceIndex++) { AimWithPlayerController(InSourceActor, Params, TraceStart, TraceEnd); //Effective on server and launching client only // ------------------------------------------------------ SetActorLocationAndRotation(TraceEnd, SourceActor->GetActorRotation()); CurrentTraceEnd = TraceEnd; TArray<FHitResult> TraceHitResults; DoTrace(TraceHitResults, InSourceActor->GetWorld(), Filter, TraceStart, TraceEnd, TraceProfile.Name, Params); for (int32 j = TraceHitResults.Num() - 1; j >= 0; j--) { if (MaxHitResultsPerTrace >= 0 && j + 1 > MaxHitResultsPerTrace) { // Trim to MaxHitResultsPerTrace TraceHitResults.RemoveAt(j); continue; } FHitResult& HitResult = TraceHitResults[j]; // Reminder: if bUsePersistentHitResults, Number of Traces = 1 if (bUsePersistentHitResults) { // This is looping backwards so that further objects from player are added first to the queue. // This results in closer actors taking precedence as the further actors will get bumped out of the TArray. if (HitResult.Actor.IsValid() && (!HitResult.bBlockingHit || PersistentHitResults.Num() < 1)) { bool bActorAlreadyInPersistentHits = false; // Make sure PersistentHitResults doesn't have this hit actor already for (int32 k = 0; k < PersistentHitResults.Num(); k++) { FHitResult& PersistentHitResult = PersistentHitResults[k]; if (PersistentHitResult.Actor.Get() == HitResult.Actor.Get()) { bActorAlreadyInPersistentHits = true; break; } } if (bActorAlreadyInPersistentHits) { continue; } if (PersistentHitResults.Num() >= MaxHitResultsPerTrace) { // Treat PersistentHitResults like a queue, remove first element PersistentHitResults.RemoveAt(0); } PersistentHitResults.Add(HitResult); } } else { // ReticleActors for PersistentHitResults are handled later int32 ReticleIndex = TraceIndex * MaxHitResultsPerTrace + j; if (ReticleIndex < ReticleActors.Num()) { if (AGameplayAbilityWorldReticle* LocalReticleActor = ReticleActors[ReticleIndex].Get()) { const bool bHitActor = HitResult.Actor != nullptr; if (bHitActor && !HitResult.bBlockingHit) { LocalReticleActor->SetActorHiddenInGame(false); const FVector ReticleLocation = (bHitActor && LocalReticleActor->bSnapToTargetedActor) ? HitResult.Actor->GetActorLocation() : HitResult.Location; LocalReticleActor->SetActorLocation(ReticleLocation); LocalReticleActor->SetIsTargetAnActor(bHitActor); } else { LocalReticleActor->SetActorHiddenInGame(true); } } } } } // for TraceHitResults if (!bUsePersistentHitResults) { if (TraceHitResults.Num() < ReticleActors.Num()) { // We have less hit results than ReticleActors, hide the extra ones for (int32 j = TraceHitResults.Num(); j < ReticleActors.Num(); j++) { if (AGameplayAbilityWorldReticle* LocalReticleActor = ReticleActors[j].Get()) { LocalReticleActor->SetIsTargetAnActor(false); LocalReticleActor->SetActorHiddenInGame(true); } } } } if (TraceHitResults.Num() < 1) { // If there were no hits, add a default HitResult at the end of the trace FHitResult HitResult; // Start param could be player ViewPoint. We want HitResult to always display the StartLocation. HitResult.TraceStart = StartLocation.GetTargetingTransform().GetLocation(); HitResult.TraceEnd = TraceEnd; HitResult.Location = TraceEnd; HitResult.ImpactPoint = TraceEnd; TraceHitResults.Add(HitResult); if (bUsePersistentHitResults && PersistentHitResults.Num() < 1) { PersistentHitResults.Add(HitResult); } } ReturnHitResults.Append(TraceHitResults); } // for NumberOfTraces // Reminder: if bUsePersistentHitResults, Number of Traces = 1 if (bUsePersistentHitResults && MaxHitResultsPerTrace > 0) { // Handle ReticleActors for (int32 PersistentHitResultIndex = 0; PersistentHitResultIndex < PersistentHitResults.Num(); PersistentHitResultIndex++) { FHitResult& HitResult = PersistentHitResults[PersistentHitResultIndex]; // Update TraceStart because old persistent HitResults will have their original TraceStart and the player could have moved since then HitResult.TraceStart = StartLocation.GetTargetingTransform().GetLocation(); if (AGameplayAbilityWorldReticle* LocalReticleActor = ReticleActors[PersistentHitResultIndex].Get()) { const bool bHitActor = HitResult.Actor != nullptr; if (bHitActor && !HitResult.bBlockingHit) { LocalReticleActor->SetActorHiddenInGame(false); const FVector ReticleLocation = (bHitActor && LocalReticleActor->bSnapToTargetedActor) ? HitResult.Actor->GetActorLocation() : HitResult.Location; LocalReticleActor->SetActorLocation(ReticleLocation); LocalReticleActor->SetIsTargetAnActor(bHitActor); } else { LocalReticleActor->SetActorHiddenInGame(true); } } } if (PersistentHitResults.Num() < ReticleActors.Num()) { // We have less hit results than ReticleActors, hide the extra ones for (int32 PersistentHitResultIndex = PersistentHitResults.Num(); PersistentHitResultIndex < ReticleActors.Num(); PersistentHitResultIndex++) { if (AGameplayAbilityWorldReticle* LocalReticleActor = ReticleActors[PersistentHitResultIndex].Get()) { LocalReticleActor->SetIsTargetAnActor(false); LocalReticleActor->SetActorHiddenInGame(true); } } } return PersistentHitResults; } return ReturnHitResults; } AGameplayAbilityWorldReticle* AGSGATA_Trace::SpawnReticleActor(FVector Location, FRotator Rotation) { if (ReticleClass) { AGameplayAbilityWorldReticle* SpawnedReticleActor = GetWorld()->SpawnActor<AGameplayAbilityWorldReticle>(ReticleClass, Location, Rotation); if (SpawnedReticleActor) { SpawnedReticleActor->InitializeReticle(this, MasterPC, ReticleParams); SpawnedReticleActor->SetActorHiddenInGame(true); ReticleActors.Add(SpawnedReticleActor); // This is to catch cases of playing on a listen server where we are using a replicated reticle actor. // (In a client controlled player, this would only run on the client and therefor never replicate. If it runs // on a listen server, the reticle actor may replicate. We want consistancy between client/listen server players. // Just saying 'make the reticle actor non replicated' isnt a good answer, since we want to mix and match reticle // actors and there may be other targeting types that want to replicate the same reticle actor class). if (!ShouldProduceTargetDataOnServer) { SpawnedReticleActor->SetReplicates(false); } return SpawnedReticleActor; } } return nullptr; } void AGSGATA_Trace::DestroyReticleActors() { for (int32 i = ReticleActors.Num() - 1; i >= 0; i--) { if (ReticleActors[i].IsValid()) { ReticleActors[i].Get()->Destroy(); } } ReticleActors.Empty(); }
31.271626
244
0.752642
Ritchiezhao
785d9aeddfaefcb9919a681572aa37f5e2bb7dc1
294
cpp
C++
task4.cpp
Hung150/lab20
63c8ad9b4fa4add7f610608190f3631ec1bbe719
[ "Apache-2.0" ]
null
null
null
task4.cpp
Hung150/lab20
63c8ad9b4fa4add7f610608190f3631ec1bbe719
[ "Apache-2.0" ]
null
null
null
task4.cpp
Hung150/lab20
63c8ad9b4fa4add7f610608190f3631ec1bbe719
[ "Apache-2.0" ]
null
null
null
#include <iostream> #include <cstring> using namespace std; main(){ char s[90]; char ch; cout << "Enter string: "<<endl; cin >> s; cout << endl << "Enter the character: "<<endl; cin >> ch; for (int i=0;i<s.length();i++){ cout << s[i]; if (s[i]==ch) cout << s[i]; } }
18.375
48
0.527211
Hung150
7860829129a999328b3a2995193f66bc81521620
17,725
cpp
C++
01.Firmware/components/FabGL/src/dispdrivers/vga8controller.cpp
POMIN-163/xbw
ebda2fb925ec54e48e806ba1c3cd4e04a7b25368
[ "Apache-2.0" ]
5
2022-02-14T03:12:57.000Z
2022-03-06T11:58:31.000Z
01.Firmware/components/FabGL/src/dispdrivers/vga8controller.cpp
POMIN-163/xbw
ebda2fb925ec54e48e806ba1c3cd4e04a7b25368
[ "Apache-2.0" ]
null
null
null
01.Firmware/components/FabGL/src/dispdrivers/vga8controller.cpp
POMIN-163/xbw
ebda2fb925ec54e48e806ba1c3cd4e04a7b25368
[ "Apache-2.0" ]
4
2022-02-23T07:00:59.000Z
2022-03-10T03:58:11.000Z
/* Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com> Copyright (c) 2019-2021 Fabrizio Di Vittorio. All rights reserved. * Please contact fdivitto2013@gmail.com if you need a commercial license. * This library and related software is available under GPL v3. FabGL 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. FabGL 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 FabGL. If not, see <http://www.gnu.org/licenses/>. */ #include <alloca.h> #include <stdarg.h> #include <math.h> #include <string.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "soc/i2s_struct.h" #include "soc/i2s_reg.h" #include "driver/periph_ctrl.h" #include "soc/rtc.h" #include "esp_spi_flash.h" #include "esp_heap_caps.h" #include "fabutils.h" #include "vga8controller.h" #include "devdrivers/swgenerator.h" #pragma GCC optimize ("O2") namespace fabgl { /* To improve drawing and rendering speed pixels order is a bit oddy because we want to pack pixels (3 bits) into a uint32_t and ESP32 is little-endian. 8 pixels (24 bits) are packed in 3 bytes: bytes: 0 1 2 ... bits: 76543210 76543210 76543210 ... pixels: 55666777 23334445 00011122 ... bits24: 0 1... */ static inline __attribute__((always_inline)) void VGA8_SETPIXELINROW(uint8_t * row, int x, int value) { uint32_t * bits24 = (uint32_t*)(row + (x >> 3) * 3); // x / 8 * 3 int shift = 21 - (x & 7) * 3; *bits24 ^= ((value << shift) ^ *bits24) & (7 << shift); } static inline __attribute__((always_inline)) int VGA8_GETPIXELINROW(uint8_t * row, int x) { uint32_t * bits24 = (uint32_t*)(row + (x >> 3) * 3); // x / 8 * 3 int shift = 21 - (x & 7) * 3; return (*bits24 >> shift) & 7; } #define VGA8_INVERTPIXELINROW(row, x) *((uint32_t*)(row + ((x) >> 3) * 3)) ^= 7 << (21 - ((x) & 7) * 3) static inline __attribute__((always_inline)) void VGA8_SETPIXEL(int x, int y, int value) { auto row = (uint8_t*) VGA8Controller::sgetScanline(y); uint32_t * bits24 = (uint32_t*)(row + (x >> 3) * 3); // x / 8 * 3 int shift = 21 - (x & 7) * 3; *bits24 ^= ((value << shift) ^ *bits24) & (7 << shift); } #define VGA8_GETPIXEL(x, y) VGA8_GETPIXELINROW((uint8_t*)VGA8Controller::s_viewPort[(y)], (x)) #define VGA8_INVERT_PIXEL(x, y) VGA8_INVERTPIXELINROW((uint8_t*)VGA8Controller::s_viewPort[(y)], (x)) #define VGA8_COLUMNSQUANTUM 16 /*************************************************************************************/ /* VGA8Controller definitions */ VGA8Controller * VGA8Controller::s_instance = nullptr; VGA8Controller::VGA8Controller() : VGAPalettedController(VGA8_LinesCount, VGA8_COLUMNSQUANTUM, NativePixelFormat::PALETTE8, 8, 3, ISRHandler) { s_instance = this; m_packedPaletteIndexPair_to_signals = (uint16_t *) heap_caps_malloc(256 * sizeof(uint16_t), MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL); } VGA8Controller::~VGA8Controller() { heap_caps_free((void *)m_packedPaletteIndexPair_to_signals); } void VGA8Controller::setupDefaultPalette() { setPaletteItem(0, RGB888(0, 0, 0)); // 0: black setPaletteItem(1, RGB888(128, 0, 0)); // 1: red setPaletteItem(2, RGB888(0, 128, 0)); // 2: green setPaletteItem(3, RGB888(0, 0, 128)); // 3: blue setPaletteItem(4, RGB888(255, 0, 0)); // 4: bright red setPaletteItem(5, RGB888(0, 255, 0)); // 5: bright green setPaletteItem(6, RGB888(0, 0, 255)); // 6: bright blue setPaletteItem(7, RGB888(255, 255, 255)); // 7: white } void VGA8Controller::setPaletteItem(int index, RGB888 const & color) { index %= 8; m_palette[index] = color; auto packed222 = RGB888toPackedRGB222(color); for (int i = 0; i < 8; ++i) { m_packedPaletteIndexPair_to_signals[(index << 3) | i] &= 0xFF00; m_packedPaletteIndexPair_to_signals[(index << 3) | i] |= (m_HVSync | packed222); m_packedPaletteIndexPair_to_signals[(i << 3) | index] &= 0x00FF; m_packedPaletteIndexPair_to_signals[(i << 3) | index] |= (m_HVSync | packed222) << 8; } } void VGA8Controller::setPixelAt(PixelDesc const & pixelDesc, Rect & updateRect) { genericSetPixelAt(pixelDesc, updateRect, [&] (RGB888 const & color) { return RGB888toPaletteIndex(color); }, VGA8_SETPIXEL ); } // coordinates are absolute values (not relative to origin) // line clipped on current absolute clipping rectangle void VGA8Controller::absDrawLine(int X1, int Y1, int X2, int Y2, RGB888 color) { genericAbsDrawLine(X1, Y1, X2, Y2, color, [&] (RGB888 const & color) { return RGB888toPaletteIndex(color); }, [&] (int Y, int X1, int X2, uint8_t colorIndex) { rawFillRow(Y, X1, X2, colorIndex); }, [&] (int Y, int X1, int X2) { rawInvertRow(Y, X1, X2); }, VGA8_SETPIXEL, [&] (int X, int Y) { VGA8_INVERT_PIXEL(X, Y); } ); } // parameters not checked void VGA8Controller::rawFillRow(int y, int x1, int x2, RGB888 color) { rawFillRow(y, x1, x2, RGB888toPaletteIndex(color)); } // parameters not checked void VGA8Controller::rawFillRow(int y, int x1, int x2, uint8_t colorIndex) { uint8_t * row = (uint8_t*) m_viewPort[y]; for (; x1 <= x2; ++x1) VGA8_SETPIXELINROW(row, x1, colorIndex); } // parameters not checked void VGA8Controller::rawInvertRow(int y, int x1, int x2) { auto row = m_viewPort[y]; for (int x = x1; x <= x2; ++x) VGA8_INVERTPIXELINROW(row, x); } void VGA8Controller::rawCopyRow(int x1, int x2, int srcY, int dstY) { auto srcRow = (uint8_t*) m_viewPort[srcY]; auto dstRow = (uint8_t*) m_viewPort[dstY]; for (; x1 <= x2; ++x1) VGA8_SETPIXELINROW(dstRow, x1, VGA8_GETPIXELINROW(srcRow, x1)); } void VGA8Controller::swapRows(int yA, int yB, int x1, int x2) { auto rowA = (uint8_t*) m_viewPort[yA]; auto rowB = (uint8_t*) m_viewPort[yB]; for (; x1 <= x2; ++x1) { uint8_t a = VGA8_GETPIXELINROW(rowA, x1); uint8_t b = VGA8_GETPIXELINROW(rowB, x1); VGA8_SETPIXELINROW(rowA, x1, b); VGA8_SETPIXELINROW(rowB, x1, a); } } void VGA8Controller::drawEllipse(Size const & size, Rect & updateRect) { genericDrawEllipse(size, updateRect, [&] (RGB888 const & color) { return RGB888toPaletteIndex(color); }, VGA8_SETPIXEL ); } void VGA8Controller::clear(Rect & updateRect) { hideSprites(updateRect); uint8_t paletteIndex = RGB888toPaletteIndex(getActualBrushColor()); uint32_t pattern8 = (paletteIndex) | (paletteIndex << 3) | (paletteIndex << 6) | (paletteIndex << 9) | (paletteIndex << 12) | (paletteIndex << 15) | (paletteIndex << 18) | (paletteIndex << 21); for (int y = 0; y < m_viewPortHeight; ++y) { auto dest = (uint8_t*) m_viewPort[y]; for (int x = 0; x < m_viewPortWidth; x += 8, dest += 3) *((uint32_t*)dest) = (*((uint32_t*)dest) & 0xFF000000) | pattern8; } } // scroll < 0 -> scroll UP // scroll > 0 -> scroll DOWN void VGA8Controller::VScroll(int scroll, Rect & updateRect) { genericVScroll(scroll, updateRect, [&] (int yA, int yB, int x1, int x2) { swapRows(yA, yB, x1, x2); }, // swapRowsCopying [&] (int yA, int yB) { tswap(m_viewPort[yA], m_viewPort[yB]); }, // swapRowsPointers [&] (int y, int x1, int x2, RGB888 color) { rawFillRow(y, x1, x2, color); } // rawFillRow ); } // todo: optimize! void VGA8Controller::HScroll(int scroll, Rect & updateRect) { hideSprites(updateRect); uint8_t back = RGB888toPaletteIndex(getActualBrushColor()); int Y1 = paintState().scrollingRegion.Y1; int Y2 = paintState().scrollingRegion.Y2; int X1 = paintState().scrollingRegion.X1; int X2 = paintState().scrollingRegion.X2; int width = X2 - X1 + 1; bool HScrolllingRegionAligned = ((X1 & 7) == 0 && (width & 7) == 0); // 8 pixels aligned if (scroll < 0) { // scroll left for (int y = Y1; y <= Y2; ++y) { for (int s = -scroll; s > 0;) { if (HScrolllingRegionAligned && s >= 8) { // scroll left by multiplies of 8 uint8_t * row = (uint8_t*) (m_viewPort[y]) + X1 / 8 * 3; auto sc = s & ~7; auto sz = width & ~7; memmove(row, row + sc / 8 * 3, (sz - sc) / 8 * 3); rawFillRow(y, X2 - sc + 1, X2, back); s -= sc; } else { // unaligned horizontal scrolling region, fallback to slow version auto row = (uint8_t*) m_viewPort[y]; for (int x = X1; x <= X2 - s; ++x) VGA8_SETPIXELINROW(row, x, VGA8_GETPIXELINROW(row, x + s)); // fill right area with brush color rawFillRow(y, X2 - s + 1, X2, back); s = 0; } } } } else if (scroll > 0) { // scroll right for (int y = Y1; y <= Y2; ++y) { for (int s = scroll; s > 0;) { if (HScrolllingRegionAligned && s >= 8) { // scroll right by multiplies of 8 uint8_t * row = (uint8_t*) (m_viewPort[y]) + X1 / 8 * 3; auto sc = s & ~7; auto sz = width & ~7; memmove(row + sc / 8 * 3, row, (sz - sc) / 8 * 3); rawFillRow(y, X1, X1 + sc - 1, back); s -= sc; } else { // unaligned horizontal scrolling region, fallback to slow version auto row = (uint8_t*) m_viewPort[y]; for (int x = X2 - s; x >= X1; --x) VGA8_SETPIXELINROW(row, x + s, VGA8_GETPIXELINROW(row, x)); // fill left area with brush color rawFillRow(y, X1, X1 + s - 1, back); s = 0; } } } } } void VGA8Controller::drawGlyph(Glyph const & glyph, GlyphOptions glyphOptions, RGB888 penColor, RGB888 brushColor, Rect & updateRect) { genericDrawGlyph(glyph, glyphOptions, penColor, brushColor, updateRect, [&] (RGB888 const & color) { return RGB888toPaletteIndex(color); }, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, VGA8_SETPIXELINROW ); } void VGA8Controller::invertRect(Rect const & rect, Rect & updateRect) { genericInvertRect(rect, updateRect, [&] (int Y, int X1, int X2) { rawInvertRow(Y, X1, X2); } ); } void VGA8Controller::swapFGBG(Rect const & rect, Rect & updateRect) { genericSwapFGBG(rect, updateRect, [&] (RGB888 const & color) { return RGB888toPaletteIndex(color); }, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, VGA8_GETPIXELINROW, VGA8_SETPIXELINROW ); } // Slow operation! // supports overlapping of source and dest rectangles void VGA8Controller::copyRect(Rect const & source, Rect & updateRect) { genericCopyRect(source, updateRect, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, VGA8_GETPIXELINROW, VGA8_SETPIXELINROW ); } // no bounds check is done! void VGA8Controller::readScreen(Rect const & rect, RGB888 * destBuf) { for (int y = rect.Y1; y <= rect.Y2; ++y) { auto row = (uint8_t*) m_viewPort[y]; for (int x = rect.X1; x <= rect.X2; ++x, ++destBuf) { const RGB222 v = m_palette[VGA8_GETPIXELINROW(row, x)]; *destBuf = RGB888(v.R * 85, v.G * 85, v.B * 85); // 85 x 3 = 255 } } } void VGA8Controller::rawDrawBitmap_Native(int destX, int destY, Bitmap const * bitmap, int X1, int Y1, int XCount, int YCount) { genericRawDrawBitmap_Native(destX, destY, (uint8_t*) bitmap->data, bitmap->width, X1, Y1, XCount, YCount, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, // rawGetRow VGA8_SETPIXELINROW ); } void VGA8Controller::rawDrawBitmap_Mask(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount) { auto foregroundColorIndex = RGB888toPaletteIndex(bitmap->foregroundColor); genericRawDrawBitmap_Mask(destX, destY, bitmap, (uint8_t*)saveBackground, X1, Y1, XCount, YCount, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, // rawGetRow VGA8_GETPIXELINROW, [&] (uint8_t * row, int x) { VGA8_SETPIXELINROW(row, x, foregroundColorIndex); } // rawSetPixelInRow ); } void VGA8Controller::rawDrawBitmap_RGBA2222(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount) { genericRawDrawBitmap_RGBA2222(destX, destY, bitmap, (uint8_t*)saveBackground, X1, Y1, XCount, YCount, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, // rawGetRow VGA8_GETPIXELINROW, [&] (uint8_t * row, int x, uint8_t src) { VGA8_SETPIXELINROW(row, x, RGB2222toPaletteIndex(src)); } // rawSetPixelInRow ); } void VGA8Controller::rawDrawBitmap_RGBA8888(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount) { genericRawDrawBitmap_RGBA8888(destX, destY, bitmap, (uint8_t*)saveBackground, X1, Y1, XCount, YCount, [&] (int y) { return (uint8_t*) m_viewPort[y]; }, // rawGetRow [&] (uint8_t * row, int x) { return VGA8_GETPIXELINROW(row, x); }, // rawGetPixelInRow [&] (uint8_t * row, int x, RGBA8888 const & src) { VGA8_SETPIXELINROW(row, x, RGB8888toPaletteIndex(src)); } // rawSetPixelInRow ); } void VGA8Controller::directSetPixel(int x, int y, int value) { VGA8_SETPIXEL(x, y, value); } void IRAM_ATTR VGA8Controller::ISRHandler(void * arg) { #if FABGLIB_VGAXCONTROLLER_PERFORMANCE_CHECK auto s1 = getCycleCount(); #endif auto ctrl = (VGA8Controller *) arg; if (I2S1.int_st.out_eof) { auto const desc = (lldesc_t*) I2S1.out_eof_des_addr; if (desc == s_frameResetDesc) s_scanLine = 0; auto const width = ctrl->m_viewPortWidth; auto const height = ctrl->m_viewPortHeight; auto const packedPaletteIndexPair_to_signals = (uint16_t const *) ctrl->m_packedPaletteIndexPair_to_signals; auto const lines = ctrl->m_lines; int scanLine = (s_scanLine + VGA8_LinesCount / 2) % height; auto lineIndex = scanLine & (VGA8_LinesCount - 1); for (int i = 0; i < VGA8_LinesCount / 2; ++i) { auto src = (uint8_t const *) s_viewPortVisible[scanLine]; auto dest = (uint16_t*) lines[lineIndex]; // optimizazion warn: horizontal resolution must be a multiple of 16! for (int col = 0; col < width; col += 16) { auto w1 = *((uint16_t*)(src )); // hi A:23334445, lo A:55666777 auto w2 = *((uint16_t*)(src + 2)); // hi B:55666777, lo A:00011122 auto w3 = *((uint16_t*)(src + 4)); // hi B:00011122, lo B:23334445 PSRAM_HACK; auto src1 = w1 | (w2 << 16); auto src2 = (w2 >> 8) | (w3 << 8); auto v1 = packedPaletteIndexPair_to_signals[(src1 ) & 0x3f]; // pixels 0, 1 auto v2 = packedPaletteIndexPair_to_signals[(src1 >> 6) & 0x3f]; // pixels 2, 3 auto v3 = packedPaletteIndexPair_to_signals[(src1 >> 12) & 0x3f]; // pixels 4, 5 auto v4 = packedPaletteIndexPair_to_signals[(src1 >> 18) & 0x3f]; // pixels 6, 7 auto v5 = packedPaletteIndexPair_to_signals[(src2 ) & 0x3f]; // pixels 8, 9 auto v6 = packedPaletteIndexPair_to_signals[(src2 >> 6) & 0x3f]; // pixels 10, 11 auto v7 = packedPaletteIndexPair_to_signals[(src2 >> 12) & 0x3f]; // pixels 12, 13 auto v8 = packedPaletteIndexPair_to_signals[(src2 >> 18) & 0x3f]; // pixels 14, 15 *(dest + 2) = v1; *(dest + 3) = v2; *(dest + 0) = v3; *(dest + 1) = v4; *(dest + 6) = v5; *(dest + 7) = v6; *(dest + 4) = v7; *(dest + 5) = v8; dest += 8; src += 6; } ++lineIndex; ++scanLine; } s_scanLine += VGA8_LinesCount / 2; if (scanLine >= height && !ctrl->m_primitiveProcessingSuspended && spi_flash_cache_enabled() && ctrl->m_primitiveExecTask) { // vertical sync, unlock primitive execution task // warn: don't use vTaskSuspendAll() in primitive drawing, otherwise vTaskNotifyGiveFromISR may be blocked and screen will flick! vTaskNotifyGiveFromISR(ctrl->m_primitiveExecTask, NULL); } } #if FABGLIB_VGAXCONTROLLER_PERFORMANCE_CHECK s_vgapalctrlcycles += getCycleCount() - s1; #endif I2S1.int_clr.val = I2S1.int_st.val; } } // end of namespace
35.238569
195
0.58708
POMIN-163
786741811d75451c0ef4e60401bbaaf967b62a0b
782
cpp
C++
src/aquarius2/proxy/internal/ProxyTaskRunner.cpp
kirino17/ecef
b9214aec0462db26718fca1cdcc9add200fabfb8
[ "BSD-3-Clause" ]
60
2018-09-29T05:08:07.000Z
2022-03-05T19:44:20.000Z
src/aquarius2/proxy/internal/ProxyTaskRunner.cpp
c3358/ecef
b9214aec0462db26718fca1cdcc9add200fabfb8
[ "BSD-3-Clause" ]
4
2018-11-19T07:47:56.000Z
2020-12-30T05:06:21.000Z
src/aquarius2/proxy/internal/ProxyTaskRunner.cpp
c3358/ecef
b9214aec0462db26718fca1cdcc9add200fabfb8
[ "BSD-3-Clause" ]
27
2018-10-29T17:30:53.000Z
2022-03-29T01:48:24.000Z
#include "ProxyTaskRunner.h" #include "include/cef_task.h" AQUA_PROXY_AUTO_CONSTRUCTOR(ProxyTaskRunner, CefTaskRunner); bool ProxyTaskRunner::IsValid() { return _rawptr != nullptr; } bool ProxyTaskRunner::IsSame(shrewd_ptr<ProxyTaskRunner> runner) { ASSERTQ(false); if (!runner || !ORIGIN(CefTaskRunner, runner)) { return false; } return FORWARD(CefTaskRunner)->IsSame(ORIGIN(CefTaskRunner, runner)); } bool ProxyTaskRunner::BelongsToCurrentThread() { ASSERTQ(false); return FORWARD(CefTaskRunner)->BelongsToCurrentThread(); } bool ProxyTaskRunner::PostTask(int cb, shrewd_ptr<ProxyTaskBind> binding) { ASSERTQ(false); return false; } bool ProxyTaskRunner::PostDelayedTask(int cb, shrewd_ptr<ProxyTaskBind> binding, int delay_ms) { ASSERTQ(false); return false; }
25.225806
96
0.773657
kirino17
786881120b776d9efd73468b373ef5426dbb9a5e
3,756
cpp
C++
src/HTTPSConnection.cpp
abelsensors/esp32_https_server
e568d8321764cce26ab76976f6489065b3744c7a
[ "MIT" ]
null
null
null
src/HTTPSConnection.cpp
abelsensors/esp32_https_server
e568d8321764cce26ab76976f6489065b3744c7a
[ "MIT" ]
null
null
null
src/HTTPSConnection.cpp
abelsensors/esp32_https_server
e568d8321764cce26ab76976f6489065b3744c7a
[ "MIT" ]
2
2022-01-26T19:47:32.000Z
2022-02-28T15:15:07.000Z
#include "HTTPSConnection.hpp" namespace httpsserver { HTTPSConnection::HTTPSConnection(ResourceResolver * resResolver): HTTPConnection(resResolver) { _ssl = NULL; } HTTPSConnection::~HTTPSConnection() { // Close the socket closeConnection(); } bool HTTPSConnection::isSecure() { return true; } /** * Initializes the connection from a server socket. * * The call WILL BLOCK if accept(serverSocketID) blocks. So use select() to check for that in advance. */ int HTTPSConnection::initialize(int serverSocketID, SSL_CTX * sslCtx, HTTPHeaders *defaultHeaders) { if (_connectionState == STATE_UNDEFINED) { // Let the base class connect the plain tcp socket int resSocket = HTTPConnection::initialize(serverSocketID, defaultHeaders); // Build up SSL Connection context if the socket has been created successfully if (resSocket >= 0) { _ssl = SSL_new(sslCtx); if (_ssl) { // Bind SSL to the socket int success = SSL_set_fd(_ssl, resSocket); if (success) { // Perform the handshake success = SSL_accept(_ssl); if (success) { return resSocket; } else { HTTPS_LOGE("SSL_accept failed. Aborting handshake. FID=%d", resSocket); } } else { HTTPS_LOGE("SSL_set_fd failed. Aborting handshake. FID=%d", resSocket); } } else { HTTPS_LOGE("SSL_new failed. Aborting handshake. FID=%d", resSocket); } } else { HTTPS_LOGE("Could not accept() new connection. FID=%d", resSocket); } _connectionState = STATE_ERROR; _clientState = CSTATE_ACTIVE; // This will only be called if the connection could not be established and cleanup // variables like _ssl etc. closeConnection(); } // Error: The connection has already been established or could not be established return -1; } void HTTPSConnection::closeConnection() { // FIXME: Copy from HTTPConnection, could be done better probably if (_connectionState != STATE_ERROR && _connectionState != STATE_CLOSED) { // First call to closeConnection - set the timestamp to calculate the timeout later on if (_connectionState != STATE_CLOSING) { _shutdownTS = millis(); } // Set the connection state to closing. We stay in closing as long as SSL has not been shutdown // correctly _connectionState = STATE_CLOSING; } // Try to tear down SSL while we are in the _shutdownTS timeout period or if an error occurred if (_ssl) { if(_connectionState == STATE_ERROR || SSL_shutdown(_ssl) == 0) { // SSL_shutdown will return 1 as soon as the client answered with close notify // This means we are safe to close the socket SSL_free(_ssl); _ssl = NULL; } else if (_shutdownTS + HTTPS_SHUTDOWN_TIMEOUT < millis()) { // The timeout has been hit, we force SSL shutdown now by freeing the context SSL_free(_ssl); _ssl = NULL; HTTPS_LOGW("SSL_shutdown did not receive close notification from the client"); _connectionState = STATE_ERROR; } } // If SSL has been brought down, close the socket if (!_ssl) { HTTPConnection::closeConnection(); } } size_t HTTPSConnection::writeBuffer(byte* buffer, size_t length) { return SSL_write(_ssl, buffer, length); } size_t HTTPSConnection::readBytesToBuffer(byte* buffer, size_t length) { int ret = SSL_read(_ssl, buffer, length); if (ret < 0) { HTTPS_LOGE("SSL_read error: %d", SSL_get_error(_ssl, ret)); } return ret; } size_t HTTPSConnection::pendingByteCount() { return SSL_pending(_ssl); } bool HTTPSConnection::canReadData() { return HTTPConnection::canReadData() || (SSL_pending(_ssl) > 0); } } /* namespace httpsserver */
29.34375
102
0.676784
abelsensors
786a78d7380a854fd3d3a381bac5aef7b89cd772
6,844
cpp
C++
Engine/Src/SFCore/Stream/SFCompressedStream.cpp
blue3k/StormForge
1557e699a673ae9adcc8f987868139f601ec0887
[ "Apache-2.0" ]
1
2020-06-20T07:35:25.000Z
2020-06-20T07:35:25.000Z
Engine/Src/SFCore/Stream/SFCompressedStream.cpp
blue3k/StormForge
1557e699a673ae9adcc8f987868139f601ec0887
[ "Apache-2.0" ]
null
null
null
Engine/Src/SFCore/Stream/SFCompressedStream.cpp
blue3k/StormForge
1557e699a673ae9adcc8f987868139f601ec0887
[ "Apache-2.0" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // // CopyRight (c) 2017 Kyungkun Ko // // Author : KyungKun Ko // // Description : SFFileOutputStream // // //////////////////////////////////////////////////////////////////////////////// #include "SFCorePCH.h" #include "SFTypedefs.h" #include "Stream/SFCompressedStream.h" #include "Util/SFUtility.h" #include "zlib.h" #include "Math/SFMathUtil.h" namespace SF { namespace ImplCompressedStream { // void* alloc_func(voidpf opaque, uInt items, uInt size) { auto pHeap = (IHeap*)opaque; return pHeap->Alloc(items * size); } // void free_func(voidpf opaque, voidpf address) { auto pHeap = (IHeap*)opaque; pHeap->Free(address); } } ///////////////////////////////////////////////////////////////////////////// // // CompressedInputStream // CompressedInputStream::CompressedInputStream(IHeap& heap, IInputStream& inputStream, size_t sourceSize, size_t decompressedSize) : m_Heap(heap) , m_Stream(inputStream) , m_CompressedSourceSize(sourceSize) , m_DecompressedSize(decompressedSize) { m_CompressionInfo = (z_stream*)m_StreamStructBuffer; memset(m_CompressionInfo, 0, sizeof(z_stream)); m_CompressionInfo->zalloc = ImplCompressedStream::alloc_func; m_CompressionInfo->zfree = ImplCompressedStream::free_func; m_CompressionInfo->opaque = &m_Heap; m_InputStartPosition = inputStream.GetPosition(); inflateInit(m_CompressionInfo); } CompressedInputStream::~CompressedInputStream() { CloseCompressionStream(); } void CompressedInputStream::CloseCompressionStream() { if (m_CompressionInfo != nullptr) inflateEnd(m_CompressionInfo); m_CompressionInfo = nullptr; } Result CompressedInputStream::Seek(SeekMode seekPos, int64_t offset) { if (seekPos != SeekMode::Current) { Assert(false); // not supported return ResultCode::INVALID_ARG; } uint8_t decompressBuffer[128]; while (offset > 0) { auto readSize = Math::Min(offset, (int64_t)sizeof(decompressBuffer)); Read(decompressBuffer, static_cast<size_t>(readSize)); offset -= readSize; } return ResultCode::SUCCESS; } // Read data Result CompressedInputStream::Read(void* buffer, size_t readSize) { auto remainOutputSize = m_DecompressedSize - m_Position; if (remainOutputSize < readSize) { readSize = remainOutputSize; } if (readSize == 0) return ResultCode::FAIL; m_CompressionInfo->next_out = (Bytef*)buffer; m_CompressionInfo->avail_out = (uint)readSize; while (m_CompressionInfo->avail_out > 0) { if (m_CompressionInfo->avail_in == 0) { auto remainInputSize = m_Stream.GetPosition() - m_InputStartPosition; auto bufferSize = sizeof(m_DecompressBuffer); if (remainInputSize < bufferSize) { bufferSize = remainInputSize; } if (bufferSize == 0) return ResultCode::END_OF_STREAM; Result result = m_Stream.Read(m_DecompressBuffer, bufferSize); if (!result) return result; m_CompressionInfo->avail_in = (uint)bufferSize; m_CompressionInfo->next_in = m_DecompressBuffer; } auto zError = inflate(m_CompressionInfo, Z_NO_FLUSH); switch (zError) { case Z_NEED_DICT: zError = Z_DATA_ERROR; case Z_DATA_ERROR: case Z_STREAM_ERROR: CloseCompressionStream(); return ResultCode::INVALID_FORMAT; case Z_MEM_ERROR: CloseCompressionStream(); return ResultCode::OUT_OF_MEMORY; } } m_Position += readSize; return ResultCode::SUCCESS; } ///////////////////////////////////////////////////////////////////////////////////////// // // compressed Output stream class // CompressedOutputStream::CompressedOutputStream(IHeap& heap, IOutputStream& stream) : m_Heap(heap) , m_Stream(stream) { m_CompressionInfo = (z_stream*)m_StreamStructBuffer; memset(m_CompressionInfo, 0, sizeof(z_stream)); m_CompressionInfo->zalloc = ImplCompressedStream::alloc_func; m_CompressionInfo->zfree = ImplCompressedStream::free_func; m_CompressionInfo->opaque = &m_Heap; deflateInit(m_CompressionInfo, Z_DEFAULT_COMPRESSION); } CompressedOutputStream::~CompressedOutputStream() { CloseCompressionStream(); } void CompressedOutputStream::CloseCompressionStream() { if (m_CompressionInfo != nullptr) deflateEnd(m_CompressionInfo); m_CompressionInfo = nullptr; } // flush pending output Result CompressedOutputStream::Flush() { if (m_CompressionInfo == nullptr) return ResultCode::SUCCESS; while(true) { if (m_CompressionInfo->avail_out == 0) { m_CompressedOutputSize += sizeof(m_CompressBuffer); Result result = m_Stream.Write(m_CompressBuffer, sizeof(m_CompressBuffer)); if (!result) return result; m_CompressionInfo->avail_out = sizeof(m_CompressBuffer); m_CompressionInfo->next_out = m_CompressBuffer; } auto zError = deflate(m_CompressionInfo, Z_FULL_FLUSH); switch (zError) { case Z_NEED_DICT: zError = Z_DATA_ERROR; case Z_DATA_ERROR: case Z_STREAM_ERROR: CloseCompressionStream(); return ResultCode::FAIL; case Z_MEM_ERROR: CloseCompressionStream(); return ResultCode::FAIL; case Z_STREAM_END: m_CompressedOutputSize += sizeof(m_CompressBuffer) - m_CompressionInfo->avail_out; return ResultCode::SUCCESS; } } } size_t CompressedOutputStream::GetCompressedSize() const { if (m_CompressionInfo == nullptr) return m_CompressedOutputSize; else return m_CompressedOutputSize + sizeof(m_CompressBuffer) - m_CompressionInfo->avail_out; } // Write data Result CompressedOutputStream::Write(const void* buffer, size_t writeSize) { m_CompressionInfo->next_in = (Bytef*)buffer; m_CompressionInfo->avail_in = (uint)writeSize; while (m_CompressionInfo->avail_in > 0) { if (m_CompressionInfo->avail_out == 0) { m_CompressedOutputSize += sizeof(m_CompressBuffer); Result result = m_Stream.Write(m_CompressBuffer, sizeof(m_CompressBuffer)); if (!result) return result; m_CompressionInfo->avail_out = sizeof(m_CompressBuffer); m_CompressionInfo->next_out = m_CompressBuffer; } auto zError = deflate(m_CompressionInfo, Z_NO_FLUSH); switch (zError) { case Z_NEED_DICT: zError = Z_DATA_ERROR; case Z_DATA_ERROR: case Z_STREAM_ERROR: CloseCompressionStream(); return ResultCode::INVALID_FORMAT; case Z_MEM_ERROR: CloseCompressionStream(); return ResultCode::OUT_OF_MEMORY; } } m_Position += writeSize; return ResultCode::SUCCESS; } }
24.442857
130
0.658533
blue3k
7871f51084cb1bee410708a8f73538b6ccd2d244
4,701
hh
C++
trex/domain/EnumDomain.hh
miatauro/trex2-agent
d896f8335f3194237a8bba49949e86f5488feddb
[ "BSD-3-Clause" ]
null
null
null
trex/domain/EnumDomain.hh
miatauro/trex2-agent
d896f8335f3194237a8bba49949e86f5488feddb
[ "BSD-3-Clause" ]
null
null
null
trex/domain/EnumDomain.hh
miatauro/trex2-agent
d896f8335f3194237a8bba49949e86f5488feddb
[ "BSD-3-Clause" ]
null
null
null
/* -*- C++ -*- */ /** @file "EnumDomain.hh" * @brief string values enumeration domain * * This file defines the EnumDamain class. * * The EnumDomain is a specialization in order to declare domains * based on string values. * * @author Frederic Py <fpy@mbari.org> * @ingroup domains */ /********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2011, MBARI. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the TREX Project nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #ifndef H_EnumDomain # define H_EnumDomain # include "EnumeratedDomain.hh" namespace TREX { namespace transaction { /** @brief Enum domain * * This class implements a simple representation of strings domain. * The representation is based on an EnumeratedDomain that enumerates all * the possible values for this string. * * @author Frederic Py <fpy@mbari.org> * @ingroup domains */ class EnumDomain :public TREX::transaction::EnumeratedDomain<TREX::utils::Symbol> { public: static TREX::utils::Symbol const type_name; /** @brief Default Constructor * * Creates a new full string domain. */ EnumDomain() :TREX::transaction::EnumeratedDomain<TREX::utils::Symbol>(type_name) {} /** @brief Constructor * * @tparam a C++ iterator type * @param from an iterator * @param to an iterator * * @pre [@e from, @e to ) should be a valide iterator sequence * @pre @e Iter should points to TREX::utils::Symbol elements * * Creates a new instance restricted to all the elements in [@e from, @e to) * * @throw EmptyDomainthe created domain is empty */ template<class Iter> EnumDomain(Iter from, Iter to) :TREX::transaction::EnumeratedDomain<TREX::utils::Symbol>(type_name, from, to) {} /** @brief Constructor * @param val a value * * Create a new domain with the single value @e val */ EnumDomain(TREX::utils::Symbol const &val) :TREX::transaction::EnumeratedDomain<TREX::utils::Symbol>(type_name, val) {} /** @brief XML parsing constructor * * @param node an XML node * * Create a new domain based on the content of @e node. The type of * EnumDomain is enum. * @example * A full domain is defined by the empty element : * @code * <enum/> * @endcode * * A enum containing the two values "foo" and "bar" is described by * @code * <enum> * <elem value="foo"/> * <elem value="bar"/> * </enum> *@endcode */ explicit EnumDomain(boost::property_tree::ptree::value_type &node) :TREX::transaction::EnumeratedDomain<TREX::utils::Symbol>(node) {} /** @brief Destructor */ ~EnumDomain() {} /** @brief Copy operator * * Allocates a new copy of current instance */ DomainBase *copy() const { return new EnumDomain(begin(), end()); } }; // TREX::transaction::EnumDomain } // TREX::transaction } // TREX #endif // H_EnumDomain
34.313869
82
0.640289
miatauro
7872d60fa999bc937958663007629d3cfa44c8e9
377
cpp
C++
source/mazegenerator/AldousBroder.cpp
danielplawrence/MazeGeneration
d9d0e878c94226aa379e6ee2a2681f1c99b2f792
[ "Unlicense" ]
null
null
null
source/mazegenerator/AldousBroder.cpp
danielplawrence/MazeGeneration
d9d0e878c94226aa379e6ee2a2681f1c99b2f792
[ "Unlicense" ]
null
null
null
source/mazegenerator/AldousBroder.cpp
danielplawrence/MazeGeneration
d9d0e878c94226aa379e6ee2a2681f1c99b2f792
[ "Unlicense" ]
null
null
null
#include <mazegenerator/AldousBroder.h> GridPtr AldousBroder::on(GridPtr grid) { auto cell = grid->randomCell(); auto unvisited = grid->size() - 1; while (unvisited > 0) { auto neighbor = randomElement(cell->neighbours.getAll()); if (neighbor->getLinks().empty()) { cell->link(neighbor); unvisited--; } cell = neighbor; } return grid; }
22.176471
61
0.633952
danielplawrence
7872f56e147aef75e7167389ae9219914fabd136
6,111
cpp
C++
tests/unit_tests/parser/math_char.cpp
cpp-niel/mfl
d22d698b112b95d102150d5f3a5f35d8eb7fb0f3
[ "MIT" ]
4
2021-04-02T02:52:05.000Z
2021-12-11T00:42:35.000Z
tests/unit_tests/parser/math_char.cpp
cpp-niel/mfl
d22d698b112b95d102150d5f3a5f35d8eb7fb0f3
[ "MIT" ]
null
null
null
tests/unit_tests/parser/math_char.cpp
cpp-niel/mfl
d22d698b112b95d102150d5f3a5f35d8eb7fb0f3
[ "MIT" ]
null
null
null
#include "parser/parse.hpp" #include "framework/doctest.hpp" #include "framework/node_types_are.hpp" namespace mfl::parser { TEST_SUITE("parse math char") { TEST_CASE("parse a single math_char") { const auto expected = math_char{.kind = item_kind::bin, .family = font_family::roman, .char_code = 43}; const auto [noads, error] = parse("+"); const auto actual = std::get<math_char>(noads[0]); CHECK(expected.kind == actual.kind); CHECK(expected.char_code == actual.char_code); CHECK(expected.family == actual.family); } //TEST_CASE("parse a single multi-byte utf8 math_char") //{ // const auto expected = math_char{.kind = item_kind::bin, .family = font_family::roman, .char_code = 0x2200}; // const auto [noads, error] = parse("∀"); // const auto actual = std::get<math_char>(noads[0]); // CHECK(expected.kind == actual.kind); // CHECK(expected.char_code == actual.char_code); // CHECK(expected.family == actual.family); //} TEST_CASE("parse a single math_char variable") { const auto italic_x = 0x1d465; const auto expected = math_char{.kind = item_kind::ord, .family = font_family::roman, .char_code = italic_x}; const auto [noads, error] = parse("x"); const auto actual = std::get<math_char>(noads[0]); CHECK(expected.kind == actual.kind); CHECK(expected.char_code == actual.char_code); CHECK(expected.family == actual.family); } TEST_CASE("parse a single math_char in italic context") { const auto expected = math_char{.kind = item_kind::ord, .family = font_family::italic, .char_code = 120}; const auto [noads, error] = parse("\\mathit{x}"); const auto actual = std::get<math_char>(noads[0]); CHECK(expected.kind == actual.kind); CHECK(expected.char_code == actual.char_code); CHECK(expected.family == actual.family); } TEST_CASE("parse a single math_char in bold context") { const auto expected = math_char{.kind = item_kind::ord, .family = font_family::bold, .char_code = 120}; const auto [noads, error] = parse("\\mathbf{x}"); const auto actual = std::get<math_char>(noads[0]); CHECK(expected.kind == actual.kind); CHECK(expected.char_code == actual.char_code); CHECK(expected.family == actual.family); } TEST_CASE("parse a sequence of math_chars") { const auto [result, error] = parse("a1b2"); CHECK(node_types_are<math_char, math_char, math_char, math_char>(result)); } TEST_CASE("kind is ord and font family is roman for letters") { const auto [noads, error] = parse("a"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::ord); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is ord and font family is roman for digits") { const auto [noads, error] = parse("2"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::ord); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is bin and font family is roman for binary operators") { const auto [noads, error] = parse("*"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::bin); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is bin and font family is roman for command binary operators") { const auto [noads, error] = parse("\\boxplus"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::bin); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is rel and font family is roman for arrows") { const auto [noads, error] = parse("\\leftarrow"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::rel); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is open and font family is roman for left delimiters") { const auto [noads, error] = parse("["); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::open); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is open and font family is roman for command left delimiters") { const auto [noads, error] = parse("\\lfloor"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::open); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is close and font family is roman for right delimiters") { const auto [noads, error] = parse(")"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::close); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is close and font family is roman for command right delimiters") { const auto [noads, error] = parse("\\rceil"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::close); CHECK(actual.family == font_family::roman); } TEST_CASE("kind is op and font family is roman for unicode characters") { const auto [noads, error] = parse("\\pi"); const auto actual = std::get<math_char>(noads[0]); CHECK(actual.kind == item_kind::ord); CHECK(actual.family == font_family::roman); } } }
41.013423
121
0.56341
cpp-niel
787684df66343e26e77f78b610a3cfb2ebed1297
7,199
cpp
C++
SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialPlayerSpawner.cpp
eddyrainy/UnrealGDK
eb86c58d23d55e74b584b91c2d35702ba08448be
[ "MIT" ]
null
null
null
SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialPlayerSpawner.cpp
eddyrainy/UnrealGDK
eb86c58d23d55e74b584b91c2d35702ba08448be
[ "MIT" ]
null
null
null
SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialPlayerSpawner.cpp
eddyrainy/UnrealGDK
eb86c58d23d55e74b584b91c2d35702ba08448be
[ "MIT" ]
null
null
null
// Copyright (c) Improbable Worlds Ltd, All Rights Reserved #include "Interop/SpatialPlayerSpawner.h" #include "Engine/Engine.h" #include "Engine/LocalPlayer.h" #include "Kismet/GameplayStatics.h" #include "TimerManager.h" #include "EngineClasses/SpatialNetDriver.h" #include "Interop/Connection/SpatialWorkerConnection.h" #include "Interop/SpatialReceiver.h" #include "SpatialConstants.h" #include "Utils/SchemaUtils.h" #include <WorkerSDK/improbable/c_schema.h> #include <WorkerSDK/improbable/c_worker.h> DEFINE_LOG_CATEGORY(LogSpatialPlayerSpawner); using namespace SpatialGDK; void USpatialPlayerSpawner::Init(USpatialNetDriver* InNetDriver, FTimerManager* InTimerManager) { NetDriver = InNetDriver; TimerManager = InTimerManager; NumberOfAttempts = 0; } void USpatialPlayerSpawner::ReceivePlayerSpawnRequest(Schema_Object* Payload, const char* CallerAttribute, Worker_RequestId RequestId ) { FString Attributes = FString{ UTF8_TO_TCHAR(CallerAttribute) }; bool bAlreadyHasPlayer; WorkersWithPlayersSpawned.Emplace(Attributes, &bAlreadyHasPlayer); // Accept the player if we have not already accepted a player from this worker. if (!bAlreadyHasPlayer) { // Extract spawn parameters. FString URLString = GetStringFromSchema(Payload, 1); FUniqueNetIdRepl UniqueId; TArray<uint8> UniqueIdBytes = GetBytesFromSchema(Payload, 2); FNetBitReader UniqueIdReader(nullptr, UniqueIdBytes.GetData(), UniqueIdBytes.Num() * 8); UniqueIdReader << UniqueId; FName OnlinePlatformName = FName(*GetStringFromSchema(Payload, 3)); bool bSimulatedPlayer = GetBoolFromSchema(Payload, 4); URLString.Append(TEXT("?workerAttribute=")).Append(Attributes); if (bSimulatedPlayer) { URLString += TEXT("?simulatedPlayer=1"); } NetDriver->AcceptNewPlayer(FURL(nullptr, *URLString, TRAVEL_Absolute), UniqueId, OnlinePlatformName); } // Send a successful response if the player has been accepted, either from this request or one in the past. Worker_CommandResponse CommandResponse = {}; CommandResponse.component_id = SpatialConstants::PLAYER_SPAWNER_COMPONENT_ID; CommandResponse.command_index = 1; CommandResponse.schema_type = Schema_CreateCommandResponse(); Schema_Object* ResponseObject = Schema_GetCommandResponseObject(CommandResponse.schema_type); NetDriver->Connection->SendCommandResponse(RequestId, &CommandResponse); } void USpatialPlayerSpawner::SendPlayerSpawnRequest() { // Send an entity query for the SpatialSpawner and bind a delegate so that once it's found, we send a spawn command. Worker_Constraint SpatialSpawnerConstraint; SpatialSpawnerConstraint.constraint_type = WORKER_CONSTRAINT_TYPE_COMPONENT; SpatialSpawnerConstraint.constraint.component_constraint.component_id = SpatialConstants::PLAYER_SPAWNER_COMPONENT_ID; Worker_EntityQuery SpatialSpawnerQuery{}; SpatialSpawnerQuery.constraint = SpatialSpawnerConstraint; SpatialSpawnerQuery.result_type = WORKER_RESULT_TYPE_SNAPSHOT; Worker_RequestId RequestID; RequestID = NetDriver->Connection->SendEntityQueryRequest(&SpatialSpawnerQuery); EntityQueryDelegate SpatialSpawnerQueryDelegate; SpatialSpawnerQueryDelegate.BindLambda([this, RequestID](const Worker_EntityQueryResponseOp& Op) { if (Op.status_code != WORKER_STATUS_CODE_SUCCESS) { UE_LOG(LogSpatialPlayerSpawner, Error, TEXT("Entity query for SpatialSpawner failed: %s"), UTF8_TO_TCHAR(Op.message)); } else if (Op.result_count == 0) { UE_LOG(LogSpatialPlayerSpawner, Error, TEXT("Could not find SpatialSpawner via entity query: %s"), UTF8_TO_TCHAR(Op.message)); } else { checkf(Op.result_count == 1, TEXT("There should never be more than one SpatialSpawner entity.")); // Construct and send the player spawn request. FURL LoginURL; FUniqueNetIdRepl UniqueId; FName OnlinePlatformName; ObtainPlayerParams(LoginURL, UniqueId, OnlinePlatformName); Worker_CommandRequest CommandRequest = {}; CommandRequest.component_id = SpatialConstants::PLAYER_SPAWNER_COMPONENT_ID; CommandRequest.command_index = 1; CommandRequest.schema_type = Schema_CreateCommandRequest(); Schema_Object* RequestObject = Schema_GetCommandRequestObject(CommandRequest.schema_type); AddStringToSchema(RequestObject, 1, LoginURL.ToString(true)); // Write player identity information. FNetBitWriter UniqueIdWriter(0); UniqueIdWriter << UniqueId; AddBytesToSchema(RequestObject, 2, UniqueIdWriter); AddStringToSchema(RequestObject, 3, OnlinePlatformName.ToString()); UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(NetDriver); bool bSimulatedPlayer = GameInstance ? GameInstance->IsSimulatedPlayer() : false; Schema_AddBool(RequestObject, 4, bSimulatedPlayer); NetDriver->Connection->SendCommandRequest(Op.results[0].entity_id, &CommandRequest, 1); } }); UE_LOG(LogSpatialPlayerSpawner, Log, TEXT("Sending player spawn request")); NetDriver->Receiver->AddEntityQueryDelegate(RequestID, SpatialSpawnerQueryDelegate); ++NumberOfAttempts; } void USpatialPlayerSpawner::ReceivePlayerSpawnResponse(const Worker_CommandResponseOp& Op) { if (Op.status_code == WORKER_STATUS_CODE_SUCCESS) { UE_LOG(LogSpatialPlayerSpawner, Display, TEXT("Player spawned sucessfully")); } else if (NumberOfAttempts < SpatialConstants::MAX_NUMBER_COMMAND_ATTEMPTS) { UE_LOG(LogSpatialPlayerSpawner, Warning, TEXT("Player spawn request failed: \"%s\""), UTF8_TO_TCHAR(Op.message)); FTimerHandle RetryTimer; TimerManager->SetTimer(RetryTimer, [WeakThis = TWeakObjectPtr<USpatialPlayerSpawner>(this)]() { if (USpatialPlayerSpawner* Spawner = WeakThis.Get()) { Spawner->SendPlayerSpawnRequest(); } }, SpatialConstants::GetCommandRetryWaitTimeSeconds(NumberOfAttempts), false); } else { UE_LOG(LogSpatialPlayerSpawner, Error, TEXT("Player spawn request failed too many times. (%u attempts)"), SpatialConstants::MAX_NUMBER_COMMAND_ATTEMPTS); } } void USpatialPlayerSpawner::ObtainPlayerParams(FURL& LoginURL, FUniqueNetIdRepl& OutUniqueId, FName& OutOnlinePlatformName) { const FWorldContext* const WorldContext = GEngine->GetWorldContextFromWorld(NetDriver->GetWorld()); check(WorldContext->OwningGameInstance); // This code is adapted from PendingNetGame.cpp:242 if (ULocalPlayer* LocalPlayer = WorldContext->OwningGameInstance->GetFirstGamePlayer()) { // Send the player nickname if available FString OverrideName = LocalPlayer->GetNickname(); if (OverrideName.Len() > 0) { LoginURL.AddOption(*FString::Printf(TEXT("Name=%s"), *OverrideName)); } // Send any game-specific url options for this player FString GameUrlOptions = LocalPlayer->GetGameLoginOptions(); if (GameUrlOptions.Len() > 0) { LoginURL.AddOption(*FString::Printf(TEXT("%s"), *GameUrlOptions)); } // Pull in options from the current world URL (to preserve options added to a travel URL) const TArray<FString>& LastURLOptions = WorldContext->LastURL.Op; for (const FString& Op : LastURLOptions) { LoginURL.AddOption(*Op); } // Send the player unique Id at login OutUniqueId = LocalPlayer->GetPreferredUniqueNetId(); } OutOnlinePlatformName = WorldContext->OwningGameInstance->GetOnlinePlatformName(); }
37.300518
135
0.786498
eddyrainy
787ed3e2cee4aa3564d9393294f93613ef20eee7
11,227
hpp
C++
srrg2_core/src/srrg_image/image.hpp
srrg-sapienza/srrg2_core
56c1f8305f2a9918b7e7c581d83d394ffb7ea50e
[ "BSD-3-Clause" ]
5
2020-03-11T14:36:13.000Z
2021-09-09T09:01:15.000Z
srrg2_core/src/srrg_image/image.hpp
srrg-sapienza/srrg2_core
56c1f8305f2a9918b7e7c581d83d394ffb7ea50e
[ "BSD-3-Clause" ]
1
2020-06-07T17:25:04.000Z
2020-07-15T07:36:10.000Z
srrg2_core/src/srrg_image/image.hpp
srrg-sapienza/srrg2_core
56c1f8305f2a9918b7e7c581d83d394ffb7ea50e
[ "BSD-3-Clause" ]
2
2020-11-30T08:17:53.000Z
2021-06-19T05:07:07.000Z
namespace srrg2_core { template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::toCv(cv::Mat& dest_) const { dest_.create(this->rows(), this->cols(), ImageType_); for (size_t r = 0; r < this->rows(); ++r) { CVVecType* dest_ptr = dest_.ptr<CVVecType>(r); const EigenVecType* src_ptr = this->rowPtr(r); for (size_t c = 0; c < this->cols(); ++c, ++dest_ptr, ++src_ptr) { CVVecType& dest_item = *dest_ptr; const EigenVecType& src_item = *src_ptr; for (int n = 0; n < NumChannels_; ++n) { dest_item[n] = src_item[n]; } } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::fromCv(const cv::Mat& src_) { assert(src_.type() == ImageType_); MatrixType::resize(src_.rows, src_.cols); for (int r = 0; r < src_.rows; ++r) { const CVVecType* src_ptr = src_.ptr<CVVecType>(r); EigenVecType* dest_ptr = this->rowPtr(r); for (int c = 0; c < src_.cols; ++c, ++dest_ptr, ++src_ptr) { const CVVecType& src_item = *src_ptr; EigenVecType& dest_item = *dest_ptr; for (int n = 0; n < NumChannels_; ++n) { dest_item[n] = src_item[n]; } } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::fromBuffer(const uint8_t* buffer) { const Scalar* src_ptr = reinterpret_cast<const Scalar*>(buffer); for (size_t r = 0; r < this->rows(); ++r) { EigenVecType* dest_ptr = this->rowPtr(r); for (size_t c = 0; c < this->cols(); ++c, ++dest_ptr) { EigenVecType& dest_item = *dest_ptr; for (int n = 0; n < NumChannels_; ++n, ++src_ptr) { dest_item[n] = *src_ptr; } } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> template <typename DestImageType_, typename ScaleType_> void Image_<Scalar_, ImageType_, NumChannels_>::convertTo(DestImageType_& dest, const ScaleType_& s) const { assert(dest.numChannels() == numChannels()); typedef typename DestImageType_::EigenVecType DestVecType; dest.resize(rows(), cols()); for (size_t r = 0; r < dest.rows(); ++r) { const EigenVecType* src_ptr = this->rowPtr(r); DestVecType* dest_ptr = dest.rowPtr(r); for (size_t c = 0; c < cols(); ++c, ++src_ptr, ++dest_ptr) { const EigenVecType& src_item = *src_ptr; DestVecType& dest_item = *dest_ptr; for (int n = 0; n < NumChannels_; ++n) { dest_item[n] = src_item[n] * s; } } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::scale(float scale_factor_) { for (size_t r = 0; r < this->rows(); ++r) { for (size_t c = 0; c < this->cols(); ++c) { (*this)(r, c) *= scale_factor_; } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::downsample(Image_<Scalar,ImageType_,NumChannels_>& dest, DOWNSAMPLE_PIXELS npixels) { assert(this->type() == ImageType_); const float base = sqrt(static_cast<float>(npixels)); //TODO use map between DOWNSAMPLE_PIXELS and its base? const float inv_base = 1 / base; const float inv_npixels = 1 / (float)npixels; int new_rows = this->rows() * inv_base; int new_cols = this->cols() * inv_base; if (this->rows() % new_rows) { throw std::runtime_error("Image::downsample: the rows of dest should divide perfectly the rows of this"); } if (this->cols() % new_cols) { throw std::runtime_error("Image::downsample: the cols of dest should divide perfectly the cols of this"); } dest.resize(new_rows, new_cols); Eigen::Matrix<double, NumChannels_, 1> tmp; int r_idx_start, r_idx_end, c_idx_start, c_idx_end; for (int r = 0; r < new_rows; ++r) { r_idx_start = r * base; r_idx_end = r_idx_start + base; for (int c = 0; c < new_cols; ++c) { c_idx_start = c * base; c_idx_end = c_idx_start + base; tmp.setZero(); for (int rr = r_idx_start; rr < r_idx_end; ++rr) { for (int cc = c_idx_start; cc < c_idx_end; ++cc) { tmp += (*this)(rr, cc).template cast<double>(); } } dest(r, c) = (tmp * inv_npixels).template cast<Scalar>(); } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::integralImage(Image_<Scalar,ImageType_,NumChannels_>& dest_) { const int rows = this->rows(); const int cols = this->cols(); dest_.resize(rows, cols); Eigen::Matrix<Scalar, NumChannels_, 1> A, F, E; A.setZero(); F.setZero(); E.setZero(); for(int r = 0; r < rows; ++r) { const Eigen::Matrix<Scalar, NumChannels_, 1>* D = this->rowPtr(r); Eigen::Matrix<Scalar, NumChannels_, 1>* I = dest_.rowPtr(r); for(int c = 0; c < cols; ++c, ++I, ++D) { if(r > 1) { E = dest_.at(r-1,c); } else { E.setZero(); } if(r > 1 && c > 1) A = dest_.at(r-1, c-1); else A.setZero(); if(c > 1) F = dest_.at(r, c-1); else F.setZero(); *I = *D + E + F - A; } } } template <class Scalar_, ImageType ImageType_, int NumChannels_> void Image_<Scalar_, ImageType_, NumChannels_>::blur(Image_<Scalar,ImageType_,NumChannels_>& dest_, const size_t& window_) { const int rows = this->rows(); const int cols = this->cols(); dest_.resize(rows, cols); dest_.fill(Eigen::Matrix<Scalar, NumChannels_, 1>::Zero()); Image_<Scalar_, ImageType_, NumChannels_> integral; this->integralImage(integral); for (unsigned int r = window_; r < rows - window_; ++r ) { const Eigen::Matrix<Scalar, NumChannels_, 1>* up_row_ptr=integral.rowPtr(r-window_)+window_; const Eigen::Matrix<Scalar, NumChannels_, 1>* down_row_ptr=integral.rowPtr(r+window_)+window_; Eigen::Matrix<Scalar, NumChannels_, 1>* dest_row_ptr=dest_.rowPtr(r)+window_; for (unsigned int c = window_; c < cols - window_; ++c, ++down_row_ptr, ++up_row_ptr, ++dest_row_ptr) { Eigen::Matrix<Scalar, NumChannels_, 1> m11=*(down_row_ptr+window_); Eigen::Matrix<Scalar, NumChannels_, 1> m00=*(up_row_ptr-window_); Eigen::Matrix<Scalar, NumChannels_, 1> m01=*(down_row_ptr-window_); Eigen::Matrix<Scalar, NumChannels_, 1> m10=*(up_row_ptr+window_); Eigen::Matrix<Scalar, NumChannels_, 1> n_sum=m11+m00-m01-m10; if (n_sum.dot(n_sum)>0.2) *dest_row_ptr = n_sum.normalized(); else *dest_row_ptr = Eigen::Matrix<Scalar, NumChannels_, 1>::Zero(); } } } template <class Scalar_, ImageType ImageType_> void Image_<Scalar_, ImageType_, 1>::toCv(cv::Mat& dest_) const { dest_.create(this->rows(), this->cols(), ImageType_); for (size_t r = 0; r < this->rows(); ++r) { Scalar* dest_ptr = dest_.ptr<Scalar>(r); const Scalar* src_ptr = this->rowPtr(r); memcpy(dest_ptr, src_ptr, sizeof(Scalar) * this->cols()); } } template <class Scalar_, ImageType ImageType_> void Image_<Scalar_, ImageType_, 1>::fromCv(const cv::Mat& src_) { assert(src_.type() == ImageType_); MatrixType::resize(src_.rows, src_.cols); for (size_t r = 0; r < this->rows(); ++r) { const Scalar* src_ptr = src_.ptr<Scalar>(r); Scalar* dest_ptr = this->rowPtr(r); memcpy(dest_ptr, src_ptr, sizeof(Scalar) * this->cols()); } } template <class Scalar_, ImageType ImageType_> void Image_<Scalar_, ImageType_, 1>::fromBuffer(const uint8_t* buffer) { const Scalar* src_ptr = reinterpret_cast<const Scalar*>(buffer); for (size_t r = 0; r < this->rows(); ++r, src_ptr += cols()) { Scalar* dest_ptr = this->rowPtr(r); memcpy(dest_ptr, src_ptr, sizeof(Scalar) * this->cols()); } } template <class Scalar_, ImageType ImageType_> template <typename DestImageType_, typename ScaleType_> void Image_<Scalar_, ImageType_, 1>::convertTo(DestImageType_& dest, const ScaleType_& s) const { assert(dest.numChannels() == numChannels()); typedef typename DestImageType_::Scalar DestScalar; dest.resize(rows(), cols()); for (size_t r = 0; r < dest.rows(); ++r) { const Scalar* src_ptr = this->rowPtr(r); DestScalar* dest_ptr = dest.rowPtr(r); for (size_t c = 0; c < cols(); ++c, ++src_ptr, ++dest_ptr) { *dest_ptr = (DestScalar)(*src_ptr * s); } } } template <class Scalar_, ImageType ImageType_> void Image_<Scalar_, ImageType_, 1>::scale(float scale_factor_) { for (size_t r = 0; r < this->rows(); ++r) { for (size_t c = 0; c < this->cols(); ++c) { (*this)(r, c) *= scale_factor_; } } } template <class Scalar_, ImageType ImageType_> void Image_<Scalar_, ImageType_, 1>::downsample(Image_<Scalar, ImageType_, 1>& dest, DOWNSAMPLE_PIXELS npixels) { const float base = sqrt(static_cast<float>(npixels)); //TODO use map between DOWNSAMPLE_PIXELS and its base? const float inv_base = 1 / base; const float inv_npixels = 1 / (float)npixels; int new_rows = this->rows() * inv_base; int new_cols = this->cols() * inv_base; if (this->rows() % new_rows) { throw std::runtime_error("Image::downsample: the rows of dest should divide perfectly the rows of this"); } if (this->cols() % new_cols) { throw std::runtime_error("Image::downsample: the cols of dest should divide perfectly the cols of this"); } dest.resize(new_rows, new_cols); double tmp = 0; int r_idx_start, r_idx_end, c_idx_start, c_idx_end; for (int r = 0; r < new_rows; ++r) { r_idx_start = r * base; r_idx_end = r_idx_start + base; for (int c = 0; c < new_cols; ++c) { c_idx_start = c * base; c_idx_end = c_idx_start + base; tmp = 0; for (int rr = r_idx_start; rr < r_idx_end; ++rr) { for (int cc = c_idx_start; cc < c_idx_end; ++cc) { tmp += (*this)(rr, cc); } } dest(r, c) = tmp * inv_npixels; } } } template <class Scalar_, ImageType ImageType_> Image_<uint8_t,TYPE_8UC1,1> Image_<Scalar_, ImageType_, 1>::operator==(const size_t& value_) const { using MaskImage = Image_<uint8_t,TYPE_8UC1,1>; MaskImage mask(this->rows(), this->cols()); for (size_t r = 0; r < this->rows(); ++r) { const Scalar* src_ptr = this->rowPtr(r); uint8_t* dest_ptr = mask.rowPtr(r); for (size_t c = 0; c < this->cols(); ++c, ++src_ptr, ++dest_ptr) { *dest_ptr = (*src_ptr == value_); } } return mask; } }
37.175497
112
0.591253
srrg-sapienza
787eee1092a6141b0f5f5fafd6655b1a3d9fe031
6,636
cxx
C++
Libs/Widgets/GUI/Midas3TreeViewClient.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
Libs/Widgets/GUI/Midas3TreeViewClient.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
Libs/Widgets/GUI/Midas3TreeViewClient.cxx
midasplatform/MidasClient
728d4a5969691b54b7d0efd2dbad5a4df85d1a0e
[ "Apache-2.0" ]
null
null
null
/****************************************************************************** * Copyright 2011 Kitware Inc. * * 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 "Midas3TreeViewClient.h" #include <QtGui> #include <QItemSelection> #include <QContextMenuEvent> #include <QModelIndex> #include <iostream> #include "Midas3TreeItem.h" #include "Midas3TreeModelClient.h" #include "Midas3FolderTreeItem.h" #include "Midas3ItemTreeItem.h" #include "Midas3BitstreamTreeItem.h" #include "m3doCommunity.h" #include "m3dsFolder.h" #include "m3doFolder.h" #include "m3dsItem.h" #include "m3doItem.h" #include "m3doBitstream.h" #include "m3dsBitstream.h" #include "mdoObject.h" Midas3TreeViewClient::Midas3TreeViewClient(QWidget* parent) : Midas3TreeView(parent) { m_Model = new Midas3TreeModelClient; this->setModel(m_Model); this->setAcceptDrops(true); this->setSelectionMode(QTreeView::SingleSelection); connect(this, SIGNAL(collapsed(const QModelIndex &) ), this->model(), SLOT(ItemCollapsed(const QModelIndex &) ) ); connect(this, SIGNAL(expanded(const QModelIndex &) ), this->model(), SLOT(ItemExpanded(const QModelIndex &) ) ); connect(m_Model, SIGNAL(Expand(const QModelIndex &) ), this, SLOT(expand(const QModelIndex &) ) ); // define action to be triggered when tree item is selected QItemSelectionModel* itemSelectionModel = this->selectionModel(); connect(itemSelectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &) ), this, SLOT(UpdateSelection(const QItemSelection &, const QItemSelection &) ) ); m_MimeType = "MIDAS/client_resource"; m_AcceptMimeType = "MIDAS/server_resource"; } Midas3TreeViewClient::~Midas3TreeViewClient() { delete m_Model; } void Midas3TreeViewClient::mouseDoubleClickEvent(QMouseEvent* event) { Midas3BitstreamTreeItem* bitstream = NULL; Midas3TreeItem* node = const_cast<Midas3TreeItem *>( m_Model->GetMidasTreeItem(this->indexAt(event->pos() ) ) ); if( (bitstream = dynamic_cast<Midas3BitstreamTreeItem *>(node) ) != NULL ) { emit BitstreamOpenRequest(); } else { QTreeView::mouseDoubleClickEvent(event); } } void Midas3TreeViewClient::dragMoveEvent(QDragMoveEvent* event) { selectionModel()->clearSelection(); selectionModel()->select(this->indexAt(event->pos() ), QItemSelectionModel::Select | QItemSelectionModel::Rows); if( event->mimeData()->hasUrls() ) { Midas3TreeItem* node = const_cast<Midas3TreeItem *>( m_Model->GetMidasTreeItem(this->indexAt(event->pos() ) ) ); if( dynamic_cast<Midas3ItemTreeItem *>(node) ) { event->acceptProposedAction(); } else if( dynamic_cast<Midas3FolderTreeItem *>(node) && !dynamic_cast<m3do::Community *>(node->GetObject() ) ) { event->acceptProposedAction(); } else { event->setAccepted(false); } } else if( event->mimeData()->hasFormat("MIDAS/server_resource") ) { event->setAccepted(!indexAt(event->pos() ).isValid() ); } } void Midas3TreeViewClient::dropEvent(QDropEvent* event) { if( !event || !event->mimeData() ) { event->setAccepted(false); return; } const QMimeData* md = event->mimeData(); if( md->hasUrls() ) { Midas3ItemTreeItem* item = NULL; Midas3FolderTreeItem* folder = NULL; Midas3TreeItem* node = const_cast<Midas3TreeItem *>( m_Model->GetMidasTreeItem(this->indexAt(event->pos() ) ) ); QStringList files; foreach(QUrl url, md->urls() ) { QFileInfo info(url.toLocalFile() ); if( info.exists() && info.isFile() ) { files << url.toLocalFile(); } } if( (item = dynamic_cast<Midas3ItemTreeItem *>(node) )) { emit BitstreamsDroppedIntoItem(item, files); event->acceptProposedAction(); } else if( (folder = dynamic_cast<Midas3FolderTreeItem *>(node) ) && !dynamic_cast<m3do::Community *>(node->GetObject() ) ) { emit BitstreamsDroppedIntoFolder(folder, files); event->acceptProposedAction(); } } else if( md->hasFormat("MIDAS/server_resource") ) { QString data = QString(md->data("MIDAS/server_resource") ); std::vector<std::string> tokens; midasUtils::Tokenize(data.toStdString(), tokens); int type = atoi(tokens[0].c_str() ); int id = atoi(tokens[1].c_str() ); emit ResourceDropped(type, id); event->acceptProposedAction(); } } void Midas3TreeViewClient::expandAll() { m_Model->ExpandAllResources(); Midas3TreeView::expandAll(); } void Midas3TreeViewClient::collapseAll() { m_Model->ClearExpandedList(); Midas3TreeView::collapseAll(); } void Midas3TreeViewClient::FetchItemData(Midas3TreeItem* item) { Midas3FolderTreeItem* folderTreeItem = NULL; Midas3ItemTreeItem* itemTreeItem = NULL; Midas3BitstreamTreeItem* bitstreamTreeItem = NULL; if( (folderTreeItem = dynamic_cast<Midas3FolderTreeItem *>(item) ) != NULL ) { m3ds::Folder mdsFolder; mdsFolder.SetObject(folderTreeItem->GetFolder() ); mdsFolder.Fetch(); emit Midas3FolderTreeItemSelected(folderTreeItem); } else if( (itemTreeItem = dynamic_cast<Midas3ItemTreeItem *>(item) ) != NULL ) { m3ds::Item mdsItem; mdsItem.SetObject(itemTreeItem->GetItem() ); mdsItem.Fetch(); emit Midas3ItemTreeItemSelected(itemTreeItem); } else if( (bitstreamTreeItem = dynamic_cast<Midas3BitstreamTreeItem *>(item) ) != NULL ) { m3ds::Bitstream mdsBitstream; mdsBitstream.SetObject(bitstreamTreeItem->GetBitstream() ); mdsBitstream.Fetch(); emit Midas3BitstreamTreeItemSelected(bitstreamTreeItem); } } void Midas3TreeViewClient::AddResource(mdo::Object* object) { m_Model->AddResource(object); } void Midas3TreeViewClient::UpdateResource(mdo::Object *) { } void Midas3TreeViewClient::DeleteResource(mdo::Object* object) { m_Model->DeleteResource(object); }
29.757848
114
0.66953
midasplatform
787f0b85b45535b03e7667b10d86a331eb5581a6
808
cpp
C++
reddit-v1-user-agent.cpp
JulienRaynal/orca
0ab3f232273209d48a088fc5d050a4e4b35c6c58
[ "MIT" ]
null
null
null
reddit-v1-user-agent.cpp
JulienRaynal/orca
0ab3f232273209d48a088fc5d050a4e4b35c6c58
[ "MIT" ]
null
null
null
reddit-v1-user-agent.cpp
JulienRaynal/orca
0ab3f232273209d48a088fc5d050a4e4b35c6c58
[ "MIT" ]
null
null
null
#include <stdarg.h> #include "orka-user-agent.hpp" #include "reddit-v1-user-agent.hpp" #define BASE_API_URL "https://www.reddit.com/api/v1" namespace reddit { namespace v1 { namespace user_agent { void init(struct dati *ua, char *username, char *password) { ua_init(&ua->common, BASE_API_URL); ua->username = username; } /* template function for performing requests */ void run( struct dati *ua, struct resp_handle *resp_handle, struct sized_buffer *req_body, enum http_method http_method, char endpoint[], ...) { //create the url route va_list args; va_start (args, endpoint); orka::user_agent::vrun( &ua->common, resp_handle, req_body, http_method, endpoint, args); va_end(args); } } // namespace user_agent } // namespace v1 } // namespace reddit
17.565217
54
0.689356
JulienRaynal
7880b4f9b41e4fb3a106344dc0116fc606fc25f1
862
hpp
C++
src/stan/algorithms/hmc/nuts/dense_e_nuts.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
1
2019-09-06T15:53:17.000Z
2019-09-06T15:53:17.000Z
src/stan/algorithms/hmc/nuts/dense_e_nuts.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
8
2019-01-17T18:51:16.000Z
2019-01-17T18:51:39.000Z
src/stan/algorithms/hmc/nuts/dense_e_nuts.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
null
null
null
#ifndef STAN_MCMC_HMC_NUTS_DENSE_E_NUTS_HPP #define STAN_MCMC_HMC_NUTS_DENSE_E_NUTS_HPP #include "base_nuts.hpp" #include "stan/algorithms/hmc/hamiltonians/dense_e_point.hpp" #include "stan/algorithms/hmc/hamiltonians/dense_e_metric.hpp" #include "stan/algorithms/hmc/integrators/expl_leapfrog.hpp" namespace stan { namespace mcmc { /** * The No-U-Turn sampler (NUTS) with multinomial sampling * with a Gaussian-Euclidean disintegration and dense metric */ template <class Model, class BaseRNG> class dense_e_nuts : public base_nuts<Model, dense_e_metric, expl_leapfrog, BaseRNG> { public: dense_e_nuts(const Model& model, BaseRNG& rng) : base_nuts<Model, dense_e_metric, expl_leapfrog, BaseRNG>(model, rng) { } }; } // mcmc } // stan #endif
31.925926
67
0.684455
alashworth
788506ffa89bf819a0e5979bc17f1ad21947cf41
1,986
cpp
C++
src/activation.cpp
NicolasMakaroff/MLMVN
7a4941f57862c74173c755b6ffc48789c049baec
[ "MIT" ]
null
null
null
src/activation.cpp
NicolasMakaroff/MLMVN
7a4941f57862c74173c755b6ffc48789c049baec
[ "MIT" ]
null
null
null
src/activation.cpp
NicolasMakaroff/MLMVN
7a4941f57862c74173c755b6ffc48789c049baec
[ "MIT" ]
null
null
null
#include "activation.hpp" /** Short class for different activation functions */ // Discrete activation function std::string activation::getType(){ return "ToDo"; } void activation::setType(std::string type){ } std::complex<double> activation::NonPeriodicDiscrete(std::complex<double> z_, int categories){ double arg_z = activation::shiftAngle(std::arg(z_)); int cat = int(floor((categories * arg_z)/(2*M_PI))); std::complex<double> projection = std::complex<double>(std::polar(1.0,2*M_PI*cat / categories)); if(std::imag(projection) < 0.000001){ std::complex<double> z1 = std::complex<double>(std::real(projection),0); return z1; } if(std::real(projection) < 0.000001){ std::complex<double> z2 = std::complex<double>(0,std::imag(projection)); return z2; } return projection; } std::complex<double> activation::NonPeriodicContinuous(std::complex<double> z_){ double arg_z = shiftAngle(std::arg(z_)); std::complex<double> projection = std::polar(1.0,arg_z); if(std::imag(projection) < 0.000001){ projection = std::complex<double>(std::real(projection),0); } return projection; } std::complex<double> PeriodicDiscrete(std::complex<double> z_, int categories, int periods){ double arg_z = activation::shiftAngle(std::arg(z_)); int cat = int(floor((categories * periods * arg_z)/2*M_PI)); double arg2 = std::fmod(cat,categories); std::complex<double> projection = std::polar(1.0, 2*M_PI*arg2 / categories); if(std::imag(projection) < 0.000001){ projection = std::complex<double>(std::real(projection),0); } return projection; } /** std::complex<double> PeriodicContinuous(std::complex<double> z_, int periods){ }*/ double activation::shiftAngle(double z){ return std::fmod(z + 2*M_PI,2*M_PI); }
32.032258
104
0.618328
NicolasMakaroff
788802120fed832a426fba6c4d259e8035b2592b
1,730
cpp
C++
test/unit/core-sigcxx/trackable-test.cpp
zhanggyb/skland
055d91a6830b95d248d407c37a8a2fa20b148efd
[ "Apache-2.0" ]
20
2017-01-11T05:59:18.000Z
2019-08-17T03:21:38.000Z
test/unit/core-sigcxx/trackable-test.cpp
zhanggyb/skland
055d91a6830b95d248d407c37a8a2fa20b148efd
[ "Apache-2.0" ]
null
null
null
test/unit/core-sigcxx/trackable-test.cpp
zhanggyb/skland
055d91a6830b95d248d407c37a8a2fa20b148efd
[ "Apache-2.0" ]
3
2017-03-03T17:37:10.000Z
2018-08-08T12:44:23.000Z
// // Created by zhanggyb on 16-9-19. // #include "trackable-test.hpp" #include <skland/core/sigcxx.hpp> #include "subject.hpp" #include "observer.hpp" using namespace skland; using namespace skland::core; TEST_F(TrackableTest, slot_1) { Subject subject; Observer observer; subject.signal1().Connect(&observer, &Observer::OnSignal1); subject.Test(1); // Emit signal1: 1 ASSERT_TRUE(observer.count1() == 1); } TEST_F(TrackableTest, unbind_signal_1) { Subject subject; Observer observer1; Observer observer2; Observer observer3; subject.signal1().Connect(&observer1, &Observer::OnSignal1); subject.signal1().Connect(&observer2, &Observer::OnUnbindSlot); subject.signal1().Connect(&observer3, &Observer::OnSignal1); subject.Test(1); // Emit signal1: 1 ASSERT_TRUE(subject.signal1().CountConnections() == 2); } TEST_F(TrackableTest, unbind_all_signals_1) { Subject subject; Observer observer1; subject.signal1().Connect(&observer1, &Observer::OnSignal1); subject.signal1().Connect(&observer1, &Observer::OnUnbindAllSignals); subject.signal1().Connect(&observer1, &Observer::OnSignal1); subject.Test(1); // Emit signal1: 1 ASSERT_TRUE(subject.signal1().CountConnections() == 0); } TEST_F(TrackableTest, delete_this_1) { Subject subject; auto* observer1 = new Observer; auto* observer2 = new Observer; auto* observer3 = new Observer; subject.signal1().Connect(observer1, &Observer::OnSignal1); subject.signal1().Connect(observer2, &Observer::OnDeleteThis); subject.signal1().Connect(observer3, &Observer::OnSignal1); subject.Test(1); // Emit signal1: 1 ASSERT_TRUE(subject.signal1().CountConnections() == 2); delete observer1; delete observer3; }
24.366197
71
0.726012
zhanggyb
788ad416c7b1689e0f5bff361fcca8d74906e439
8,088
cc
C++
src/tim/lite/execution.cc
2019dj/TIM-VX
b3e52591f412d95a2deeebc7e2d8aca2bc909352
[ "MIT" ]
118
2021-01-12T01:56:25.000Z
2022-03-30T09:50:58.000Z
src/tim/lite/execution.cc
2019dj/TIM-VX
b3e52591f412d95a2deeebc7e2d8aca2bc909352
[ "MIT" ]
114
2021-01-29T08:21:43.000Z
2022-03-28T11:58:10.000Z
src/tim/lite/execution.cc
2019dj/TIM-VX
b3e52591f412d95a2deeebc7e2d8aca2bc909352
[ "MIT" ]
56
2021-01-12T02:42:53.000Z
2022-03-24T02:15:20.000Z
/**************************************************************************** * * Copyright (c) 2021 Vivante Corporation * * 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 "execution_private.h" #include <cstdint> #include <cstring> #include <vector> #include <memory> #include "handle_private.h" #include "vip_lite.h" namespace tim { namespace lite { namespace { bool QueryInputBufferParameters( vip_buffer_create_params_t& param, uint32_t index, vip_network network) { uint32_t count = 0; vip_query_network(network, VIP_NETWORK_PROP_INPUT_COUNT, &count); if (index >= count) { return false; } memset(&param, 0, sizeof(param)); param.memory_type = VIP_BUFFER_MEMORY_TYPE_DEFAULT; vip_query_input(network, index, VIP_BUFFER_PROP_DATA_FORMAT, &param.data_format); vip_query_input(network, index, VIP_BUFFER_PROP_NUM_OF_DIMENSION, &param.num_of_dims); vip_query_input(network, index, VIP_BUFFER_PROP_SIZES_OF_DIMENSION, param.sizes); vip_query_input(network, index, VIP_BUFFER_PROP_QUANT_FORMAT, &param.quant_format); switch(param.quant_format) { case VIP_BUFFER_QUANTIZE_DYNAMIC_FIXED_POINT: vip_query_input(network, index, VIP_BUFFER_PROP_FIXED_POINT_POS, &param.quant_data.dfp.fixed_point_pos); break; case VIP_BUFFER_QUANTIZE_TF_ASYMM: vip_query_input(network, index, VIP_BUFFER_PROP_TF_SCALE, &param.quant_data.affine.scale); vip_query_input(network, index, VIP_BUFFER_PROP_TF_ZERO_POINT, &param.quant_data.affine.zeroPoint); default: break; } return true; } bool QueryOutputBufferParameters( vip_buffer_create_params_t& param, uint32_t index, vip_network network) { uint32_t count = 0; vip_query_network(network, VIP_NETWORK_PROP_OUTPUT_COUNT, &count); if (index >= count) { return false; } memset(&param, 0, sizeof(param)); param.memory_type = VIP_BUFFER_MEMORY_TYPE_DEFAULT; vip_query_output(network, index, VIP_BUFFER_PROP_DATA_FORMAT, &param.data_format); vip_query_output(network, index, VIP_BUFFER_PROP_NUM_OF_DIMENSION, &param.num_of_dims); vip_query_output(network, index, VIP_BUFFER_PROP_SIZES_OF_DIMENSION, param.sizes); vip_query_output(network, index, VIP_BUFFER_PROP_QUANT_FORMAT, &param.quant_format); switch(param.quant_format) { case VIP_BUFFER_QUANTIZE_DYNAMIC_FIXED_POINT: vip_query_output(network, index, VIP_BUFFER_PROP_FIXED_POINT_POS, &param.quant_data.dfp.fixed_point_pos); break; case VIP_BUFFER_QUANTIZE_TF_ASYMM: vip_query_output(network, index, VIP_BUFFER_PROP_TF_SCALE, &param.quant_data.affine.scale); vip_query_output(network, index, VIP_BUFFER_PROP_TF_ZERO_POINT, &param.quant_data.affine.zeroPoint); break; default: break; } return true; } } ExecutionImpl::ExecutionImpl(const void* executable, size_t executable_size) { vip_status_e status = VIP_SUCCESS; vip_network network = nullptr; std::vector<uint8_t> data(executable_size); valid_ = false; status = vip_init(); if (status != VIP_SUCCESS) { return; } memcpy(data.data(), executable, executable_size); status = vip_create_network(data.data(), data.size(), VIP_CREATE_NETWORK_FROM_MEMORY, &network); if (status == VIP_SUCCESS && network) { status = vip_prepare_network(network); if (status == VIP_SUCCESS) { network_ = network; valid_ = true; } else { vip_destroy_network(network); } } if (!valid_) { vip_destroy(); } } ExecutionImpl::~ExecutionImpl() { if (!valid_) { return; } if (network_) { vip_finish_network(network_); vip_destroy_network(network_); } input_maps_.clear(); output_maps_.clear(); vip_destroy(); } Execution& ExecutionImpl::BindInputs(const std::vector<std::shared_ptr<Handle>>& handles) { if (!IsValid()) { return *this; } vip_status_e status = VIP_SUCCESS; vip_buffer_create_params_t param = { 0 }; for (uint32_t i = 0; i < handles.size(); i ++) { auto handle = handles[i]; if (!handle) { status = VIP_ERROR_FAILURE; break; } std::shared_ptr<InternalHandle> internal_handle = nullptr; if (input_maps_.find(handle) == input_maps_.end()) { if (!QueryInputBufferParameters(param, i, network_)) { status = VIP_ERROR_FAILURE; break; } internal_handle = handle->impl()->Register(param); if (!internal_handle) { status = VIP_ERROR_FAILURE; break; } input_maps_[handle] = internal_handle; } else { internal_handle = input_maps_.at(handle); } status = vip_set_input(network_, i, internal_handle->handle()); if (status != VIP_SUCCESS) { break; } } return *this; }; Execution& ExecutionImpl::BindOutputs(const std::vector<std::shared_ptr<Handle>>& handles) { if (!IsValid()) { return *this; } vip_status_e status = VIP_SUCCESS; vip_buffer_create_params_t param = { 0 }; for (uint32_t i = 0; i < handles.size(); i ++) { auto handle = handles[i]; if (!handle) { status = VIP_ERROR_FAILURE; break; } std::shared_ptr<InternalHandle> internal_handle = nullptr; if (output_maps_.find(handle) == output_maps_.end()) { if (!QueryOutputBufferParameters(param, i, network_)) { status = VIP_ERROR_FAILURE; break; } internal_handle = handle->impl()->Register(param); if (!internal_handle) { status = VIP_ERROR_FAILURE; break; } output_maps_[handle] = internal_handle; } else { internal_handle = output_maps_.at(handle); } status = vip_set_output(network_, i, internal_handle->handle()); if (status != VIP_SUCCESS) { break; } } return *this; }; bool ExecutionImpl::Trigger() { if (!IsValid()) { return false; } vip_status_e status = vip_run_network(network_); return status == VIP_SUCCESS; }; std::shared_ptr<Execution> Execution::Create( const void* executable, size_t executable_size) { std::shared_ptr<ExecutionImpl> exec; if (executable && executable_size) { exec = std::make_shared<ExecutionImpl>(executable, executable_size); if (!exec->IsValid()) { exec.reset(); } } return exec; } } }
35.165217
92
0.626978
2019dj
788c8b959e0067c449f323b80847b4c8d0aa7a9c
14,844
cpp
C++
0.52/GraySvr/CCharNPCStatus.cpp
Jhobean/Source-Archive
ab24ba44ffd34c329accedb980699e94c196fceb
[ "Apache-2.0" ]
2
2020-12-22T17:03:14.000Z
2021-07-31T23:59:05.000Z
0.52/GraySvr/CCharNPCStatus.cpp
Jhobean/Source-Archive
ab24ba44ffd34c329accedb980699e94c196fceb
[ "Apache-2.0" ]
null
null
null
0.52/GraySvr/CCharNPCStatus.cpp
Jhobean/Source-Archive
ab24ba44ffd34c329accedb980699e94c196fceb
[ "Apache-2.0" ]
4
2021-04-21T19:43:48.000Z
2021-10-07T00:38:23.000Z
// // CCharNPCStatus.cpp // Copyright Menace Software (www.menasoft.com). // // Test things to judge what an NPC might be thinking. (want to do) // But take no actions here. // #include "graysvr.h" // predef header. CREID_TYPE CChar::NPC_GetAllyGroupType(CREID_TYPE idTest) // static { switch ( idTest ) { case CREID_MAN: case CREID_WOMAN: case CREID_GHOSTMAN: case CREID_GHOSTWOMAN: return( CREID_MAN ); case CREID_ETTIN: case CREID_ETTIN_AXE: return( CREID_ETTIN ); case CREID_ORC_LORD: case CREID_ORC: case CREID_ORC_CLUB: return( CREID_ORC ); case CREID_DAEMON: case CREID_DAEMON_SWORD: return( CREID_DAEMON ); case CREID_DRAGON_GREY: case CREID_DRAGON_RED: case CREID_DRAKE_GREY: case CREID_DRAKE_RED: return( CREID_DRAGON_GREY ); case CREID_LIZMAN: case CREID_LIZMAN_SPEAR: case CREID_LIZMAN_MACE: return( CREID_LIZMAN ); case CREID_RATMAN: case CREID_RATMAN_CLUB: case CREID_RATMAN_SWORD: return( CREID_RATMAN ); case CREID_SKELETON: case CREID_SKEL_AXE: case CREID_SKEL_SW_SH: return( CREID_SKELETON ); case CREID_TROLL_SWORD: case CREID_TROLL: case CREID_TROLL_MACE: return( CREID_TROLL ); case CREID_Tera_Warrior: case CREID_Tera_Drone: case CREID_Tera_Matriarch: return( CREID_Tera_Drone ); case CREID_Ophid_Mage: case CREID_Ophid_Warrior: case CREID_Ophid_Queen: return( CREID_Ophid_Warrior ); case CREID_HORSE1: case CREID_HORSE4: case CREID_HORSE2: case CREID_HORSE3: case CREID_HORSE_PACK: return( CREID_HORSE1 ); case CREID_BrownBear: case CREID_GrizzlyBear: case CREID_PolarBear: return( CREID_BrownBear ); case CREID_Cow_BW: case CREID_Cow2: case CREID_Bull_Brown: case CREID_Bull2: return( CREID_Bull_Brown ); case CREID_Ostard_Desert: case CREID_Ostard_Frenz: case CREID_Ostard_Forest: return( CREID_Ostard_Forest ); case CREID_Sheep: case CREID_Sheep_Sheered: return( CREID_Sheep ); case CREID_Hart: case CREID_Deer: return( CREID_Deer ); case CREID_Pig: case CREID_Boar: return( CREID_Pig ); case CREID_Llama: case CREID_LLAMA_PACK: return( CREID_Llama ); } return( idTest ); } int CChar::NPC_OnHearName( const TCHAR * pszText ) const { // Did I just hear my name ? // RETURN: // index to skip past the name. const TCHAR * pszName = GetName(); int i = FindStrWord( pszText, pszName ); if ( i ) return( i ); // Named the chars type ? (must come first !) pszName = m_pDef->GetTradeName(); for ( i=0; pszText[i] != '\0'; i++ ) { if ( pszName[i] == '\0' ) { // found name. while ( ISWHITESPACE( pszText[i] )) i ++; return( i ); // Char name found } if ( toupper( pszName[i] ) != toupper( pszText[i] )) // not the name. break; } return( 0 ); } bool CChar::NPC_CanSpeak() const { if ( m_pNPC == NULL ) // all players can speak. return( true ); return( m_pNPC->m_Speech.GetCount() || m_pDef->m_Speech.GetCount() ); } bool CChar::NPC_FightMayCast() const { // This NPC could cast spells if they wanted to ? // check mana and anti-magic #define NPC_MAGERY_MIN_CAST 300 // Min magery to cast. int iSkillVal = Skill_GetBase(SKILL_MAGERY); if ( iSkillVal < NPC_MAGERY_MIN_CAST ) return( false ); if ( m_pArea->IsFlag( REGION_ANTIMAGIC_DAMAGE | REGION_FLAG_SAFE )) // can't cast here. return false; if ( m_StatMana < 5 ) return( false ); return( true ); } bool CChar::NPC_IsSpawnedBy( const CItem * pItem ) const { if ( ! IsStat( STATF_Spawned )) // shortcut - i'm not a spawned. return( false ); return( Memory_FindObjTypes( pItem, MEMORY_ISPAWNED ) != NULL ); } bool CChar::NPC_IsOwnedBy( const CChar * pChar, bool fAllowGM ) const { // fAllowGM = consider GM's to be owners of all NPC's if ( this == pChar ) return( true ); if ( fAllowGM && pChar->IsPriv( PRIV_GM )) return( pChar->GetPrivLevel() > GetPrivLevel()); if ( ! IsStat( STATF_Pet ) || m_pPlayer ) // shortcut - i'm not a pet. return( false ); return( Memory_FindObjTypes( pChar, MEMORY_IPET ) != NULL ); } CChar * CChar::NPC_GetOwner() const { // Assume i am a pet. Get my first (primary) owner. if ( ! IsStat( STATF_Pet )) return( NULL ); CItemMemory * pMemory = Memory_FindTypes( MEMORY_IPET ); if ( pMemory == NULL ) { // ClearStat( STATF_Pet ); DEBUG_CHECK(0); return( NULL ); } return( pMemory->m_uidLink.CharFind()); } int CChar::NPC_GetTrainMax( SKILL_TYPE Skill ) const { // What is the max I can train to ? int iMax = IMULDIV( g_Serv.m_iTrainSkillPercent, Skill_GetBase(Skill), 100 ); if ( iMax > g_Serv.m_iTrainSkillMax ) return( g_Serv.m_iTrainSkillMax ); return( iMax ); } bool CChar::NPC_CheckWalkHere( const CPointBase & pt, const CRegionBase * pArea ) const { // Does the NPC want to walk here ? step on this item ? ASSERT( m_pNPC ); // not an NPC if ( m_pArea != NULL ) // most decisions are based on area. { if ( m_pNPC->m_Brain == NPCBRAIN_GUARD && ! IsStat( STATF_War )) { // Guards will want to stay in guard range. if ( m_pArea->IsGuarded() && ! pArea->IsGuarded()) { return( false ); } } if ( IsEvil() && Stat_Get(STAT_INT) > 20 ) { if ( ! m_pArea->IsGuarded() && pArea->IsGuarded()) // too smart for this. { return( false ); } } } // Is there a nasty object here that will hurt us ? CWorldSearch AreaItems( pt ); while (true) { CItem * pItem = AreaItems.GetItem(); if ( pItem == NULL ) break; int zdiff = pItem->GetTopZ() - pt.m_z; if ( abs(zdiff) > 3 ) continue; int iIntToAvoid = 10; // how intelligent do i have to be to avoid this. switch ( pItem->m_type ) { case ITEM_SHRINE: case ITEM_DREAM_GATE: case ITEM_ADVANCE_GATE: // always avoid. return( false ); case ITEM_WEB: if ( GetDispID() == CREID_GIANT_SPIDER ) continue; iIntToAvoid = 80; goto try_avoid; case ITEM_FIRE: // fire object hurts us ? if ( m_pDef->Can(CAN_C_FIRE_IMMUNE)) // i like fire. continue; #if 0 // standing on burning kindling shouldn't hurt us ? if ( pItem->GetDispID() >= ITEMID_CAMPFIRE && pItem->GetDispID() < ITEMID_EMBERS ) continue; #endif iIntToAvoid = 20; // most creatures recognize fire as bad. goto try_avoid; case ITEM_SPELL: iIntToAvoid = 150; goto try_avoid; case ITEM_TRAP: iIntToAvoid = 150; goto try_avoid; case ITEM_TRAP_ACTIVE: iIntToAvoid = 50; goto try_avoid; case ITEM_MOONGATE: case ITEM_TELEPAD: try_avoid: if ( GetRandVal( Stat_Get(STAT_INT)) > GetRandVal( iIntToAvoid )) return( false ); break; } } return( true ); } //////////////////////////////////////////////////////////////////// // This stuff is still questionable. int CChar::NPC_WantThisItem( CItem * pItem ) const { // This should be the ULTIMATE place to check if the NPC wants this in any way. // May not want to use it but rather just put it in my pack. // // NOTE: // Don't check if i can see this or i can reach it. // Also take into consideration that some items such as: // ex. i want to eat fruit off a fruit tree. // ex. i want raw food that may be cooked etc. // ex. I want a corpse that i can cut up and eat the parts. // ex. I want a chest to loot. // RETURN: // 0-100 percent = how bad do we want it ? if ( ! CanMove( pItem, false )) { // Some items like fruit trees, chests and corpses might still be useful. return( false ); } bool bWantGold = false; if ( strstr( m_pDef->m_sDesires, "GOLD" ) != 0 ) bWantGold = true; switch ( pItem->GetDispID()) { case ITEMID_FOOD_MEAT_RAW: // I want this if I eat meat if ( strstr( m_pDef->m_sFoodType, "MEAT" )) return true; if ( strstr( m_pDef->m_sFoodType, "ANY" )) return true; break; case ITEMID_HIDES: // I want this if I eat leather if ( strstr( m_pDef->m_sDesires, "LEATHER" )) return true; if ( strstr( m_pDef->m_sFoodType, "LEATHER" )) return true; break; } switch ( pItem->m_type ) { case ITEM_ARMOR: case ITEM_CLOTHING: break; case ITEM_AROCK: if ( strstr( m_pDef->m_sDesires, "ROCKS" )) return true; break; case ITEM_FOOD: // I want this if I eat ANY food type if (strstr( m_pDef->m_sFoodType, "ANY" )) return true; break; case ITEM_COIN: if ( bWantGold ) return true; } // anything else to check for? if ( strstr( m_pDef->m_sFoodType, "ANY") || strstr( m_pDef->m_sFoodType, "FRUIT")) { if ( pItem->m_pDef->IsFruit( pItem->GetDispID())) return true; } // If I'm smart and I want gold, I'll pick up valuables too (can be sold) if ( bWantGold && Stat_Get(STAT_INT) > 50 && pItem->GetBasePrice( false ) > 30 ) return true; // I guess I don't want it return 0; } int CChar::NPC_WantToUseThisItem( const CItem * pItem ) const { // Does the NPC want to use the item now ? // This may be reviewing items i have in my pack. // // ex. armor is better than what i'm wearing ? // ex. str potion in battle. // ex. heal potion in battle. // ex. food when i'm hungry. return( 0 ); } int CChar::NPC_GetHostilityLevelToward( CChar * pCharTarg ) const { // What is my general hostility level toward this type of creature ? // // based on: // npc vs player, (evil npc's don't like players regurdless of align, xcept in town) // karma (we are of different alignments) // creature body type. (allie groups) // hunger, (they could be food) // memories of this creature. // // DO NOT consider: // strength, he is far stronger or waeker than me. // health, i may be near death. // location (guarded area), (xcept in the case that evil people like other evils in town) // loot, etc. // // RETURN: // 100 = extreme hatred. // 0 = neutral. // -100 = love them // if ( pCharTarg == NULL ) return( 0 ); if ( pCharTarg->IsStat( STATF_DEAD | STATF_INVUL | STATF_Stone )) return( 0 ); ASSERT(m_pNPC); int iKarma = Stat_Get(STAT_Karma); int iHostility = 0; if ( IsEvil() && // i am evil. ! m_pArea->IsGuarded() && // we are not in an evil town. pCharTarg->m_pPlayer ) // my target is a player. { // If i'm evil i give no benefit to players with bad karma. // I hate all players. // Unless i'm in a guarded area. then they are cool. iHostility = 51; } else if ( m_pNPC->m_Brain == NPCBRAIN_BESERK ) // i'm beserk. { // beserks just hate everyone all the time. iHostility = 100; } else if ( pCharTarg->m_pNPC && // my target is an NPC pCharTarg->m_pNPC->m_Brain != NPCBRAIN_BESERK && // ok to hate beserks. ! g_Serv.m_fMonsterFight ) // monsters are not supposed to fight other monsters ! { iHostility = -50; goto domemorybase; // set this low in case we are defending ourselves. but not attack for hunger. } else { // base hostillity on karma diff. if ( iKarma < 0 ) { // I'm evil. iHostility += ( - iKarma ) / 1024; } else if ( pCharTarg->IsEvil()) { // I'm good and my target is evil. iHostility += ( iKarma ) / 1024; } } // Based on just creature type. if ( pCharTarg->m_pNPC ) { // Human NPC's will attack humans . if ( GetDispID() == pCharTarg->GetDispID()) { // I will never attack those of my own kind...even if starving iHostility -= 100; } else if ( NPC_GetAllyGroupType( GetDispID()) == NPC_GetAllyGroupType(pCharTarg->GetDispID())) { iHostility -= 50; } else if ( pCharTarg->m_pNPC->m_Brain == m_pNPC->m_Brain ) // My basic kind { // Won't attack other monsters. (unless very hungry) iHostility -= 30; } } else { // Not immediately hostile if looks the same as me. if ( ! IsHuman() && NPC_GetAllyGroupType( GetDispID()) == NPC_GetAllyGroupType(pCharTarg->GetDispID())) { iHostility -= 51; } } // How hungry am I? Could this creature be food ? // some creatures are not appetising. { int iFoodLevel = GetFoodLevelPercent(); if ( iFoodLevel < 50 && CanEat( pCharTarg ) > iFoodLevel ) { if ( iFoodLevel < 10 ) { iHostility += 20; } if ( iFoodLevel < 1 ) { iHostility += 20; } } } domemorybase: // I have been attacked/angered by this creature before ? CItemMemory * pMemory = Memory_FindObjTypes( pCharTarg, MEMORY_FIGHT|MEMORY_AGGREIVED |MEMORY_IRRITATEDBY|MEMORY_SAWCRIME ); if ( pMemory ) { iHostility += 50; } return( iHostility ); } int CChar::NPC_GetAttackContinueMotivation( CChar * pChar, int iMotivation ) const { // I have seen fit to attack them. // How much do i want to continue an existing fight ? cowardice ? // ARGS: // iMotivation = My base motivation toward this creature. // // RETURN: // -101 = ? dead meat. (run away) // // 0 = I'm have no interest. // 50 = even match. // 100 = he's a push over. ASSERT( m_pNPC ); if ( m_pNPC->m_Brain == NPCBRAIN_BESERK ) { // Less interested the further away they are. return( iMotivation + 80 - GetDist( pChar )); } // Undead are fearless. if ( m_pNPC->m_Brain == NPCBRAIN_UNDEAD || m_pNPC->m_Brain == NPCBRAIN_GUARD || m_pNPC->m_Brain == NPCBRAIN_CONJURED ) iMotivation += 90; // Try to stay on one target. if ( IsStat( STATF_War ) && m_Act_Targ == pChar->GetUID()) iMotivation += 8; // Less interested the further away they are. iMotivation -= GetDist( pChar ); if ( ! g_Serv.m_fMonsterFear ) { return( iMotivation ); } // I'm just plain stronger. iMotivation += ( Stat_Get(STAT_STR) - pChar->Stat_Get(STAT_STR)); // I'm healthy. int iTmp = GetHealthPercent() - pChar->GetHealthPercent(); if ( iTmp < -50 ) iMotivation -= 50; else if ( iTmp > 50 ) iMotivation += 50; // I'm smart and therefore more cowardly. (if injured) iMotivation -= Stat_Get(STAT_INT) / 16; return( iMotivation ); } int CChar::NPC_GetAttackMotivation( CChar * pChar, int iMotivation ) const { // Some sort of monster. // Am I stronger than he is ? Should I continue fighting ? // Take into consideration AC, health, skills, etc.. // RETURN: // <-1 = dead meat. (run away) // 0 = I'm have no interest. // 50 = even match. // 100 = he's a push over. ASSERT( m_pNPC ); if ( m_StatHealth <= 0 ) return( -1 ); // I'm dead. if ( pChar == NULL ) return( 0 ); // Is the target interesting ? if ( pChar->m_pArea->IsFlag( REGION_FLAG_SAFE )) // universal return( 0 ); // If the area is guarded then think better of this. if ( pChar->m_pArea->IsGuarded() && m_pNPC->m_Brain != NPCBRAIN_GUARD ) // too smart for this. { iMotivation -= Stat_Get(STAT_INT) / 20; } // Owned by or is one of my kind ? CChar * pCharOwn = pChar->NPC_GetOwner(); if ( pCharOwn == NULL ) { pCharOwn = pChar; } iMotivation += NPC_GetHostilityLevelToward( pCharOwn ); if ( iMotivation > 0 ) { // Am i injured etc ? iMotivation = NPC_GetAttackContinueMotivation( pChar, iMotivation ); } #ifdef _DEBUG if ( g_Serv.m_wDebugFlags & DEBUGF_MOTIVATION ) { DEBUG_MSG(( "NPC_GetAttackMotivation '%s' for '%s' is %d\n", GetName(), pChar->GetName(), iMotivation )); } #endif return( iMotivation ); }
24.215334
125
0.662018
Jhobean
788dc407836449d0a88ff1a33ac18da7b3e01336
6,580
hpp
C++
include/networkit/distance/SSSP.hpp
kmc-kk/networkit
28c1208104acae8ef70911340bf88b3e3dd08db7
[ "MIT" ]
null
null
null
include/networkit/distance/SSSP.hpp
kmc-kk/networkit
28c1208104acae8ef70911340bf88b3e3dd08db7
[ "MIT" ]
null
null
null
include/networkit/distance/SSSP.hpp
kmc-kk/networkit
28c1208104acae8ef70911340bf88b3e3dd08db7
[ "MIT" ]
1
2020-02-05T17:39:47.000Z
2020-02-05T17:39:47.000Z
/* * SSSP.h * * Created on: 15.04.2014 * Author: cls */ #ifndef NETWORKIT_DISTANCE_SSSP_HPP_ #define NETWORKIT_DISTANCE_SSSP_HPP_ #include <set> #include <stack> #include <networkit/base/Algorithm.hpp> #include <networkit/graph/Graph.hpp> #include <networkit/auxiliary/Multiprecision.hpp> #include <tlx/define/deprecated.hpp> namespace NetworKit { /** * @ingroup distance * Abstract base class for single-source shortest path algorithms. */ class SSSP : public Algorithm { public: /** * Creates the SSSP class for @a G and source @a s. * * @param G The graph. * @param source The source node. * @param storePaths Paths are reconstructable and the number of paths is * stored. * @param storeNodesSortedByDistance Store a vector of nodes ordered in * increasing distance from the source. * @param target The target node. */ SSSP(const Graph &G, node source, bool storePaths = true, bool storeNodesSortedByDistance = false, node target = none); virtual ~SSSP() = default; /** Computes the shortest paths from the source to all other nodes. */ virtual void run() = 0; /** * Returns a vector of weighted distances from the source node, i.e. the * length of the shortest path from the source node to any other node. * * @return The weighted distances from the source node to any other node in * the graph. */ std::vector<edgeweight> TLX_DEPRECATED(getDistances(bool moveOut)); const std::vector<edgeweight> &getDistances(); /** * Returns the distance from the source node to @a t. * @param t Target node. * @return The distance from source to target node @a t. */ edgeweight distance(node t) const; /** * Returns the number of shortest paths between the source node and @a t. * @param t Target node. * @return The number of shortest paths between source and @a t. */ bigfloat numberOfPaths(node t) const; /** * Returns the number of shortest paths between the source node and @a t * as a double value. Workaround for Cython * @param t Target node. * @return The number of shortest paths between source and @a t. */ double _numberOfPaths(node t) const; /** * Returns the predecessor nodes of @a t on all shortest paths from source * to @a t. * @param t Target node. * @return The predecessors of @a t on all shortest paths from source to @a * t. */ std::vector<node> getPredecessors(node t) const; /** * Returns a shortest path from source to @a t and an empty path if source * and @a t are not connected. * * @param t Target node. * @param forward If @c true (default) the path is directed from source to * @a t, otherwise the path is reversed. * @return A shortest path from source to @a t or an empty path. */ std::vector<node> getPath(node t, bool forward = true) const; /** * Returns all shortest paths from source to @a t and an empty set if source * and @a t are not connected. * * @param t Target node. * @param forward If @c true (default) the path is directed from source to * @a t, otherwise the path is reversed. * @return All shortest paths from source node to target node @a t. */ std::set<std::vector<node>> getPaths(node t, bool forward = true) const; /* Returns the number of shortest paths to node t.*/ bigfloat getNumberOfPaths(node t) const; /** * Returns a vector of nodes ordered in increasing distance from the source. * * For this functionality to be available, storeNodesSortedByDistance has * to be set to true in the constructor. There are no guarantees regarding * the ordering of two nodes with the same distance to the source. * * @return vector of nodes ordered in increasing distance from the source */ std::vector<node> TLX_DEPRECATED(getNodesSortedByDistance(bool moveOut)); const std::vector<node> &getNodesSortedByDistance() const; /** * Returns the number of nodes reached by the source. */ count getReachableNodes() const { assureFinished(); return reachedNodes; } /** * Sets a new source. */ void setSource(node newSource) { if (!G.hasNode(newSource)) throw std::runtime_error("Error: node not in the graph."); source = newSource; } /** * Sets a new target. */ void setTarget(node newTarget) { if (!G.hasNode(newTarget)) throw std::runtime_error("Error: node not in the graph."); target = newTarget; } /** * Returns the sum of distances from the source node node to the reached * nodes. */ count getSumOfDistances() const { assureFinished(); return sumDist; } protected: const Graph &G; node source; node target; double sumDist; count reachedNodes; std::vector<edgeweight> distances; std::vector<std::vector<node>> previous; // predecessors on shortest path std::vector<bigfloat> npaths; std::vector<uint8_t> visited; uint8_t ts; std::vector<node> nodesSortedByDistance; bool storePaths; //!< if true, paths are reconstructable and the number of //!< paths is stored bool storeNodesSortedByDistance; //!< if true, store a vector of nodes //!< ordered in increasing distance from //!< the source }; inline edgeweight SSSP::distance(node t) const { return distances[t]; } inline bigfloat SSSP::numberOfPaths(node t) const { if (!storePaths) { throw std::runtime_error("number of paths have not been stored"); } return npaths[t]; } inline double SSSP::_numberOfPaths(node t) const { if (!storePaths) { throw std::runtime_error("number of paths have not been stored"); } bigfloat limit = std::numeric_limits<double>::max(); if (npaths[t] > limit) { throw std::overflow_error("number of paths do not fit into a double"); } double res; npaths[t].ToDouble(res); return res; } inline std::vector<node> SSSP::getPredecessors(node t) const { if (!storePaths) { throw std::runtime_error("predecessors have not been stored"); } return previous[t]; } inline bigfloat SSSP::getNumberOfPaths(node t) const { return npaths[t]; } } /* namespace NetworKit */ #endif // NETWORKIT_DISTANCE_SSSP_HPP_
30.604651
80
0.641793
kmc-kk
7894ed955d679957b3814246ccd588735a194ab9
2,748
cc
C++
cc/puzzle_6_1/main.cc
craig-chasseur/aoc2019
e2bed89deef4cabc37ff438dd7d26efe0187500b
[ "MIT" ]
null
null
null
cc/puzzle_6_1/main.cc
craig-chasseur/aoc2019
e2bed89deef4cabc37ff438dd7d26efe0187500b
[ "MIT" ]
null
null
null
cc/puzzle_6_1/main.cc
craig-chasseur/aoc2019
e2bed89deef4cabc37ff438dd7d26efe0187500b
[ "MIT" ]
null
null
null
#include <fstream> #include <iostream> #include <string> #include <type_traits> #include <utility> #include <vector> #include "absl/container/flat_hash_map.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" #include "cc/util/check.h" namespace { class OrbitGraph { public: OrbitGraph() = default; void AddOrbit(std::string orbiter, std::string center) { CHECK(name_to_node_.try_emplace(std::move(orbiter), std::move(center)) .second); } int CountOrbits() { int total = 0; for (auto& name_and_node : name_to_node_) { total += CountOrbitsForNode(&name_and_node.second); } return total; } int CountTransfers(absl::string_view src, absl::string_view dst) const { absl::flat_hash_map<absl::string_view, int> src_distance; int current_src_distance = 0; auto src_it = name_to_node_.find(src); while (src_it != name_to_node_.end()) { src_distance.try_emplace(src_it->second.parent, current_src_distance++); src_it = name_to_node_.find(src_it->second.parent); } int current_dst_distance = 0; auto dst_it = name_to_node_.find(dst); while (dst_it != name_to_node_.end()) { auto common_ancestor_it = src_distance.find(dst_it->second.parent); if (common_ancestor_it != src_distance.end()) { return current_dst_distance + common_ancestor_it->second; } ++current_dst_distance; dst_it = name_to_node_.find(dst_it->second.parent); } CHECK(false); } private: struct Node { explicit Node(std::string parent_in) : parent(parent_in) {} std::string parent; int orbit_count = -1; // memoized once initially counted }; int CountOrbitsForNode(Node* node) { if (node->orbit_count >= 0) return node->orbit_count; if (node->parent == "COM") { node->orbit_count = 1; } else { auto parent_it = name_to_node_.find(node->parent); CHECK(parent_it != name_to_node_.end()); node->orbit_count = 1 + CountOrbitsForNode(&parent_it->second); } return node->orbit_count; } absl::flat_hash_map<std::string, Node> name_to_node_; }; OrbitGraph ReadOrbits(const char* filename) { OrbitGraph graph; std::ifstream stream(filename); std::string buffer; while (stream >> buffer) { std::vector<std::string> parts = absl::StrSplit(buffer, absl::ByChar(')')); CHECK(parts.size() == 2); graph.AddOrbit(std::move(parts[1]), std::move(parts[0])); } stream.close(); return graph; } } // namespace int main(int argc, char** argv) { if (argc != 2) { std::cerr << "USAGE: main FILENAME\n"; return 1; } OrbitGraph graph = ReadOrbits(argv[1]); std::cout << graph.CountTransfers("YOU", "SAN") << "\n"; return 0; }
26.941176
79
0.663028
craig-chasseur
7896682deb89ff1aa82cf5cbceb3fe2e3f9a7c02
8,692
cpp
C++
src/SVArduino/sv_client.cpp
Sundiverr/SVisual
0b652efbd6ebb16db7d2a618db6f4ee8203e6310
[ "MIT" ]
1
2019-04-30T20:51:02.000Z
2019-04-30T20:51:02.000Z
src/SVArduino/sv_client.cpp
Sundiverr/SVisual
0b652efbd6ebb16db7d2a618db6f4ee8203e6310
[ "MIT" ]
null
null
null
src/SVArduino/sv_client.cpp
Sundiverr/SVisual
0b652efbd6ebb16db7d2a618db6f4ee8203e6310
[ "MIT" ]
null
null
null
#include <stdlib.h> #include <string.h> #include <Ethernet.h> #include <WiFi.h> #include "MsTimer2.h" #include "SVClient.h" #include "sv_auxFunc.h" #include "sv_structurs.h" #include "sv_binTree.h" #include "sv_objClient.h" namespace svisual{ sv_client objCln; // connect to server of ethernet // module - name module (create on server or the first call) // macAddrModule - mac addr module // ipAddrModule - ipaddr module // ipAddrServ - ipaddr server bool connectOfEthernet(const char* module, const char* macAddrModule, const char* ipAddrModule, const char* ipAddrServ, int portServ){ return objCln.connectOfEthernet(module, macAddrModule, ipAddrModule, ipAddrServ, portServ); } // connect to server of wifi // module - name module (create on server or the first call) // ssid - your network SSID // pass - secret password network // ipAddrServ - ipaddr server // portServ - port server bool connectOfWiFi(const char* module, const char* ssid, const char* pass, const char* ipAddrServ, int portServ){ return objCln.connectOfWiFi(module, ssid, pass, ipAddrServ, portServ); } // connect to server of COM // module - name module // comPort - com port // ipAddrServ - ipaddr server // portServ - port server bool connectOfCOM(const char* module, int speed){ return objCln.connectOfCOM(module, speed); } // add value for rec bool addBoolValue(const char* name, bool value_in, bool onlyPosFront){ value val; val.tBool = value_in; return objCln.addValue(name, valueType::tBool, val, onlyPosFront); } // add value for rec bool addIntValue(const char* name, int value_in){ value val; val.tInt = value_in; return objCln.addValue(name, valueType::tInt, val); } // add value for rec bool addFloatValue(const char* name, float value_in){ value val; val.tFloat = value_in; return objCln.addValue(name, valueType::tFloat, val); } bool sv_client::tcpConnect(){ if (isWiFi_) WiFi.begin(ssid_, pass_); return ethClient_->connect(ipServer_, portServ_); } void thrProc(){ objCln.doSendCyc(); } bool sv_client::connectOfEthernet(const char* moduleName, const char* macAddrModule, const char* ipAddrModule, const char* ipAddrServ, int port){ if (isConnect_) return true; int len = strlen(moduleName); if ((len == 0) || (len >= SV_NAMESZ)) return false; if (strstr(moduleName, "=end=") || strstr(moduleName, "=begin=")) return false; byte macModule[6]; byte ipModule[4]; strcpy(module_, moduleName); parseBytes(macAddrModule, '-', macModule, 6, 16); parseBytes(ipAddrModule, '.', ipModule, 4, 10); parseBytes(ipAddrServ, '.', ipServer_, 4, 10); portServ_ = port; Ethernet.begin(macModule, ipModule); if (!ethClient_) ethClient_ = new EthernetClient(); for (int i = 0; i < 10; ++i){ isConnect_ = ethClient_->connect(ipServer_, portServ_); if (isConnect_) break; delay(1000); } if (isConnect_ ){ MsTimer2::set(SV_CYCLEREC_MS, thrProc); MsTimer2::start(); } return isConnect_; } bool sv_client::connectOfWiFi(const char* moduleName, const char* ssid, const char* pass, const char* ipAddrServ, int port){ if (isConnect_) return true; int len = strlen(moduleName); if ((len == 0) || (len >= SV_NAMESZ)) return false; if (strstr(moduleName, "=end=") || strstr(moduleName, "=begin=")) return false; strcpy(module_, moduleName); parseBytes(ipAddrServ, '.', ipServer_, 4, 10); portServ_ = port; for (int i = 0; i < 3; ++i){ if (WiFi.begin((char*)ssid, pass) == WL_CONNECTED){ isConnect_ = true; break; } delay(10000); } if (!isConnect_) return false; isWiFi_ = true; ssid_ = (char*)realloc((void*)ssid_, strlen(ssid) + 1); strcpy(ssid_, ssid); pass_ = (char*)realloc((void*)pass_, strlen(pass) + 1); strcpy(pass_, pass); if (!ethClient_) ethClient_ = new WiFiClient(); for (int i = 0; i < 10; ++i){ isConnect_ = ethClient_->connect(ipServer_, portServ_); if (isConnect_) break; delay(1000); } if (isConnect_ ){ MsTimer2::set(SV_CYCLEREC_MS, thrProc); MsTimer2::start(); } return isConnect_; } bool sv_client::connectOfCOM(const char* moduleName, int speed){ if (isConnect_) return true; int len = strlen(moduleName); if ((len == 0) || (len >= SV_NAMESZ)) return false; if (strstr(moduleName, "=end=") || strstr(moduleName, "=begin=")) return false; strcpy(module_, moduleName); Serial.begin(speed); isConnect_ = true; isCom_ = true; MsTimer2::set(SV_CYCLEREC_MS, thrProc); MsTimer2::start(); return isConnect_; } bool sv_client::addValue(const char* name, valueType type, value val, bool onlyPosFront){ if (!isConnect_) return false; valueRec* vr = (valueRec*)values_.find(name); if (!vr){ int sz = values_.size(); if ((sz + 1) > SV_VALS_MAX_CNT) return false; int len = strlen(name); if ((len == 0) || (len >= SV_NAMESZ)) return false; if (strstr(name, "=end=") || strstr(name, "=begin=")) return false; vr = new valueRec(); vr->name = (char*)malloc(len + 1); strcpy(vr->name, name); vr->type = type; memset(vr->vals, 0, sizeof(value) * SV_PACKETSZ); values_.insert(vr->name, vr); } vr->vals[curCycCnt_] = val; vr->isActive = true; vr->vals[curCycCnt_] = val; // на случай прерывания в этом месте как раз vr->isOnlyFront = onlyPosFront; return true; } bool sv_client::sendDataOfEthernet(){ bool ok = true; ethClient_->flush(); if (ethClient_->connected()) { int sz = values_.size(); if (sz == 0) return ok; const char* start = "=begin="; ethClient_->write((const uint8_t*)start, strlen(start)); int vlSz = sizeof(dataRef); long int allSz = SV_NAMESZ + vlSz * sz; ethClient_->write((const uint8_t*)&allSz, 4); ethClient_->write((const uint8_t*)module_, SV_NAMESZ); valueRec* data; dataRef auxSD; memset(auxSD.vals, 0, 4 * SV_PACKETSZ); for (int i = 0; i < sz; ++i){ data = (valueRec*)values_.at(i); strcpy(auxSD.name, data->name); auxSD.type = (long int)data->type; for (int j = 0; j < SV_PACKETSZ; ++j){ if ((data->type == valueType::tInt) || (data->type == valueType::tBool)) auxSD.vals[j].tInt = data->vals[j].tInt; else auxSD.vals[j].tFloat = data->vals[j].tFloat; } ethClient_->write((const uint8_t*)&auxSD, vlSz); } const char* end = "=end="; ethClient_->write((const uint8_t*)end, strlen(end)); } else { ethClient_->stop(); ok = false; } return ok; } bool sv_client::sendDataOfCom(){ int sz = values_.size(); if (sz == 0) return true; Serial.flush(); const char* start = "=begin="; Serial.write(start, strlen(start)); int vlSz = sizeof(dataRef); long int allSz = SV_NAMESZ + vlSz * sz; Serial.write((char*)&allSz, 4); Serial.write(module_, SV_NAMESZ); valueRec* data; dataRef auxSD; memset(auxSD.vals, 0, 4 * SV_PACKETSZ); for (int i = 0; i < sz; ++i){ data = (valueRec*)values_.at(i); strcpy(auxSD.name, data->name); auxSD.type = (long int)data->type; for (int j = 0; j < SV_PACKETSZ; ++j){ if ((data->type == valueType::tInt) || (data->type == valueType::tBool)) auxSD.vals[j].tInt = data->vals[j].tInt; else auxSD.vals[j].tFloat = data->vals[j].tFloat; } Serial.write((char*)&auxSD, vlSz); } const char* end = "=end="; Serial.write(end, strlen(end)); return true; } bool sv_client::sendData(){ bool ok = false; if (isCom_) ok = sendDataOfCom(); else ok = sendDataOfEthernet(); return ok; } void sv_client::doSendCyc(){ // connection support if (!isConnect_) isConnect_ = tcpConnect(); // check active value in current cycle int prevCyc = curCycCnt_ - 1; if (prevCyc < 0) prevCyc = SV_PACKETSZ - 1; int sz = values_.size(); valueRec* vr; for (int i = 0; i < sz; ++i){ vr = (valueRec*)values_.at(i); if (!vr->isActive){ vr->vals[curCycCnt_] = vr->vals[prevCyc]; if ((vr->type == valueType::tBool) && vr->isOnlyFront) vr->vals[curCycCnt_].tBool = false; } vr->isActive = false; } int next = curCycCnt_ + 1; // send data if (next >= SV_PACKETSZ) { isConnect_ = (isConnect_) ? sendData() : false; curCycCnt_ = 0; } else ++curCycCnt_; } }
23.240642
147
0.614933
Sundiverr
a191cf87e7fada8b971263fb2092c140eb4d46b8
3,359
hpp
C++
src/utility/gpu/memory.hpp
OpenJij/OpenJij
9ed58500ef47583bc472410d470bb2dd4bfec74a
[ "Apache-2.0" ]
61
2019-01-05T13:37:10.000Z
2022-03-11T02:11:08.000Z
src/utility/gpu/memory.hpp
OpenJij/OpenJij
9ed58500ef47583bc472410d470bb2dd4bfec74a
[ "Apache-2.0" ]
79
2019-01-29T09:55:20.000Z
2022-02-19T04:06:20.000Z
src/utility/gpu/memory.hpp
OpenJij/OpenJij
9ed58500ef47583bc472410d470bb2dd4bfec74a
[ "Apache-2.0" ]
21
2019-01-07T07:55:10.000Z
2022-03-08T14:27:23.000Z
// Copyright 2021 Jij Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef OPENJIJ_UTILITY_GPU_MEMORY_HPP__ #define OPENJIJ_UTILITY_GPU_MEMORY_HPP__ #ifdef USE_CUDA #include <cuda_runtime.h> #include <memory> #include <utility/gpu/handle_error.hpp> #include <type_traits> namespace openjij { namespace utility { namespace cuda { /** * @brief deleter for cuda device memory */ struct deleter_dev{ void operator()(void* ptr) const{ HANDLE_ERROR_CUDA(cudaFree(ptr)); } }; /** * @brief deleter for cuda pinned host memory (cudaHostFree) */ struct deleter_host{ void operator()(void* ptr) const{ HANDLE_ERROR_CUDA(cudaFreeHost(ptr)); } }; /** * @brief unique_ptr for cuda device memory * * @tparam T */ template<typename T> using unique_dev_ptr = std::unique_ptr<T, deleter_dev>; /** * @brief unique_ptr for cuda host memory * * @tparam T */ template<typename T> using unique_host_ptr = std::unique_ptr<T, deleter_host>; /** * @brief make_unique for cuda device memory * * @tparam T * @param n * * @return unique_dev_ptr object */ template<typename T> cuda::unique_dev_ptr<T> make_dev_unique(std::size_t n){ static_assert(std::is_array<T>::value, "T must be an array."); using U = typename std::remove_extent<T>::type; U* ptr; HANDLE_ERROR_CUDA(cudaMalloc(reinterpret_cast<void**>(&ptr), sizeof(U) * n)); return cuda::unique_dev_ptr<T>{ptr}; } /** * @brief make_unique for cuda pinned host memory (page-locked memory) * * @tparam T * @param n * * @return unique_host_ptr object */ template<typename T> cuda::unique_host_ptr<T> make_host_unique(std::size_t n){ static_assert(std::is_array<T>::value, "T must be an array."); using U = typename std::remove_extent<T>::type; U* ptr; HANDLE_ERROR_CUDA(cudaMallocHost(reinterpret_cast<void**>(&ptr), sizeof(U) * n)); return cuda::unique_host_ptr<T>{ptr}; } }// namespace cuda } // namespace utility } // namespace openjij #endif #endif
32.61165
101
0.526347
OpenJij
a1924d66b6469f2ae62602ade94a7d77f3517822
5,912
cpp
C++
utility/unittest/ssl_test.cpp
infinitEnigma/beam
5aa354cf62d88c53001509498e4949143dc41c3b
[ "Apache-2.0" ]
1
2020-03-11T07:13:22.000Z
2020-03-11T07:13:22.000Z
utility/unittest/ssl_test.cpp
infinitEnigma/beam
5aa354cf62d88c53001509498e4949143dc41c3b
[ "Apache-2.0" ]
null
null
null
utility/unittest/ssl_test.cpp
infinitEnigma/beam
5aa354cf62d88c53001509498e4949143dc41c3b
[ "Apache-2.0" ]
null
null
null
// Copyright 2018 The Beam Team // // 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 "utility/io/sslio.h" #include "utility/logger.h" #include <sstream> #include <memory> using namespace beam; using namespace beam::io; using namespace std; namespace { void setup_test_CA(SSL_CTX* ctx, const std::string& caFile) { if (SSL_CTX_load_verify_locations(ctx, caFile.c_str(), nullptr) != 1) { LOG_ERROR() << "SSL_CTX_load_verify_locations failed" << caFile; IO_EXCEPTION(EC_SSL_ERROR); } } int test_sslio(bool requestCertificate, bool rejectUnauthorized, const string& serverCertName, const string& clientCertName = "") { LOG_INFO() << "Testing SSLIO " << TRACE(requestCertificate) << TRACE(rejectUnauthorized) << TRACE(serverCertName) << TRACE(clientCertName); static const char a[] = "AAAAAAAAAAAAAAAAAAAA"; static const char b[] = "BBBBBBBBBBBBBBBBBBBB"; int nErrors = 0; size_t expectedSize = 0; size_t receivedSize = 0; auto on_decrypted = [&receivedSize](void* data, size_t size) -> bool { //LOG_DEBUG() << "received " << size << " bytes"; receivedSize += size; return true; }; std::unique_ptr<SSLIO> server; std::unique_ptr<SSLIO> client; auto on_encrypted_server = [&client, &nErrors](const io::SharedBuffer& data, bool flush) -> Result { if (!client) { ++nErrors; return make_unexpected(EC_EINVAL); } client->on_encrypted_data_from_stream(data.data, data.size); return Ok(); }; auto on_encrypted_client = [&server, &nErrors](const io::SharedBuffer& data, bool flush) -> Result { if (!server) { ++nErrors; return make_unexpected(EC_EINVAL); } server->on_encrypted_data_from_stream(data.data, data.size); return Ok(); }; struct PathHelper { string certFileName; string certKeyFileName; PathHelper(const std::string& name) { std::stringstream ss; ss << PROJECT_SOURCE_DIR "/utility/unittest/" << name; string certPath = ss.str(); certFileName = certPath + ".crt"; certKeyFileName = certPath + ".key"; } }; PathHelper serverCert(serverCertName); SSLContext::Ptr serverCtx = SSLContext::create_server_ctx( serverCert.certFileName.c_str(), serverCert.certKeyFileName.c_str(), requestCertificate, rejectUnauthorized ); PathHelper clientCert(clientCertName); SSLContext::Ptr clientCtx = SSLContext::create_client_context((clientCertName.empty() ? nullptr : clientCert.certFileName.c_str()) , (clientCertName.empty() ? nullptr : clientCert.certKeyFileName.c_str()), rejectUnauthorized); const char* CAfile = PROJECT_SOURCE_DIR "/utility/unittest/beam_CA.pem"; setup_test_CA(serverCtx->get(), CAfile); setup_test_CA(clientCtx->get(), CAfile); server = std::make_unique<SSLIO>(serverCtx, on_decrypted, on_encrypted_server); client = std::make_unique<SSLIO>(clientCtx, on_decrypted, on_encrypted_client); client->flush(); SharedBuffer aBuf(a, strlen(a)); SharedBuffer bBuf(b, strlen(b)); for (int i=0; i<4321; ++i) { client->enqueue(aBuf); expectedSize += aBuf.size; client->enqueue(bBuf); expectedSize += bBuf.size; } client->flush(); if (expectedSize != receivedSize) { LOG_ERROR() << TRACE(expectedSize) << TRACE(receivedSize); ++nErrors; } LOG_INFO() << TRACE(nErrors); return nErrors; } } #define CHECK_TRUE(s) {\ auto r = (s);\ retCode += r;\ }\ #define CHECK_FALSE(s) {\ auto r = (s);\ if (r == 0) \ retCode += 1; \ }\ int main() { int logLevel = LOG_LEVEL_DEBUG; #if LOG_VERBOSE_ENABLED logLevel = LOG_LEVEL_VERBOSE; #endif auto logger = Logger::create(logLevel, logLevel); int retCode = 0; const std::string clientCert = "beam_client"; const std::string serverCert = "beam_server"; const std::string selfSignedCert = "test"; try { CHECK_FALSE(test_sslio(false, true, selfSignedCert)); CHECK_FALSE(test_sslio(true, true, selfSignedCert)); CHECK_FALSE(test_sslio(true, true, selfSignedCert, clientCert)); CHECK_TRUE(test_sslio(true, false, selfSignedCert)); CHECK_TRUE(test_sslio(false, false, selfSignedCert)); // should work with installed test beam CA CHECK_TRUE(test_sslio(false, false, serverCert)); CHECK_TRUE(test_sslio(true, false, serverCert)); CHECK_TRUE(test_sslio(false, true, serverCert)); CHECK_FALSE(test_sslio(true, true, serverCert)); CHECK_TRUE(test_sslio(true, true, serverCert, clientCert)); } catch (const exception& e) { LOG_ERROR() << e.what(); retCode = 255; } catch (...) { LOG_ERROR() << "non-std exception"; retCode = 255; } return retCode; }
34.17341
163
0.60318
infinitEnigma
a1984dd2049ff58d36fd086e7b632059ee98fb0c
766
cpp
C++
leetcode.com/0526 Beautiful Arrangement/main.cpp
sky-bro/AC
29bfa3f13994612887e18065fa6e854b9a29633d
[ "MIT" ]
1
2020-08-20T11:02:49.000Z
2020-08-20T11:02:49.000Z
leetcode.com/0526 Beautiful Arrangement/main.cpp
sky-bro/AC
29bfa3f13994612887e18065fa6e854b9a29633d
[ "MIT" ]
null
null
null
leetcode.com/0526 Beautiful Arrangement/main.cpp
sky-bro/AC
29bfa3f13994612887e18065fa6e854b9a29633d
[ "MIT" ]
1
2022-01-01T23:23:13.000Z
2022-01-01T23:23:13.000Z
#include <iostream> #include <unordered_map> #include <vector> using namespace std; class Solution { private: vector<unordered_map<int, int>> dp; int n; int dfs(int i, int visited) { if (i == 0) return 1; if (dp[i].count(visited)) return dp[i][visited]; int res = 0; for (int ii = 1; ii <= n; ++ii) { if ((1 << ii) & visited) continue; if ((i % ii) && (ii % i)) continue; res += dfs(i - 1, visited | (1 << ii)); } return dp[i][visited] = res; } public: int countArrangement(int N) { n = N; dp.clear(); dp.resize(n + 1); return dfs(n, 0); } }; int main(int argc, char const *argv[]) { int N; Solution s; while (cin >> N) { cout << s.countArrangement(N) << endl; } return 0; }
18.682927
52
0.541775
sky-bro
a19fe84c7caf56ff12b25b503d87badbabcdbd25
517
cpp
C++
CSC/CSC114/GaddisExamples/Chapter07/Pr7-26.cpp
HNSS-US/DelTech
a424da4e10ec0a33caaa6ed1c1d78837bdc6b0a2
[ "MIT" ]
null
null
null
CSC/CSC114/GaddisExamples/Chapter07/Pr7-26.cpp
HNSS-US/DelTech
a424da4e10ec0a33caaa6ed1c1d78837bdc6b0a2
[ "MIT" ]
null
null
null
CSC/CSC114/GaddisExamples/Chapter07/Pr7-26.cpp
HNSS-US/DelTech
a424da4e10ec0a33caaa6ed1c1d78837bdc6b0a2
[ "MIT" ]
null
null
null
// This program demonstrates the range-based for loop with a vector. #include <iostream> #include <vector> using namespace std; int main() { // Define a vector. vector<int> numbers(5); // Get values for the vector elements. for (int &val : numbers) { cout << "Enter an integer value: "; cin >> val; } // Display the vector elements. cout << "Here are the values that you entered:\n"; for (int val : numbers) cout << val << endl; return 0; }
21.541667
69
0.586074
HNSS-US
a1a1876062598adbc42bd7560ba6a73446d6cf79
6,932
cpp
C++
src/server/UI/mainwindow.cpp
afrostalin/FireNET
212bd7b0bf5a3ceef4c19fe527c7f23e624e296b
[ "BSL-1.0" ]
27
2015-12-22T20:29:12.000Z
2021-06-05T18:25:27.000Z
src/server/UI/mainwindow.cpp
afrostalin/FireNET
212bd7b0bf5a3ceef4c19fe527c7f23e624e296b
[ "BSL-1.0" ]
36
2015-06-14T15:17:19.000Z
2017-12-28T16:01:02.000Z
src/server/UI/mainwindow.cpp
afrostalin/FireNET
212bd7b0bf5a3ceef4c19fe527c7f23e624e296b
[ "BSL-1.0" ]
14
2016-01-14T11:15:47.000Z
2021-05-04T20:24:46.000Z
// Copyright (C) 2014-2018 Ilya Chernetsov. All rights reserved. Contacts: <chernecoff@gmail.com> // License: https://github.com/afrostalin/FireNET/blob/master/LICENSE #include "global.h" #include "mainwindow.h" #include "ui_mainwindow.h" #include "UILogger.h" #include "Core/tcpserver.h" #include "Core/remoteserver.h" #include "Tools/console.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); ui->Output->setTextElideMode(Qt::ElideNone); ui->Output->setResizeMode(QListView::Adjust); m_OutputItemID = -1; connect(&m_UpdateTimer, &QTimer::timeout, this, &MainWindow::UpdateServerStatus); connect(this, &MainWindow::scroll, ui->Output, &QListWidget::scrollToBottom); m_UpdateTimer.start(250); } MainWindow::~MainWindow() { SAFE_DELETE(ui); } void MainWindow::LogToOutput(ELogType type, const QString& msg) { if (!ui || !ui->Output) return; QMutexLocker locker(&m_Mutex); // If log level 0 or 1 - We not need use scroll and save all lines if (m_OutputItemID >= 24 && gEnv->m_UILogLevel < 2) { try { auto pItem = ui->Output->item(0); if (pItem) { SAFE_DELETE(pItem); m_OutputItemID--; } } catch (const std::exception&) { } } ui->Output->addItem(msg); m_OutputItemID++; switch (type) { case ELog_Debug: { try { auto pItem = ui->Output->item(m_OutputItemID); if (pItem) { pItem->setForeground(Qt::darkGreen); } } catch (const std::exception&) { } break; } case ELog_Info: { try { auto pItem = ui->Output->item(m_OutputItemID); if (pItem) { pItem->setForeground(Qt::white); } } catch (const std::exception&) { } break; } case ELog_Warning: { try { auto pItem = ui->Output->item(m_OutputItemID); if (pItem) { pItem->setForeground(Qt::darkYellow); } } catch (const std::exception&) { } break; } case ELog_Error: { try { auto pItem = ui->Output->item(m_OutputItemID); if (pItem) { pItem->setForeground(Qt::red); } } catch (const std::exception&) { } break; } default: break; }; if (gEnv && !gEnv->isQuiting && gEnv->m_UILogLevel >= 2) { emit scroll(); } } void MainWindow::UpdateServerStatus() const { if (gEnv->isQuiting || !ui || !ui->Status) return; ui->Status->clear(); // Global status int clientCount = 0; int maxClientCount = 0; int gsCount = 0; int maxGsCount = 0; if (gEnv->pServer) { clientCount = gEnv->pServer->GetClientCount(); maxClientCount = gEnv->pServer->GetMaxClientCount(); } if (gEnv->pRemoteServer) { gsCount = gEnv->pRemoteServer->GetClientCount(); maxGsCount = gEnv->pRemoteServer->GetMaxClientCount(); } QString status = _strFormat("MServer : %s | MClients : %d/%d | RServer : %s | RClients : %d/%d | DBMode : %s | DBStatus : %s | IPackets : %d | OPackets : %d | ISpeed : %d | OSpeed : %d", gEnv->m_ServerStatus.m_MainServerStatus.toStdString().c_str(), clientCount, maxClientCount, gEnv->m_ServerStatus.m_RemoteServerStatus.toStdString().c_str(), gsCount, maxGsCount, gEnv->m_ServerStatus.m_DBMode.toStdString().c_str(), gEnv->m_ServerStatus.m_DBStatus.toStdString().c_str(), gEnv->m_InputPacketsCount, gEnv->m_OutputPacketsCount, gEnv->m_InputSpeed, gEnv->m_OutputSpeed).c_str(); ui->Status->addItem(status); auto pItem = ui->Status->item(0); if (pItem) pItem->setForeground(Qt::darkCyan); } void MainWindow::EnableStressMode() { ClearOutput(); LogWarning("YOU ENABLED STRESS TEST MODE, RESTART SERVER IF YOU NEED DISABLE IT"); } void MainWindow::CleanUp() { emit stop(); m_UpdateTimer.stop(); // Wait server thread here while (!gEnv->isReadyToClose) { QEventLoop loop; QTimer::singleShot(100, &loop, &QEventLoop::quit); loop.exec(); } ClearOutput(); ClearStatus(); QCoreApplication::quit(); } void MainWindow::ClearOutput() { QMutexLocker locker(&m_Mutex); if (ui && ui->Output) { ui->Output->clear(); m_OutputItemID = -1; } } void MainWindow::ClearStatus() const { if (ui && ui->Status) ui->Status->clear(); } void MainWindow::on_Input_returnPressed() { QString input = ui->Input->text(); ui->Input->clear(); CConsole* pConsole = gEnv->pConsole; if (pConsole == nullptr) { LogError("Can't get console!"); return; } if (!pConsole->ExecuteCommand(input)) { QStringList keys = input.split(" "); // Get variable description if (keys.size() > 0 && keys[0].contains("?")) { LogInfo("%s", keys[0].toStdString().c_str()); QString key = keys[0].remove("?"); QString description = gEnv->pConsole->GetDescription(key); if (!description.isEmpty()) { LogInfo("%s - %s", key.toStdString().c_str(), description.toStdString().c_str()); } else { if (!gEnv->pConsole->FindVariabelMatches(key)) { LogWarning("No one similar variable is found"); } } return; } // Find variable and get type, value or set new value if (keys.size() > 0 && gEnv->pConsole->CheckVariableExists(keys[0])) { if (keys.size() == 1) { // Get variable type and value QVariant::Type var_type = gEnv->pConsole->GetVariable(keys[0]).type(); switch (var_type) { case QVariant::Bool: { LogInfo("%s = %s", keys[0].toStdString().c_str(), gEnv->pConsole->GetBool(keys[0].toStdString().c_str()) ? "true" : "false"); break; } case QVariant::Int: { LogInfo("%s = %d", keys[0].toStdString().c_str(), gEnv->pConsole->GetInt(keys[0].toStdString().c_str())); break; } case QVariant::Double: { LogInfo("%s = %f", keys[0].toStdString().c_str(), gEnv->pConsole->GetDouble(keys[0].toStdString().c_str())); break; } case QVariant::String: { LogInfo("%s = %s", keys[0].toStdString().c_str(), gEnv->pConsole->GetString(keys[0].toStdString().c_str()).c_str()); break; } default: break; } } else if (keys.size() == 2 && !keys[1].isEmpty()) // Set new value for variable { LogInfo("%s = %s", keys[0].toStdString().c_str(), keys[1].toStdString().c_str()); QVariant::Type var_type = gEnv->pConsole->GetVariable(keys[0]).type(); switch (var_type) { case QVariant::Bool: { bool value = (keys[1].toInt() == 1) ? true : false; gEnv->pConsole->SetVariable(keys[0], value); break; } case QVariant::Int: { int value = keys[1].toInt(); gEnv->pConsole->SetVariable(keys[0], value); break; } case QVariant::Double: { double value = keys[1].toDouble(); gEnv->pConsole->SetVariable(keys[0], value); break; } case QVariant::String: { QString value = keys[1]; gEnv->pConsole->SetVariable(keys[0], value); break; } default: break; } } } else { LogWarning("Unknown console command or variable <%s>", input.toStdString().c_str()); } } }
19.526761
187
0.626659
afrostalin
a1a5bf8ec26af205c0c77690845648cfac1e7195
2,800
hpp
C++
engine/include/xe/core/gpu.hpp
trbflxr/xe
13123869a848972e064cb8c6838c4215f034f3d9
[ "MIT" ]
null
null
null
engine/include/xe/core/gpu.hpp
trbflxr/xe
13123869a848972e064cb8c6838c4215f034f3d9
[ "MIT" ]
null
null
null
engine/include/xe/core/gpu.hpp
trbflxr/xe
13123869a848972e064cb8c6838c4215f034f3d9
[ "MIT" ]
null
null
null
// // Created by FLXR on 9/3/2019. // #ifndef XE_GPU_HPP #define XE_GPU_HPP #include <atomic> #include <thread> #include <mutex> #include <memory> #include <xe/params.hpp> #include <xe/core/object.hpp> #include <xe/graphics/display_list.hpp> namespace xe { class Window; namespace gpu { class Backend; } class XE_API GPU : public Object { XE_OBJECT(GPU, Object); friend class Engine; friend struct WindowBackend; friend class gpu::Backend; public: enum class Vendor { AMD, Nvidia, Intel, Invalid }; typedef std::function<void()> Job; public: ~GPU() override; std::shared_ptr<gpu::Buffer> createBuffer(const gpu::Buffer::Info &info) const; std::shared_ptr<gpu::Texture> createTexture(const gpu::Texture::Info &info) const; std::shared_ptr<gpu::Pipeline> createPipeline(const gpu::Pipeline::Info &info) const; std::shared_ptr<gpu::Framebuffer> createFramebuffer(const gpu::Framebuffer::Info &info) const; void destroyResource(const gpu::Resource &resource) const; uint32_t maxBuffers() const { return params_.maxBuffers; } uint32_t maxTextures() const { return params_.maxTextures; } uint32_t maxPipelines() const { return params_.maxPipelines; } uint32_t maxFramebuffers() const { return params_.maxFramebuffers; } uint32_t usedBuffers() const { return usedBuffers_; } uint32_t usedTextures() const { return usedTextures_; } uint32_t usedPipelines() const { return usedPipelines_; } uint32_t usedFramebuffers() const { return usedFramebuffers_; } Vendor vendor() const { return vendor_; } static uint32_t drawCalls(); static uint32_t gpuCommands(); private: GPU(); void init(); void run(); void prepareRender(); void execute(); void stop(); void submitCommands(DisplayList &&dl); void executeInRenderThread(const Job &job); void executeDeferred(); bool shouldStop() const { return shouldStop_; } private: bool shouldStop_ = false; Params::GPU params_{ }; Vendor vendor_ = Vendor::Invalid; std::shared_ptr<Window> window_; std::unique_ptr<DisplayList> logicFrame_; DisplayList renderFrame_; struct ThreadSync { DisplayList nextFrame; std::thread thread; std::mutex mxR; std::mutex mxL; std::condition_variable cvR; std::condition_variable cvL; bool initialized; bool exit; } threadSync_; std::mutex jobMutex_; std::vector<Job> jobs_; RenderContext *ctx_ = nullptr; mutable uint32_t usedBuffers_ = 0; mutable uint32_t usedTextures_ = 0; mutable uint32_t usedPipelines_ = 0; mutable uint32_t usedFramebuffers_ = 0; static std::atomic<uint32_t> gpuCommands_; }; } #endif //XE_GPU_HPP
23.931624
98
0.682143
trbflxr
a1a83c496fd4fa0387691cb075c57de2dce3b370
54,360
cpp
C++
src/AstTransforms.cpp
ohamel-softwaresecure/souffle
d4b9fe641f0c51d2a25408af45416a7e5123f866
[ "UPL-1.0" ]
null
null
null
src/AstTransforms.cpp
ohamel-softwaresecure/souffle
d4b9fe641f0c51d2a25408af45416a7e5123f866
[ "UPL-1.0" ]
null
null
null
src/AstTransforms.cpp
ohamel-softwaresecure/souffle
d4b9fe641f0c51d2a25408af45416a7e5123f866
[ "UPL-1.0" ]
null
null
null
/* * Souffle - A Datalog Compiler * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved * Licensed under the Universal Permissive License v 1.0 as shown at: * - https://opensource.org/licenses/UPL * - <souffle root>/licenses/SOUFFLE-UPL.txt */ /************************************************************************ * * @file AstTransforms.cpp * * Implementation of AST transformation passes. * ***********************************************************************/ #include "AstTransforms.h" #include "AstArgument.h" #include "AstAttribute.h" #include "AstClause.h" #include "AstGroundAnalysis.h" #include "AstLiteral.h" #include "AstNode.h" #include "AstProgram.h" #include "AstRelation.h" #include "AstRelationIdentifier.h" #include "AstTypeAnalysis.h" #include "AstTypeEnvironmentAnalysis.h" #include "AstUtils.h" #include "AstVisitor.h" #include "BinaryConstraintOps.h" #include "FunctorOps.h" #include "GraphUtils.h" #include "PrecedenceGraph.h" #include "RamTypes.h" #include "TypeSystem.h" #include <cstddef> #include <functional> #include <map> #include <memory> #include <ostream> #include <set> namespace souffle { bool NullTransformer::transform(AstTranslationUnit& translationUnit) { return false; } bool PipelineTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; for (auto& transformer : pipeline) { changed |= applySubtransformer(translationUnit, transformer.get()); } return changed; } bool ConditionalTransformer::transform(AstTranslationUnit& translationUnit) { return condition() ? applySubtransformer(translationUnit, transformer.get()) : false; } bool WhileTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; while (condition()) { changed |= applySubtransformer(translationUnit, transformer.get()); } return changed; } bool FixpointTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; while (applySubtransformer(translationUnit, transformer.get())) { changed = true; } return changed; } bool RemoveRelationCopiesTransformer::removeRelationCopies(AstTranslationUnit& translationUnit) { using alias_map = std::map<AstRelationIdentifier, AstRelationIdentifier>; // tests whether something is a variable auto isVar = [&](const AstArgument& arg) { return dynamic_cast<const AstVariable*>(&arg) != nullptr; }; // tests whether something is a record auto isRec = [&](const AstArgument& arg) { return dynamic_cast<const AstRecordInit*>(&arg) != nullptr; }; // collect aliases alias_map isDirectAliasOf; auto* ioType = translationUnit.getAnalysis<IOType>(); AstProgram& program = *translationUnit.getProgram(); // search for relations only defined by a single rule .. for (AstRelation* rel : program.getRelations()) { if (!ioType->isIO(rel) && rel->getClauses().size() == 1u) { // .. of shape r(x,y,..) :- s(x,y,..) AstClause* cl = rel->getClause(0); std::vector<AstAtom*> bodyAtoms = getBodyLiterals<AstAtom>(*cl); if (!isFact(*cl) && cl->getBodyLiterals().size() == 1u && bodyAtoms.size() == 1u) { AstAtom* atom = bodyAtoms[0]; if (equal_targets(cl->getHead()->getArguments(), atom->getArguments())) { // we have a match but have to check that all arguments are either // variables or records containing variables bool onlyVars = true; auto args = cl->getHead()->getArguments(); while (!args.empty()) { const auto& cur = args.back(); args.pop_back(); if (!isVar(*cur)) { if (isRec(*cur)) { // records are decomposed and their arguments are checked const auto& rec_args = static_cast<const AstRecordInit&>(*cur).getArguments(); for (auto rec_arg : rec_args) { args.push_back(rec_arg); } } else { onlyVars = false; break; } } } if (onlyVars) { // all arguments are either variables or records containing variables isDirectAliasOf[cl->getHead()->getName()] = atom->getName(); } } } } } // map each relation to its ultimate alias (could be transitive) alias_map isAliasOf; // track any copy cycles; cyclic rules are effectively empty std::set<AstRelationIdentifier> cycle_reps; for (std::pair<AstRelationIdentifier, AstRelationIdentifier> cur : isDirectAliasOf) { // compute replacement std::set<AstRelationIdentifier> visited; visited.insert(cur.first); visited.insert(cur.second); auto pos = isDirectAliasOf.find(cur.second); while (pos != isDirectAliasOf.end()) { if (visited.count(pos->second) != 0u) { cycle_reps.insert(cur.second); break; } cur.second = pos->second; pos = isDirectAliasOf.find(cur.second); } isAliasOf[cur.first] = cur.second; } if (isAliasOf.empty()) { return false; } // replace usage of relations according to alias map visitDepthFirst(program, [&](const AstAtom& atom) { auto pos = isAliasOf.find(atom.getName()); if (pos != isAliasOf.end()) { const_cast<AstAtom&>(atom).setName(pos->second); } }); // break remaining cycles for (const auto& rep : cycle_reps) { auto rel = program.getRelation(rep); rel->removeClause(rel->getClause(0)); } // remove unused relations for (const auto& cur : isAliasOf) { if (cycle_reps.count(cur.first) == 0u) { program.removeRelation(program.getRelation(cur.first)->getName()); } } return true; } bool UniqueAggregationVariablesTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; // make variables in aggregates unique int aggNumber = 0; visitDepthFirstPostOrder(*translationUnit.getProgram(), [&](const AstAggregator& agg) { // only applicable for aggregates with target expression if (agg.getTargetExpression() == nullptr) { return; } // get all variables in the target expression std::set<std::string> names; visitDepthFirst( *agg.getTargetExpression(), [&](const AstVariable& var) { names.insert(var.getName()); }); // rename them visitDepthFirst(agg, [&](const AstVariable& var) { auto pos = names.find(var.getName()); if (pos == names.end()) { return; } const_cast<AstVariable&>(var).setName(" " + var.getName() + toString(aggNumber)); changed = true; }); // increment aggregation number aggNumber++; }); return changed; } bool MaterializeAggregationQueriesTransformer::materializeAggregationQueries( AstTranslationUnit& translationUnit) { bool changed = false; AstProgram& program = *translationUnit.getProgram(); const TypeEnvironment& env = translationUnit.getAnalysis<TypeEnvironmentAnalysis>()->getTypeEnvironment(); // if an aggregator has a body consisting of more than an atom => create new relation int counter = 0; visitDepthFirst(program, [&](const AstClause& clause) { visitDepthFirst(clause, [&](const AstAggregator& agg) { // check whether a materialization is required if (!needsMaterializedRelation(agg)) { return; } changed = true; // -- create a new clause -- auto relName = "__agg_rel_" + toString(counter++); while (program.getRelation(relName) != nullptr) { relName = "__agg_rel_" + toString(counter++); } // create the new clause for the materialised thing auto* aggClause = new AstClause(); // create the body of the new thing for (const auto& cur : agg.getBodyLiterals()) { aggClause->addToBody(std::unique_ptr<AstLiteral>(cur->clone())); } // find stuff for which we need a grounding for (const auto& argPair : getGroundedTerms(*aggClause)) { const auto* variable = dynamic_cast<const AstVariable*>(argPair.first); bool variableIsGrounded = argPair.second; // if it's not even a variable type or the term is grounded // then skip it if (variable == nullptr || variableIsGrounded) { continue; } for (const auto& lit : clause.getBodyLiterals()) { const auto* atom = dynamic_cast<const AstAtom*>(lit); if (atom == nullptr) { continue; // ignore these because they can't ground the variable } for (const auto& arg : atom->getArguments()) { const auto* atomVariable = dynamic_cast<const AstVariable*>(arg); // if this atom contains the variable I need to ground, add it if ((atomVariable != nullptr) && variable->getName() == atomVariable->getName()) { // expand the body with this one so that it will ground this variable aggClause->addToBody(std::unique_ptr<AstLiteral>(atom->clone())); break; } } } } auto* head = new AstAtom(); head->setName(relName); std::vector<bool> symbolArguments; // Ensure each variable is only added once std::set<std::string> variables; visitDepthFirst(*aggClause, [&](const AstVariable& var) { variables.insert(var.getName()); }); // Insert all variables occurring in the body of the aggregate into the head for (const auto& var : variables) { head->addArgument(std::make_unique<AstVariable>(var)); } aggClause->setHead(std::unique_ptr<AstAtom>(head)); // instantiate unnamed variables in count operations if (agg.getOperator() == AstAggregator::count) { int count = 0; for (const auto& cur : aggClause->getBodyLiterals()) { cur->apply(makeLambdaAstMapper( [&](std::unique_ptr<AstNode> node) -> std::unique_ptr<AstNode> { // check whether it is a unnamed variable auto* var = dynamic_cast<AstUnnamedVariable*>(node.get()); if (var == nullptr) { return node; } // replace by variable auto name = " _" + toString(count++); auto res = new AstVariable(name); // extend head head->addArgument(std::unique_ptr<AstArgument>(res->clone())); // return replacement return std::unique_ptr<AstNode>(res); })); } } // -- build relation -- auto* rel = new AstRelation(); rel->setName(relName); // add attributes std::map<const AstArgument*, TypeSet> argTypes = TypeAnalysis::analyseTypes(env, *aggClause, &program); for (const auto& cur : head->getArguments()) { rel->addAttribute(std::make_unique<AstAttribute>( toString(*cur), (isNumberType(argTypes[cur])) ? "number" : "symbol")); } rel->addClause(std::unique_ptr<AstClause>(aggClause)); program.appendRelation(std::unique_ptr<AstRelation>(rel)); // -- update aggregate -- // count the usage of variables in the clause // outside of aggregates. Note that the visitor // is exhaustive hence double counting occurs // which needs to be deducted for variables inside // the aggregators and variables in the expression // of aggregate need to be added. Counter is zero // if the variable is local to the aggregate std::map<std::string, int> varCtr; visitDepthFirst(clause, [&](const AstArgument& arg) { if (const auto* a = dynamic_cast<const AstAggregator*>(&arg)) { visitDepthFirst(arg, [&](const AstVariable& var) { varCtr[var.getName()]--; }); if (a->getTargetExpression() != nullptr) { visitDepthFirst(*a->getTargetExpression(), [&](const AstVariable& var) { varCtr[var.getName()]++; }); } } else { visitDepthFirst(arg, [&](const AstVariable& var) { varCtr[var.getName()]++; }); } }); std::vector<std::unique_ptr<AstArgument>> args; for (auto arg : head->getArguments()) { if (auto* var = dynamic_cast<AstVariable*>(arg)) { // replace local variable by underscore if local if (varCtr[var->getName()] == 0) { args.emplace_back(new AstUnnamedVariable()); continue; } } args.emplace_back(arg->clone()); } auto* aggAtom = new AstAtom(head->getName(), std::move(args), head->getSrcLoc()); const_cast<AstAggregator&>(agg).clearBodyLiterals(); const_cast<AstAggregator&>(agg).addBodyLiteral(std::unique_ptr<AstLiteral>(aggAtom)); }); }); return changed; } bool MaterializeAggregationQueriesTransformer::needsMaterializedRelation(const AstAggregator& agg) { // everything with more than 1 body literal => materialize if (agg.getBodyLiterals().size() > 1) { return true; } // inspect remaining atom more closely const AstAtom* atom = dynamic_cast<const AstAtom*>(agg.getBodyLiterals()[0]); if (atom == nullptr) { // no atoms, so materialize return true; } // if the same variable occurs several times => materialize bool duplicates = false; std::set<std::string> vars; visitDepthFirst(*atom, [&](const AstVariable& var) { duplicates = duplicates || !vars.insert(var.getName()).second; }); // if there are duplicates a materialization is required if (duplicates) { return true; } // for all others the materialization can be skipped return false; } bool RemoveEmptyRelationsTransformer::removeEmptyRelations(AstTranslationUnit& translationUnit) { AstProgram& program = *translationUnit.getProgram(); auto* ioTypes = translationUnit.getAnalysis<IOType>(); bool changed = false; for (auto rel : program.getRelations()) { if (rel->clauseSize() > 0 || ioTypes->isInput(rel)) { continue; } changed |= removeEmptyRelationUses(translationUnit, rel); bool usedInAggregate = false; visitDepthFirst(program, [&](const AstAggregator& agg) { for (const auto lit : agg.getBodyLiterals()) { visitDepthFirst(*lit, [&](const AstAtom& atom) { if (getAtomRelation(&atom, &program) == rel) { usedInAggregate = true; } }); } }); if (!usedInAggregate && !ioTypes->isOutput(rel)) { program.removeRelation(rel->getName()); changed = true; } } return changed; } bool RemoveEmptyRelationsTransformer::removeEmptyRelationUses( AstTranslationUnit& translationUnit, AstRelation* emptyRelation) { AstProgram& program = *translationUnit.getProgram(); bool changed = false; // // (1) drop rules from the program that have empty relations in their bodies. // (2) drop negations of empty relations // // get all clauses std::vector<const AstClause*> clauses; visitDepthFirst(program, [&](const AstClause& cur) { clauses.push_back(&cur); }); // clean all clauses for (const AstClause* cl : clauses) { // check for an atom whose relation is the empty relation bool removed = false; for (AstLiteral* lit : cl->getBodyLiterals()) { if (auto* arg = dynamic_cast<AstAtom*>(lit)) { if (getAtomRelation(arg, &program) == emptyRelation) { program.removeClause(cl); removed = true; changed = true; break; } } } if (!removed) { // check whether a negation with empty relations exists bool rewrite = false; for (AstLiteral* lit : cl->getBodyLiterals()) { if (auto* neg = dynamic_cast<AstNegation*>(lit)) { if (getAtomRelation(neg->getAtom(), &program) == emptyRelation) { rewrite = true; break; } } } if (rewrite) { // clone clause without negation for empty relations auto res = std::unique_ptr<AstClause>(cloneHead(cl)); for (AstLiteral* lit : cl->getBodyLiterals()) { if (auto* neg = dynamic_cast<AstNegation*>(lit)) { if (getAtomRelation(neg->getAtom(), &program) != emptyRelation) { res->addToBody(std::unique_ptr<AstLiteral>(lit->clone())); } } else { res->addToBody(std::unique_ptr<AstLiteral>(lit->clone())); } } program.removeClause(cl); program.appendClause(std::move(res)); changed = true; } } } return changed; } bool RemoveRedundantRelationsTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; auto* redundantRelationsAnalysis = translationUnit.getAnalysis<RedundantRelations>(); const std::set<const AstRelation*>& redundantRelations = redundantRelationsAnalysis->getRedundantRelations(); if (!redundantRelations.empty()) { for (auto rel : redundantRelations) { translationUnit.getProgram()->removeRelation(rel->getName()); changed = true; } } return changed; } bool RemoveBooleanConstraintsTransformer::transform(AstTranslationUnit& translationUnit) { AstProgram& program = *translationUnit.getProgram(); // If any boolean constraints exist, they will be removed bool changed = false; visitDepthFirst(program, [&](const AstBooleanConstraint&) { changed = true; }); // Remove true and false constant literals from all aggregators struct removeBools : public AstNodeMapper { std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { // Remove them from child nodes node->apply(*this); if (auto* aggr = dynamic_cast<AstAggregator*>(node.get())) { bool containsTrue = false; bool containsFalse = false; for (AstLiteral* lit : aggr->getBodyLiterals()) { if (auto* bc = dynamic_cast<AstBooleanConstraint*>(lit)) { bc->isTrue() ? containsTrue = true : containsFalse = true; } } if (containsFalse || containsTrue) { // Only keep literals that aren't boolean constraints auto replacementAggregator = std::unique_ptr<AstAggregator>(aggr->clone()); replacementAggregator->clearBodyLiterals(); bool isEmpty = true; // Don't bother copying over body literals if any are false if (!containsFalse) { for (AstLiteral* lit : aggr->getBodyLiterals()) { // Don't add in 'true' boolean constraints if (dynamic_cast<AstBooleanConstraint*>(lit) == nullptr) { isEmpty = false; replacementAggregator->addBodyLiteral( std::unique_ptr<AstLiteral>(lit->clone())); } } } if (containsFalse || isEmpty) { // Empty aggregator body! // Not currently handled, so add in a false literal in the body // E.g. max x : { } =becomes=> max 1 : {0 = 1} replacementAggregator->setTargetExpression(std::make_unique<AstNumberConstant>(1)); // Add '0 = 1' if false was found, '1 = 1' otherwise int lhsConstant = containsFalse ? 0 : 1; replacementAggregator->addBodyLiteral(std::make_unique<AstBinaryConstraint>( BinaryConstraintOp::EQ, std::make_unique<AstNumberConstant>(lhsConstant), std::make_unique<AstNumberConstant>(1))); } return replacementAggregator; } } // no false or true, so return the original node return node; } }; removeBools update; program.apply(update); // Remove true and false constant literals from all clauses for (AstRelation* rel : program.getRelations()) { for (AstClause* clause : rel->getClauses()) { bool containsTrue = false; bool containsFalse = false; for (AstLiteral* lit : clause->getBodyLiterals()) { if (auto* bc = dynamic_cast<AstBooleanConstraint*>(lit)) { bc->isTrue() ? containsTrue = true : containsFalse = true; } } if (containsFalse) { // Clause will always fail rel->removeClause(clause); } else if (containsTrue) { auto replacementClause = std::unique_ptr<AstClause>(cloneHead(clause)); // Only keep non-'true' literals for (AstLiteral* lit : clause->getBodyLiterals()) { if (dynamic_cast<AstBooleanConstraint*>(lit) == nullptr) { replacementClause->addToBody(std::unique_ptr<AstLiteral>(lit->clone())); } } rel->removeClause(clause); rel->addClause(std::move(replacementClause)); } } } return changed; } bool PartitionBodyLiteralsTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; AstProgram& program = *translationUnit.getProgram(); /* Process: * Go through each clause and construct a variable dependency graph G. * The nodes of G are the variables. A path between a and b exists iff * a and b appear in a common body literal. * * Using the graph, we can extract the body literals that are not associated * with the arguments in the head atom into new relations. Depending on * variable dependencies among these body literals, the literals can * be partitioned into multiple separate new propositional clauses. * * E.g. a(x) <- b(x), c(y), d(y), e(z), f(z). can be transformed into: * - a(x) <- b(x), newrel0(), newrel1(). * - newrel0() <- c(y), d(y). * - newrel1() <- e(z), f(z). * * Note that only one pass through the clauses is needed: * - All arguments in the body literals of the transformed clause cannot be * independent of the head arguments (by construction) * - The new relations holding the disconnected body literals are propositional, * hence having no head arguments, and so the transformation does not apply. */ // Store clauses to add and remove after analysing the program std::vector<AstClause*> clausesToAdd; std::vector<const AstClause*> clausesToRemove; // The transformation is local to each rule, so can visit each independently visitDepthFirst(program, [&](const AstClause& clause) { // Create the variable dependency graph G Graph<std::string> variableGraph = Graph<std::string>(); std::set<std::string> ruleVariables; // Add in the nodes // The nodes of G are the variables in the rule visitDepthFirst(clause, [&](const AstVariable& var) { variableGraph.insert(var.getName()); ruleVariables.insert(var.getName()); }); // Add in the edges // Since we are only looking at reachability in the final graph, it is // enough to just add in an (undirected) edge from the first variable // in the literal to each of the other variables. std::vector<AstLiteral*> literalsToConsider = clause.getBodyLiterals(); literalsToConsider.push_back(clause.getHead()); for (AstLiteral* clauseLiteral : literalsToConsider) { std::set<std::string> literalVariables; // Store all variables in the literal visitDepthFirst( *clauseLiteral, [&](const AstVariable& var) { literalVariables.insert(var.getName()); }); // No new edges if only one variable is present if (literalVariables.size() > 1) { std::string firstVariable = *literalVariables.begin(); literalVariables.erase(literalVariables.begin()); // Create the undirected edge for (const std::string& var : literalVariables) { variableGraph.insert(firstVariable, var); variableGraph.insert(var, firstVariable); } } } // Find the connected components of G std::set<std::string> seenNodes; // Find the connected component associated with the head std::set<std::string> headComponent; visitDepthFirst( *clause.getHead(), [&](const AstVariable& var) { headComponent.insert(var.getName()); }); if (!headComponent.empty()) { variableGraph.visitDepthFirst(*headComponent.begin(), [&](const std::string& var) { headComponent.insert(var); seenNodes.insert(var); }); } // Compute all other connected components in the graph G std::set<std::set<std::string>> connectedComponents; for (std::string var : ruleVariables) { if (seenNodes.find(var) != seenNodes.end()) { // Node has already been added to a connected component continue; } // Construct the connected component std::set<std::string> component; variableGraph.visitDepthFirst(var, [&](const std::string& child) { component.insert(child); seenNodes.insert(child); }); connectedComponents.insert(component); } if (connectedComponents.empty()) { // No separate connected components, so no point partitioning return; } // Need to extract some disconnected lits! changed = true; std::vector<AstAtom*> replacementAtoms; // Construct the new rules for (const std::set<std::string>& component : connectedComponents) { // Come up with a unique new name for the relation static int disconnectedCount = 0; std::stringstream nextName; nextName << "+disconnected" << disconnectedCount; AstRelationIdentifier newRelationName = nextName.str(); disconnectedCount++; // Create the extracted relation and clause for the component // newrelX() <- disconnectedLiterals(x). auto newRelation = std::make_unique<AstRelation>(); newRelation->setName(newRelationName); program.appendRelation(std::move(newRelation)); auto* disconnectedClause = new AstClause(); disconnectedClause->setSrcLoc(clause.getSrcLoc()); disconnectedClause->setHead(std::make_unique<AstAtom>(newRelationName)); // Find the body literals for this connected component std::vector<AstLiteral*> associatedLiterals; for (AstLiteral* bodyLiteral : clause.getBodyLiterals()) { bool associated = false; visitDepthFirst(*bodyLiteral, [&](const AstVariable& var) { if (component.find(var.getName()) != component.end()) { associated = true; } }); if (associated) { disconnectedClause->addToBody(std::unique_ptr<AstLiteral>(bodyLiteral->clone())); } } // Create the atom to replace all these literals replacementAtoms.push_back(new AstAtom(newRelationName)); // Add the clause to the program clausesToAdd.push_back(disconnectedClause); } // Create the replacement clause // a(x) <- b(x), c(y), d(z). --> a(x) <- newrel0(), newrel1(), b(x). auto* replacementClause = new AstClause(); replacementClause->setSrcLoc(clause.getSrcLoc()); replacementClause->setHead(std::unique_ptr<AstAtom>(clause.getHead()->clone())); // Add the new propositions to the clause first for (AstAtom* newAtom : replacementAtoms) { replacementClause->addToBody(std::unique_ptr<AstLiteral>(newAtom)); } // Add the remaining body literals to the clause for (AstLiteral* bodyLiteral : clause.getBodyLiterals()) { bool associated = false; bool hasVariables = false; visitDepthFirst(*bodyLiteral, [&](const AstVariable& var) { hasVariables = true; if (headComponent.find(var.getName()) != headComponent.end()) { associated = true; } }); if (associated || !hasVariables) { replacementClause->addToBody(std::unique_ptr<AstLiteral>(bodyLiteral->clone())); } } // Replace the old clause with the new one clausesToRemove.push_back(&clause); clausesToAdd.push_back(replacementClause); }); // Adjust the program for (AstClause* newClause : clausesToAdd) { program.appendClause(std::unique_ptr<AstClause>(newClause)); } for (const AstClause* oldClause : clausesToRemove) { program.removeClause(oldClause); } return changed; } bool ReduceExistentialsTransformer::transform(AstTranslationUnit& translationUnit) { AstProgram& program = *translationUnit.getProgram(); // Checks whether an atom is of the form a(_,_,...,_) auto isExistentialAtom = [&](const AstAtom& atom) { for (AstArgument* arg : atom.getArguments()) { if (dynamic_cast<AstUnnamedVariable*>(arg) == nullptr) { return false; } } return true; }; // Construct a dependency graph G where: // - Each relation is a node // - An edge (a,b) exists iff a uses b "non-existentially" in one of its *recursive* clauses // This way, a relation can be transformed into an existential form // if and only if all its predecessors can also be transformed. Graph<AstRelationIdentifier> relationGraph = Graph<AstRelationIdentifier>(); // Add in the nodes for (AstRelation* relation : program.getRelations()) { relationGraph.insert(relation->getName()); } // Keep track of all relations that cannot be transformed std::set<AstRelationIdentifier> minimalIrreducibleRelations; auto* ioType = translationUnit.getAnalysis<IOType>(); for (AstRelation* relation : program.getRelations()) { // No I/O relations can be transformed if (ioType->isIO(relation)) { minimalIrreducibleRelations.insert(relation->getName()); } for (AstClause* clause : relation->getClauses()) { bool recursive = isRecursiveClause(*clause); visitDepthFirst(*clause, [&](const AstAtom& atom) { if (atom.getName() == clause->getHead()->getName()) { return; } if (!isExistentialAtom(atom)) { if (recursive) { // Clause is recursive, so add an edge to the dependency graph relationGraph.insert(clause->getHead()->getName(), atom.getName()); } else { // Non-existential apperance in a non-recursive clause, so // it's out of the picture minimalIrreducibleRelations.insert(atom.getName()); } } }); } } // TODO (see issue #564): Don't transform relations appearing in aggregators // due to aggregator issues with unnamed variables. visitDepthFirst(program, [&](const AstAggregator& aggr) { visitDepthFirst( aggr, [&](const AstAtom& atom) { minimalIrreducibleRelations.insert(atom.getName()); }); }); // Run a DFS from each 'bad' source // A node is reachable in a DFS from an irreducible node if and only if it is // also an irreducible node std::set<AstRelationIdentifier> irreducibleRelations; for (AstRelationIdentifier relationName : minimalIrreducibleRelations) { relationGraph.visitDepthFirst(relationName, [&](const AstRelationIdentifier& subRel) { irreducibleRelations.insert(subRel); }); } // All other relations are necessarily existential std::set<AstRelationIdentifier> existentialRelations; for (AstRelation* relation : program.getRelations()) { if (!relation->getClauses().empty() && relation->getArity() != 0 && irreducibleRelations.find(relation->getName()) == irreducibleRelations.end()) { existentialRelations.insert(relation->getName()); } } // Reduce the existential relations for (AstRelationIdentifier relationName : existentialRelations) { AstRelation* originalRelation = program.getRelation(relationName); std::stringstream newRelationName; newRelationName << "+?exists_" << relationName; auto newRelation = std::make_unique<AstRelation>(); newRelation->setName(newRelationName.str()); newRelation->setSrcLoc(originalRelation->getSrcLoc()); // EqRel relations require two arguments, so remove it from the qualifier newRelation->setQualifier(originalRelation->getQualifier() & ~(EQREL_RELATION)); // Keep all non-recursive clauses for (AstClause* clause : originalRelation->getClauses()) { if (!isRecursiveClause(*clause)) { auto newClause = std::make_unique<AstClause>(); newClause->setSrcLoc(clause->getSrcLoc()); if (const AstExecutionPlan* plan = clause->getExecutionPlan()) { newClause->setExecutionPlan(std::unique_ptr<AstExecutionPlan>(plan->clone())); } newClause->setHead(std::make_unique<AstAtom>(newRelationName.str())); for (AstLiteral* lit : clause->getBodyLiterals()) { newClause->addToBody(std::unique_ptr<AstLiteral>(lit->clone())); } newRelation->addClause(std::move(newClause)); } } program.appendRelation(std::move(newRelation)); } // Mapper that renames the occurrences of marked relations with their existential // counterparts struct renameExistentials : public AstNodeMapper { const std::set<AstRelationIdentifier>& relations; renameExistentials(std::set<AstRelationIdentifier>& relations) : relations(relations) {} std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { if (auto* clause = dynamic_cast<AstClause*>(node.get())) { if (relations.find(clause->getHead()->getName()) != relations.end()) { // Clause is going to be removed, so don't rename it return node; } } else if (auto* atom = dynamic_cast<AstAtom*>(node.get())) { if (relations.find(atom->getName()) != relations.end()) { // Relation is now existential, so rename it std::stringstream newName; newName << "+?exists_" << atom->getName(); return std::make_unique<AstAtom>(newName.str()); } } node->apply(*this); return node; } }; renameExistentials update(existentialRelations); program.apply(update); bool changed = !existentialRelations.empty(); return changed; } bool ReplaceSingletonVariablesTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; AstProgram& program = *translationUnit.getProgram(); // Node-mapper to replace a set of singletons with unnamed variables struct replaceSingletons : public AstNodeMapper { std::set<std::string>& singletons; replaceSingletons(std::set<std::string>& singletons) : singletons(singletons) {} std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { if (auto* var = dynamic_cast<AstVariable*>(node.get())) { if (singletons.find(var->getName()) != singletons.end()) { return std::make_unique<AstUnnamedVariable>(); } } node->apply(*this); return node; } }; for (AstRelation* rel : program.getRelations()) { for (AstClause* clause : rel->getClauses()) { std::set<std::string> nonsingletons; std::set<std::string> vars; visitDepthFirst(*clause, [&](const AstVariable& var) { const std::string& name = var.getName(); if (vars.find(name) != vars.end()) { // Variable seen before, so not a singleton variable nonsingletons.insert(name); } else { vars.insert(name); } }); std::set<std::string> ignoredVars; // Don't unname singleton variables occurring in records. // TODO (azreika): remove this check once issue #420 is fixed std::set<std::string> recordVars; visitDepthFirst(*clause, [&](const AstRecordInit& rec) { visitDepthFirst(rec, [&](const AstVariable& var) { ignoredVars.insert(var.getName()); }); }); // Don't unname singleton variables occuring in constraints. std::set<std::string> constraintVars; visitDepthFirst(*clause, [&](const AstConstraint& cons) { visitDepthFirst(cons, [&](const AstVariable& var) { ignoredVars.insert(var.getName()); }); }); std::set<std::string> singletons; for (auto& var : vars) { if ((nonsingletons.find(var) == nonsingletons.end()) && (ignoredVars.find(var) == ignoredVars.end())) { changed = true; singletons.insert(var); } } // Replace the singletons found with underscores replaceSingletons update(singletons); clause->apply(update); } } return changed; } bool NameUnnamedVariablesTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; static constexpr const char* boundPrefix = "+underscore"; struct nameVariables : public AstNodeMapper { mutable bool changed = false; mutable size_t count = 0; nameVariables() = default; std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { if (dynamic_cast<AstUnnamedVariable*>(node.get()) != nullptr) { changed = true; std::stringstream name; name << boundPrefix << "_" << count++; return std::make_unique<AstVariable>(name.str()); } node->apply(*this); return node; } }; AstProgram& program = *translationUnit.getProgram(); for (AstRelation* rel : program.getRelations()) { for (AstClause* clause : rel->getClauses()) { nameVariables update; clause->apply(update); changed |= update.changed; } } return changed; } bool RemoveRedundantSumsTransformer::transform(AstTranslationUnit& translationUnit) { struct ReplaceSumWithCount : public AstNodeMapper { ReplaceSumWithCount() = default; std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { // Apply to all aggregates of the form // sum k : { .. } where k is a constant if (auto* agg = dynamic_cast<AstAggregator*>(node.get())) { if (agg->getOperator() == AstAggregator::Op::sum) { if (const auto* constant = dynamic_cast<const AstNumberConstant*>(agg->getTargetExpression())) { changed = true; // Then construct the new thing to replace it with auto count = std::make_unique<AstAggregator>(AstAggregator::Op::count); // Duplicate the body of the aggregate for (const auto& lit : agg->getBodyLiterals()) { count->addBodyLiteral(std::unique_ptr<AstLiteral>(lit->clone())); } auto number = std::unique_ptr<AstNumberConstant>(constant->clone()); // Now it's constant * count : { ... } auto result = std::make_unique<AstIntrinsicFunctor>( FunctorOp::MUL, std::move(number), std::move(count)); return result; } } } node->apply(*this); return node; } // variables mutable bool changed = false; }; ReplaceSumWithCount update; translationUnit.getProgram()->apply(update); return update.changed; } bool NormaliseConstraintsTransformer::transform(AstTranslationUnit& translationUnit) { bool changed = false; // set a prefix for variables bound by magic-set for identification later // prepended by + to avoid conflict with user-defined variables static constexpr const char* boundPrefix = "+abdul"; AstProgram& program = *translationUnit.getProgram(); /* Create a node mapper that recursively replaces all constants and underscores * with named variables. * * The mapper keeps track of constraints that should be added to the original * clause it is being applied on in a given constraint set. */ struct constraintNormaliser : public AstNodeMapper { std::set<AstBinaryConstraint*>& constraints; mutable int changeCount; constraintNormaliser(std::set<AstBinaryConstraint*>& constraints, int changeCount) : constraints(constraints), changeCount(changeCount) {} bool hasChanged() const { return changeCount > 0; } int getChangeCount() const { return changeCount; } std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { if (auto* stringConstant = dynamic_cast<AstStringConstant*>(node.get())) { // string constant found changeCount++; // create new variable name (with appropriate suffix) std::string constantValue = stringConstant->getConstant(); std::stringstream newVariableName; newVariableName << boundPrefix << changeCount << "_" << constantValue << "_s"; // create new constraint (+abdulX = constant) auto newVariable = std::make_unique<AstVariable>(newVariableName.str()); constraints.insert(new AstBinaryConstraint(BinaryConstraintOp::EQ, std::unique_ptr<AstArgument>(newVariable->clone()), std::unique_ptr<AstArgument>(stringConstant->clone()))); // update constant to be the variable created return newVariable; } else if (auto* numberConstant = dynamic_cast<AstNumberConstant*>(node.get())) { // number constant found changeCount++; // create new variable name (with appropriate suffix) RamDomain constantValue = numberConstant->getRamRepresentation(); std::stringstream newVariableName; newVariableName << boundPrefix << changeCount << "_" << constantValue << "_n"; // create new constraint (+abdulX = constant) auto newVariable = std::make_unique<AstVariable>(newVariableName.str()); constraints.insert(new AstBinaryConstraint(BinaryConstraintOp::EQ, std::unique_ptr<AstArgument>(newVariable->clone()), std::unique_ptr<AstArgument>(numberConstant->clone()))); // update constant to be the variable created return newVariable; } else if (dynamic_cast<AstUnnamedVariable*>(node.get()) != nullptr) { // underscore found changeCount++; // create new variable name std::stringstream newVariableName; newVariableName << "+underscore" << changeCount; return std::make_unique<AstVariable>(newVariableName.str()); } node->apply(*this); return node; } }; int changeCount = 0; // number of constants and underscores seen so far // apply the change to all clauses in the program for (AstRelation* rel : program.getRelations()) { for (AstClause* clause : rel->getClauses()) { if (isFact(*clause)) { continue; // don't normalise facts } std::set<AstBinaryConstraint*> constraints; constraintNormaliser update(constraints, changeCount); clause->apply(update); changeCount = update.getChangeCount(); changed = changed || update.hasChanged(); for (AstBinaryConstraint* constraint : constraints) { clause->addToBody(std::unique_ptr<AstBinaryConstraint>(constraint)); } } } return changed; } bool RemoveTypecastsTransformer::transform(AstTranslationUnit& translationUnit) { struct TypecastRemover : public AstNodeMapper { mutable bool changed{false}; std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { // remove sub-typecasts first node->apply(*this); // if current node is a typecast, replace with the value directly if (auto* cast = dynamic_cast<AstTypeCast*>(node.get())) { changed = true; return std::unique_ptr<AstArgument>(cast->getValue()->clone()); } // otherwise, return the original node return node; } }; TypecastRemover update; translationUnit.getProgram()->apply(update); return update.changed; } bool PolymorphicOperatorsTransformer::transform(AstTranslationUnit& translationUnit) { struct TypeRewriter : public AstNodeMapper { mutable bool changed{false}; const TypeAnalysis& typeAnalysis; ErrorReport& report; TypeRewriter(const TypeAnalysis& typeAnalysis, ErrorReport& report) : typeAnalysis(typeAnalysis), report(report) {} std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { // Utility lambdas to determine if all args are of the same type. auto isFloat = [&](const AstArgument* argument) { return isFloatType(typeAnalysis.getTypes(argument)); }; auto isUnsigned = [&](const AstArgument* argument) { return isUnsignedType(typeAnalysis.getTypes(argument)); }; // rewrite sub-expressions first node->apply(*this); // Handle functor if (auto* functor = dynamic_cast<AstIntrinsicFunctor*>(node.get())) { if (isOverloadedFunctor(functor->getFunction())) { // All args must be of the same type. if (all_of(functor->getArguments(), isFloat)) { FunctorOp convertedFunctor = convertOverloadedFunctor(functor->getFunction(), TypeAttribute::Float); functor->setFunction(convertedFunctor); changed = true; } else if (all_of(functor->getArguments(), isUnsigned)) { FunctorOp convertedFunctor = convertOverloadedFunctor(functor->getFunction(), TypeAttribute::Unsigned); functor->setFunction(convertedFunctor); changed = true; } } } // Handle binary constraint if (auto* binaryConstraint = dynamic_cast<AstBinaryConstraint*>(node.get())) { if (isOverloaded(binaryConstraint->getOperator())) { // Get arguments auto* leftArg = binaryConstraint->getLHS(); auto* rightArg = binaryConstraint->getRHS(); // Both args must be of the same type if (isFloat(leftArg) && isFloat(rightArg)) { BinaryConstraintOp convertedConstraint = convertOverloadedConstraint( binaryConstraint->getOperator(), TypeAttribute::Float); binaryConstraint->setOperator(convertedConstraint); changed = true; } else if (isUnsigned(leftArg) && isUnsigned(rightArg)) { BinaryConstraintOp convertedConstraint = convertOverloadedConstraint( binaryConstraint->getOperator(), TypeAttribute::Unsigned); binaryConstraint->setOperator(convertedConstraint); changed = true; } } } // otherwise, return the original node return node; } }; const TypeAnalysis& typeAnalysis = *translationUnit.getAnalysis<TypeAnalysis>(); TypeRewriter update(typeAnalysis, translationUnit.getErrorReport()); translationUnit.getProgram()->apply(update); return update.changed; } bool AstUserDefinedFunctorsTransformer::transform(AstTranslationUnit& translationUnit) { struct UserFunctorRewriter : public AstNodeMapper { mutable bool changed{false}; const AstProgram& program; ErrorReport& report; UserFunctorRewriter(const AstProgram& program, ErrorReport& report) : program(program), report(report){}; std::unique_ptr<AstNode> operator()(std::unique_ptr<AstNode> node) const override { node->apply(*this); if (auto* userFunctor = dynamic_cast<AstUserDefinedFunctor*>(node.get())) { AstFunctorDeclaration* functorDeclaration = program.getFunctorDeclaration(userFunctor->getName()); // Check if the functor has been declared if (functorDeclaration == nullptr) { report.addError("User-defined functor hasn't been declared", userFunctor->getSrcLoc()); return node; } // Check arity correctness. if (functorDeclaration->getArity() != userFunctor->getArguments().size()) { report.addError("Mismatching number of arguments of functor", userFunctor->getSrcLoc()); return node; } // Set types of functor instance based on its declaration. userFunctor->setArgsTypes(functorDeclaration->getArgsTypes()); userFunctor->setReturnType(functorDeclaration->getReturnType()); changed = true; } return node; } }; UserFunctorRewriter update(*translationUnit.getProgram(), translationUnit.getErrorReport()); translationUnit.getProgram()->apply(update); return update.changed; } } // end of namespace souffle
40.567164
110
0.568727
ohamel-softwaresecure
a1a8c85c1f7b3d62f3f30a48b8fbd866d8b10cf0
1,034
hpp
C++
archive/stan/src/stan/lang/generator/generate_functions.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
1
2019-09-06T15:53:17.000Z
2019-09-06T15:53:17.000Z
archive/stan/src/stan/lang/generator/generate_functions.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
8
2019-01-17T18:51:16.000Z
2019-01-17T18:51:39.000Z
archive/stan/src/stan/lang/generator/generate_functions.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
null
null
null
#ifndef STAN_LANG_GENERATOR_GENERATE_FUNCTIONS_HPP #define STAN_LANG_GENERATOR_GENERATE_FUNCTIONS_HPP #include <stan/lang/ast.hpp> #include <stan/lang/generator/generate_function.hpp> #include <stan/lang/generator/generate_function_functor.hpp> #include <ostream> #include <vector> namespace stan { namespace lang { /** * Generate function forward declarations, definitions, and * functors for the the specified sequence of function * declarations and definitions, writing to the specified stream. * * @param[in] funs sequence of function declarations and * definitions * @param[in,out] o stream for generating * are generated (for non-templated functions only) */ void generate_functions(const std::vector<function_decl_def>& funs, std::ostream& o) { for (size_t i = 0; i < funs.size(); ++i) { generate_function(funs[i], o); generate_function_functor(funs[i], o); } } } } #endif
30.411765
72
0.662476
alashworth
a1a8de673e4f10886904777f9fd9a0b377280823
4,501
cpp
C++
export/release/macos/obj/src/flixel/addons/ui/AnchorPoint.cpp
EnvyBun/KB-FNF-MOD
f7541661229c587bf99f0508cc3eba7043f8c177
[ "Apache-2.0" ]
1
2021-07-19T05:10:43.000Z
2021-07-19T05:10:43.000Z
export/release/macos/obj/src/flixel/addons/ui/AnchorPoint.cpp
EnvyBun/KB-FNF-MOD
f7541661229c587bf99f0508cc3eba7043f8c177
[ "Apache-2.0" ]
null
null
null
export/release/macos/obj/src/flixel/addons/ui/AnchorPoint.cpp
EnvyBun/KB-FNF-MOD
f7541661229c587bf99f0508cc3eba7043f8c177
[ "Apache-2.0" ]
null
null
null
// Generated by Haxe 4.1.5 #include <hxcpp.h> #ifndef INCLUDED_flixel_addons_ui_AnchorPoint #include <flixel/addons/ui/AnchorPoint.h> #endif HX_DEFINE_STACK_FRAME(_hx_pos_6681d3195fadcae2_3_new,"flixel.addons.ui.AnchorPoint","new",0x37a3eddc,"flixel.addons.ui.AnchorPoint.new","flixel/addons/ui/AnchorPoint.hx",3,0xb4184ab5) namespace flixel{ namespace addons{ namespace ui{ void AnchorPoint_obj::__construct(Float Offset,::String Side,::String Flush){ HX_STACKFRAME(&_hx_pos_6681d3195fadcae2_3_new) HXLINE( 7) this->flush = HX_("center",d5,25,db,05); HXLINE( 6) this->side = HX_("center",d5,25,db,05); HXLINE( 5) this->offset = ((Float)0); HXLINE( 11) this->offset = Offset; HXLINE( 12) this->side = Side; HXLINE( 13) this->flush = Flush; } Dynamic AnchorPoint_obj::__CreateEmpty() { return new AnchorPoint_obj; } void *AnchorPoint_obj::_hx_vtable = 0; Dynamic AnchorPoint_obj::__Create(::hx::DynamicArray inArgs) { ::hx::ObjectPtr< AnchorPoint_obj > _hx_result = new AnchorPoint_obj(); _hx_result->__construct(inArgs[0],inArgs[1],inArgs[2]); return _hx_result; } bool AnchorPoint_obj::_hx_isInstanceOf(int inClassId) { return inClassId==(int)0x00000001 || inClassId==(int)0x1d6497b0; } AnchorPoint_obj::AnchorPoint_obj() { } void AnchorPoint_obj::__Mark(HX_MARK_PARAMS) { HX_MARK_BEGIN_CLASS(AnchorPoint); HX_MARK_MEMBER_NAME(offset,"offset"); HX_MARK_MEMBER_NAME(side,"side"); HX_MARK_MEMBER_NAME(flush,"flush"); HX_MARK_END_CLASS(); } void AnchorPoint_obj::__Visit(HX_VISIT_PARAMS) { HX_VISIT_MEMBER_NAME(offset,"offset"); HX_VISIT_MEMBER_NAME(side,"side"); HX_VISIT_MEMBER_NAME(flush,"flush"); } ::hx::Val AnchorPoint_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp) { switch(inName.length) { case 4: if (HX_FIELD_EQ(inName,"side") ) { return ::hx::Val( side ); } break; case 5: if (HX_FIELD_EQ(inName,"flush") ) { return ::hx::Val( flush ); } break; case 6: if (HX_FIELD_EQ(inName,"offset") ) { return ::hx::Val( offset ); } } return super::__Field(inName,inCallProp); } ::hx::Val AnchorPoint_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp) { switch(inName.length) { case 4: if (HX_FIELD_EQ(inName,"side") ) { side=inValue.Cast< ::String >(); return inValue; } break; case 5: if (HX_FIELD_EQ(inName,"flush") ) { flush=inValue.Cast< ::String >(); return inValue; } break; case 6: if (HX_FIELD_EQ(inName,"offset") ) { offset=inValue.Cast< Float >(); return inValue; } } return super::__SetField(inName,inValue,inCallProp); } void AnchorPoint_obj::__GetFields(Array< ::String> &outFields) { outFields->push(HX_("offset",93,97,3f,60)); outFields->push(HX_("side",97,8d,53,4c)); outFields->push(HX_("flush",c4,62,9b,02)); super::__GetFields(outFields); }; #ifdef HXCPP_SCRIPTABLE static ::hx::StorageInfo AnchorPoint_obj_sMemberStorageInfo[] = { {::hx::fsFloat,(int)offsetof(AnchorPoint_obj,offset),HX_("offset",93,97,3f,60)}, {::hx::fsString,(int)offsetof(AnchorPoint_obj,side),HX_("side",97,8d,53,4c)}, {::hx::fsString,(int)offsetof(AnchorPoint_obj,flush),HX_("flush",c4,62,9b,02)}, { ::hx::fsUnknown, 0, null()} }; static ::hx::StaticInfo *AnchorPoint_obj_sStaticStorageInfo = 0; #endif static ::String AnchorPoint_obj_sMemberFields[] = { HX_("offset",93,97,3f,60), HX_("side",97,8d,53,4c), HX_("flush",c4,62,9b,02), ::String(null()) }; ::hx::Class AnchorPoint_obj::__mClass; void AnchorPoint_obj::__register() { AnchorPoint_obj _hx_dummy; AnchorPoint_obj::_hx_vtable = *(void **)&_hx_dummy; ::hx::Static(__mClass) = new ::hx::Class_obj(); __mClass->mName = HX_("flixel.addons.ui.AnchorPoint",ea,0f,f1,0d); __mClass->mSuper = &super::__SGetClass(); __mClass->mConstructEmpty = &__CreateEmpty; __mClass->mConstructArgs = &__Create; __mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField; __mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField; __mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */); __mClass->mMembers = ::hx::Class_obj::dupFunctions(AnchorPoint_obj_sMemberFields); __mClass->mCanCast = ::hx::TCanCast< AnchorPoint_obj >; #ifdef HXCPP_SCRIPTABLE __mClass->mMemberStorageInfo = AnchorPoint_obj_sMemberStorageInfo; #endif #ifdef HXCPP_SCRIPTABLE __mClass->mStaticStorageInfo = AnchorPoint_obj_sStaticStorageInfo; #endif ::hx::_hx_RegisterClass(__mClass->mName, __mClass); } } // end namespace flixel } // end namespace addons } // end namespace ui
31.921986
183
0.726061
EnvyBun
a1ab2e219487c47362a61a460f9a0d29f9b1c3f4
5,289
cpp
C++
src/qt/src/corelib/kernel/qsharedmemory_symbian.cpp
jefleponot/phantomjs
4333acfa798677ec895d73673898c3ffad36e4c0
[ "BSD-3-Clause" ]
25
2015-07-21T18:14:57.000Z
2021-02-21T10:00:48.000Z
src/qt/src/corelib/kernel/qsharedmemory_symbian.cpp
jefleponot/phantomjs
4333acfa798677ec895d73673898c3ffad36e4c0
[ "BSD-3-Clause" ]
3
2015-01-19T11:31:54.000Z
2015-07-01T13:28:48.000Z
src/qt/src/corelib/kernel/qsharedmemory_symbian.cpp
jefleponot/phantomjs
4333acfa798677ec895d73673898c3ffad36e4c0
[ "BSD-3-Clause" ]
9
2016-03-14T13:25:14.000Z
2021-02-21T10:09:22.000Z
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qsharedmemory.h" #include "qsharedmemory_p.h" #include "qcore_symbian_p.h" #include <qdebug.h> #ifndef QT_NO_SHAREDMEMORY #define QSHAREDMEMORY_DEBUG QT_BEGIN_NAMESPACE QSharedMemoryPrivate::QSharedMemoryPrivate() : QObjectPrivate(), memory(0), size(0), error(QSharedMemory::NoError), #ifndef QT_NO_SYSTEMSEMAPHORE systemSemaphore(QString()), lockedByMe(false) #endif { } void QSharedMemoryPrivate::setErrorString(const QString &function, TInt errorCode) { if (errorCode == KErrNone) return; switch (errorCode) { case KErrAlreadyExists: error = QSharedMemory::AlreadyExists; errorString = QSharedMemory::tr("%1: already exists").arg(function); break; case KErrNotFound: error = QSharedMemory::NotFound; errorString = QSharedMemory::tr("%1: doesn't exists").arg(function); break; case KErrArgument: error = QSharedMemory::InvalidSize; errorString = QSharedMemory::tr("%1: invalid size").arg(function); break; case KErrNoMemory: error = QSharedMemory::OutOfResources; errorString = QSharedMemory::tr("%1: out of resources").arg(function); break; case KErrPermissionDenied: error = QSharedMemory::PermissionDenied; errorString = QSharedMemory::tr("%1: permission denied").arg(function); break; default: errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errorCode); error = QSharedMemory::UnknownError; #if defined QSHAREDMEMORY_DEBUG qDebug() << errorString << "key" << key; #endif break; } } key_t QSharedMemoryPrivate::handle() { // don't allow making handles on empty keys if (nativeKey.isEmpty()) { error = QSharedMemory::KeyError; errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle")); return 0; } // Not really cost effective to check here if shared memory is attachable, as it requires // exactly the same call as attaching, so always assume handle is valid and return failure // from attach. return 1; } void QSharedMemoryPrivate::cleanHandle() { chunk.Close(); } bool QSharedMemoryPrivate::create(int size) { if (!handle()) return false; TPtrC ptr(qt_QString2TPtrC(nativeKey)); TInt err = chunk.CreateGlobal(ptr, size, size); if (err != KErrNone) { setErrorString(QLatin1String("QSharedMemory::create"), err); return false; } // Zero out the created chunk Mem::FillZ(chunk.Base(), chunk.Size()); return true; } bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode /* mode */) { // Grab a pointer to the memory block if (!chunk.Handle()) { if (!handle()) return false; TPtrC ptr(qt_QString2TPtrC(nativeKey)); TInt err = KErrNoMemory; err = chunk.OpenGlobal(ptr, false); if (err != KErrNone) { setErrorString(QLatin1String("QSharedMemory::attach"), err); return false; } } size = chunk.Size(); memory = chunk.Base(); return true; } bool QSharedMemoryPrivate::detach() { chunk.Close(); memory = 0; size = 0; return true; } QT_END_NAMESPACE #endif //QT_NO_SHAREDMEMORY
30.051136
104
0.668557
jefleponot
a1adaa2f8524b211108b887544a6b7cfcdb6110b
1,368
hpp
C++
utils/timer.hpp
BowenforGit/Grasper
268468d6eb0a56e9a4815c0c1d7660b06bf8a1f7
[ "Apache-2.0" ]
29
2019-11-18T14:25:05.000Z
2022-02-10T07:21:48.000Z
utils/timer.hpp
BowenforGit/Grasper
268468d6eb0a56e9a4815c0c1d7660b06bf8a1f7
[ "Apache-2.0" ]
2
2021-03-17T03:17:38.000Z
2021-04-11T04:06:23.000Z
utils/timer.hpp
BowenforGit/Grasper
268468d6eb0a56e9a4815c0c1d7660b06bf8a1f7
[ "Apache-2.0" ]
6
2019-11-21T18:04:15.000Z
2022-03-01T02:48:50.000Z
/* Copyright 2019 Husky Data Lab, CUHK Authors: Hongzhi Chen (hzchen@cse.cuhk.edu.hk) */ #ifndef TIMER_HPP_ #define TIMER_HPP_ #include <emmintrin.h> #include <sys/time.h> #include <unistd.h> #include <stdint.h> #include <string> #include <vector> class timer { public: static uint64_t get_usec() { struct timespec tp; /* POSIX.1-2008: Applications should use the clock_gettime() function instead of the obsolescent gettimeofday() function. */ /* NOTE: The clock_gettime() function is only available on Linux. The mach_absolute_time() function is an alternative on OSX. */ clock_gettime(CLOCK_MONOTONIC, &tp); return ((tp.tv_sec * 1000 * 1000) + (tp.tv_nsec / 1000)); } static void cpu_relax(int u) { int t = 166 * u; while ((t--) > 0) _mm_pause(); // a busy-wait loop } static void init_timers(int size); static void reset_timers(); static double get_current_time(); static void start_timer(int i); static void reset_timer(int i); static void stop_timer(int i); static double get_timer(int i); static void print_timer(std::string str, int i); static int N_Timers; static std::vector<double> _timers; // timers static std::vector<double> _acc_time; // accumulated time }; #endif /* TIMER_HPP_ */
24
77
0.646199
BowenforGit
a1af8186be2dd8773350cad537b2b66c78d1b447
15,833
cpp
C++
CLR/Libraries/CorLib/corlib_native_System_BitConverter.cpp
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
null
null
null
CLR/Libraries/CorLib/corlib_native_System_BitConverter.cpp
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
null
null
null
CLR/Libraries/CorLib/corlib_native_System_BitConverter.cpp
valoni/STM32F103
75f0cb8be593ca287a08f5992d1f5d3c3bb12bfc
[ "Apache-2.0" ]
1
2019-12-03T05:37:43.000Z
2019-12-03T05:37:43.000Z
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) Microsoft Corporation. All rights reserved. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "CorLib.h" char DigitalToHex(BYTE x) { return x < 10 ? x + '0' : x - 10 + 'A'; } char* ByteArrayToHex(BYTE* pInput, int index, int length) { char* pOutput = new char[length * 3]; char* p = pOutput; pInput += index; for(int i = 0; i < length; i++, pInput++) { *p++ = DigitalToHex(*pInput / 16); *p++ = DigitalToHex(*pInput % 16); *p++ = '-'; } *(--p) = 0; return pOutput; } HRESULT Library_corlib_native_System_BitConverter::get_IsLittleEndian___STATIC__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); DWORD x = 0x12345678; BYTE* p = reinterpret_cast<BYTE*>(&x); stack.SetResult_Boolean(*p == 0x78); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::DoubleToInt64Bits___STATIC__I8__R8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); double input = stack.Arg0().NumericByRefConst().r8; __int64* p = reinterpret_cast<__int64*>(&input); stack.SetResult_I8(*p); TINYCLR_NOCLEANUP_NOLABEL(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__BOOLEAN( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); bool input = stack.Arg0().NumericByRefConst().u1 != 0; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 1, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<bool*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__CHAR( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); wchar_t input = stack.Arg0().NumericByRefConst().u2; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 2, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<wchar_t*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__R8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); double input = stack.Arg0().NumericByRefConst().r8; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 8, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<double*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__R4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); float input = stack.Arg0().NumericByRefConst().r4; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 4, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<float*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); int input = stack.Arg0().NumericByRefConst().s4; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 4, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<int*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__I8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); __int64 input = stack.Arg0().NumericByRefConst().s8; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 8, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<__int64*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__I2( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); short input = stack.Arg0().NumericByRefConst().s2; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 2, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<short*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__U4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); unsigned int input = stack.Arg0().NumericByRefConst().u4; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 4, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<unsigned int*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__U8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); unsigned __int64 input = stack.Arg0().NumericByRefConst().u8; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 8, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<unsigned __int64*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::GetBytes___STATIC__SZARRAY_U1__U2( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); unsigned short input = stack.Arg0().NumericByRefConst().u2; TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance(stack.PushValueAndClear(), 2, g_CLR_RT_WellKnownTypes.m_UInt8)); BYTE* p = stack.TopValue().DereferenceArray()->GetFirstElement(); *reinterpret_cast<unsigned short*>(p) = input; TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::Int64BitsToDouble___STATIC__R8__I8( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); __int64 input = stack.Arg0().NumericByRefConst().s8; double* p = reinterpret_cast<double*>(&input); stack.SetResult_R8(*p); TINYCLR_NOCLEANUP_NOLABEL(); } HRESULT Library_corlib_native_System_BitConverter::ToBoolean___STATIC__BOOLEAN__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); BYTE* p = pArray->GetFirstElement(); stack.SetResult_Boolean(*reinterpret_cast<bool*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToChar___STATIC__CHAR__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 2 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult(*reinterpret_cast<wchar_t*>(p + index), DATATYPE_CHAR); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToDouble___STATIC__R8__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 8 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_R8(*reinterpret_cast<double*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToSingle___STATIC__R4__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 4 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_R4(*reinterpret_cast<float*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToInt16___STATIC__I2__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 2 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult(*reinterpret_cast<short*>(p + index), DATATYPE_I2); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToInt32___STATIC__I4__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 4 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_I4(*reinterpret_cast<int*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToInt64___STATIC__I8__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 8 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_I8(*reinterpret_cast<__int64*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToUInt16___STATIC__U2__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 2 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult(*reinterpret_cast<unsigned short*>(p + index), DATATYPE_U2); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToUInt32___STATIC__U4__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 4 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_U4(*reinterpret_cast<unsigned int*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToUInt64___STATIC__U8__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 8 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); stack.SetResult_U8(*reinterpret_cast<unsigned __int64*>(p + index)); TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToString___STATIC__STRING__SZARRAY_U1( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); if (pArray->m_numOfElements == 0) { TINYCLR_CHECK_HRESULT(stack.SetResult_String("")); } else { BYTE* p = pArray->GetFirstElement(); char* pOutput = ByteArrayToHex(p, 0, pArray->m_numOfElements); TINYCLR_CHECK_HRESULT(stack.SetResult_String(pOutput)); delete[] pOutput; } TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToString___STATIC__STRING__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; if (pArray->m_numOfElements == 0 && index == 0) { TINYCLR_CHECK_HRESULT(stack.SetResult_String("")); } else { if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); BYTE* p = pArray->GetFirstElement(); char* pOutput = ByteArrayToHex(p, index, pArray->m_numOfElements - index); TINYCLR_CHECK_HRESULT(stack.SetResult_String(pOutput)); delete[] pOutput; } TINYCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_BitConverter::ToString___STATIC__STRING__SZARRAY_U1__I4__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index = stack.Arg1().NumericByRefConst().s4; int length = stack.Arg2().NumericByRefConst().s4; if (pArray->m_numOfElements == 0 && index == 0 && length == 0) { TINYCLR_CHECK_HRESULT(stack.SetResult_String("")); } else { if (index < 0 || length < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + length > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p = pArray->GetFirstElement(); char* pOutput = ByteArrayToHex(p, index, length); TINYCLR_CHECK_HRESULT(stack.SetResult_String(pOutput)); delete[] pOutput; } TINYCLR_NOCLEANUP(); }
34.569869
201
0.739152
valoni
a1b260e5b269b5281a133e02563deca98851b6e5
16,949
cpp
C++
stage0/src/library/compiler/eager_lambda_lifting.cpp
tballmsft/lean4
fb57b73e1f07828fa9aad91c2112bf072b3e79f2
[ "Apache-2.0" ]
1,538
2019-04-25T11:00:03.000Z
2022-03-30T02:35:48.000Z
stage0/src/library/compiler/eager_lambda_lifting.cpp
tballmsft/lean4
fb57b73e1f07828fa9aad91c2112bf072b3e79f2
[ "Apache-2.0" ]
812
2019-05-20T09:15:21.000Z
2022-03-31T16:36:04.000Z
stage0/src/library/compiler/eager_lambda_lifting.cpp
tballmsft/lean4
fb57b73e1f07828fa9aad91c2112bf072b3e79f2
[ "Apache-2.0" ]
168
2019-04-25T12:49:34.000Z
2022-03-29T05:07:14.000Z
/* Copyright (c) 2019 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #include "runtime/flet.h" #include "kernel/instantiate.h" #include "kernel/abstract.h" #include "kernel/for_each_fn.h" #include "kernel/type_checker.h" #include "kernel/inductive.h" #include "library/trace.h" #include "library/class.h" #include "library/compiler/util.h" #include "library/compiler/csimp.h" #include "library/compiler/closed_term_cache.h" namespace lean { extern "C" object* lean_mk_eager_lambda_lifting_name(object* n, object* idx); extern "C" uint8 lean_is_eager_lambda_lifting_name(object* n); name mk_elambda_lifting_name(name const & fn, unsigned idx) { return name(lean_mk_eager_lambda_lifting_name(fn.to_obj_arg(), mk_nat_obj(idx))); } bool is_elambda_lifting_name(name fn) { return lean_is_eager_lambda_lifting_name(fn.to_obj_arg()); } /* Return true iff `e` contains a free variable that is not in `exception_set`. */ static bool has_fvar_except(expr const & e, name_set const & exception_set) { if (!has_fvar(e)) return false; bool found = false; for_each(e, [&](expr const & e, unsigned) { if (!has_fvar(e)) return false; if (found) return false; // done if (is_fvar(e) && !exception_set.contains(fvar_name(e))) { found = true; return false; // done } return true; }); return found; } /* Return true if the type of a parameter in `params` depends on `fvar`. */ static bool depends_on_fvar(local_ctx const & lctx, buffer<expr> const & params, expr const & fvar) { for (expr const & param : params) { local_decl const & decl = lctx.get_local_decl(param); lean_assert(!decl.get_value()); if (has_fvar(decl.get_type(), fvar)) return true; } return false; } /* We eagerly lift lambda expressions that are stored in terminal constructors. We say a constructor application is terminal if it is the result/returned. We use this transformation to generate good code for the following scenario: Suppose we have a definition ``` def f (x : nat) : Pro (Nat -> Nat) (Nat -> Bool) := ((fun y, <code1 using x y>), (fun z, <code2 using x z>)) ``` That is, `f` is "packing" functions in a structure and returning it. Now, consider the following application: ``` (f a).1 b ``` Without eager lambda lifting, `f a` will create two closures and one pair. Then, we project the first closure in the pair and apply it to `b`. This is inefficient. If `f` is small, we can workaround this problem by inlining `f`. However, if inlining is not feasible, we would have to perform all memory allocations. This is particularly bad, if `f` is a structure with many fields. With eager lambda lifting, we transform `f` into ``` def f._elambda_1 (x y) : Nat := <code1 using x y> def f._elambda_2 (x z) : Bool := <code2 using x z> def f (x : nat) : Pro (Nat -> Nat) (Nat -> Bool) := (f._elambda_1 x, f._elambda_2 x) ``` Then, when the simplifier sees `(f a).1 b`, it can reduce it to `f._elambda_1 a b`, and closure and pair allocations are avoided. Note that we do not lift all nested lambdas here, only the ones in terminal constructors. Premature lambda lifting may hurt performance in the non-terminal case. Example: ``` def f (xs : List Nat) := let g := fun x, x + x in List.map g xs ``` We want to keep `fun x, x+x` until we specialize `f`. Remark: we also skip this transformation for definitions marked as `[inline]` or `[instance]`. */ class eager_lambda_lifting_fn { type_checker::state m_st; csimp_cfg m_cfg; local_ctx m_lctx; buffer<comp_decl> m_new_decls; name m_base_name; name_set m_closed_fvars; /* let-declarations that only depend on global constants and other closed_fvars */ name_set m_terminal_lambdas; name_set m_nonterminal_lambdas; unsigned m_next_idx{1}; environment const & env() const { return m_st.env(); } name_generator & ngen() { return m_st.ngen(); } expr eta_expand(expr const & e) { return lcnf_eta_expand(m_st, m_lctx, e); } name next_name() { name r = mk_elambda_lifting_name(m_base_name, m_next_idx); m_next_idx++; return r; } bool collect_fvars_core(expr const & e, name_set & collected, buffer<expr> & fvars) { if (!has_fvar(e)) return true; bool ok = true; for_each(e, [&](expr const & x, unsigned) { if (!has_fvar(x)) return false; if (!ok) return false; if (is_fvar(x)) { if (!collected.contains(fvar_name(x))) { collected.insert(fvar_name(x)); local_decl d = m_lctx.get_local_decl(x); /* We do not eagerly lift a lambda if we need to copy a join-point. Remark: we may revise this decision in the future, and use the same approach we use at `lambda_lifting.cpp`. */ if (is_join_point_name(d.get_user_name())) { ok = false; return false; } else { if (!collect_fvars_core(d.get_type(), collected, fvars)) { ok = false; return false; } if (m_closed_fvars.contains(fvar_name(x))) { /* If x only depends on global constants and other variables in m_closed_fvars. Then, we also collect the other variables at m_closed_fvars. */ if (!collect_fvars_core(*d.get_value(), collected, fvars)) { ok = false; return false; } } fvars.push_back(x); } } } return true; }); return ok; } bool collect_fvars(expr const & e, buffer<expr> & fvars) { if (!has_fvar(e)) return true; name_set collected; if (collect_fvars_core(e, collected, fvars)) { sort_fvars(m_lctx, fvars); return true; } else { return false; } } /* Split fvars in two groups: `new_params` and `to_copy`. We put a fvar `x` in `new_params` if it is not a let declaration, or a variable in `params` depend on `x`, or it is not in `m_closed_fvars`. The variables in `to_copy` are variables that depend only on global constants or other variables in `to_copy`, and `params` do not depend on them. */ void split_fvars(buffer<expr> const & fvars, buffer<expr> const & params, buffer<expr> & new_params, buffer<expr> & to_copy) { for (expr const & fvar : fvars) { local_decl const & decl = m_lctx.get_local_decl(fvar); if (!decl.get_value()) { new_params.push_back(fvar); } else { if (!m_closed_fvars.contains(fvar_name(fvar)) || depends_on_fvar(m_lctx, params, fvar)) { new_params.push_back(fvar); } else { to_copy.push_back(fvar); } } } } expr lift_lambda(expr e, bool apply_simp) { /* Hack: We use `try` here because previous compilation steps may have produced type incorrect terms. */ try { lean_assert(is_lambda(e)); buffer<expr> fvars; if (!collect_fvars(e, fvars)) { return e; } buffer<expr> params; while (is_lambda(e)) { expr param_type = instantiate_rev(binding_domain(e), params.size(), params.data()); expr param = m_lctx.mk_local_decl(ngen(), binding_name(e), param_type, binding_info(e)); params.push_back(param); e = binding_body(e); } e = instantiate_rev(e, params.size(), params.data()); buffer<expr> new_params, to_copy; split_fvars(fvars, params, new_params, to_copy); /* Variables in `to_copy` only depend on global constants and other variables in `to_copy`. Moreover, `params` do not depend on them. It is wasteful to pass them as new parameters to the new lifted declaration. We can just copy them. The code duplication is not problematic because later at `extract_closed` we will create global names for closed terms, and eliminate the redundancy. */ e = m_lctx.mk_lambda(to_copy, e); e = m_lctx.mk_lambda(params, e); expr code = abstract(e, new_params.size(), new_params.data()); unsigned i = new_params.size(); while (i > 0) { --i; local_decl const & decl = m_lctx.get_local_decl(new_params[i]); expr type = abstract(decl.get_type(), i, new_params.data()); code = ::lean::mk_lambda(decl.get_user_name(), type, code); } if (apply_simp) { code = csimp(env(), code, m_cfg); } expr type = cheap_beta_reduce(type_checker(m_st).infer(code)); name n = next_name(); /* We add the auxiliary declaration `n` as a "meta" axiom to the environment. This is a hack to make sure we can use `csimp` to simplify `code` and other definitions that use `n`. We used a similar hack at `specialize.cpp`. */ declaration aux_ax = mk_axiom(n, names(), type, true /* meta */); m_st.env() = env().add(aux_ax, false); m_new_decls.push_back(comp_decl(n, code)); return mk_app(mk_constant(n), new_params); } catch (exception &) { return e; } } /* Given a free variable `x`, follow let-decls and return a pair `(x, v)`. Examples for `find(x)` - `x := 1` ==> `(x, 1)` - `z := (fun w, w+1); y := z; x := y` ==> `(z, (fun w, w+1))` - `z := f a; y := mdata kv z; x := y` ==> `(z, f a)` */ pair<name, expr> find(expr const & x) const { lean_assert(is_fvar(x)); expr e = x; name r = fvar_name(x); while (true) { if (is_mdata(e)) { e = mdata_expr(e); } else if (is_fvar(e)) { r = fvar_name(e); optional<local_decl> decl = m_lctx.find_local_decl(e); lean_assert(decl); if (optional<expr> v = decl->get_value()) { if (is_join_point_name(decl->get_user_name())) { return mk_pair(r, e); } else { e = *v; } } else { return mk_pair(r, e); } } else { return mk_pair(r, e); } } } expr visit_lambda_core(expr e) { flet<local_ctx> save_lctx(m_lctx, m_lctx); buffer<expr> fvars; while (is_lambda(e)) { expr new_type = instantiate_rev(binding_domain(e), fvars.size(), fvars.data()); expr new_fvar = m_lctx.mk_local_decl(ngen(), binding_name(e), new_type, binding_info(e)); fvars.push_back(new_fvar); e = binding_body(e); } expr r = visit_terminal(instantiate_rev(e, fvars.size(), fvars.data())); return m_lctx.mk_lambda(fvars, r); } expr visit_let(expr e) { flet<local_ctx> save_lctx(m_lctx, m_lctx); buffer<expr> fvars; while (is_let(e)) { bool not_root = false; bool jp = is_join_point_name(let_name(e)); expr new_type = instantiate_rev(let_type(e), fvars.size(), fvars.data()); expr new_val = visit(instantiate_rev(let_value(e), fvars.size(), fvars.data()), not_root, jp); expr new_fvar = m_lctx.mk_local_decl(ngen(), let_name(e), new_type, new_val); if (!has_fvar_except(new_type, m_closed_fvars) && !has_fvar_except(new_val, m_closed_fvars)) { m_closed_fvars.insert(fvar_name(new_fvar)); } fvars.push_back(new_fvar); e = let_body(e); } expr r = visit_terminal(instantiate_rev(e, fvars.size(), fvars.data())); r = abstract(r, fvars.size(), fvars.data()); unsigned i = fvars.size(); while (i > 0) { --i; name const & n = fvar_name(fvars[i]); local_decl const & decl = m_lctx.get_local_decl(n); expr type = abstract(decl.get_type(), i, fvars.data()); expr val = *decl.get_value(); if (m_terminal_lambdas.contains(n) && !m_nonterminal_lambdas.contains(n)) { expr new_val = eta_expand(val); lean_assert(is_lambda(new_val)); bool apply_simp = new_val != val; val = lift_lambda(new_val, apply_simp); } r = ::lean::mk_let(decl.get_user_name(), type, abstract(val, i, fvars.data()), r); } return r; } expr visit_cases_on(expr const & e) { lean_assert(is_cases_on_app(env(), e)); buffer<expr> args; expr const & c = get_app_args(e, args); /* Remark: eager lambda lifting is applied before we have erased most type information. */ unsigned minor_idx; unsigned minors_end; bool before_erasure = true; std::tie(minor_idx, minors_end) = get_cases_on_minors_range(env(), const_name(c), before_erasure); for (; minor_idx < minors_end; minor_idx++) { args[minor_idx] = visit_lambda_core(args[minor_idx]); } return mk_app(c, args); } expr visit_app(expr const & e) { if (is_cases_on_app(env(), e)) { return visit_cases_on(e); } else { buffer<expr> args; get_app_args(e, args); for (expr const & arg : args) { if (is_fvar(arg)) { name x; expr v; std::tie(x, v) = find(arg); if (is_lambda(v)) { m_nonterminal_lambdas.insert(x); } } } return e; } } expr visit_lambda(expr const & e, bool root, bool join_point) { if (root || join_point) return visit_lambda_core(e); else return e; } expr visit(expr const & e, bool root = false, bool join_point = false) { switch (e.kind()) { case expr_kind::App: return visit_app(e); case expr_kind::Lambda: return visit_lambda(e, root, join_point); case expr_kind::Let: return visit_let(e); default: return e; } } expr visit_terminal(expr const & e) { expr t = is_fvar(e) ? find(e).second : e; if (is_constructor_app(env(), t)) { buffer<expr> args; get_app_args(e, args); for (expr const & arg : args) { if (is_fvar(arg)) { name x; expr v; std::tie(x, v) = find(arg); v = eta_expand(v); if (is_lambda(v)) { m_terminal_lambdas.insert(x); } } } return e; } else { return visit(e); } } public: eager_lambda_lifting_fn(environment const & env, csimp_cfg const & cfg): m_st(env), m_cfg(cfg) {} pair<environment, comp_decls> operator()(comp_decl const & cdecl) { m_base_name = cdecl.fst(); expr r = visit(cdecl.snd(), true); comp_decl new_cdecl(cdecl.fst(), r); m_new_decls.push_back(new_cdecl); return mk_pair(env(), comp_decls(m_new_decls)); } }; pair<environment, comp_decls> eager_lambda_lifting(environment env, comp_decls const & ds, csimp_cfg const & cfg) { comp_decls r; for (comp_decl const & d : ds) { if (has_inline_attribute(env, d.fst()) || is_instance(env, d.fst())) { r = append(r, comp_decls(d)); } else { comp_decls new_ds; std::tie(env, new_ds) = eager_lambda_lifting_fn(env, cfg)(d); r = append(r, new_ds); } } return mk_pair(env, r); } }
39.693208
130
0.545755
tballmsft
a1b2e5e3b5b52f7ae039aca17d05455453205755
1,052
hpp
C++
main/mainDefs.hpp
v1993/generators
78b4a106b83ac8604d826d4751f7ab38c1ccdbd4
[ "MIT" ]
null
null
null
main/mainDefs.hpp
v1993/generators
78b4a106b83ac8604d826d4751f7ab38c1ccdbd4
[ "MIT" ]
null
null
null
main/mainDefs.hpp
v1993/generators
78b4a106b83ac8604d826d4751f7ab38c1ccdbd4
[ "MIT" ]
null
null
null
#ifndef I_V_MAIN_DEFS #define I_V_MAIN_DEFS #pragma once #include <iostream> #include <fstream> #include <algorithm> #include <iterator> #include <exception> #include <vector> #include <string> #include <memory> //#include <filesystem> #include <cstdlib> #include <boost/any.hpp> #include <boost/bind.hpp> #include <boost/thread/thread.hpp> #include <boost/asio.hpp> #include <boost/filesystem.hpp> #include <boost/variant.hpp> #include <boost/dll/import.hpp> struct cacheop { explicit cacheop(std::string const& val): value(val) { } operator std::string() const { return value; } std::string value; }; struct opts { opts(): cache("") {} std::shared_ptr<std::ostream> out; bool no_end = false; std::string backend; std::vector<std::string> backend_opts; unsigned int jobs; cacheop cache; std::string cachefile = ""; std::vector<std::shared_ptr<std::ifstream>> inpfiles; std::map<std::shared_ptr<std::ifstream>, std::string> inpfiles_names; }; #endif // kate: indent-mode cstyle; indent-width 4; replace-tabs off; tab-width 4;
21.916667
76
0.715779
v1993
a1b5e70bbad8fd9f7fffe7c81048dcbe14a0ed83
602
cpp
C++
AppBase/CameraMenu.cpp
SatoshiMabuchi/Crystal
91b2d72e5544cf86183587d2cfea48ca7f390dd4
[ "MIT" ]
null
null
null
AppBase/CameraMenu.cpp
SatoshiMabuchi/Crystal
91b2d72e5544cf86183587d2cfea48ca7f390dd4
[ "MIT" ]
null
null
null
AppBase/CameraMenu.cpp
SatoshiMabuchi/Crystal
91b2d72e5544cf86183587d2cfea48ca7f390dd4
[ "MIT" ]
null
null
null
#include "CameraMenu.h" #include "imgui.h" #include "../UI/IModel.h" #include "../UI/ICanvas.h" using namespace Crystal::UI; void CameraMenu::show() { if (ImGui::BeginMenu("Camera")) { if (ImGui::MenuItem("Fit")) { canvas->fitCamera(model->getBoundingBox()); } if (ImGui::MenuItem("XY")) { canvas->setCameraXY(model->getBoundingBox()); } if (ImGui::MenuItem("YZ")) { canvas->setCameraYZ(model->getBoundingBox()); } if (ImGui::MenuItem("ZX")) { canvas->setCameraZX(model->getBoundingBox()); } ImGui::EndMenu(); } //ImGui::EndMenuBar(); }
20.758621
49
0.606312
SatoshiMabuchi
a1b638e5f264494033ad687cdfe9c9fd76bdd1c9
2,345
cpp
C++
lib/asmjit/test/asmjit_test_perf.cpp
diegocarba99/bangheera
2aa92584a66fe2736c312eee099e14357003c3c3
[ "MIT" ]
1
2021-05-22T21:18:44.000Z
2021-05-22T21:18:44.000Z
lib/asmjit/test/asmjit_test_perf.cpp
diegocarba99/bangheera
2aa92584a66fe2736c312eee099e14357003c3c3
[ "MIT" ]
null
null
null
lib/asmjit/test/asmjit_test_perf.cpp
diegocarba99/bangheera
2aa92584a66fe2736c312eee099e14357003c3c3
[ "MIT" ]
3
2021-03-12T10:41:03.000Z
2022-02-12T02:33:45.000Z
// AsmJit - Machine code generation for C++ // // * Official AsmJit Home Page: https://asmjit.com // * Official Github Repository: https://github.com/asmjit/asmjit // // Copyright (c) 2008-2020 The AsmJit Authors // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation would be // appreciated but is not required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. #include <asmjit/core.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cmdline.h" using namespace asmjit; #if defined(ASMJIT_BUILD_X86) void benchmarkX86Emitters(uint32_t numIterations, bool testX86, bool testX64) noexcept; #endif int main(int argc, char* argv[]) { CmdLine cmdLine(argc, argv); uint32_t numIterations = 20000; printf("AsmJit Performance Suite v%u.%u.%u:\n\n", unsigned((ASMJIT_LIBRARY_VERSION >> 16) ), unsigned((ASMJIT_LIBRARY_VERSION >> 8) & 0xFF), unsigned((ASMJIT_LIBRARY_VERSION ) & 0xFF)); printf("Usage:\n"); printf(" --help Show usage only\n"); printf(" --quick Decrease the number of iterations to make tests quicker\n"); printf(" --arch=<ARCH> Select architecture to run ('all' by default)\n"); printf("\n"); if (cmdLine.hasArg("--help")) return 0; if (cmdLine.hasArg("--quick")) numIterations = 1000; const char* arch = cmdLine.valueOf("--arch", "all"); #if defined(ASMJIT_BUILD_X86) bool testX86 = strcmp(arch, "all") == 0 || strcmp(arch, "x86") == 0; bool testX64 = strcmp(arch, "all") == 0 || strcmp(arch, "x64") == 0; if (testX86 || testX64) benchmarkX86Emitters(numIterations, testX86, testX64); #endif return 0; }
33.5
87
0.696802
diegocarba99
a1bc7563a7c3370940798cc8c3c53c58edaaa59a
6,089
cc
C++
arch/x86_64/cpu/idt.cc
PoisonNinja/quark
0cc2b8191f0c5cbd856caac688bfdac54a7d3369
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
3
2019-08-01T03:16:31.000Z
2022-02-17T06:52:26.000Z
arch/x86_64/cpu/idt.cc
PoisonNinja/quark
0cc2b8191f0c5cbd856caac688bfdac54a7d3369
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
32
2018-03-26T20:10:44.000Z
2020-07-13T03:01:42.000Z
arch/x86_64/cpu/idt.cc
PoisonNinja/quark
0cc2b8191f0c5cbd856caac688bfdac54a7d3369
[ "BSD-3-Clause-Clear", "BSD-3-Clause" ]
1
2018-08-29T21:31:06.000Z
2018-08-29T21:31:06.000Z
#include <arch/cpu/idt.h> namespace cpu { namespace x86_64 { namespace idt { constexpr size_t num_entries = 256; static struct idt::entry entries[num_entries]; static struct idt::descriptor descriptor = { .limit = sizeof(struct idt::entry) * num_entries - 1, .offset = reinterpret_cast<addr_t>(&entries), }; extern "C" void isr0(void); extern "C" void isr1(void); extern "C" void isr2(void); extern "C" void isr3(void); extern "C" void isr4(void); extern "C" void isr5(void); extern "C" void isr6(void); extern "C" void isr7(void); extern "C" void isr8(void); extern "C" void isr9(void); extern "C" void isr10(void); extern "C" void isr11(void); extern "C" void isr12(void); extern "C" void isr13(void); extern "C" void isr14(void); extern "C" void isr15(void); extern "C" void isr16(void); extern "C" void isr17(void); extern "C" void isr18(void); extern "C" void isr19(void); extern "C" void isr20(void); extern "C" void isr21(void); extern "C" void isr22(void); extern "C" void isr23(void); extern "C" void isr24(void); extern "C" void isr25(void); extern "C" void isr26(void); extern "C" void isr27(void); extern "C" void isr28(void); extern "C" void isr29(void); extern "C" void isr30(void); extern "C" void isr31(void); extern "C" void irq0(void); extern "C" void irq1(void); extern "C" void irq2(void); extern "C" void irq3(void); extern "C" void irq4(void); extern "C" void irq5(void); extern "C" void irq6(void); extern "C" void irq7(void); extern "C" void irq8(void); extern "C" void irq9(void); extern "C" void irq10(void); extern "C" void irq11(void); extern "C" void irq12(void); extern "C" void irq13(void); extern "C" void irq14(void); extern "C" void irq15(void); extern "C" void idt_load(addr_t); static void set_entry(struct idt::entry* entry, addr_t offset, uint16_t selector, uint8_t attributes) { entry->offset_low = offset & 0xFFFF; entry->selector = selector; entry->zero = 0; entry->attributes = attributes; entry->offset_middle = (offset >> 16) & 0xFFFF; entry->offset_high = (offset >> 32) & 0xFFFFFFFF; entry->zero_two = 0; } void init() { // Interrupt gates, only kernel accessible idt::set_entry(&entries[0], reinterpret_cast<addr_t>(isr0), 0x08, 0x8E); idt::set_entry(&entries[1], reinterpret_cast<addr_t>(isr1), 0x08, 0x8E); idt::set_entry(&entries[2], reinterpret_cast<addr_t>(isr2), 0x08, 0x8E); idt::set_entry(&entries[3], reinterpret_cast<addr_t>(isr3), 0x08, 0x8E); idt::set_entry(&entries[4], reinterpret_cast<addr_t>(isr4), 0x08, 0x8E); idt::set_entry(&entries[5], reinterpret_cast<addr_t>(isr5), 0x08, 0x8E); idt::set_entry(&entries[6], reinterpret_cast<addr_t>(isr6), 0x08, 0x8E); idt::set_entry(&entries[7], reinterpret_cast<addr_t>(isr7), 0x08, 0x8E); idt::set_entry(&entries[8], reinterpret_cast<addr_t>(isr8), 0x08, 0x8E); idt::set_entry(&entries[9], reinterpret_cast<addr_t>(isr9), 0x08, 0x8E); idt::set_entry(&entries[10], reinterpret_cast<addr_t>(isr10), 0x08, 0x8E); idt::set_entry(&entries[11], reinterpret_cast<addr_t>(isr11), 0x08, 0x8E); idt::set_entry(&entries[12], reinterpret_cast<addr_t>(isr12), 0x08, 0x8E); idt::set_entry(&entries[13], reinterpret_cast<addr_t>(isr13), 0x08, 0x8E); idt::set_entry(&entries[14], reinterpret_cast<addr_t>(isr14), 0x08, 0x8E); idt::set_entry(&entries[15], reinterpret_cast<addr_t>(isr15), 0x08, 0x8E); idt::set_entry(&entries[16], reinterpret_cast<addr_t>(isr16), 0x08, 0x8E); idt::set_entry(&entries[17], reinterpret_cast<addr_t>(isr17), 0x08, 0x8E); idt::set_entry(&entries[18], reinterpret_cast<addr_t>(isr18), 0x08, 0x8E); idt::set_entry(&entries[19], reinterpret_cast<addr_t>(isr19), 0x08, 0x8E); idt::set_entry(&entries[20], reinterpret_cast<addr_t>(isr20), 0x08, 0x8E); idt::set_entry(&entries[21], reinterpret_cast<addr_t>(isr21), 0x08, 0x8E); idt::set_entry(&entries[22], reinterpret_cast<addr_t>(isr22), 0x08, 0x8E); idt::set_entry(&entries[23], reinterpret_cast<addr_t>(isr23), 0x08, 0x8E); idt::set_entry(&entries[24], reinterpret_cast<addr_t>(isr24), 0x08, 0x8E); idt::set_entry(&entries[25], reinterpret_cast<addr_t>(isr25), 0x08, 0x8E); idt::set_entry(&entries[26], reinterpret_cast<addr_t>(isr26), 0x08, 0x8E); idt::set_entry(&entries[27], reinterpret_cast<addr_t>(isr27), 0x08, 0x8E); idt::set_entry(&entries[28], reinterpret_cast<addr_t>(isr28), 0x08, 0x8E); idt::set_entry(&entries[29], reinterpret_cast<addr_t>(isr29), 0x08, 0x8E); idt::set_entry(&entries[30], reinterpret_cast<addr_t>(isr30), 0x08, 0x8E); idt::set_entry(&entries[31], reinterpret_cast<addr_t>(isr31), 0x08, 0x8E); idt::set_entry(&entries[32], reinterpret_cast<addr_t>(irq0), 0x08, 0x8E); idt::set_entry(&entries[33], reinterpret_cast<addr_t>(irq1), 0x08, 0x8E); idt::set_entry(&entries[34], reinterpret_cast<addr_t>(irq2), 0x08, 0x8E); idt::set_entry(&entries[35], reinterpret_cast<addr_t>(irq3), 0x08, 0x8E); idt::set_entry(&entries[36], reinterpret_cast<addr_t>(irq4), 0x08, 0x8E); idt::set_entry(&entries[37], reinterpret_cast<addr_t>(irq5), 0x08, 0x8E); idt::set_entry(&entries[38], reinterpret_cast<addr_t>(irq6), 0x08, 0x8E); idt::set_entry(&entries[39], reinterpret_cast<addr_t>(irq7), 0x08, 0x8E); idt::set_entry(&entries[40], reinterpret_cast<addr_t>(irq8), 0x08, 0x8E); idt::set_entry(&entries[41], reinterpret_cast<addr_t>(irq9), 0x08, 0x8E); idt::set_entry(&entries[42], reinterpret_cast<addr_t>(irq10), 0x08, 0x8E); idt::set_entry(&entries[43], reinterpret_cast<addr_t>(irq11), 0x08, 0x8E); idt::set_entry(&entries[44], reinterpret_cast<addr_t>(irq12), 0x08, 0x8E); idt::set_entry(&entries[45], reinterpret_cast<addr_t>(irq13), 0x08, 0x8E); idt::set_entry(&entries[46], reinterpret_cast<addr_t>(irq14), 0x08, 0x8E); idt::set_entry(&entries[47], reinterpret_cast<addr_t>(irq15), 0x08, 0x8E); idt::idt_load(reinterpret_cast<addr_t>(&descriptor)); } } // namespace idt } // namespace x86_64 } // namespace cpu
44.445255
78
0.69371
PoisonNinja
a1bc7a13c0e2e7017ae8b30cb0f24653cfff79c3
1,613
cpp
C++
2DGames/Shader.cpp
A12134/Hope3
dbeb4393c8da04171828d53e2a6e0c74f76ef680
[ "MIT" ]
null
null
null
2DGames/Shader.cpp
A12134/Hope3
dbeb4393c8da04171828d53e2a6e0c74f76ef680
[ "MIT" ]
null
null
null
2DGames/Shader.cpp
A12134/Hope3
dbeb4393c8da04171828d53e2a6e0c74f76ef680
[ "MIT" ]
null
null
null
#include "Shader.h" #include <sstream> #include <fstream> #include <iostream> Shader::Shader(EShaderType type, GLint ID) { this->mShaderType = type; this->mShaderAddress = glCreateShader(ID); std::string tmpType; switch (type) { case EShaderType::EVertexShader: tmpType = "Vertex Shader"; break; case EShaderType::EGeometryShader: tmpType = "Geometry Shader"; break; case EShaderType::EFragmentShader: tmpType = "Fragment Shader"; break; default: tmpType = ""; break; } LogManager::addLog(ELogType::E_EVENT, "Create " + tmpType + "."); } void Shader::loadShaderSource(const std::string & filePath) { std::ifstream file; file.open(filePath.c_str()); if (!file.good()) { LogManager::addLog(ELogType::E_ERROR, "Cannot find " + filePath + "."); LogManager::errorExit(); } std::stringstream stream; stream << file.rdbuf(); file.close(); LogManager::addLog(ELogType::E_EVENT, "Load shader source from " + filePath + "."); std::string mShaderSource = stream.str(); const char* sourceChar = mShaderSource.c_str(); glShaderSource(this->mShaderAddress, 1, &sourceChar, NULL); glCompileShader(this->mShaderAddress); int success; char infoLog[512]; glGetShaderiv(this->mShaderAddress, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(this->mShaderAddress, 512, NULL, infoLog); std::string infoLogStr = infoLog; LogManager::addLog(ELogType::E_ERROR, "Fail to compile shader source from " + filePath + ":\n" + infoLogStr); LogManager::errorExit(); } LogManager::addLog(ELogType::E_EVENT, "Compiled " + filePath + "."); } Shader::~Shader() { }
23.720588
111
0.701798
A12134
a1bd086cf7a22259f2b2b1b22d7a9f6a7cb4f317
3,581
cpp
C++
src/simpcl/src/filters/unstable/handmade_icp.cpp
senceryazici/point-cloud-filters
d5e4e599b493cc2af1517000c012d7936d46cf0f
[ "MIT" ]
17
2020-01-08T14:35:05.000Z
2021-12-09T12:30:07.000Z
src/simpcl/src/filters/unstable/handmade_icp.cpp
senceryazici/point-cloud-filters
d5e4e599b493cc2af1517000c012d7936d46cf0f
[ "MIT" ]
2
2020-01-31T16:31:48.000Z
2022-03-09T12:49:53.000Z
src/simpcl/src/filters/unstable/handmade_icp.cpp
senceryazici/point-cloud-filters
d5e4e599b493cc2af1517000c012d7936d46cf0f
[ "MIT" ]
7
2020-01-08T21:28:58.000Z
2021-12-03T06:00:05.000Z
// Iterative Closest Point Algorithm // FIXME: Publishing nothing // ERROR: // Import dependencies #include <ros/ros.h> #include <string> #include <iostream> #include <pcl_ros/point_cloud.h> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl_conversions/pcl_conversions.h> #include <sensor_msgs/PointCloud2.h> // Definitions ros::Publisher pub; std::string subscribed_topic; std::string published_topic; double threshold; int count; pcl::PCLPointCloud2* carrier = new pcl::PCLPointCloud2; pcl::PCLPointCloud2ConstPtr cloudPtrCarry(carrier); pcl::PointCloud<pcl::PointXYZ> *cloudXYZ_one = new pcl::PointCloud<pcl::PointXYZ>; pcl::PointCloud<pcl::PointXYZ>::Ptr cloudXYZPtr1(cloudXYZ_one); pcl::PointCloud<pcl::PointXYZ> *cloudXYZ_two = new pcl::PointCloud<pcl::PointXYZ>; pcl::PointCloud<pcl::PointXYZ>::Ptr cloudXYZPtr2(cloudXYZ_two); pcl::PointCloud<pcl::PointXYZ> *cloud_final = new pcl::PointCloud<pcl::PointXYZ>; pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPtrFinal(cloud_final); // callback void cloud_cb(const sensor_msgs::PointCloud2ConstPtr& cloud_msg) { *cloudXYZPtr1 = *cloudXYZPtr2; pcl_conversions::toPCL(*cloud_msg, *carrier); pcl::fromPCLPointCloud2(*carrier, *cloudXYZPtr2); std::cout << "Cloud1: " << cloudXYZ_one->width << "\tCloud2: " << cloudXYZ_two->width << "\n" << std::endl; } // main int main(int argc, char **argv) { // Initialize ROS ros::init(argc, argv, "handmade"); ros::NodeHandle n; ros::Rate r(10); // Load parameters from launch file ros::NodeHandle nh_private("~"); nh_private.param<std::string>("subscribed_topic", subscribed_topic, "/point_cloud"); nh_private.param<std::string>("published_topic", published_topic, "cloud_icp"); nh_private.param<double>("threshold", threshold, 50.0); // Create Subscriber and listen subscribed_topic ros::Subscriber sub = n.subscribe<sensor_msgs::PointCloud2>(subscribed_topic, 1, cloud_cb); // Create Publisher pub = n.advertise<sensor_msgs::PointCloud2>(published_topic, 1); while(ros::ok()) { if(cloudXYZ_one->points.size() < cloudXYZ_two->points.size()) { count = cloudXYZ_one->points.size(); } else { count = cloudXYZ_two->points.size(); } for (size_t i = -1; i < count; ++i) { if(abs(cloudXYZ_one->points[i].x - cloudXYZ_two->points[i].x) < threshold) { cloud_final->points[i].x = (cloudXYZ_one->points[i].x + cloudXYZ_two->points[i].x) / 2; } else { cloud_final->points[i].x = 0; } if(abs(cloudXYZ_one->points[i].y - cloudXYZ_two->points[i].y) < threshold) { cloud_final->points[i].y = (cloudXYZ_one->points[i].y + cloudXYZ_two->points[i].y) / 2; } else { cloud_final->points[i].y = 0; } if(abs(cloudXYZ_one->points[i].z - cloudXYZ_two->points[i].z) < threshold) { cloud_final->points[i].z = (cloudXYZ_one->points[i].z + cloudXYZ_two->points[i].z) / 2; } else { cloud_final->points[i].z = 0; } } cloud_final->header.frame_id = "stereo_camera"; cloud_final->header.stamp = ros::Time::now(); // pcl::toPCLPointCloud2(*cloud_final, *carrier); pub.publish(*cloud_final); // Publish r.sleep(); ros::spinOnce(); } return 0; }
32.853211
103
0.615191
senceryazici
a1c0c5f96d90c4408bd5b6606ecf6b999782adc8
25,353
cc
C++
xic/src/fileio/fio_chd_read.cc
bernardventer/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
3
2020-01-26T14:18:52.000Z
2020-12-09T20:07:22.000Z
xic/src/fileio/fio_chd_read.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
null
null
null
xic/src/fileio/fio_chd_read.cc
chris-ayala/xictools
4ea72c118679caed700dab3d49a8d36445acaec3
[ "Apache-2.0" ]
2
2020-01-26T14:19:02.000Z
2021-08-14T16:33:28.000Z
/*========================================================================* * * * Distributed by Whiteley Research Inc., Sunnyvale, California, USA * * http://wrcad.com * * Copyright (C) 2017 Whiteley Research Inc., all rights reserved. * * Author: Stephen R. Whiteley, except as indicated. * * * * As fully as possible recognizing licensing terms and conditions * * imposed by earlier work from which this work was derived, if any, * * this work is released under the Apache License, Version 2.0 (the * * "License"). You may not use this file except in compliance with * * the License, and compliance with inherited licenses which are * * specified in a sub-header below this one if applicable. A copy * * of the License is provided with this distribution, or you may * * obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * See the License for the specific language governing permissions * * and limitations under the License. * * * * 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 NON- * * INFRINGEMENT. IN NO EVENT SHALL WHITELEY RESEARCH INCORPORATED * * OR STEPHEN R. WHITELEY 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. * * * *========================================================================* * XicTools Integrated Circuit Design System * * * * Xic Integrated Circuit Layout and Schematic Editor * * * *========================================================================* $Id:$ *========================================================================*/ #include "fio.h" #include "fio_chd.h" #include "fio_cvt_base.h" #include "fio_cgd.h" #include "fio_zio.h" #include "cd_digest.h" //----------------------------------------------------------------------------- // sCHDin functions // This is a class to retrieve a cCHD from a file. //----------------------------------------------------------------------------- ChdCgdType sCHDin::ci_def_cgd_type = CHD_CGDmemory; sCHDin::sCHDin() { ci_chd = 0; ci_fp = 0; ci_zio = 0; ci_nmtab = 0; ci_attab = 0; ci_nametab = 0; ci_flags = 0; ci_magic = 0; ci_mode = Physical; ci_nogo = false; } sCHDin::~sCHDin() { delete ci_zio; delete ci_nmtab; delete ci_attab; if (ci_fp) fclose(ci_fp); } inline int sCHDin::read_byte() { int c; if (ci_zio) c = ci_zio->zio_getc(); else c = getc(ci_fp); if (c == EOF) { ci_nogo = true; Errs()->add_error("read_byte: premature EOF"); return (0); } return (c); } // The cgdtype can be CGDmemory or CGDfile, this determines the CGD // type created if geometry records are found. // cCHD * sCHDin::read(const char *fname, ChdCgdType cgdtype) { if (!fname || !*fname) { Errs()->add_error("read: null or empty file name."); return (0); } ci_fp = fopen(fname, "rb"); if (!ci_fp) { Errs()->add_error("read: failed to open %s for input.", fname); return (0); } int geo_rev = read_magic(); if (geo_rev < 0) { Errs()->add_error("read: incorrect file type."); return (0); } if (ci_magic >= 6) { // Magic 6 and larger compress the physical records. ci_zio = zio_stream::zio_open(ci_fp, "r"); if (!ci_zio) return (0); } ci_mode = Physical; bool ret = read_chd(); if (ci_zio) { int v = ci_zio->stream().avail_in; // give back buffered chars delete ci_zio; ci_zio = 0; large_fseek(ci_fp, -v, SEEK_CUR); } if (ret) { if (geo_rev >= 1) { // File contains physical geometry records. if (cgdtype == CHD_CGDmemory || cgdtype == CHD_CGDfile) { CgdType tp = (cgdtype == CHD_CGDfile ? CGDfile : CGDmemory); cCGD *cgd = new cCGD(0); if (!cgd->read(ci_fp, tp, false)) { delete cgd; cgd = 0; } if (cgd) { // Save in the CD list. char *dbname = CDcgd()->newCgdName(); CDcgd()->cgdStore(dbname, cgd); delete [] dbname; // Link to the CHD, and set the flag to free the CGD // when unlinked. cgd->set_free_on_unlink(true); ci_chd->setCgd(cgd); } else { Errs()->add_error("read: geometry read failed."); delete ci_chd; ci_chd = 0; } } } else { ci_mode = Electrical; ret = read_chd(); } } if (ci_fp) { fclose(ci_fp); ci_fp = 0; } delete ci_nmtab; ci_nmtab = 0; delete ci_attab; ci_attab = 0; if (ci_nogo) { ci_nogo = false; delete ci_chd; ci_chd = 0; } cCHD *chd = ci_chd; ci_chd = 0; return (chd); } bool sCHDin::check(const char *fname) { if (!fname || !*fname) return (false); ci_fp = fopen(fname, "rb"); if (!ci_fp) return (false); int ok = read_magic(); fclose(ci_fp); ci_chd = 0; ci_fp = 0; ci_nmtab = 0; ci_attab = 0; ci_magic = 0; ci_nogo = false; return (ok >= 0); } // Check the file header and set co_magic to the file format number. // Return the geometry format number (currently 1) if geometry is // included, 0 if no geometry, -1 if unrecognized header. // int sCHDin::read_magic() { char *string = read_n_string(); if (!string) return (false); GCarray<char*> gc_string(string); // If '+N' is concatenated to magic string, N is a decimal integer // giving geometry format version.. int geo_rev = 0; char *t = strchr(string, '+'); if (t) { *t++ = 0; geo_rev = atoi(t); } unsigned int n = strlen(MAGIC_STRING); if (strncmp(string, MAGIC_STRING, n)) return (-1); ci_magic = atoi(string + n); if (ci_magic > 6) return (-1); if (geo_rev && geo_rev != 1) return (-1); return (geo_rev); } bool sCHDin::read_chd() { ci_nametab = 0; ci_flags = 0; if (ci_mode == Physical) { char *fn = read_n_string(); if (ci_nogo) return (false); GCarray<char*> gc_fn(fn); FileType ft = (FileType)read_unsigned(); if (ci_nogo) return (false); double sc = read_real(); if (ci_nogo) return (false); // NOTUSED // Non-unit scaling is no longer supported. if (fabs(sc - 1.0) > 1e-12) { Errs()->add_error("read_chd: non-unit scaling, not supported."); return (false); } ci_chd = new cCHD(fn, ft); if (ci_magic >= 1) { ci_chd->setPcInfo(read_info(), Physical); if (ci_nogo) return (false); } if (ci_magic >= 4) { if (!read_alias()) return (false); } } else { if (!ci_chd) return (false); char *str = read_n_string(); if (!str) { ci_nogo = false; // EOF sets this return (true); } GCarray<char*> gc_str(str); if (strcmp(str, "ELECTRICAL")) { Errs()->add_error("read_chd: electrical data corrupt."); return (false); } ci_chd->setPcInfo(read_info(), Electrical); if (ci_nogo) return (false); } if (!read_tables()) return (false); if (read_nametab()) ci_chd->setNameTab(ci_nametab, ci_mode); if (ci_nogo) return (false); return (true); } bool sCHDin::map(ticket_t *ptkt) { if (!ptkt) return (false); CDcellName n = (CDcellName)SymTab::get(ci_nmtab, *ptkt); if (n == (CDcellName)ST_NIL) { Errs()->add_error( "read_nametab: name index from instance not in table."); return (false); } symref_t *p = ci_nametab->get(n); if (!p) { ci_nametab->new_symref(Tstring(n), ci_mode, &p); ci_nametab->add(p); p->set_flags(ci_flags); } *ptkt = p->get_ticket(); return (true); } bool sCHDin::read_nametab() { ci_nametab = new nametab_t(ci_mode); for (;;) { unsigned int ni = read_unsigned(); if (ci_nogo) break; if (ni == 0) break; int64_t off = read_unsigned64(); if (ci_nogo) break; CDcellName s = (CDcellName)SymTab::get(ci_nmtab, ni); if (s == (CDcellName)ST_NIL) { Errs()->add_error( "read_nametab: name index not in table (%d).", ni); ci_nogo = true; break; } ci_flags = read_unsigned() & CVio_mask; if (ci_nogo) break; symref_t *p = ci_nametab->get(s); if (!p) { ci_nametab->new_symref(Tstring(s), ci_mode, &p, (ci_flags & CVcif)); ci_nametab->add(p); } p->set_flags(ci_flags); p->set_offset(off); if (p->get_flags() & CVcif) { p->set_num(read_signed()); if (ci_nogo) break; } // The CVx_xxx flags are currently always set. if (p->get_flags() & CVx_bb) { BBox BB; BB.left = read_signed(); if (ci_nogo) break; BB.bottom = read_signed(); if (ci_nogo) break; BB.right = read_signed(); if (ci_nogo) break; BB.top = read_signed(); if (ci_nogo) break; p->set_bb(&BB); } if (p->get_flags() & CVx_srf) { if (ci_magic >= 3) { // Using compressed instance lists. This reads // segmented (magic 5) and non-segmented lists. // Note: if p has no instances, the CVcmpr flag might // not be set. ticket_t last_tkt = 0; unsigned int offs = 0; bool start = true; crgen_t gen(ci_nametab, 0); for (;;) { unsigned int cnt; unsigned char *str = (unsigned char*)read_n_string(&cnt); gen.set(str); bool chained; unsigned char *nstr = gen.next_remap(0, this, ci_attab, &cnt, &chained); if (!nstr) { ci_nogo = true; break; } ticket_t t = ci_nametab->get_space(cnt); if (!t) { if (ci_nametab->is_full()) { Errs()->add_error( "Ticket allocation failed, internal block " "limit %d reached in\nname table allocation.", BDB_MAX); } else { Errs()->add_error( "Ticket allocation failure, request for 0 " "bytes in name\ntable allocation."); } ci_nogo = true; break; } if (last_tkt) { unsigned char *ss = ci_nametab->find_space(last_tkt); ss += offs; ss[0] = t & 0xff; ss[1] = (t >> 8) & 0xff; ss[2] = (t >> 16) & 0xff; ss[3] = (t >> 24) & 0xff; // Compress the bytes of long streams. ci_nametab->save_space(last_tkt); } last_tkt = t; offs = cnt - 4; unsigned char *ss = ci_nametab->find_space(t); memcpy(ss, nstr, cnt); if (start) { p->set_crefs(t); start = false; } delete [] nstr; delete [] str; if (!chained) { // Compress the bytes of long streams. ci_nametab->save_space(t); break; } } } else { ticket_t cref_end = 0; for (;;) { unsigned int ci = read_unsigned(); if (ci_nogo) break; if (!ci) break; cref_t *c; ticket_t ctk = ci_nametab->new_cref(&c); CDcellName n = (CDcellName)SymTab::get(ci_nmtab, ci); if (n == (CDcellName)ST_NIL) { Errs()->add_error( "read_nametab: name index from instance not in table."); ci_nogo = true; delete ci_nametab; ci_nametab = 0; return (false); } symref_t *pt = ci_nametab->get(n); if (!pt) { ci_nametab->new_symref(Tstring(n), ci_mode, &pt); ci_nametab->add(pt); pt->set_flags(ci_flags); } c->set_refptr(pt->get_ticket()); c->set_data(read_unsigned()); if (ci_nogo) break; ticket_t otkt = c->get_tkt(); void *xx = SymTab::get(ci_attab, otkt); if (xx == ST_NIL) { Errs()->add_error( "read_nametab: ticket not in table."); ci_nogo = true; break; } c->set_tkt((ticket_t)((unsigned int)(long)xx - 1)); if (ci_nogo) break; c->set_pos_x(read_signed()); if (ci_nogo) break; c->set_pos_y(read_signed()); if (ci_nogo) break; if (!cref_end) p->set_crefs(ctk); cref_end = ctk; } if (cref_end) { cref_t *c = ci_nametab->find_cref(cref_end); c->set_last_cref(true); } } } } if (ci_nogo) { delete ci_nametab; ci_nametab = 0; return (false); } return (true); } cv_info * sCHDin::read_info() { cv_info *cv = new cv_info(false, false); cv->set_records(read_unsigned()); if (ci_nogo) return (cv); cv->set_cells(read_unsigned()); if (ci_nogo) return (cv); cv->set_boxes(read_unsigned()); if (ci_nogo) return (cv); cv->set_polys(read_unsigned()); if (ci_nogo) return (cv); cv->set_wires(read_unsigned()); if (ci_nogo) return (cv); if (ci_magic >= 2) { cv->set_vertices(read_unsigned()); if (ci_nogo) return (cv); } cv->set_labels(read_unsigned()); if (ci_nogo) return (cv); cv->set_srefs(read_unsigned()); if (ci_nogo) return (cv); cv->set_arefs(read_unsigned()); if (ci_nogo) return (cv); for (;;) { char *s = read_n_string(); if (ci_nogo) { delete [] s; return (cv); } if (!s) break; cv->add_layer(s); delete [] s; } return (cv); } bool sCHDin::read_alias() { // First unsigned is the symref flags. // NOTUSED unsigned int flags = read_unsigned(); // Second unsigned is the alias flags. flags = read_unsigned(); if (ci_nogo) return (false); cv_alias_info *ai = new cv_alias_info(); ai->set_flags(flags); if (flags & CVAL_PREFIX) { ai->set_prefix(read_n_string()); if (ci_nogo) { delete ai; return (false); } } if (flags & CVAL_SUFFIX) { ai->set_suffix(read_n_string()); if (ci_nogo) { delete ai; return (false); } } ci_chd->setAliasInfo(ai); return (true); } bool sCHDin::read_tables() { if (!ci_nmtab) ci_nmtab = new SymTab(false, false); ci_nmtab->clear(); for (;;) { char *s = read_n_string(); if (ci_nogo) return (false); if (!s) break; unsigned int n = read_unsigned(); if (ci_nogo) return (false); if (SymTab::get(ci_nmtab, n) == ST_NIL) { // The names are inserted into the CD string table here. const char *nm = Tstring(CD()->CellNameTableAdd(s)); ci_nmtab->add(n, nm, false); } delete [] s; } if (!ci_attab) ci_attab = new SymTab(false, false); ci_attab->clear(); for (;;) { unsigned int otkt = read_unsigned(); if (ci_nogo) return (false); unsigned char fl = read_byte(); if (ci_nogo) return (false); if (fl == 0xff) break; CDattr at; if (ci_magic >= 3) { at.decode_transform(fl >> 4); if (fl & MAGIC3_NX) { at.nx = read_unsigned(); if (ci_nogo) return (false); at.dx = read_signed(); if (ci_nogo) return (false); } if (fl & MAGIC3_NY) { at.ny = read_unsigned(); if (ci_nogo) return (false); at.dy = read_signed(); if (ci_nogo) return (false); } if (fl & MAGIC3_MG) { at.magn = read_real(); if (ci_nogo) return (false); } } else { at.ax = read_byte(); if (ci_nogo) return (false); at.ay = read_byte(); if (ci_nogo) return (false); at.refly = read_byte(); if (ci_nogo) return (false); if (fl & 1) { at.magn = read_real(); if (ci_nogo) return (false); } if (fl & 2) { at.nx = read_unsigned(); if (ci_nogo) return (false); at.ny = read_unsigned(); if (ci_nogo) return (false); at.dx = read_signed(); if (ci_nogo) return (false); at.dy = read_signed(); if (ci_nogo) return (false); } } ticket_t ntkt = CD()->RecordAttr(&at); if (SymTab::get(ci_attab, otkt) == ST_NIL) // save as ntkt+1 to avoid 0 ci_attab->add((unsigned int)otkt, (void*)(long)(ntkt+1), false); } return (true); } unsigned int sCHDin::read_unsigned() { unsigned int b = read_byte(); if (ci_nogo) return (0); unsigned int i = (b & 0x7f); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 7); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 14); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 21); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0xf) << 28); // 4 bits left // Only 4 LSBs can be set. if (b & 0xf0) { Errs()->add_error("read_unsigned: int32 overflow."); ci_nogo = true; return (0); } return (i); } int64_t sCHDin::read_unsigned64() { int64_t b = read_byte(); if (ci_nogo) return (0); int64_t i = (b & 0x7f); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 7); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 14); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 21); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 28); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 35); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 42); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 49); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x7f) << 56); if (!(b & 0x80)) return (i); b = read_byte(); if (ci_nogo) return (0); i |= ((b & 0x1) << 63); // 1 bit left // Only 1 LSB can be set. if (b & 0xfe) { Errs()->add_error("read_unsigned64: int64 overflow."); ci_nogo = true; return (0); } return (i); } int sCHDin::read_signed() { unsigned int b = read_byte(); if (ci_nogo) return (0); bool neg = b & 1; unsigned int i = (b & 0x7f) >> 1; if (!(b & 0x80)) return (neg ? -i : i); b = read_byte(); if (ci_nogo) return (0); i |= (b & 0x7f) << 6; if (!(b & 0x80)) return (neg ? -i : i); b = read_byte(); if (ci_nogo) return (0); i |= (b & 0x7f) << 13; if (!(b & 0x80)) return (neg ? -i : i); b = read_byte(); if (ci_nogo) return (0); i |= (b & 0x7f) << 20; if (!(b & 0x80)) return (neg ? -i : i); b = read_byte(); if (ci_nogo) return (0); i |= (b & 0xf) << 27; // 4 bits left (sign bit excluded) // Only 4 LSBs can be set (sign bit excluded). if (b & 0xf0) { Errs()->add_error("read_signed: overflow."); ci_nogo = true; return (0); } return (neg ? -i : i); } double sCHDin::read_real() { // ieee double // first byte is lsb of mantissa union { double n; unsigned char b[sizeof(double)]; } u; u.n = 1.0; if (u.b[0] == 0) { // machine is little-endian, read bytes in order for (int i = 0; i < (int)sizeof(double); i++) { u.b[i] = read_byte(); if (ci_nogo) return (0.0); } } else { // machine is big-endian, read bytes in reverse order for (int i = sizeof(double) - 1; i >= 0; i--) { u.b[i] = read_byte(); if (ci_nogo) return (0.0); } } #ifndef WIN32 if (isnan(u.n)) { Errs()->add_error("read_real: bad value (nan)."); ci_nogo = true; return (0.0); } #endif return (u.n); } char * sCHDin::read_n_string(unsigned int *n) { int len = read_unsigned(); if (n) *n = len; if (len == 0) return (0); char *str = new char[len+1]; char *s = str; while (len--) { int c = read_byte(); if (ci_nogo) { delete [] str; return (0); } *s++ = c; } *s = 0; return (str); }
27.617647
80
0.427721
bernardventer
a1c2ca47070a833745f663e2e5ce94dd43862854
102
cpp
C++
src/main.cpp
xue2sheng/probeHTTP
d0792d01b34331c085297ae8d67209e70cbf11f5
[ "MIT" ]
null
null
null
src/main.cpp
xue2sheng/probeHTTP
d0792d01b34331c085297ae8d67209e70cbf11f5
[ "MIT" ]
null
null
null
src/main.cpp
xue2sheng/probeHTTP
d0792d01b34331c085297ae8d67209e70cbf11f5
[ "MIT" ]
null
null
null
#include "main_function.h" int main(int argc, char** argv) { return main_function(argc, argv); }
14.571429
37
0.686275
xue2sheng
a1c5e7d56a30b109a44d8d3fbd86bdb48d7da3a1
968
hpp
C++
MadEngine/Utility/DrawBatch.hpp
Fs02/Volge-TheSurvivor
cbbdf660e3357c99ff106587f5d6783b267f6e92
[ "MIT" ]
2
2016-11-11T13:19:03.000Z
2019-04-21T21:03:09.000Z
MadEngine/Utility/DrawBatch.hpp
Fs02/Volge-TheSurvivor
cbbdf660e3357c99ff106587f5d6783b267f6e92
[ "MIT" ]
25
2015-07-09T03:57:16.000Z
2015-07-09T03:57:17.000Z
MadEngine/Utility/DrawBatch.hpp
Fs02/Volge-TheSurvivor
cbbdf660e3357c99ff106587f5d6783b267f6e92
[ "MIT" ]
null
null
null
#ifndef _DRAWBATCH_HPP_ #define _DRAWBATCH_HPP_ #include <SFML/Graphics.hpp> #include <Box2D/Box2D.h> #include "../Manager/Resource.hpp" namespace Mad { namespace Utility { class DrawBatch { private: sf::RenderWindow* m_TargetWindow; sf::Font *m_Font; sf::Text *m_Text; sf::Sprite *m_Sprite; sf::RectangleShape *m_RectShape; sf::CircleShape *m_CircleShape; public: DrawBatch(); ~DrawBatch(); void setDrawTarget(sf::RenderWindow& targetWindow); sf::RenderTarget& getRenderTarget(); void begin(); void end(); void cleanUp(); void drawText(const std::string& text, const sf::Vector2f& pos = sf::Vector2f(0,0), float rot = 0.f, int size =30, const sf::Color& color = sf::Color::Black, sf::Text::Style style = sf::Text::Regular); //primitive shape drawing void drawLine(const b2Vec2& a, const b2Vec2& b, const sf::Color& col); void drawSprite(const sf::Sprite& sprite); }; } } #endif
22.511628
205
0.668388
Fs02
a1c6269469e60c8b6132b98c8d2352b6c46e165e
11,892
cpp
C++
tests/helics/shared_library/SystemTests.cpp
corinnegroth/HELICS
b8eda371b081a7d391d019c14bba5cf5042ae590
[ "BSD-3-Clause" ]
null
null
null
tests/helics/shared_library/SystemTests.cpp
corinnegroth/HELICS
b8eda371b081a7d391d019c14bba5cf5042ae590
[ "BSD-3-Clause" ]
null
null
null
tests/helics/shared_library/SystemTests.cpp
corinnegroth/HELICS
b8eda371b081a7d391d019c14bba5cf5042ae590
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2017-2020, Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable Energy, LLC. See the top-level NOTICE for additional details. All rights reserved. SPDX-License-Identifier: BSD-3-Clause */ #include <gtest/gtest.h> /** these test cases test out the value converters */ #include "ctestFixtures.hpp" #include <thread> // test generating a global from a broker and some of its error pathways TEST(other_tests, broker_global_value) { auto err = helicsErrorInitialize(); auto brk = helicsCreateBroker("test", "gbroker", "--root", &err); std::string globalVal = "this is a string constant that functions as a global"; std::string globalVal2 = "this is a second string constant that functions as a global"; helicsBrokerSetGlobal(brk, "testglobal", globalVal.c_str(), &err); auto q = helicsCreateQuery("global", "testglobal"); auto res = helicsQueryBrokerExecute(q, brk, &err); EXPECT_EQ(res, globalVal); helicsBrokerSetGlobal(brk, "testglobal2", globalVal2.c_str(), &err); helicsQueryFree(q); q = helicsCreateQuery("global", "testglobal2"); res = helicsQueryBrokerExecute(q, brk, &err); EXPECT_EQ(res, globalVal2); res = helicsQueryBrokerExecute(nullptr, brk, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryBrokerExecute(q, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryBrokerExecute(nullptr, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); helicsBrokerSetGlobal(brk, nullptr, "v2", &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsBrokerDisconnect(brk, &err); helicsQueryFree(q); EXPECT_EQ(helicsBrokerIsConnected(brk), helics_false); helicsBrokerFree(brk); } // test global value creation from a core and its error pathways TEST(other_tests, core_global_value) { helicsCloseLibrary(); auto err = helicsErrorInitialize(); auto brk = helicsCreateBroker("test", "gbrokerc", "--root", &err); auto cr = helicsCreateCore("test", "gcore", "--broker=gbrokerc", &err); EXPECT_EQ(err.error_code, 0); auto connected = helicsCoreConnect(cr, &err); EXPECT_EQ(connected, helics_true); EXPECT_EQ(err.error_code, 0); EXPECT_EQ(helicsCoreIsConnected(cr), helics_true); std::string globalVal = "this is a string constant that functions as a global"; std::string globalVal2 = "this is a second string constant that functions as a global"; helicsCoreSetGlobal(cr, "testglobal", globalVal.c_str(), &err); auto q = helicsCreateQuery("global", "testglobal"); auto res = helicsQueryCoreExecute(q, cr, &err); EXPECT_EQ(res, globalVal); helicsCoreSetGlobal(cr, "testglobal2", globalVal2.c_str(), &err); helicsQueryFree(q); q = helicsCreateQuery("global", "testglobal2"); res = helicsQueryCoreExecute(q, cr, &err); EXPECT_EQ(res, globalVal2); res = helicsQueryCoreExecute(nullptr, cr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryCoreExecute(q, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryCoreExecute(nullptr, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); helicsCoreSetGlobal(cr, nullptr, "v2", &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsBrokerDisconnect(brk, &err); helicsCoreDisconnect(cr, &err); helicsQueryFree(q); EXPECT_EQ(helicsBrokerIsConnected(brk), helics_false); } // test global value creation from a federate and some error pathways for queries and global creation TEST(other_tests, federate_global_value) { auto err = helicsErrorInitialize(); auto brk = helicsCreateBroker("test", "gbrokerc", "--root", &err); auto cr = helicsCreateCore("test", "gcore", "--broker=gbrokerc", &err); // test creation of federateInfo from command line arguments const char* argv[4]; argv[0] = ""; argv[1] = "--corename=gcore"; argv[2] = "--type=test"; argv[3] = "--period=1.0"; auto fi = helicsCreateFederateInfo(); helicsFederateInfoLoadFromArgs(fi, 4, argv, &err); EXPECT_EQ(err.error_code, 0); auto fed = helicsCreateValueFederate("fed0", fi, &err); EXPECT_EQ(err.error_code, 0); argv[3] = "--period=frogs"; //this is meant to generate an error in command line processing auto fi2 = helicsFederateInfoClone(fi, &err); EXPECT_NE(fi2, nullptr); helicsFederateInfoLoadFromArgs(fi2, 4, argv, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsFederateInfoFree(fi2); helicsFederateInfoFree(fi); std::string globalVal = "this is a string constant that functions as a global"; std::string globalVal2 = "this is a second string constant that functions as a global"; helicsFederateSetGlobal(fed, "testglobal", globalVal.c_str(), &err); auto q = helicsCreateQuery("global", "testglobal"); auto res = helicsQueryExecute(q, fed, &err); EXPECT_EQ(res, globalVal); helicsFederateSetGlobal(fed, "testglobal2", globalVal2.c_str(), &err); helicsQueryFree(q); q = helicsCreateQuery("global", "testglobal2"); helicsQueryExecuteAsync(q, fed, &err); while (helicsQueryIsCompleted(q) == helics_false) { std::this_thread::sleep_for(std::chrono::milliseconds(20)); } res = helicsQueryExecuteComplete(q, &err); EXPECT_EQ(res, globalVal2); auto q2 = helicsCreateQuery(nullptr, "isinit"); helicsQueryExecuteAsync(q2, fed, &err); while (helicsQueryIsCompleted(q2) == helics_false) { std::this_thread::sleep_for(std::chrono::milliseconds(20)); } res = helicsQueryExecuteComplete(q2, &err); EXPECT_STREQ(res, "false"); // a series of invalid query calls res = helicsQueryExecute(nullptr, fed, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryExecute(q, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); res = helicsQueryExecute(nullptr, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_STREQ("#invalid", res); helicsFederateSetGlobal(fed, nullptr, "v2", &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsQueryExecuteAsync(q, nullptr, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsQueryExecuteAsync(nullptr, fed, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); helicsFederateFinalize(fed, &err); helicsCoreDisconnect(cr, &err); helicsBrokerDisconnect(brk, &err); helicsQueryFree(q); helicsQueryFree(q2); EXPECT_EQ(helicsBrokerIsConnected(brk), helics_false); } // test global value creation from a federate and some error pathways for queries and global creation TEST(other_tests, federate_add_dependency) { auto err = helicsErrorInitialize(); auto brk = helicsCreateBroker("test", "gbrokerd", "--root", &err); auto cr = helicsCreateCore("test", "dcore", "--broker=gbrokerd", &err); // test creation of federateInfo from command line arguments const char* argv[4]; argv[0] = ""; argv[1] = "--corename=dcore"; argv[2] = "--type=test"; argv[3] = "--period=1.0"; auto fi = helicsCreateFederateInfo(); helicsFederateInfoLoadFromArgs(fi, 4, argv, &err); helicsFederateInfoSetFlagOption(fi, helics_flag_source_only, true, &err); auto fed1 = helicsCreateMessageFederate("fed1", fi, &err); EXPECT_EQ(err.error_code, 0); auto fi2 = helicsCreateFederateInfo(); helicsFederateInfoLoadFromArgs(fi2, 4, argv, &err); auto fed2 = helicsCreateMessageFederate("fed2", fi2, &err); helicsFederateRegisterGlobalEndpoint(fed2, "ept2", nullptr, &err); helicsFederateRegisterGlobalEndpoint(fed1, "ept1", nullptr, &err); helicsFederateAddDependency(fed1, "fed2", &err); EXPECT_EQ(err.error_code, 0); helicsFederateEnterExecutingModeAsync(fed1, &err); helicsFederateEnterExecutingMode(fed2, &err); helicsFederateEnterExecutingModeComplete(fed1, &err); helicsFederateInfoFree(fi); helicsFederateInfoFree(fi2); helicsFederateFinalize(fed1, &err); helicsFederateFinalize(fed2, &err); helicsBrokerFree(brk); helicsCoreFree(cr); } // test core creation from command line arguments TEST(other_tests, core_creation) { auto err = helicsErrorInitialize(); auto brk = helicsCreateBroker("test", "gbrokerc", "--root", &err); const char* argv[4]; argv[0] = ""; argv[1] = "--name=gcore"; argv[2] = "--timeout=2000"; argv[3] = "--broker=gbrokerc"; auto cr = helicsCreateCoreFromArgs("test", nullptr, 4, argv, &err); EXPECT_EQ(err.error_code, 0); EXPECT_STREQ(helicsCoreGetIdentifier(cr), "gcore"); argv[1] = "--name=gcore2"; argv[2] = "--log-level=what_logs?"; auto cr2 = helicsCreateCoreFromArgs("test", nullptr, 4, argv, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_EQ(cr2, nullptr); helicsBrokerDisconnect(brk, &err); helicsCoreDisconnect(cr, &err); EXPECT_EQ(helicsBrokerIsConnected(brk), helics_false); } // test broker creation from command line arguments TEST(other_tests, broker_creation) { auto err = helicsErrorInitialize(); const char* argv[4]; argv[0] = ""; argv[1] = "--name=gbrokerc"; argv[2] = "--timeout=2000"; argv[3] = "--root"; auto brk = helicsCreateBrokerFromArgs("test", nullptr, 4, argv, &err); EXPECT_EQ(err.error_code, 0); EXPECT_STREQ(helicsBrokerGetIdentifier(brk), "gbrokerc"); argv[1] = "--name=gbrokerc2"; argv[2] = "--log-level=what_logs?"; auto brk2 = helicsCreateBrokerFromArgs("test", nullptr, 4, argv, &err); EXPECT_NE(err.error_code, 0); helicsErrorClear(&err); EXPECT_EQ(brk2, nullptr); helicsBrokerDisconnect(brk, &err); } TEST(federate_tests, federateGeneratedLocalError) { auto fi = helicsCreateFederateInfo(); helicsFederateInfoSetCoreType(fi, helics_core_type_test, nullptr); helicsFederateInfoSetCoreName(fi, "core_full_le", nullptr); helicsFederateInfoSetCoreInitString(fi, "-f 1 --autobroker --error_timeout=0", nullptr); auto fed1 = helicsCreateValueFederate("fed1", fi, nullptr); helicsFederateInfoFree(fi); helicsFederateEnterExecutingMode(fed1, nullptr); helicsFederateRequestTime(fed1, 2.0, nullptr); helicsFederateLocalError(fed1, 9827, "user generated error"); auto err = helicsErrorInitialize(); helicsFederateRequestTime(fed1, 3.0, &err); EXPECT_NE(err.error_code, 0); auto cr = helicsFederateGetCoreObject(fed1, nullptr); helicsCoreDisconnect(cr, nullptr); helicsCoreFree(cr); helicsFederateDestroy(fed1); } TEST(federate_tests, federateGeneratedGlobalError) { auto fi = helicsCreateFederateInfo(); helicsFederateInfoSetCoreType(fi, helics_core_type_test, nullptr); helicsFederateInfoSetCoreName(fi, "core_full_ge", nullptr); helicsFederateInfoSetCoreInitString(fi, "-f 1 --autobroker --error_timeout=0", nullptr); auto fed1 = helicsCreateValueFederate("fed1", fi, nullptr); helicsFederateInfoFree(fi); helicsFederateEnterExecutingMode(fed1, nullptr); helicsFederateRequestTime(fed1, 2.0, nullptr); helicsFederateGlobalError(fed1, 9827, "user generated global error"); auto err = helicsErrorInitialize(); helicsFederateRequestTime(fed1, 3.0, &err); EXPECT_NE(err.error_code, 0); helicsFederateDestroy(fed1); }
34.77193
114
0.698116
corinnegroth
a1ca9c462dbf20a7558631e0dc412b5bc1c0f408
16,778
cpp
C++
MMVII/src/CalcDescriptPCar/cAimeTieP.cpp
micmacIGN/micmac
558a0d104bc07150b2ff1fe2d5fb952b8f70088d
[ "CECILL-B" ]
451
2016-11-25T09:40:28.000Z
2022-03-30T04:20:42.000Z
MMVII/src/CalcDescriptPCar/cAimeTieP.cpp
Pandinosaurus/micmac
4aba7eb1b330d5dfd87afdb88ce40ac3372aff26
[ "CECILL-B" ]
143
2016-11-25T20:35:57.000Z
2022-03-01T11:58:02.000Z
MMVII/src/CalcDescriptPCar/cAimeTieP.cpp
Pandinosaurus/micmac
4aba7eb1b330d5dfd87afdb88ce40ac3372aff26
[ "CECILL-B" ]
139
2016-12-02T10:26:21.000Z
2022-03-10T19:40:29.000Z
#include "include/MMVII_all.h" #include "include/MMVII_Tpl_Images.h" #include "include/MMVII_2Include_Serial_Tpl.h" namespace MMVII { /** Map the interval [-1,1] to itself, the parameter : * Steep fix the derivate in 0 * Exp fix the power and hence concavity/convexity */ class cConcavexMapP1M1 : public cFctrRR { public : double NVF (double) const; virtual double F (double) const override ; void Show() const; // static cFctrRR TheOne; ///< the object return always 1 cConcavexMapP1M1(double aSteep,double aExp,bool Shift0Is0); private : double mShift; double mFact; double mSteep; double mExp; }; static const cTabulFonc1D & AllocTabConCavex(double aSteep,double aExp,int aNbDig) { cPt3dr aParam(aSteep,aExp,aNbDig); static int aCpt=0; static cPt3dr aLastParam(-1,-1,-1); static cTabulFonc1D * aRes = nullptr; if ((aRes == nullptr) || (aParam!=aLastParam)) { cMemManager::SetActiveMemoryCount(false); // Will not unaloccate Res ... aCpt++; if (aCpt==100) { cMMVII_Appli::CurrentAppli().MMVII_WARNING("Susicious many alloc in AllocTabConCavex"); } aLastParam = aParam; delete aRes; cConcavexMapP1M1 aCM(aSteep,aExp,(aSteep<0)); aRes = new cTabulFonc1D (aCM,-1,1,5000); cMemManager::SetActiveMemoryCount(true); } return *aRes; /* typedef std::map<cPt3dr,cTabulFonc1D *> tMap; cMemManager::SetActiveMemoryCount(false); // static std::map<cTabulFonc1D,cPt3dr> aBufRes; static tMap aMap; // static cConcavexMapP1M1 aCM(1e9,0.5,true); // static cConcavexMapP1M1 aCM(10,0.5); // static cTabulFonc1D aTF(aCM,-1,1,5000); cMemManager::SetActiveMemoryCount(true); return *(aMap[cPt3dr(0.0,0.0,0.0)]); */ } double cConcavexMapP1M1::F (double aX) const {return NVF(aX);} double cConcavexMapP1M1::NVF (double aX) const { if (aX<0) return -NVF(-aX); return mFact * (pow(aX+mShift,mExp) - pow(mShift,mExp)); } cConcavexMapP1M1::cConcavexMapP1M1(double aSteep,double aExp,bool Shift0Is0) : mSteep (aSteep), mExp (aExp) { if (Shift0Is0) { mFact = 1.0; mShift = 0.0; } else { MMVII_INTERNAL_ASSERT_medium((mExp!=1)||(mSteep==1),"cConcavexMapP1M1"); MMVII_INTERNAL_ASSERT_medium((mExp>=1)||(mSteep>1),"cConcavexMapP1M1"); MMVII_INTERNAL_ASSERT_medium((mExp<=1)||(mSteep<1),"cConcavexMapP1M1"); { mFact = 1; for (int aK= 0 ; aK<20 ; aK++) { mShift = pow(mSteep /(mFact*mExp),1/(mExp-1)); mFact = 1/(pow(1+mShift,mExp) - pow(mShift,mExp)); // StdOut() << "cConcavexMapP1M1:: SHF" << mShift << " FACT " << mFact << "\n"; } // Show(); } } } void cConcavexMapP1M1::Show() const { double aEps= 1e-4; StdOut() << " STEEP0 " << mSteep << " EXP " << mExp << "\n"; StdOut() << " V0 " << NVF(0) << " V1 " << NVF(-1) << " VM1 " << NVF(-1) << " D0 " << (NVF(aEps)-NVF(-aEps)) / (2*aEps) << " D1 " << (NVF(1+aEps)-NVF(1-aEps)) / (2*aEps) << " DM1 " << (NVF(-1+aEps)-NVF(-1-aEps)) / (2*aEps) << "\n"; for (int aK=0 ; aK<=10 ; aK++) { double aV = aK/10.0; StdOut() << " * " << aV << " => " << NVF(aV) << "\n"; } getchar(); } void TTT() { { cConcavexMapP1M1 aCM(5.0,0.5,false); aCM.Show(); } { cConcavexMapP1M1 aCM(10.0,0.5,false); aCM.Show(); } exit(EXIT_SUCCESS); // cConcavexMapP1M1(10.0,0.5); // cConcavexMapP1M1(2.0,0.5); // cConcavexMapP1M1(0.5,2); // cConcavexMapP1M1(1.0,1.0); } /* ================================= */ /* cAimePCar */ /* ================================= */ cAimeDescriptor::cAimeDescriptor() : mILP (cPt2di(1,1)) { } cAimeDescriptor cAimeDescriptor::DupLPIm() const { cAimeDescriptor aRes(*this); aRes.mILP = mILP.Dup(); return aRes; } cIm2D<tU_INT1> cAimeDescriptor::ILP() const {return mILP;} const std::vector<double> & cAimeDescriptor::DirPrinc() const {return mDirPrinc;} std::vector<double> & cAimeDescriptor::DirPrinc() {return mDirPrinc;} double cAimeDescriptor::DistanceFromIShift(const cAimeDescriptor & aAD2,int aShift,const cSetAimePCAR & aSet) const { const cDataIm2D<tU_INT1> & aDIm1(mILP.DIm()); cPt2di aSz1= aDIm1.Sz(); tU_INT1 * const * aData1 = aDIm1.ExtractRawData2D(); const cDataIm2D<tU_INT1> & aDIm2(aAD2.mILP.DIm()); cPt2di aSz2= aDIm2.Sz(); tU_INT1 * const * aData2 = aDIm2.ExtractRawData2D(); MMVII_INTERNAL_ASSERT_tiny(aSz1==aSz2,"cAimeDescriptor::Distance"); int aNbX = aSz1.x(); aShift = mod(aShift,aNbX); int aIRes = 0; for (int aY=0 ; aY<aSz1.y() ; aY++) { const tU_INT1 * aLine1 = aData1[aY]; const tU_INT1 * aLine2 = aData2[aY]; for (int aX1= 0; aX1<aNbX ; aX1++) { aIRes += Square(aLine1[aX1]-aLine2[(aX1+aShift)%aNbX]); } } double aRes = aIRes; aRes /= aSz1.x() * aSz1.y(); aRes /= Square(aSet.Ampl2N()); return aRes; } double cAimeDescriptor::DistanceFrom2RPeek(double aX1,const cAimeDescriptor & aAD2,double aX2,const cSetAimePCAR & aSet) const { return DistanceFromIShift(aAD2,round_ni(aX2-aX1),aSet); } double cAimeDescriptor::DistanceFromStdPeek(int aIPeek,const cAimeDescriptor & aAD2,const cSetAimePCAR & aSet) const { return DistanceFrom2RPeek(mDirPrinc.at(aIPeek),aAD2,aAD2.mDirPrinc.at(aIPeek),aSet); } cWhitchMin<int,double> cAimeDescriptor::DistanceFromBestPeek(const cAimeDescriptor & aAD2,const cSetAimePCAR & aSet) const { cWhitchMin<int,double> aWMin(-1,1e60); for (int aK=0 ; aK<int(mDirPrinc.size()) ; aK++) { aWMin.Add(aK,DistanceFromStdPeek(aK,aAD2,aSet)); } return aWMin; } void AddData(const cAuxAr2007 & anAux,cAimeDescriptor & aDesc) { AddData(cAuxAr2007("ILP",anAux) , aDesc.ILP().DIm()); AddData(cAuxAr2007("Dirs",anAux) , aDesc.DirPrinc()); } /* ================================= */ /* cAimePCar */ /* ================================= */ cAimeDescriptor & cAimePCar::Desc() {return mDesc; } const cAimeDescriptor & cAimePCar::Desc() const {return mDesc; } cPt2dr& cAimePCar::Pt() {return mPt;} const cPt2dr& cAimePCar::Pt() const {return mPt;} cPt2dr& cAimePCar::PtIm() {return mPtIm;} const cPt2dr& cAimePCar::PtIm() const {return mPtIm;} void AddData(const cAuxAr2007 & anAux,cAimePCar & aPC) { AddData(cAuxAr2007("Pt",anAux),aPC.Pt()); AddData(cAuxAr2007("Desc",anAux),aPC.Desc()); } cAimePCar cAimePCar::DupLPIm() const { cAimePCar aRes; aRes.mPt = mPt; aRes.mPtIm = mPtIm; aRes.mDesc = mDesc.DupLPIm(); return aRes; } double cAimePCar::L1Dist(const cAimePCar& aP2) const { return mDesc.ILP().DIm().L1Dist(aP2.mDesc.ILP().DIm()); } /* ================================= */ /* cProtoAimeTieP */ /* ================================= */ template<class Type> cProtoAimeTieP<Type>::cProtoAimeTieP ( cGP_OneImage<Type> * aGPI, const cPt2di & aPInit, bool ChgMaj ) : mGPI (aGPI), mChgMaj (ChgMaj), mPImInit (aPInit), mPRImRefined (ToR(mPImInit)), mPFileInit (mGPI->Im2File(ToR(mPImInit))), mNumAPC (-1) { } template<class Type> cProtoAimeTieP<Type>::cProtoAimeTieP ( cGP_OneImage<Type> * aGPI, const cPt2dr & aPInit ) : mGPI (aGPI), mChgMaj (false), mPImInit (ToI(aPInit)), mPRImRefined (aPInit), mPFileInit (mGPI->Im2File(aPInit)), mPFileRefined (mPFileInit), mNumAPC (-1) { } template<class Type> int cProtoAimeTieP<Type>::NumOct() const {return mGPI->Oct()->NumInPyr();} template<class Type> int cProtoAimeTieP<Type>::NumIm() const {return mGPI->NumInOct();} template<class Type> float cProtoAimeTieP<Type>::ScaleInO() const {return mGPI->ScaleInO();} template<class Type> float cProtoAimeTieP<Type>::ScaleAbs() const {return mGPI->ScaleAbs();} template<class Type> const cGaussianPyramid<Type> & cProtoAimeTieP<Type>::Pyram() const {return mGPI->Pyr();} template<class Type> const cGP_Params& cProtoAimeTieP<Type>::Params() const {return Pyram().Params();} /// ALP Aime Log Pol double CalcOrient(const cDataIm2D<tREAL4>& aDIm,eModeNormOr aMode) { // cDataIm2D<tREAL4> & aDIm(aIm.DIm()); cPt2di aSz = aDIm.Sz(); int aNbRho = (aMode==eModeNormOr::eMNO_MaxGradR) ? (aSz.y()-1) : aSz.y(); int aNbTeta = aSz.x(); cIm1D<tREAL4> aHisto(aNbTeta,nullptr,eModeInitImage::eMIA_Null); cDataIm1D<tREAL4> & aDHisto(aHisto.DIm()); // Parse the image and fill the histogramme in teta for (const auto & aP : cRect2(cPt2di(0,0),cPt2di(aNbTeta,aNbRho))) { double aVal = aDIm.GetV(aP); switch(aMode) { case eModeNormOr::eMNO_MaxGray : break; // tangential gradient, diff along teta case eModeNormOr::eMNO_MaxGradT : aVal -= aDIm.GetV(cPt2di((aP.x()+1)%aNbTeta,aP.y())); break; // radial gradient, diff along teta case eModeNormOr::eMNO_MaxGradR : aVal -= aDIm.GetV(cPt2di(aP.x(),aP.y()+1)); break; default : MMVII_INTERNAL_ASSERT_strong(false,"Unhandled enum val in eModeNormOr"); break; } aDHisto.AddV(aP.x(),std::abs(aVal)); } // Get integer max value int aIRes = WhitchMax(aDHisto).x(); // refine it by parabol fitting double aDelta = StableInterpoleExtr ( aDHisto.CircGetV(aIRes-1), aDHisto.CircGetV(aIRes ), aDHisto.CircGetV(aIRes+1) ); // Ensure it is in [0, NbTeta[ double aRes = mod_real(aIRes + aDelta,aNbTeta); return aRes; } template<class Type> bool cProtoAimeTieP<Type>::FillAPC(const cFilterPCar& aFPC,cAimePCar & aPC,bool ForTest) { // static int aCpt=0; aCpt++; StdOut() << "BUG cProtoAimeTieP " << aCpt << " " << ForTest << "\n"; // bool Bug=(aCpt==65); int aNbTeta = aFPC.LPS_NbTeta(); int aNbRho = aFPC.LPS_NbRho(); double aMulV = aFPC.LPS_Mult(); bool aCensusMode = aFPC.LPS_CensusMode(); double aRho0 = aFPC.LPC_Rho0(); int aShiftI0 = aFPC.LPC_DeltaI0(); int aDeltaIm = aFPC.LPC_DeltaIm(); tGPI * aImCarac = mGPI; tGPI * aImDetect = aImCarac->ImOriHom(); ///< Image original with same level of detection const std::vector<tGPI*> & aVIm = aImDetect->Pyr().VMajIm() ; ///< Vector of Major Images int aK0 = aImDetect->NumMaj() + aShiftI0; ///< We may wish to have more resolved images (or less ?) MMVII_INTERNAL_ASSERT_medium(aK0>=0,"Num Maj assertion in FillAPC"); int aKLim = aK0+ (aNbRho -1) * aDeltaIm; ///< K of lowest resolved image if (aKLim >= int(aVIm.size())) // If out of the pyramid return false; cPt2dr aCenter = mPFileRefined; // Center cPt2di aSzLP(aNbTeta,aNbRho); // Sz of Log Pol image const std::vector<cPt2dr> & aVDirTeta0 = aFPC.VDirTeta0(); // vector of direction const std::vector<cPt2dr> & aVDirTeta1 = aFPC.VDirTeta1(); // other vector of direction, may be interlaced cIm2D<tREAL4> aILPr(aSzLP); // Real Log Pol images cDataIm2D<tREAL4>& aDILPr = aILPr.DIm(); // Data real log pol im int IndRhoLP=0; cComputeStdDev<double> aRawStat; // To normalize value double aVCentral=0.0; // To be used in census mode for (int aKIm=aK0 ; aKIm<=aKLim ; aKIm+= aDeltaIm) { tGPI & anIk = *(aVIm.at(aKIm)); // Image at corresponding level cPt2dr aCk = anIk.File2Im(aCenter); // Centre in geometry of image double aRhok = aRho0 * anIk.ScaleInO(); // Rho in fact R0 * ScaleAbs / ScaleOfOct cDataIm2D<Type> & aDImk (anIk.ImG().DIm()); // Data Image at level if (ForTest) { // Check if all corner are inside for (int aK=0 ; aK<4 ; aK++) { cPt2dr aP = aCk + ToR(TAB4Corner[aK]) * aRhok; if (! aDImk.InsideBL(aP)) { return false; } } } // Memorize central value 4 census if (aCensusMode && (aKIm==aK0)) { aVCentral = aDImk.GetVBL(aCk); if (ForTest && (aVCentral==0)) { return false; } } if (!ForTest) { for (int aKTeta=0 ; aKTeta<aNbTeta ; aKTeta++) { const cPt2dr & aDir = (aKIm%2) ? aVDirTeta1.at(aKTeta) : aVDirTeta0.at(aKTeta); cPt2dr aP = aCk + aDir * aRhok; // Point in LogPol double aV = aDImk.GetVBL(aP); aDILPr.SetV(cPt2di(aKTeta,IndRhoLP),aV); if (! aCensusMode) { aRawStat.Add(1.0,aV); } } } IndRhoLP++; // StdOut() << "RoohhhhK " << aRhok << " ABS=" << anIk.ScaleAbs()<< "\n"; } // StdOut() << "xxxxxRoohhhhK NBT=" << aNbTeta << " \n"; getchar(); // Now, in test mode, we know that all the circle will be inside, OK then ... if (ForTest) { return true; } // Compute the main orientations from real image if (aFPC.IsForTieP()) { for (int aK=0 ; aK<int(eModeNormOr::eNbVals) ; aK++) { aPC.Desc().DirPrinc().push_back(CalcOrient(aDILPr,eModeNormOr(aK))) ; } } // Memorize the localization aPC.Pt() = aCenter; aPC.PtIm() = mPRImRefined; // Now convert the image to a 8 bit unsigned one cDataIm2D<tU_INT1> & aDILPi = aPC.Desc().ILP().DIm(); aDILPi.Resize(aSzLP); cComputeStdDev<double> aStat = aCensusMode ? aRawStat : aRawStat.Normalize(); const cTabulFonc1D & aTFD = AllocTabConCavex(aFPC.LPQ_Steep0(),aFPC.LPQ_Exp(),5000); for (const auto & aP : aDILPi) { double aV0 = aDILPr.GetV(aP); double aValRes=0; if (aCensusMode) { // double aVN = aV0/aVCentral; double aRatio = NormalisedRatioPos(aV0,aVCentral); aRatio = aTFD.F(aRatio); aValRes = 128 + cSetAimePCAR::TheCensusMult * aRatio; } else { double aVN = aStat.NormalizedVal(aV0); aValRes = 128 + aMulV * aVN; } aDILPi.SetVTrunc(aP,aValRes); } return true; } template<class Type> bool cProtoAimeTieP<Type>::TestFillAPC(const cFilterPCar& aFPC) { cAimePCar aAPC; bool aRes = FillAPC(aFPC,aAPC,true); return aRes; } /* ================================= */ /* cSetAimePCAR */ /* ================================= */ const double cSetAimePCAR::TheCensusMult = 128.0; cSetAimePCAR::cSetAimePCAR(eTyPyrTieP aType,bool IsMax) : mType ((int)aType), mIsMax (IsMax) { } cSetAimePCAR::cSetAimePCAR(): cSetAimePCAR(eTyPyrTieP::eNbVals,true) { } eTyPyrTieP cSetAimePCAR::Type() {return eTyPyrTieP(mType);} int & cSetAimePCAR::IType() {return mType;} bool& cSetAimePCAR::IsMax() {return mIsMax;} std::vector<cAimePCar>& cSetAimePCAR::VPC() {return mVPC;} bool& cSetAimePCAR::Census() {return mCensus;} const bool& cSetAimePCAR::Census() const {return mCensus;} double& cSetAimePCAR::Ampl2N() {return mAmpl2N;} const double& cSetAimePCAR::Ampl2N() const {return mAmpl2N;} void AddData(const cAuxAr2007 & anAux,cSetAimePCAR & aSPC) { AddData(cAuxAr2007("Type",anAux),aSPC.IType()); AddData(cAuxAr2007("Max",anAux),aSPC.IsMax()); AddData(cAuxAr2007("VPC",anAux),aSPC.VPC() ); AddData(cAuxAr2007("Census",anAux),aSPC.Census() ); AddData(cAuxAr2007("Ampl2N",anAux),aSPC.Ampl2N() ); } void cSetAimePCAR::InitFromFile(const std::string & aName) { ReadFromFile(*this,aName); } void cSetAimePCAR::SaveInFile(const std::string & aName) const { // StdOut() << "MMPPPDD " << aName << " " << (const_cast<cSetAimePCAR *>(this))->VPC().size() << "\n"; MMVII::SaveInFile(*this,aName); if (0) { for (int aK=0; aK<100 ; aK++) StdOut() << "MMv1_SaveInFile\n"; MMv1_SaveInFile<cSetAimePCAR>(*this,aName); // generate an error as "it should" } } /* ==== INSTANCIATION ======= */ template class cProtoAimeTieP<tREAL4>; template class cProtoAimeTieP<tINT2>; };
29.748227
127
0.578794
micmacIGN
a1cc477d604f68047f9571a22d6dfc115e3d547b
515
hpp
C++
include/RadonFramework/Core/Common/StringCache.hpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
3
2015-09-15T06:57:50.000Z
2021-03-16T19:05:02.000Z
include/RadonFramework/Core/Common/StringCache.hpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
2
2015-09-26T12:41:10.000Z
2015-12-08T08:41:37.000Z
include/RadonFramework/Core/Common/StringCache.hpp
tak2004/RadonFramework
e916627a54a80fac93778d5010c50c09b112259b
[ "Apache-2.0" ]
1
2015-07-09T02:56:34.000Z
2015-07-09T02:56:34.000Z
#ifndef RF_CORE_COMMON_STRING_CACHE_HPP #define RF_CORE_COMMON_STRING_CACHE_HPP #if _MSC_VER > 1000 #pragma once #endif #include <RadonFramework/Core/Types/String.hpp> namespace RadonFramework::Core::Common { namespace StringCache { void Exchange(const char*** newValues); const char* Find(const RF_Type::String& Value); } } #ifndef RF_SHORTHAND_NAMESPACE_COMMON #define RF_SHORTHAND_NAMESPACE_COMMON namespace RF_Common = RadonFramework::Core::Common; #endif #endif // RF_CORE_COMMON_STRING_CACHE_HPP
21.458333
51
0.803883
tak2004
a1ce13a6c5962bf423e750f0229e4b420462a2bf
491
cpp
C++
features/template_variadic/variadic_indices.cpp
lostjared/cpp17_Examples
bd754ffca5e894d877624c45db64f9dda93d880a
[ "Unlicense" ]
20
2017-07-22T19:06:39.000Z
2021-07-12T06:46:24.000Z
features/template_variadic/variadic_indices.cpp
lostjared/cpp17_Examples
bd754ffca5e894d877624c45db64f9dda93d880a
[ "Unlicense" ]
null
null
null
features/template_variadic/variadic_indices.cpp
lostjared/cpp17_Examples
bd754ffca5e894d877624c45db64f9dda93d880a
[ "Unlicense" ]
7
2018-05-20T10:26:07.000Z
2021-07-12T04:11:18.000Z
#include<iostream> #include<vector> template<typename T> void print(const T &type) { std::cout << type << "\n"; } template<typename T, typename... Args> void print(const T &type, Args... args) { print(type); print(args...); } template<typename Container, typename... Index> void PrintIndex(const Container &c, Index... index) { print(c[index]...); } int main() { std::vector<std::string> v{"Hello, ", " World!", " Jared"}; PrintIndex(v, 0, 1, 2); return 0; }
19.64
63
0.610998
lostjared
a1d06389b7bd6dcf7f945d6fdd69a646aa587b27
96
hpp
C++
src/include/zap/zap/link_type.hpp
chybz/zap
ccc67d85def09faa962e44b9e36ca414207d4ec3
[ "MIT" ]
null
null
null
src/include/zap/zap/link_type.hpp
chybz/zap
ccc67d85def09faa962e44b9e36ca414207d4ec3
[ "MIT" ]
null
null
null
src/include/zap/zap/link_type.hpp
chybz/zap
ccc67d85def09faa962e44b9e36ca414207d4ec3
[ "MIT" ]
null
null
null
#pragma once namespace zap { enum class link_type { static_, shared_, auto_ }; }
7.384615
20
0.614583
chybz
a1d37aebb3345ec07e322121904b998dae0a9b19
1,749
hpp
C++
libs/chain/include/chain/transaction_validity_period.hpp
chr15murray/ledger
85be05221f19598de8c6c58652139a1f2d9e362f
[ "Apache-2.0" ]
96
2018-08-23T16:49:05.000Z
2021-11-25T00:47:16.000Z
libs/chain/include/chain/transaction_validity_period.hpp
chr15murray/ledger
85be05221f19598de8c6c58652139a1f2d9e362f
[ "Apache-2.0" ]
1,011
2018-08-17T12:25:21.000Z
2021-11-18T09:30:19.000Z
libs/chain/include/chain/transaction_validity_period.hpp
chr15murray/ledger
85be05221f19598de8c6c58652139a1f2d9e362f
[ "Apache-2.0" ]
65
2018-08-20T20:05:40.000Z
2022-02-26T23:54:35.000Z
#pragma once //------------------------------------------------------------------------------ // // Copyright 2018-2020 Fetch.AI Limited // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //------------------------------------------------------------------------------ #include "chain/transaction.hpp" namespace fetch { namespace chain { template <typename TxOrTxLayout> Transaction::Validity GetValidity(TxOrTxLayout const &tx, Transaction::BlockIndex block_index) { auto const valid_until = tx.valid_until(); auto const fallback_valid_from = valid_until >= Transaction::DEFAULT_TX_VALIDITY_PERIOD ? valid_until - Transaction::DEFAULT_TX_VALIDITY_PERIOD : 0u; auto const valid_from = tx.valid_from() == 0 ? fallback_valid_from : tx.valid_from(); if (valid_until - valid_from > Transaction::MAXIMUM_TX_VALIDITY_PERIOD) { return Transaction::Validity::INVALID; } if (valid_until <= block_index) { return Transaction::Validity::INVALID; } if (valid_from > block_index) { return Transaction::Validity::PENDING; } return Transaction::Validity::VALID; } } // namespace chain } // namespace fetch
31.232143
94
0.630646
chr15murray
a1d5707639f0daa4f2e331829fb4c178322a1c31
305
cpp
C++
SopadeLetras/Jogo.cpp
EduardaSRBastos/LetterSoup
454483576be3b98cf948851e07db11ea1bd11712
[ "MIT" ]
null
null
null
SopadeLetras/Jogo.cpp
EduardaSRBastos/LetterSoup
454483576be3b98cf948851e07db11ea1bd11712
[ "MIT" ]
null
null
null
SopadeLetras/Jogo.cpp
EduardaSRBastos/LetterSoup
454483576be3b98cf948851e07db11ea1bd11712
[ "MIT" ]
null
null
null
#include "Jogo.h" Jogo::Jogo() { } Jogo::Jogo(int x, int y) { jogador.SetPontos(0); jogo.Inicio(x, y); } void Jogo::Iniciar() { int a = 10; while (a > 0) { cout << a-- << " -----------------" << endl << endl; Jogar(); } } int Jogo::Jogar() { jogo.Ver(); return 0; } Jogo::~Jogo() { }
8.714286
55
0.47541
EduardaSRBastos
a1d62f509b21abbd42d831b8ba08dec4879fb832
1,939
cpp
C++
debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
kubamracek/llvm-project
f7ff1869cdd487d4baaf009380901e5469d8344d
[ "Apache-2.0" ]
null
null
null
debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
kubamracek/llvm-project
f7ff1869cdd487d4baaf009380901e5469d8344d
[ "Apache-2.0" ]
null
null
null
debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
kubamracek/llvm-project
f7ff1869cdd487d4baaf009380901e5469d8344d
[ "Apache-2.0" ]
null
null
null
#include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/Identifier.h" #include "mlir/IR/Location.h" #include "mlir/IR/MLIRContext.h" #include "mlir/IR/OperationSupport.h" mlir::MLIRContext Context; auto Identifier = mlir::Identifier::get("foo", &Context); mlir::OperationName OperationName("FooOp", &Context); mlir::Value Value({reinterpret_cast<void *>(0x8), mlir::Value::Kind::TrailingOpResult}); mlir::Type Type(nullptr); mlir::Type IndexType = mlir::IndexType::get(&Context); mlir::Type IntegerType = mlir::IntegerType::get(&Context, 3, mlir::IntegerType::Unsigned); mlir::Type FloatType = mlir::Float32Type::get(&Context); mlir::Type MemRefType = mlir::MemRefType::get({4, 5}, FloatType); mlir::Type UnrankedMemRefType = mlir::UnrankedMemRefType::get(IntegerType, 6); mlir::Type VectorType = mlir::VectorType::get({1, 2}, FloatType); mlir::Type TupleType = mlir::TupleType::get(&Context, mlir::TypeRange({IndexType, FloatType})); auto UnknownLoc = mlir::UnknownLoc::get(&Context); auto FileLineColLoc = mlir::FileLineColLoc::get("file", 7, 8, &Context); auto OpaqueLoc = mlir::OpaqueLoc::get<uintptr_t>(9, &Context); auto NameLoc = mlir::NameLoc::get(Identifier); auto CallSiteLoc = mlir::CallSiteLoc::get(FileLineColLoc, OpaqueLoc); auto FusedLoc = mlir::FusedLoc::get({FileLineColLoc, NameLoc}, &Context); mlir::Attribute UnitAttr = mlir::UnitAttr::get(&Context); mlir::Attribute FloatAttr = mlir::FloatAttr::get(FloatType, 1.0); mlir::Attribute IntegerAttr = mlir::IntegerAttr::get(IntegerType, 10); mlir::Attribute TypeAttr = mlir::TypeAttr::get(IndexType); mlir::Attribute ArrayAttr = mlir::ArrayAttr::get(&Context, {UnitAttr}); mlir::Attribute StringAttr = mlir::StringAttr::get(&Context, "foo"); mlir::Attribute ElementsAttr = mlir::DenseElementsAttr::get( VectorType.cast<mlir::ShapedType>(), llvm::ArrayRef<float>{2.0f, 3.0f}); int main() { return 0; }
45.093023
78
0.729758
kubamracek
a1d812bb46c6be94fade97fbf3a08d52abc52911
176
cc
C++
Mu2eInterfaces/src/Detector.cc
lborrel/Offline
db9f647bad3c702171ab5ffa5ccc04c82b3f8984
[ "Apache-2.0" ]
1
2021-06-23T22:09:28.000Z
2021-06-23T22:09:28.000Z
Mu2eInterfaces/src/Detector.cc
lborrel/Offline
db9f647bad3c702171ab5ffa5ccc04c82b3f8984
[ "Apache-2.0" ]
125
2020-04-03T13:44:30.000Z
2021-10-15T21:29:57.000Z
Mu2eInterfaces/src/Detector.cc
lborrel/Offline
db9f647bad3c702171ab5ffa5ccc04c82b3f8984
[ "Apache-2.0" ]
null
null
null
// // A base class for detector components. // // // Original author Rob Kutschke // #include "Mu2eInterfaces/inc/Detector.hh" namespace mu2e { Detector::~Detector() { } }
12.571429
41
0.676136
lborrel
a1d9745a4f73ccce5e92be9972b27a19bcca81e1
2,311
cpp
C++
polarexpress/data/generator.cpp
csecutsc/utscode2
469367528cc5697e0c5c0ccee28420591335d899
[ "Unlicense" ]
4
2018-09-30T15:06:49.000Z
2020-12-09T06:50:25.000Z
polarexpress/data/generator.cpp
csecutsc/utscode2
469367528cc5697e0c5c0ccee28420591335d899
[ "Unlicense" ]
null
null
null
polarexpress/data/generator.cpp
csecutsc/utscode2
469367528cc5697e0c5c0ccee28420591335d899
[ "Unlicense" ]
1
2021-06-17T04:10:51.000Z
2021-06-17T04:10:51.000Z
#define DEBUG 0 #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <fstream> #include <iostream> #include <sstream> #include <vector> using namespace std; typedef pair<int, int> pii; // Random number in range [lo, hi] for nonnegative lo and hi. int rand(int lo, int hi) { return ((rand() & 0x7fff) | ((rand() & 0x7fff) << 15)) % (hi - lo + 1) + lo; } string name(int num, string ext) { stringstream ss; ss << num; string str; ss >> str; return "secret/" + str + ext; } /*** VERIFIER ***/ /*** GENERATOR ***/ void gen(int num, int N) { ofstream fout(name(num, ".in").c_str()); fout << N << endl; vector<int> a; for (int i = 1; i <= N; i++) { a.push_back(i); } // Knuth shuffle. for (int i = 0; i < N; i++) { int j = rand(i, N - 1); swap(a[i], a[j]); } for (int i = 0; i < N; i++) { fout << a[i] << endl; } fout.close(); } void gen() { int t = 2; gen(t++, 1); gen(t++, 2); gen(t++, 3); gen(t++, 4); gen(t++, 10); gen(t++, 20); gen(t++, 50); gen(t++, 100); gen(t++, 200); gen(t++, 200); gen(t++, 200); } /*** SOLVER ***/ int N, O[200]; vector<int> ans; void move(int x) { int j = 0, tmp[200]; for (int i = x; i < N; i++) { tmp[j++] = O[i]; } for (int i = x - 1; i >= 0; i--) { tmp[j++] = O[i]; } memcpy(O, tmp, sizeof O); ans.push_back(x); } int find(int v) { for (int i = 0; i < N; i++) { if (O[i] == v) { return i; } } assert(false); } vector<int> solve(ifstream &fin) { ans.clear(); fin >> N; for (int i = 0; i < N; i++) { fin >> O[i]; } for (;;) { int e = 1; for (int i = find(1); i + 1 < N && O[i + 1] == e + 1; i++, e++); if (e == N) { break; } move(N); if (find(e)) { move(find(e)); } move(find(1) + 1); move(find(e + 1) + 1); } return ans; } int main() { srand(0xDEADBEEF); // GENERATE gen(); // SOLVE for (int num = 0; num <= 100; num++) { ifstream fin(name(num, ".in").c_str()); if (!fin.good()) continue; vector<int> ans = solve(fin); ofstream fout(name(num, ".ans").c_str()); fout << ans.size() << endl; for (int i = 0; i < (int)ans.size(); i++) { fout << ans[i] << endl; } fout.close(); } return 0; }
17.246269
78
0.478581
csecutsc
a1dada7333cd80ba19e1a59872552536579d95c4
844
cpp
C++
acm/cf/20151230/c.cpp
xiaohuihuigh/cpp
c28bdb79ecb86f44a92971ac259910546dba29a7
[ "MIT" ]
17
2016-01-01T12:57:25.000Z
2022-02-06T09:55:12.000Z
acm/cf/20151230/c.cpp
xiaohuihuigh/cpp
c28bdb79ecb86f44a92971ac259910546dba29a7
[ "MIT" ]
null
null
null
acm/cf/20151230/c.cpp
xiaohuihuigh/cpp
c28bdb79ecb86f44a92971ac259910546dba29a7
[ "MIT" ]
8
2018-12-27T01:31:49.000Z
2022-02-06T09:55:12.000Z
//行列分开求,否则会因为行列之间相互关联,无法快速求解 #include<bits/stdc++.h> using namespace std; const int maxn = 550; char s[maxn][maxn]; int ha[maxn][maxn]; int li[maxn][maxn]; int main(){ int h,w; cin>>h>>w;getchar(); memset(s,'#',sizeof(s)); memset(ha,0,sizeof(ha)); memset(li,0,sizeof(li)); for(int i= 1;i<=h;i++){ for (int j=1;j<=w;j++) cin>>s[i][j]; } for(int i = 1;i<=h;i++){ for(int j = 1;j<=w;j++){ ha[i][j] = ha[i][j-1]+ha[i-1][j]-ha[i-1][j-1]; if(s[i][j] == '.'&&s[i][j-1] == '.')ha[i][j]++; li[i][j] = li[i-1][j]+li[i][j-1]-li[i-1][j-1]; if(s[i][j] == '.'&&s[i-1][j] == '.')li[i][j]++; } } int t; cin>>t; while(t--){ int a,b,c,d; cin>>a>>b>>c>>d; int sum = 0; //求行和列的总和是,注意减去的部分和加上的部分 sum += ha[c][d]-ha[c][b]-ha[a-1][d]+ha[a-1][b]; sum += li[c][d]-li[c][b-1]-li[a][d]+li[a][b-1]; cout<<sum<<endl; } }
19.627907
50
0.483412
xiaohuihuigh