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
b93e09783a7aecc460f08528362c1569b0c592ce
3,298
cpp
C++
PhysXChips_Dlg/PhysXRigidDynamic_Dlg.cpp
snaxgameengine/PhysXForSnaX
aa18d93a30e6cfe11b0258af3733b65de0adf832
[ "BSD-3-Clause" ]
3
2021-04-27T08:52:40.000Z
2021-05-19T18:05:40.000Z
PhysXChips_Dlg/PhysXRigidDynamic_Dlg.cpp
snaxgameengine/PhysXForSnaX
aa18d93a30e6cfe11b0258af3733b65de0adf832
[ "BSD-3-Clause" ]
null
null
null
PhysXChips_Dlg/PhysXRigidDynamic_Dlg.cpp
snaxgameengine/PhysXForSnaX
aa18d93a30e6cfe11b0258af3733b65de0adf832
[ "BSD-3-Clause" ]
null
null
null
// Copyright(c) 2013-2019, mCODE A/S // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and /or other materials provided with the distribution. // 3. Neither the name of the copyright holders 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 HOLDERS 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 "pch.h" #include "PhysXRigidDynamic_Dlg.h" using namespace m3d; DIALOGDESC_DEF(PhysXRigidDynamic_Dlg, PHYSXRIGIDDYNAMIC_GUID); void PhysXRigidDynamic_Dlg::Init() { AddCheckBox(L"Kinematic", GetChip()->IsKinematic() ? RCheckState::Checked : RCheckState::Unchecked, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetKinematic(v.ToUInt() == RCheckState::Checked); }); AddDoubleSpinBox(L"Linear Damping", GetChip()->GetLinearDamping(), 0, FLT_MAX, 0.1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetLinearDamping(v.ToFloat()); }); AddDoubleSpinBox(L"Angular Damping", GetChip()->GetAngularDamping(), 0, FLT_MAX, 0.1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetAngularDamping(v.ToFloat()); }); AddDoubleSpinBox(L"Max Angular Velocity", GetChip()->GetMaxAngularVelocity(), 0.0001, FLT_MAX, 0.1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetMaxAngularVelocity(v.ToFloat()); }); AddDoubleSpinBox(L"Sleep Threshold", GetChip()->GetSleepThreshold(), 0.0001, FLT_MAX, 0.1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetSleepThreshold(v.ToFloat()); }); unsigned p, v; GetChip()->GetMinSolverIterations(p, v); AddSpinBox(1, L"Minimum Position Iterations", p, 1, 255, 1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetMinSolverIterations(v.ToInt(), GetValueFromWidget(2).ToInt()); }); AddSpinBox(2, L"Minimum Velocity Iterations", v, 1, 255, 1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetMinSolverIterations(GetValueFromWidget(1).ToInt(), v.ToInt()); }); AddDoubleSpinBox(L"Contact Report Threshold", GetChip()->GetContactReportThreshold(), 0.0001, FLT_MAX, 0.1, [this](Id id, RVariant v) { SetDirty(); GetChip()->SetContactReportThreshold(v.ToFloat()); }); }
64.666667
205
0.739539
snaxgameengine
b941eea895579899b81da4a62b21b2bba3738ed8
49
hpp
C++
src/boost_log_sinks_attribute_mapping.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
10
2018-03-17T00:58:42.000Z
2021-07-06T02:48:49.000Z
src/boost_log_sinks_attribute_mapping.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
2
2021-03-26T15:17:35.000Z
2021-05-20T23:55:08.000Z
src/boost_log_sinks_attribute_mapping.hpp
miathedev/BoostForArduino
919621dcd0c157094bed4df752b583ba6ea6409e
[ "BSL-1.0" ]
4
2019-05-28T21:06:37.000Z
2021-07-06T03:06:52.000Z
#include <boost/log/sinks/attribute_mapping.hpp>
24.5
48
0.816327
miathedev
b947d0b549363508cae2e17e7ff9f5eddb259fe5
7,810
cpp
C++
FEBioSource2.9/FEBioMech/FE2DFiberNeoHookean.cpp
wzaylor/FEBio_MCLS
f1052733c31196544fb0921aa55ffa5167a25f98
[ "Intel" ]
1
2021-08-24T08:37:21.000Z
2021-08-24T08:37:21.000Z
FEBioSource2.9/FEBioMech/FE2DFiberNeoHookean.cpp
wzaylor/FEBio_MCLS
f1052733c31196544fb0921aa55ffa5167a25f98
[ "Intel" ]
null
null
null
FEBioSource2.9/FEBioMech/FE2DFiberNeoHookean.cpp
wzaylor/FEBio_MCLS
f1052733c31196544fb0921aa55ffa5167a25f98
[ "Intel" ]
1
2021-03-15T08:22:06.000Z
2021-03-15T08:22:06.000Z
/*This file is part of the FEBio source code and is licensed under the MIT license listed below. See Copyright-FEBio.txt for details. Copyright (c) 2019 University of Utah, The Trustees of Columbia University in the City of New York, and others. 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 "FE2DFiberNeoHookean.h" // define the material parameters BEGIN_PARAMETER_LIST(FE2DFiberNeoHookean, FEElasticMaterial) ADD_PARAMETER2(m_E, FE_PARAM_DOUBLE, FE_RANGE_GREATER(0.0), "E"); ADD_PARAMETER2(m_v, FE_PARAM_DOUBLE, FE_RANGE_RIGHT_OPEN(-1.0, 0.5), "v"); ADD_PARAMETERV(m_a, FE_PARAM_DOUBLE, 2, "a"); ADD_PARAMETER(m_ac, FE_PARAM_DOUBLE, "active_contraction"); END_PARAMETER_LIST(); double FE2DFiberNeoHookean::m_cth[FE2DFiberNeoHookean::NSTEPS]; double FE2DFiberNeoHookean::m_sth[FE2DFiberNeoHookean::NSTEPS]; ////////////////////////////////////////////////////////////////////// // FE2DFiberNeoHookean ////////////////////////////////////////////////////////////////////// FE2DFiberNeoHookean::FE2DFiberNeoHookean(FEModel* pfem) : FEElasticMaterial(pfem) { static bool bfirst = true; if (bfirst) { double ph; const double PI = 4.0*atan(1.0); for (int n=0; n<NSTEPS; ++n) { ph = 2.0*PI*n / (double) NSTEPS; m_cth[n] = cos(ph); m_sth[n] = sin(ph); } bfirst = false; } m_ac = 0; m_a[0] = m_a[1] = 0; } mat3ds FE2DFiberNeoHookean::Stress(FEMaterialPoint& mp) { FEElasticMaterialPoint& pt = *mp.ExtractData<FEElasticMaterialPoint>(); mat3d &F = pt.m_F; double detF = pt.m_J; double detFi = 1.0/detF; double lndetF = log(detF); // calculate left Cauchy-Green tensor // (we commented out the matrix components we do not need) double b[3][3]; b[0][0] = F[0][0]*F[0][0]+F[0][1]*F[0][1]+F[0][2]*F[0][2]; b[0][1] = F[0][0]*F[1][0]+F[0][1]*F[1][1]+F[0][2]*F[1][2]; b[0][2] = F[0][0]*F[2][0]+F[0][1]*F[2][1]+F[0][2]*F[2][2]; // b[1][0] = F[1][0]*F[0][0]+F[1][1]*F[0][1]+F[1][2]*F[0][2]; b[1][1] = F[1][0]*F[1][0]+F[1][1]*F[1][1]+F[1][2]*F[1][2]; b[1][2] = F[1][0]*F[2][0]+F[1][1]*F[2][1]+F[1][2]*F[2][2]; // b[2][0] = F[2][0]*F[0][0]+F[2][1]*F[0][1]+F[2][2]*F[0][2]; // b[2][1] = F[2][0]*F[1][0]+F[2][1]*F[1][1]+F[2][2]*F[1][2]; b[2][2] = F[2][0]*F[2][0]+F[2][1]*F[2][1]+F[2][2]*F[2][2]; // lame parameters double lam = m_v*m_E/((1+m_v)*(1-2*m_v)); double mu = 0.5*m_E/(1+m_v); // calculate stress mat3ds s; // --- M A T R I X C O N T R I B U T I O N --- s.xx() = (mu*(b[0][0] - 1) + lam*lndetF)*detFi; s.yy() = (mu*(b[1][1] - 1) + lam*lndetF)*detFi; s.zz() = (mu*(b[2][2] - 1) + lam*lndetF)*detFi; s.xy() = mu*b[0][1]*detFi; s.yz() = mu*b[1][2]*detFi; s.xz() = mu*b[0][2]*detFi; // --- F I B E R C O N T R I B U T I O N --- // NOTE: we have only implemented the active contraction model for this material // There is no passive fiber stress. if (m_ac > 0) { const double PI = 4.0*atan(1.0); double wa = 1.0 / (double) NSTEPS; vec3d a0, a, v; double at; for (int n=0; n<NSTEPS; ++n) { // calculate the local material fiber vector v.x = m_cth[n]; v.y = m_sth[n]; v.z = 0; // calculate the global material fiber vector a0 = pt.m_Q*v; // calculate the global spatial fiber vector a.x = F[0][0]*a0.x + F[0][1]*a0.y + F[0][2]*a0.z; a.y = F[1][0]*a0.x + F[1][1]*a0.y + F[1][2]*a0.z; a.z = F[2][0]*a0.x + F[2][1]*a0.y + F[2][2]*a0.z; // normalize material axis and store fiber stretch a.unit(); // add active contraction stuff at = wa*m_ac *sqrt((m_a[0]*v.x)*(m_a[0]*v.x) + (m_a[1]*v.y)*(m_a[1]*v.y)); s.xx() += at*a.x*a.x; s.yy() += at*a.y*a.y; s.zz() += at*a.z*a.z; s.xy() += at*a.x*a.y; s.yz() += at*a.y*a.z; s.xz() += at*a.x*a.z; } } return s; } tens4ds FE2DFiberNeoHookean::Tangent(FEMaterialPoint& mp) { FEElasticMaterialPoint& pt = *mp.ExtractData<FEElasticMaterialPoint>(); // deformation gradient mat3d &F = pt.m_F; double detF = pt.m_J; // lame parameters double lam = m_v*m_E/((1+m_v)*(1-2*m_v)); double mu = 0.5*m_E/(1+m_v); double lam1 = lam / detF; double mu1 = (mu - lam*log(detF)) / detF; // --- M A T R I X C O N T R I B U T I O N --- double D[6][6] = {0}; D[0][0] = lam1+2.*mu1; D[0][1] = lam1 ; D[0][2] = lam1 ; D[1][0] = lam1 ; D[1][1] = lam1+2.*mu1; D[1][2] = lam1 ; D[2][0] = lam1 ; D[2][1] = lam1 ; D[2][2] = lam1+2.*mu1; D[3][3] = mu1; D[4][4] = mu1; D[5][5] = mu1; // --- F I B E R C O N T R I B U T I O N --- // NOTE: I commented the fiber stiffness out since I think it will lead to // a nonsymmetric D matrix and I can't deal with that yet. Besides, most // problems seem to be running just fine without this contribution. /* if (m_ac) { // Next, we add the fiber contribution. Since the fibers lie // randomly perpendicular to the transverse axis, we need // to integrate over that plane const double PI = 4.0*atan(1.0); double lam, at, In; vec3d a0, a, v; double wa = 1.0 / (double) NSTEPS; for (int n=0; n<NSTEPS; ++n) { // calculate the local material fiber vector v.x = m_cth[n]; v.y = m_sth[n]; v.z = 0; // calculate the global material fiber vector a0 = pt.Q*v; // calculate the global spatial fiber vector a.x = F[0][0]*a0.x + F[0][1]*a0.y + F[0][2]*a0.z; a.y = F[1][0]*a0.x + F[1][1]*a0.y + F[1][2]*a0.z; a.z = F[2][0]*a0.x + F[2][1]*a0.y + F[2][2]*a0.z; // normalize material axis and store fiber stretch lam = a.unit(); // add active contraction stuff at = wa*m_ac *sqrt((m_a[0]*v.x)*(m_a[0]*v.x) + (m_a[1]*v.y)*(m_a[1]*v.y)); In = lam*lam; D[0][0] += at*(a.x*a.x - 2.0*a.x*a.x*a.x*a.x); // c(0,0,0,0) D[0][1] += at*(a.x*a.x - 2.0*a.x*a.x*a.y*a.y); // c(0,0,1,1) D[0][2] += at*(a.x*a.x - 2.0*a.x*a.x*a.z*a.z); // c(0,0,2,2) D[0][3] -= at*(2.0*a.x*a.x*a.x*a.y); // c(0,0,0,1) D[0][4] -= at*(2.0*a.x*a.x*a.y*a.z); // c(0,0,1,2) D[0][5] -= at*(2.0*a.x*a.x*a.x*a.z); // c(0,0,0,2) D[1][1] += at*(a.y*a.y - 2.0*a.y*a.y*a.y*a.y); // c(1,1,1,1) D[1][2] += at*(a.y*a.y - 2.0*a.y*a.y*a.z*a.z); // c(1,1,2,2) D[1][3] -= at*(2.0*a.y*a.y*a.x*a.y); // c(1,1,0,1) D[1][4] -= at*(2.0*a.y*a.y*a.y*a.z); // c(1,1,1,2) D[1][5] -= at*(2.0*a.y*a.y*a.x*a.z); // c(1,1,0,2) D[2][2] += at*(a.z*a.z - 2.0*a.z*a.z*a.z*a.z); // c(2,2,2,2) D[2][3] -= at*(2.0*a.z*a.z*a.x*a.y); // c(2,2,0,1) D[2][4] -= at*(2.0*a.z*a.z*a.y*a.z); // c(2,2,1,2) D[2][5] -= at*(2.0*a.z*a.z*a.x*a.z); // c(2,2,0,2) D[3][3] -= at*(2.0*a.x*a.y*a.x*a.y); // c(0,1,0,1) D[3][4] -= at*(2.0*a.x*a.y*a.y*a.z); // c(0,1,1,2) D[3][5] -= at*(2.0*a.x*a.y*a.x*a.z); // c(0,1,0,2) D[4][4] -= at*(2.0*a.y*a.z*a.y*a.z); // c(1,2,1,2) D[4][5] -= at*(2.0*a.y*a.z*a.x*a.z); // c(1,2,0,2) D[5][5] -= at*(2.0*a.x*a.z*a.x*a.z); // c(0,2,0,2) } } */ return tens4ds(D); }
32.406639
82
0.565685
wzaylor
b94a33adf78d2b21e61582137ee61764ca00c42b
7,906
cpp
C++
ruby/input/joypad/directinput.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
153
2020-07-25T17:55:29.000Z
2021-10-01T23:45:01.000Z
ruby/input/joypad/directinput.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
245
2021-10-08T09:14:46.000Z
2022-03-31T08:53:13.000Z
ruby/input/joypad/directinput.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
44
2020-07-25T08:51:55.000Z
2021-09-25T16:09:01.000Z
#pragma once auto CALLBACK DirectInput_EnumJoypadsCallback(const DIDEVICEINSTANCE* instance, void* p) -> BOOL; auto CALLBACK DirectInput_EnumJoypadAxesCallback(const DIDEVICEOBJECTINSTANCE* instance, void* p) -> BOOL; auto CALLBACK DirectInput_EnumJoypadEffectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* p) -> BOOL; struct InputJoypadDirectInput { Input& input; InputJoypadDirectInput(Input& input) : input(input) {} struct Joypad { shared_pointer<HID::Joypad> hid{new HID::Joypad}; LPDIRECTINPUTDEVICE8 device = nullptr; LPDIRECTINPUTEFFECT effect = nullptr; u32 pathID = 0; u16 vendorID = 0; u16 productID = 0; bool isXInputDevice = false; }; vector<Joypad> joypads; uintptr handle = 0; LPDIRECTINPUT8 context = nullptr; LPDIRECTINPUTDEVICE8 device = nullptr; bool xinputAvailable = false; u32 effects = 0; auto assign(shared_pointer<HID::Joypad> hid, u32 groupID, u32 inputID, s16 value) -> void { auto& group = hid->group(groupID); if(group.input(inputID).value() == value) return; input.doChange(hid, groupID, inputID, group.input(inputID).value(), value); group.input(inputID).setValue(value); } auto poll(vector<shared_pointer<HID::Device>>& devices) -> void { for(auto& jp : joypads) { if(FAILED(jp.device->Poll())) jp.device->Acquire(); DIJOYSTATE2 state; if(FAILED(jp.device->GetDeviceState(sizeof(DIJOYSTATE2), &state))) continue; for(u32 n : range(4)) { assign(jp.hid, HID::Joypad::GroupID::Axis, 0, state.lX); assign(jp.hid, HID::Joypad::GroupID::Axis, 1, state.lY); assign(jp.hid, HID::Joypad::GroupID::Axis, 2, state.lZ); assign(jp.hid, HID::Joypad::GroupID::Axis, 3, state.lRx); assign(jp.hid, HID::Joypad::GroupID::Axis, 4, state.lRy); assign(jp.hid, HID::Joypad::GroupID::Axis, 5, state.lRz); u32 pov = state.rgdwPOV[n]; s16 xaxis = 0; s16 yaxis = 0; if(pov < 36000) { if(pov >= 31500 || pov <= 4500) yaxis = -32767; if(pov >= 4500 && pov <= 13500) xaxis = +32767; if(pov >= 13500 && pov <= 22500) yaxis = +32767; if(pov >= 22500 && pov <= 31500) xaxis = -32767; } assign(jp.hid, HID::Joypad::GroupID::Hat, n * 2 + 0, xaxis); assign(jp.hid, HID::Joypad::GroupID::Hat, n * 2 + 1, yaxis); } for(u32 n : range(128)) { assign(jp.hid, HID::Joypad::GroupID::Button, n, (bool)state.rgbButtons[n]); } devices.append(jp.hid); } } auto rumble(u64 id, bool enable) -> bool { for(auto& jp : joypads) { if(jp.hid->id() != id) continue; if(jp.effect == nullptr) continue; if(enable) jp.effect->Start(1, 0); else jp.effect->Stop(); return true; } return false; } auto initialize(uintptr handle, LPDIRECTINPUT8 context, bool xinputAvailable) -> bool { if(!handle) return false; this->handle = handle; this->context = context; this->xinputAvailable = xinputAvailable; context->EnumDevices(DI8DEVCLASS_GAMECTRL, DirectInput_EnumJoypadsCallback, (void*)this, DIEDFL_ATTACHEDONLY); return true; } auto terminate() -> void { for(auto& jp : joypads) { jp.device->Unacquire(); if(jp.effect) jp.effect->Release(); jp.device->Release(); } joypads.reset(); context = nullptr; } auto initJoypad(const DIDEVICEINSTANCE* instance) -> bool { Joypad jp; jp.vendorID = instance->guidProduct.Data1 >> 0; jp.productID = instance->guidProduct.Data1 >> 16; jp.isXInputDevice = false; if(auto device = rawinput.find(jp.vendorID, jp.productID)) { jp.isXInputDevice = device().isXInputDevice; } //Microsoft has intentionally imposed artificial restrictions on XInput devices when used with DirectInput //a) the two triggers are merged into a single axis, making uniquely distinguishing them impossible //b) rumble support is not exposed //thus, it's always preferred to let the XInput driver handle these joypads //but if the driver is not available (XInput 1.3 does not ship with stock Windows XP), fall back on DirectInput if(jp.isXInputDevice && xinputAvailable) return DIENUM_CONTINUE; if(FAILED(context->CreateDevice(instance->guidInstance, &device, 0))) return DIENUM_CONTINUE; jp.device = device; device->SetDataFormat(&c_dfDIJoystick2); device->SetCooperativeLevel((HWND)handle, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND); effects = 0; device->EnumObjects(DirectInput_EnumJoypadAxesCallback, (void*)this, DIDFT_ABSAXIS); device->EnumObjects(DirectInput_EnumJoypadEffectsCallback, (void*)this, DIDFT_FFACTUATOR); jp.hid->setRumble(effects > 0); DIPROPGUIDANDPATH property; memset(&property, 0, sizeof(DIPROPGUIDANDPATH)); property.diph.dwSize = sizeof(DIPROPGUIDANDPATH); property.diph.dwHeaderSize = sizeof(DIPROPHEADER); property.diph.dwObj = 0; property.diph.dwHow = DIPH_DEVICE; device->GetProperty(DIPROP_GUIDANDPATH, &property.diph); string devicePath = (const char*)utf8_t(property.wszPath); jp.pathID = Hash::CRC32(devicePath).value(); jp.hid->setVendorID(jp.vendorID); jp.hid->setProductID(jp.productID); jp.hid->setPathID(jp.pathID); if(jp.hid->rumble()) { //disable auto-centering spring for rumble support DIPROPDWORD property; memset(&property, 0, sizeof(DIPROPDWORD)); property.diph.dwSize = sizeof(DIPROPDWORD); property.diph.dwHeaderSize = sizeof(DIPROPHEADER); property.diph.dwObj = 0; property.diph.dwHow = DIPH_DEVICE; property.dwData = false; device->SetProperty(DIPROP_AUTOCENTER, &property.diph); DWORD dwAxes[2] = {(DWORD)DIJOFS_X, (DWORD)DIJOFS_Y}; LONG lDirection[2] = {0, 0}; DICONSTANTFORCE force; force.lMagnitude = DI_FFNOMINALMAX; //full force DIEFFECT effect; memset(&effect, 0, sizeof(DIEFFECT)); effect.dwSize = sizeof(DIEFFECT); effect.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS; effect.dwDuration = INFINITE; effect.dwSamplePeriod = 0; effect.dwGain = DI_FFNOMINALMAX; effect.dwTriggerButton = DIEB_NOTRIGGER; effect.dwTriggerRepeatInterval = 0; effect.cAxes = 2; effect.rgdwAxes = dwAxes; effect.rglDirection = lDirection; effect.lpEnvelope = 0; effect.cbTypeSpecificParams = sizeof(DICONSTANTFORCE); effect.lpvTypeSpecificParams = &force; effect.dwStartDelay = 0; device->CreateEffect(GUID_ConstantForce, &effect, &jp.effect, NULL); } for(auto n : range(6)) jp.hid->axes().append(n); for(auto n : range(8)) jp.hid->hats().append(n); for(auto n : range(128)) jp.hid->buttons().append(n); joypads.append(jp); return DIENUM_CONTINUE; } auto initAxis(const DIDEVICEOBJECTINSTANCE* instance) -> bool { DIPROPRANGE range; memset(&range, 0, sizeof(DIPROPRANGE)); range.diph.dwSize = sizeof(DIPROPRANGE); range.diph.dwHeaderSize = sizeof(DIPROPHEADER); range.diph.dwHow = DIPH_BYID; range.diph.dwObj = instance->dwType; range.lMin = -32768; range.lMax = +32767; device->SetProperty(DIPROP_RANGE, &range.diph); return DIENUM_CONTINUE; } auto initEffect(const DIDEVICEOBJECTINSTANCE* instance) -> bool { effects++; return DIENUM_CONTINUE; } }; auto CALLBACK DirectInput_EnumJoypadsCallback(const DIDEVICEINSTANCE* instance, void* p) -> BOOL { return ((InputJoypadDirectInput*)p)->initJoypad(instance); } auto CALLBACK DirectInput_EnumJoypadAxesCallback(const DIDEVICEOBJECTINSTANCE* instance, void* p) -> BOOL { return ((InputJoypadDirectInput*)p)->initAxis(instance); } auto CALLBACK DirectInput_EnumJoypadEffectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* p) -> BOOL { return ((InputJoypadDirectInput*)p)->initEffect(instance); }
36.266055
115
0.676069
CasualPokePlayer
b94af4968211cb6419b66b0e2a6075d15181bac4
7,645
hpp
C++
drivers/usb/hcds/ehci/src/ehci.hpp
kITerE/managarm
e6d1229a0bed68cb672a9cad300345a9006d78c1
[ "MIT" ]
1
2020-07-29T12:13:14.000Z
2020-07-29T12:13:14.000Z
drivers/usb/hcds/ehci/src/ehci.hpp
kITerE/managarm
e6d1229a0bed68cb672a9cad300345a9006d78c1
[ "MIT" ]
null
null
null
drivers/usb/hcds/ehci/src/ehci.hpp
kITerE/managarm
e6d1229a0bed68cb672a9cad300345a9006d78c1
[ "MIT" ]
null
null
null
#include <queue> #include <arch/mem_space.hpp> #include <async/recurring-event.hpp> #include <async/mutex.hpp> #include <async/result.hpp> #include <helix/memory.hpp> #include "spec.hpp" struct Controller; struct DeviceState; struct ConfigurationState; struct InterfaceState; struct EndpointState; // TODO: This could be moved to a "USB core" driver. struct Enumerator { Enumerator(Controller *controller); // Called by the USB hub driver once a device connects to a port. void connectPort(int port); // Called by the USB hub driver once a device completes reset. void enablePort(int port); private: enum class State { null, resetting, probing }; async::detached _reset(); async::detached _probe(); Controller *_controller; State _state; int _activePort; async::mutex _addressMutex; }; // ---------------------------------------------------------------- // Controller. // ---------------------------------------------------------------- struct Controller : std::enable_shared_from_this<Controller> { Controller(protocols::hw::Device hw_device, helix::Mapping mapping, helix::UniqueDescriptor mmio, helix::UniqueIrq irq); async::detached initialize(); async::result<void> probeDevice(); async::detached handleIrqs(); // ------------------------------------------------------------------------ // Schedule classes. // ------------------------------------------------------------------------ struct AsyncItem : boost::intrusive::list_base_hook<> { }; struct Transaction : AsyncItem { explicit Transaction(arch::dma_array<TransferDescriptor> transfers, size_t size) : transfers{std::move(transfers)}, fullSize{size}, numComplete{0}, lostSize{0} { } arch::dma_array<TransferDescriptor> transfers; size_t fullSize; size_t numComplete; size_t lostSize; // Size lost in short packets. async::promise<frg::expected<UsbError, size_t>> promise; async::promise<frg::expected<UsbError>> voidPromise; }; struct QueueEntity : AsyncItem { QueueEntity(arch::dma_object<QueueHead> the_head, int address, int pipe, PipeType type, size_t packet_size); bool getReclaim(); void setReclaim(bool reclaim); void setAddress(int address); arch::dma_object<QueueHead> head; boost::intrusive::list<Transaction> transactions; }; // ------------------------------------------------------------------------ // Device management. // ------------------------------------------------------------------------ struct EndpointSlot { size_t maxPacketSize; QueueEntity *queueEntity; }; struct DeviceSlot { EndpointSlot controlStates[16]; EndpointSlot outStates[16]; EndpointSlot inStates[16]; }; std::queue<int> _addressStack; DeviceSlot _activeDevices[128]; public: async::result<frg::expected<UsbError, std::string>> configurationDescriptor(int address); async::result<frg::expected<UsbError>> useConfiguration(int address, int configuration); async::result<frg::expected<UsbError>> useInterface(int address, int interface, int alternative); // ------------------------------------------------------------------------ // Transfer functions. // ------------------------------------------------------------------------ static Transaction *_buildControl(XferFlags dir, arch::dma_object_view<SetupPacket> setup, arch::dma_buffer_view buffer, size_t max_packet_size); static Transaction *_buildInterruptOrBulk(XferFlags dir, arch::dma_buffer_view buffer, size_t max_packet_size, bool lazy_notification); async::result<frg::expected<UsbError>> transfer(int address, int pipe, ControlTransfer info); async::result<frg::expected<UsbError, size_t>> transfer(int address, PipeType type, int pipe, InterruptTransfer info); async::result<frg::expected<UsbError, size_t>> transfer(int address, PipeType type, int pipe, BulkTransfer info); private: async::result<frg::expected<UsbError>> _directTransfer(ControlTransfer info, QueueEntity *queue, size_t max_packet_size); // ------------------------------------------------------------------------ // Schedule management. // ------------------------------------------------------------------------ void _linkAsync(QueueEntity *entity); void _linkTransaction(QueueEntity *queue, Transaction *transaction); void _progressSchedule(); void _progressQueue(QueueEntity *entity); boost::intrusive::list<QueueEntity> _asyncSchedule; arch::dma_object<QueueHead> _asyncQh; // ---------------------------------------------------------------------------- // Port management. // ---------------------------------------------------------------------------- void _checkPorts(); public: async::detached resetPort(int number); // ---------------------------------------------------------------------------- // Debugging functions. // ---------------------------------------------------------------------------- private: void _dump(Transaction *transaction); void _dump(QueueEntity *entity); private: protocols::hw::Device _hwDevice; helix::Mapping _mapping; helix::UniqueDescriptor _mmio; helix::UniqueIrq _irq; arch::mem_space _space; arch::mem_space _operational; int _numPorts; Enumerator _enumerator; }; // ---------------------------------------------------------------------------- // DeviceState // ---------------------------------------------------------------------------- struct DeviceState final : DeviceData { explicit DeviceState(std::shared_ptr<Controller> controller, int device); arch::dma_pool *setupPool() override; arch::dma_pool *bufferPool() override; async::result<frg::expected<UsbError, std::string>> configurationDescriptor() override; async::result<frg::expected<UsbError, Configuration>> useConfiguration(int number) override; async::result<frg::expected<UsbError>> transfer(ControlTransfer info) override; private: std::shared_ptr<Controller> _controller; int _device; }; // ---------------------------------------------------------------------------- // ConfigurationState // ---------------------------------------------------------------------------- struct ConfigurationState final : ConfigurationData { explicit ConfigurationState(std::shared_ptr<Controller> controller, int device, int configuration); async::result<frg::expected<UsbError, Interface>> useInterface(int number, int alternative) override; private: std::shared_ptr<Controller> _controller; int _device; int _configuration; }; // ---------------------------------------------------------------------------- // InterfaceState // ---------------------------------------------------------------------------- struct InterfaceState final : InterfaceData { explicit InterfaceState(std::shared_ptr<Controller> controller, int device, int configuration); async::result<frg::expected<UsbError, Endpoint>> getEndpoint(PipeType type, int number) override; private: std::shared_ptr<Controller> _controller; int _device; int _interface; }; // ---------------------------------------------------------------------------- // EndpointState // ---------------------------------------------------------------------------- struct EndpointState final : EndpointData { explicit EndpointState(std::shared_ptr<Controller> controller, int device, PipeType type, int endpoint); async::result<frg::expected<UsbError>> transfer(ControlTransfer info) override; async::result<frg::expected<UsbError, size_t>> transfer(InterruptTransfer info) override; async::result<frg::expected<UsbError, size_t>> transfer(BulkTransfer info) override; private: std::shared_ptr<Controller> _controller; int _device; PipeType _type; int _endpoint; };
29.980392
93
0.591629
kITerE
b94b32da02b41b69030f9732bb465d25ecf4f8ee
5,259
cpp
C++
src/wcx_plugin.cpp
remittor/paxz.wcx
8c10a4673c4e613383f7c61041e4116007ba032d
[ "MIT" ]
9
2019-11-27T09:41:03.000Z
2022-02-19T13:32:57.000Z
src/wcx_plugin.cpp
remittor/paxz.wcx
8c10a4673c4e613383f7c61041e4116007ba032d
[ "MIT" ]
null
null
null
src/wcx_plugin.cpp
remittor/paxz.wcx
8c10a4673c4e613383f7c61041e4116007ba032d
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "wcx_plugin.h" #include "winuser.h" #include "res\resource.h" namespace wcx { plugin::plugin() { m_module = NULL; m_main_thread_id = 0; m_ProcessDataProcW = NULL; m_packer_count = 0; m_testmode = false; m_inited = false; } plugin::~plugin() { destroy(); } int plugin::init(HMODULE lib_addr, DWORD thread_id) { m_module = lib_addr; m_main_thread_id = thread_id; m_inited = true; m_inicfg.init(lib_addr); m_clist.init(m_main_thread_id, m_inicfg); return 0; } int plugin::destroy() { m_arclist.clear(); m_plist.clear(); m_clist.clear(); return 0; } // ========================================================================================= int plugin::show_cfg_dialog(HWND parentWnd, HINSTANCE dllInstance) { m_inicfg.set_cache_size(m_clist.get_cache_size()); m_inicfg.show_cfg_dialog(dllInstance, parentWnd); return 0; } wcx::cfg plugin::get_cfg() { wcx::cfg cfg; m_inicfg.copy(cfg); return cfg; } // ========================================================================================= int plugin::check_file(LPCWSTR filename) { wcx::arcfile arcfile; int hr = arcfile.init(filename, imType); if (hr == 0) { return (arcfile.get_type() == atUnknown) ? E_BAD_ARCHIVE : 0; } return hr; } int plugin::open_file(LPWSTR arcName, int openMode, wcx::archive ** pArc) { int hr = E_BAD_ARCHIVE; wcx::arcfile arcfile; wcx::cache * cache = NULL; wcx::archive * arc = NULL; wcx::cfg cfg; m_clist.delete_zombies(); DWORD tid = GetCurrentThreadId(); WLOGi(L"%S(%d): [0x%X] \"%s\" ", __func__, openMode, tid, arcName); arc = new wcx::archive(); FIN_IF(!arc, 0x30001000 | E_NO_MEMORY); hr = arcfile.init(arcName, imName | imAttr | imType); FIN_IF(hr, hr); hr = m_clist.get_cache(arcfile, true, &cache); FIN_IF(hr, hr); m_inicfg.copy(cfg); hr = arc->init(cfg, arcName, openMode, tid, cache); FIN_IF(hr, 0x30012000 | E_BAD_ARCHIVE); bool xb = m_arclist.add(arc); FIN_IF(!xb, 0x30014000 | E_NO_MEMORY); cache->read_lock(); *pArc = arc; arc = NULL; hr = 0; fin: LOGe_IF(hr, "%s: ERROR = 0x%X ", __func__, hr); if (arc) delete arc; return hr & 0xFF; } int plugin::close_file(wcx::archive * arc) { wcx::cache * cache = arc->get_cache(); if (cache) { cache->read_unlock(); } if (!m_arclist.del(arc)) { delete arc; } return 0; } // ========================================================================================= int plugin::pack_files(LPCWSTR PackedFile, LPCWSTR SubPath, LPCWSTR SrcPath, LPCWSTR AddList, int Flags) { int hr = E_BAD_ARCHIVE; size_t AddListSize = 0; wcx::arcfile arcfile; wcx::packer * packer = NULL; wcx::cfg cfg; InterlockedIncrement(&m_packer_count); DWORD tid = GetCurrentThreadId(); if (m_testmode) { for (LPWSTR s = (LPWSTR)AddList; *s; s++) { if (*s == L'\1') *s = 0; } } for (LPCWSTR fn = AddList; fn[0]; fn += wcslen(fn) + 1) { AddListSize++; FIN_IF(AddListSize >= UINT_MAX, 0x300100 | E_TOO_MANY_FILES); } WLOGd(L"%S(%d): [0x%X] PackedFile = \"%s\" SrcPath = \"%s\" <%Id> ", __func__, Flags, tid, PackedFile, SrcPath, AddListSize); //WLOGd(L" SubPath= \"%s\" AddList = \"%s\" SrcPath = \"%s\" ", SubPath, AddList, SrcPath); FIN_IF(AddList[0] == 0, 0x300200 | E_NO_FILES); FIN_IF(!m_ProcessDataProcW, 0x300400 |E_NO_FILES); if (tid == m_main_thread_id) { UINT uType = MB_OK | MB_ICONERROR | MB_SYSTEMMODAL; int btn = MessageBoxW(NULL, L"Please, update Total Commander!!!", L"CRITICAL ERROR", uType); FIN(0x302200 | E_NO_FILES); } hr = arcfile.init(PackedFile, imName); FIN_IF(hr, 0x302300 | E_EOPEN); DWORD attr = GetFileAttributesW(arcfile.get_fullname()); if (attr != INVALID_FILE_ATTRIBUTES) { if (attr & FILE_ATTRIBUTE_DIRECTORY) { WLOGe(L"%S: ERROR: can't replace directory!!! ", __func__); FIN(0x302400 | E_ECREATE); } WLOGw(L"%S: WARN: archive editing not supported!!! ", __func__); FIN(0x302500 | E_ECREATE); arcfile.clear(); hr = arcfile.init(PackedFile, imName | imAttr | imType); FIN_IF(hr, 0x302600 | E_EOPEN); // TODO: parse archive } m_inicfg.copy(cfg); wcx::packer::type ctype = wcx::packer::ctZstd; // create PAXZ on default LPCWSTR p = wcsrchr(PackedFile, L'.'); if (p) { if (_wcsicmp(p, L".pax") == 0) { ctype = wcx::packer::ctUnknown; cfg.set_uncompress_mode(); // without packing } if (_wcsicmp(p, L".lz4") == 0) { ctype = wcx::packer::ctLz4; } } packer = new wcx::packer(ctype, cfg, Flags, tid, m_ProcessDataProcW); FIN_IF(!packer, 0x303200 | E_NO_MEMORY); packer->set_AddListSize(AddListSize); packer->set_arcfile(arcfile); bool xb = m_plist.add(packer); FIN_IF(!xb, 0x303300 | E_NO_MEMORY); hr = packer->pack_files(SubPath, SrcPath, AddList); fin: if (packer) { if (!m_plist.del(packer)) { delete packer; } } LOGe_IF(hr, "%s: ERROR = 0x%X ", __func__, hr); InterlockedDecrement(&m_packer_count); return hr & 0xFF; } void plugin::destroy_all_packers() { //if (!m_plist.is_empty()) { // TerminateThread for all packers! (exclude m_main_thread_id) //} } } /* namespace */
24.123853
127
0.60715
remittor
b94beb1635e95f0f2a53b68cbe6e653381df716f
37,992
cpp
C++
projects/biogears/libBiogears/src/cdm/engine/PhysiologyEngineDynamicStabilization.cpp
faaizT/core
488b357deece8dd4f7be318eefb49f6330be8239
[ "Apache-2.0" ]
1
2020-10-23T18:23:00.000Z
2020-10-23T18:23:00.000Z
projects/biogears/libBiogears/src/cdm/engine/PhysiologyEngineDynamicStabilization.cpp
faaizT/core
488b357deece8dd4f7be318eefb49f6330be8239
[ "Apache-2.0" ]
5
2020-12-23T00:19:32.000Z
2020-12-29T20:53:58.000Z
projects/biogears/libBiogears/src/cdm/engine/PhysiologyEngineDynamicStabilization.cpp
vybhavramachandran/biogears-vybhav
7271c12b85a324a4f1494e0ce15942dc25bc4931
[ "Apache-2.0" ]
null
null
null
/************************************************************************************** Copyright 2015 Applied Research Associates, 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 <biogears/cdm/engine/PhysiologyEngineDynamicStabilization.h> //Standad Includes #include <cmath> //Project Includes #include <biogears/cdm/Serializer.h> #include <biogears/cdm/engine/PhysiologyEngine.h> #include <biogears/cdm/engine/PhysiologyEngineTrack.h> #include <biogears/cdm/properties/SEScalarTime.h> #include <biogears/cdm/scenario/SECondition.h> #include <biogears/cdm/scenario/requests/SEDataRequestManager.h> #include <biogears/cdm/substance/SESubstance.h> #include <biogears/cdm/system/SESystem.h> #include <biogears/cdm/utils/GeneralMath.h> #include <biogears/cdm/utils/TimingProfile.h> #include <biogears/engine/BioGearsPhysiologyEngine.h> namespace biogears { bool PhysiologyEngineDynamicStabilization::StabilizeRestingState(PhysiologyEngine& engine) { Info("Converging to a steady state"); return Stabilize(engine, GetRestingCriteria()); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::StabilizeFeedbackState(PhysiologyEngine& engine) { if (!HasFeedbackCriteria()) return true; Info("Converging feedback to a steady state"); return Stabilize(engine, GetFeedbackCriteria()); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::StabilizeConditions(PhysiologyEngine& engine, const std::vector<const SECondition*>& conditions) { if (conditions.empty()) return true; // Grab the criteria based on the conditions we have PhysiologyEngineDynamicStabilizationCriteria* sc; m_ActiveConditions.clear(); for (auto c : conditions) { sc = GetConditionCriteria(c->GetName()); if (sc == nullptr) { Error("Engine does not support Condition"); return false; } else m_ActiveConditions.push_back(sc); } if (m_ActiveConditions.size() == 1) { Info("Converging provided condition to a steady state"); return Stabilize(engine, *m_ActiveConditions[0]); } else { if (!Merge()) { Error("Unable to merge conditions"); return false; } Info("Converging provided conditions to a steady state"); return Stabilize(engine, m_MergedConditions); } } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::Stabilize(PhysiologyEngine& engine, const PhysiologyEngineDynamicStabilizationCriteria& criteria) { const std::vector<PropertyConvergence*>& properties = criteria.GetPropertyConvergence(); if (properties.empty()) return true; //nothing to do here... m_Cancelled = false; std::stringstream ss; TimingProfile profiler; if (m_LogProgress) { profiler.Start("Total"); profiler.Start("Status"); } // Execute System initialization time PhysiologyEngineTrack* tracker = engine.GetEngineTrack(); bool hasOptionalProperties = false; // Grab all the convergence properties for (PropertyConvergence* pc : properties) { if (pc->IsOptional()) { hasOptionalProperties = true; } if (tracker) { tracker->ConnectRequest(pc->GetDataRequest(), pc->GetDataRequestScalar()); } if (!pc->GetDataRequestScalar().HasScalar()) { ss << "Cannot find convergence property " << pc->GetDataRequest().GetName(); throw CommonDataModelException(ss.str()); } } ss.precision(3); double statusTime_s = 0; // Current time of this status cycle double statusStep_s = 10; //How long did it take to simulate this much time double stablizationTime_s = 0; double dT_s = engine.GetTimeStep(TimeUnit::s); PhysiologyEngineDynamicStabilizer stabilizer(dT_s, criteria); while (!(stabilizer.HasConverged() && stabilizer.HasConvergedOptional())) { if (m_Cancelled) break; if (stabilizer.HasExceededTime()) break; engine.AdvanceModelTime(); stablizationTime_s += dT_s; m_currentTime_s += dT_s; if (m_LogProgress) { statusTime_s += dT_s; if (statusTime_s > statusStep_s) { statusTime_s = 0; ss << "Converging System... it took " << profiler.GetElapsedTime_s("Status") << "s to simulate the past " << statusStep_s << "s" << std::flush; profiler.Reset("Status"); Info(ss); } } stabilizer.Converge(); } double covTime_s = criteria.GetConvergenceTime(TimeUnit::s); if (stabilizer.HasExceededTime()) { Error("Could not converge to provided criteria"); for (PropertyConvergence* pc : properties) { if (stablizationTime_s - pc->GetLastErrorTime_s() < covTime_s) { m_ss << stablizationTime_s << "s - " << pc->GetDataRequest().GetName() << " is not converging, last error time was " << pc->GetLastErrorTime_s() << "s setting a target value of " << pc->GetCurrentTarget() << " and the current value is " << pc->GetDataRequestScalar().GetValue(); Error(m_ss); } /* else { m_ss << stablizationTime_s << "s - " << pc->GetDataRequest().GetName() << " is converging, last error time was " << pc->GetLastErrorTime_s() << "s"; Info(m_ss); }*/ } return false; } else if (m_LogProgress) { ss << "Convergence took " << profiler.GetElapsedTime_s("Total") << "s to simulate " << stablizationTime_s << "s to get engine to a steady state"; Info(ss); if (hasOptionalProperties && !stabilizer.HasConvergedOptional()) { ss << "Could not converge optional properties"; Warning(ss); for (PropertyConvergence* pc : properties) { if (stablizationTime_s - pc->GetLastErrorTime_s() < covTime_s) { m_ss << stablizationTime_s << "s - " << pc->GetDataRequest().GetName() << " is not converging, last error time was " << pc->GetLastErrorTime_s() << "s setting a target value of " << pc->GetCurrentTarget() << " and the current value is " << pc->GetDataRequestScalar().GetValue(); Error(m_ss); } } } } // Save off how long it took us to stabilize GetStabilizationDuration().SetValue(stablizationTime_s, TimeUnit::s); return true; } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizer::PhysiologyEngineDynamicStabilizer(double timeStep_s, const PhysiologyEngineDynamicStabilizationCriteria& criteria) : Loggable(criteria.GetLogger()) , m_properties(criteria.GetPropertyConvergence()) { m_dT_s = timeStep_s; m_totTime_s = 0; m_passTime_s = 0; m_optsPassTime_s = 0; m_covTime_s = criteria.GetConvergenceTime(TimeUnit::s); m_minTime_s = criteria.GetMinimumReactionTime(TimeUnit::s); m_maxTime_s = criteria.GetMaximumAllowedStabilizationTime(TimeUnit::s) + m_minTime_s; // We will run for at least minTime, THEN to the max time, so maxTime_s is the sum of both m_converged = false; m_convergedOptional = false; m_exceededTime = false; m_hasOptionalProperties = false; for (PropertyConvergence* pc : m_properties) { if (pc->IsOptional()) { m_hasOptionalProperties = true; break; } } if (!m_hasOptionalProperties) m_convergedOptional = true; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizer::Converge() { bool passedTimeStep = false; bool passedTimeStepOptions = false; m_totTime_s += m_dT_s; if (m_totTime_s < m_minTime_s) return; // Wait for it std::stringstream ss; passedTimeStep = true; passedTimeStepOptions = true; for (PropertyConvergence* pc : m_properties) { bool b = pc->Test(m_totTime_s); if (pc->IsOptional()) { passedTimeStepOptions &= b; } else { passedTimeStep &= b; } } if (passedTimeStep) m_passTime_s += m_dT_s; else m_passTime_s = 0; if (passedTimeStepOptions) m_optsPassTime_s += m_dT_s; else m_optsPassTime_s = 0; if (!m_converged && m_passTime_s >= m_covTime_s) { // We have converged m_converged = true; if (m_hasOptionalProperties) Warning("We have passed required convergence criteria, attempting to converge optional properties from multiple conditions."); } if (m_converged && m_optsPassTime_s >= m_covTime_s) { // We have converged optional props m_convergedOptional = true; Warning("We have passed required and optional convergence criteria."); } if (m_totTime_s > m_maxTime_s) { m_converged = false; m_convergedOptional = false; m_exceededTime = true; } } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::Merge() { // Get a std::hash<std::string>()("foo"); for each Property convergence Data Request // Don't forget to add hashes of compartments and substance names! if applicable // Put it in a map<hash#,vector<PropertyConvergence*>> // After this loop, go through the map and remove any // entries where the vector length is < activeConditions.size() // We only want convergence objects if ALL active conditions have them // From there find the PropertyConvergence with the largest %diff // Add that pointer to the m_MergedConditions (will need new friend method as that method should not be public) Info("Merging Conditions"); m_MergedConditions.Clear(); m_MergedConditions.SetName("MergedCondition"); // May want to include what conditions we are combining in the name? double time_s; double maxConv_s = 0; double maxMinStabilize_s = 0; double maxMaxStabilize_s = 0; const std::vector<PropertyConvergence*>* vCondPConv; std::map<std::string, std::vector<PropertyConvergence*>*> cMap; for (const PhysiologyEngineDynamicStabilizationCriteria* c : m_ActiveConditions) { m_ss << "Analyzing " << c->GetName(); Info(m_ss); vCondPConv = &c->GetPropertyConvergence(); for (PropertyConvergence* pConv : *vCondPConv) { auto cMapItr = cMap.find(pConv->GetDataRequest().GetName()); if (cMapItr != cMap.end()) cMapItr->second->push_back(pConv); else { std::vector<PropertyConvergence*>* vec = new std::vector<PropertyConvergence*>(); vec->push_back(pConv); cMap[pConv->GetDataRequest().GetName()] = vec; } } time_s = c->GetConvergenceTime(TimeUnit::s); if (time_s > maxConv_s) maxConv_s = time_s; time_s = c->GetMinimumReactionTime(TimeUnit::s); if (time_s > maxMinStabilize_s) maxMinStabilize_s = time_s; time_s = c->GetMaximumAllowedStabilizationTime(TimeUnit::s); if (time_s > maxMaxStabilize_s) maxMaxStabilize_s = time_s; } double tmpError; PropertyConvergence* pConv; for (auto i = cMap.begin(); i != cMap.end(); i++) { // Let's find the Convergence that has the largest % difference double pErr = 0; for (auto j = i->second->begin(); j != i->second->end(); j++) { tmpError = (*j)->GetPercentError(); if (tmpError > pErr) { pErr = tmpError; pConv = (*j); } } if (i->second->size() == m_ActiveConditions.size()) { m_ss << "Merged Convergance for property " << pConv->GetDataRequest().GetName() << " using " << pConv->GetPercentError() << "% error"; Info(m_ss); } else { pConv->SetOptional(true); m_ss << "Not all conditions contain " << i->first << " in convergence criteria. Making convergence on this property optional."; Warning(m_ss); } m_MergedConditions.m_PropertyConvergence.push_back(pConv); } DELETE_MAP_SECOND(cMap); // Clean up our Map m_MergedConditions.GetConvergenceTime().SetValue(maxConv_s, TimeUnit::s); m_ss << "Merged Convergence Time : " << m_MergedConditions.GetConvergenceTime(); Info(m_ss); m_MergedConditions.GetMinimumReactionTime().SetValue(maxMinStabilize_s, TimeUnit::s); m_ss << "Merged Minimum Reaction Time : " << m_MergedConditions.GetMinimumReactionTime(); Info(m_ss); m_MergedConditions.GetMaximumAllowedStabilizationTime().SetValue(maxMaxStabilize_s, TimeUnit::s); m_ss << "Merged Maximum Allowed Stabilization Time : " << m_MergedConditions.GetMaximumAllowedStabilizationTime(); Info(m_ss); return true; } //----------------------------------------------------------------------------- // This basically tests the current property with the target property and if they are in a window of acceptance bool PropertyConvergence::Test(double time_s) { double v = !m_DataRequestScalar.HasUnit() ? m_DataRequestScalar.GetValue() : m_DataRequestScalar.GetValue(m_DataRequestScalar.GetUnit()->GetString()); if (std::isnan(m_Target)) { m_Target = v; return false; // Initially target will be NaN until it is pulled for the first time } m_LastError = GeneralMath::PercentTolerance(m_Target, v); if (m_LastError < m_Error) { return true; } m_ss << time_s << "s - Resetting the target for " << GetDataRequest().GetName() << " to " << v << ", the last target value was " << m_Target; Info(m_ss); // Not converging, so this is now our target property m_Target = v; m_LastErrorTime_s = time_s; return false; } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilization::PhysiologyEngineDynamicStabilization(Logger* logger) : PhysiologyEngineStabilization(logger) , m_RestingCriteria(logger) , m_MergedConditions(logger) { m_FeedbackCriteria = nullptr; m_RestingCriteria.SetName("Resting"); } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilization::~PhysiologyEngineDynamicStabilization() { Clear(); } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilization::Clear() { PhysiologyEngineStabilization::Clear(); m_MergedConditions.m_PropertyConvergence.clear(); // \todo Make copies of stabilization criteria m_MergedConditions.Clear(); m_ActiveConditions.clear(); m_RestingCriteria.Clear(); SAFE_DELETE(m_FeedbackCriteria); DELETE_VECTOR(m_ConditionCriteria); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::Load(const CDM::PhysiologyEngineDynamicStabilizationData& in) { PhysiologyEngineStabilization::Load(in); GetRestingCriteria().Load(in.RestingStabilizationCriteria()); if (in.FeedbackStabilizationCriteria().present()) GetFeedbackCriteria().Load(in.FeedbackStabilizationCriteria().get()); for (auto cData : in.ConditionStabilization()) { PhysiologyEngineDynamicStabilizationCriteria* c = new PhysiologyEngineDynamicStabilizationCriteria(GetLogger()); c->Load(cData.Criteria()); c->SetName(cData.Name()); AddConditionCriteria(*c); } return true; } //----------------------------------------------------------------------------- CDM::PhysiologyEngineDynamicStabilizationData* PhysiologyEngineDynamicStabilization::Unload() const { CDM::PhysiologyEngineDynamicStabilizationData* data(new CDM::PhysiologyEngineDynamicStabilizationData()); Unload(*data); return data; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilization::Unload(CDM::PhysiologyEngineDynamicStabilizationData& data) const { PhysiologyEngineStabilization::Unload(data); data.RestingStabilizationCriteria(std::unique_ptr<CDM::PhysiologyEngineDynamicStabilizationCriteriaData>(GetRestingCriteria().Unload())); if (HasFeedbackCriteria()) data.FeedbackStabilizationCriteria(std::unique_ptr<CDM::PhysiologyEngineDynamicStabilizationCriteriaData>(GetFeedbackCriteria()->Unload())); for (auto& c : m_ConditionCriteria) { std::unique_ptr<CDM::PhysiologyEngineDynamicConditionStabilizationData> csData(new CDM::PhysiologyEngineDynamicConditionStabilizationData()); csData->Criteria(std::unique_ptr<CDM::PhysiologyEngineDynamicStabilizationCriteriaData>(c->Unload())); csData->Name(c->GetName()); data.ConditionStabilization().push_back(*csData); } } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::Load(const char* file) { return Load(std::string { file }); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::Load(const std::string& file) { CDM::PhysiologyEngineDynamicStabilizationData* pData; std::unique_ptr<CDM::ObjectData> data; data = Serializer::ReadFile(file, GetLogger()); pData = dynamic_cast<CDM::PhysiologyEngineDynamicStabilizationData*>(data.get()); if (pData == nullptr) { std::stringstream ss; ss << "Unable to read stabilization file : " << file << std::endl; Info(ss); return false; } return Load(*pData); } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizationCriteria& PhysiologyEngineDynamicStabilization::GetRestingCriteria() { return m_RestingCriteria; } //----------------------------------------------------------------------------- const PhysiologyEngineDynamicStabilizationCriteria& PhysiologyEngineDynamicStabilization::GetRestingCriteria() const { return m_RestingCriteria; } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilization::HasFeedbackCriteria() const { return m_FeedbackCriteria != nullptr; } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizationCriteria& PhysiologyEngineDynamicStabilization::GetFeedbackCriteria() { if (m_FeedbackCriteria == nullptr) { m_FeedbackCriteria = new PhysiologyEngineDynamicStabilizationCriteria(GetLogger()); m_FeedbackCriteria->SetName("Feedback"); } return *m_FeedbackCriteria; } //----------------------------------------------------------------------------- const PhysiologyEngineDynamicStabilizationCriteria* PhysiologyEngineDynamicStabilization::GetFeedbackCriteria() const { return m_FeedbackCriteria == nullptr ? nullptr : m_FeedbackCriteria; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilization::RemoveConditionCriteria(const char* name) { RemoveConditionCriteria(std::string { name }); } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilization::RemoveConditionCriteria(const std::string& name) { for (auto itr = m_ConditionCriteria.begin(); itr != m_ConditionCriteria.end(); itr++) { if ((*itr)->GetName() == name) { m_ConditionCriteria.erase(itr); return; } } } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizationCriteria* PhysiologyEngineDynamicStabilization::GetConditionCriteria(const char* name) const { return GetConditionCriteria(std::string { name }); } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizationCriteria* PhysiologyEngineDynamicStabilization::GetConditionCriteria(const std::string& name) const { for (auto c : m_ConditionCriteria) { if (c->GetName() == name) return c; } return nullptr; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilization::AddConditionCriteria(PhysiologyEngineDynamicStabilizationCriteria& criteria) { for (auto c : m_ConditionCriteria) { if (c->GetName() == criteria.GetName()) return; } m_ConditionCriteria.push_back(&criteria); } //----------------------------------------------------------------------------- const std::vector<PhysiologyEngineDynamicStabilizationCriteria*>& PhysiologyEngineDynamicStabilization::GetConditionCriteria() const { return m_ConditionCriteria; } //----------------------------------------------------------------------------- ////////////////////////////////////////////////// // PhysiologyEngineDynamicStabilizationCriteria // ////////////////////////////////////////////////// PhysiologyEngineDynamicStabilizationCriteria::PhysiologyEngineDynamicStabilizationCriteria(Logger* logger) : Loggable(logger) , m_DataRequestMgr(logger) { m_ConvergenceTime = nullptr; m_MinimumReactionTime = nullptr; m_MaximumAllowedStabilizationTime = nullptr; } //----------------------------------------------------------------------------- PhysiologyEngineDynamicStabilizationCriteria::~PhysiologyEngineDynamicStabilizationCriteria() { Clear(); } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizationCriteria::Clear() { SAFE_DELETE(m_ConvergenceTime); SAFE_DELETE(m_MinimumReactionTime); SAFE_DELETE(m_MaximumAllowedStabilizationTime); DELETE_VECTOR(m_PropertyConvergence); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilizationCriteria::Load(const CDM::PhysiologyEngineDynamicStabilizationCriteriaData& in) { Clear(); GetConvergenceTime().Load(in.ConvergenceTime()); GetMinimumReactionTime().Load(in.MinimumReactionTime()); GetMaximumAllowedStabilizationTime().Load(in.MaximumAllowedStabilizationTime()); for (auto pcData : in.PropertyConvergence()) CreateSystemPropertyConvergence(pcData.PercentDifference(), pcData.Name()); return true; } //----------------------------------------------------------------------------- CDM::PhysiologyEngineDynamicStabilizationCriteriaData* PhysiologyEngineDynamicStabilizationCriteria::Unload() const { CDM::PhysiologyEngineDynamicStabilizationCriteriaData* data(new CDM::PhysiologyEngineDynamicStabilizationCriteriaData()); Unload(*data); return data; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizationCriteria::Unload(CDM::PhysiologyEngineDynamicStabilizationCriteriaData& data) const { data.ConvergenceTime(std::unique_ptr<CDM::ScalarTimeData>(m_ConvergenceTime->Unload())); data.MinimumReactionTime(std::unique_ptr<CDM::ScalarTimeData>(m_MinimumReactionTime->Unload())); data.MaximumAllowedStabilizationTime(std::unique_ptr<CDM::ScalarTimeData>(m_MaximumAllowedStabilizationTime->Unload())); for (auto pc : m_PropertyConvergence) { std::unique_ptr<CDM::PhysiologyEngineDynamicStabilizationCriteriaPropertyData> pcData(new CDM::PhysiologyEngineDynamicStabilizationCriteriaPropertyData()); pcData->Name(pc->GetDataRequest().GetName()); pcData->PercentDifference(pc->m_Target); data.PropertyConvergence().push_back(*pcData.get()); } } //----------------------------------------------------------------------------- std::string PhysiologyEngineDynamicStabilizationCriteria::GetName() const { return m_Name; } //----------------------------------------------------------------------------- const char* PhysiologyEngineDynamicStabilizationCriteria::GetName_cStr() const { return m_Name.c_str(); } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizationCriteria::SetName(const char* name) { m_Name = name; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizationCriteria::SetName(const std::string& name) { m_Name = name; } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilizationCriteria::HasName() const { return m_Name.empty() ? false : true; } //----------------------------------------------------------------------------- void PhysiologyEngineDynamicStabilizationCriteria::InvalidateName() { m_Name = ""; } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilizationCriteria::HasConvergenceTime() const { return m_ConvergenceTime == nullptr ? false : m_ConvergenceTime->IsValid(); } //----------------------------------------------------------------------------- SEScalarTime& PhysiologyEngineDynamicStabilizationCriteria::GetConvergenceTime() { if (m_ConvergenceTime == nullptr) m_ConvergenceTime = new SEScalarTime(); return *m_ConvergenceTime; } //----------------------------------------------------------------------------- double PhysiologyEngineDynamicStabilizationCriteria::GetConvergenceTime(const TimeUnit& unit) const { if (m_ConvergenceTime == nullptr) return SEScalar::dNaN(); return m_ConvergenceTime->GetValue(unit); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilizationCriteria::HasMinimumReactionTime() const { return m_MinimumReactionTime == nullptr ? false : m_MinimumReactionTime->IsValid(); } //----------------------------------------------------------------------------- SEScalarTime& PhysiologyEngineDynamicStabilizationCriteria::GetMinimumReactionTime() { if (m_MinimumReactionTime == nullptr) m_MinimumReactionTime = new SEScalarTime(); return *m_MinimumReactionTime; } //----------------------------------------------------------------------------- double PhysiologyEngineDynamicStabilizationCriteria::GetMinimumReactionTime(const TimeUnit& unit) const { if (m_MinimumReactionTime == nullptr) return SEScalar::dNaN(); return m_MinimumReactionTime->GetValue(unit); } //----------------------------------------------------------------------------- bool PhysiologyEngineDynamicStabilizationCriteria::HasMaximumAllowedStabilizationTime() const { return m_MaximumAllowedStabilizationTime == nullptr ? false : m_MaximumAllowedStabilizationTime->IsValid(); } //----------------------------------------------------------------------------- SEScalarTime& PhysiologyEngineDynamicStabilizationCriteria::GetMaximumAllowedStabilizationTime() { if (m_MaximumAllowedStabilizationTime == nullptr) m_MaximumAllowedStabilizationTime = new SEScalarTime(); return *m_MaximumAllowedStabilizationTime; } //----------------------------------------------------------------------------- double PhysiologyEngineDynamicStabilizationCriteria::GetMaximumAllowedStabilizationTime(const TimeUnit& unit) const { if (m_MaximumAllowedStabilizationTime == nullptr) return SEScalar::dNaN(); return m_MaximumAllowedStabilizationTime->GetValue(unit); } //----------------------------------------------------------------------------- /// \brief /// Sets convergence critera for a specific properter. /// /// \param percentError - The acceptable percent difference window that the specified property /// must stay within for a specified amount of time for convergence to happen /// /// \param name - The name of the property to converge /// /// \details /// Mulitple convergence property criteria can be specified. All properties must converge for the // specified convergence time. Percent Difference is calculated as such : Math.abs(difference / average) * 100.0 //-------------------------------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateSystemPropertyConvergence(double percentError, const char* name) { return CreateSystemPropertyConvergence(percentError, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateSystemPropertyConvergence(double percentError, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name.c_str()) return *pc; } PropertyConvergence* p = new PropertyConvergence(m_DataRequestMgr.CreatePhysiologyDataRequest(), GetLogger()); p->m_DataRequest.SetName(name); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- /// \brief /// Sets convergence critera for a specific properter. /// /// \param percentError - The acceptable percent difference window that the specified property /// must stay within for a specified amount of time for convergence to happen /// /// \param cmpt - The name of the compartment /// /// \details /// Mulitple convergence property criteria can be specified. All properties must converge for the // specified convergence time. Percent Difference is calculated as such : Math.abs(difference / average) * 100.0 //-------------------------------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateGasCompartmentPropertyConvergence(double percentError, const char* cmpt, const char* name) { return CreateGasCompartmentPropertyConvergence(percentError, std::string { cmpt }, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateGasCompartmentPropertyConvergence(double percentError, const std::string& cmpt, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name) return *pc; } SEGasCompartmentDataRequest& dr = m_DataRequestMgr.CreateGasCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateGasCompartmentPropertyConvergence(double percentError, const char* cmpt, SESubstance& substance, const char* name) { return CreateGasCompartmentPropertyConvergence(percentError, std::string { cmpt }, substance, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateGasCompartmentPropertyConvergence(double percentError, const std::string& cmpt, SESubstance& substance, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name.c_str()) return *pc; } SEGasCompartmentDataRequest& dr = m_DataRequestMgr.CreateGasCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); dr.SetSubstance(&substance); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateLiquidCompartmentPropertyConvergence(double percentError, const char* cmpt, const char* name) { return CreateLiquidCompartmentPropertyConvergence(percentError, std::string { cmpt }, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateLiquidCompartmentPropertyConvergence(double percentError, const std::string& cmpt, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name.c_str()) return *pc; } SELiquidCompartmentDataRequest& dr = m_DataRequestMgr.CreateLiquidCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateLiquidCompartmentPropertyConvergence(double percentError, const char* cmpt, SESubstance& substance, const char* name) { return CreateLiquidCompartmentPropertyConvergence(percentError, std::string { cmpt }, substance, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateLiquidCompartmentPropertyConvergence(double percentError, const std::string& cmpt, SESubstance& substance, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name) return *pc; } SELiquidCompartmentDataRequest& dr = m_DataRequestMgr.CreateLiquidCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); dr.SetSubstance(&substance); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateThermalCompartmentPropertyConvergence(double percentError, const char* cmpt, const char* name) { return CreateThermalCompartmentPropertyConvergence(percentError, std::string { cmpt }, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateThermalCompartmentPropertyConvergence(double percentError, const std::string& cmpt, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name) return *pc; } SEThermalCompartmentDataRequest& dr = m_DataRequestMgr.CreateThermalCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateTissueCompartmentPropertyConvergence(double percentError, const char* cmpt, const char* name) { return CreateTissueCompartmentPropertyConvergence(percentError, std::string { cmpt }, std::string { name }); } //----------------------------------------------------------------------------- PropertyConvergence& PhysiologyEngineDynamicStabilizationCriteria::CreateTissueCompartmentPropertyConvergence(double percentError, const std::string& cmpt, const std::string& name) { for (PropertyConvergence* pc : m_PropertyConvergence) { if (pc->m_DataRequest.GetName() == name) return *pc; } SETissueCompartmentDataRequest& dr = m_DataRequestMgr.CreateTissueCompartmentDataRequest(); dr.SetCompartment(cmpt); dr.SetName(name); PropertyConvergence* p = new PropertyConvergence(dr, GetLogger()); p->m_Error = percentError; m_PropertyConvergence.push_back(p); return *p; } //----------------------------------------------------------------------------- const std::vector<PropertyConvergence*>& PhysiologyEngineDynamicStabilizationCriteria::GetPropertyConvergence() const { return m_PropertyConvergence; } //----------------------------------------------------------------------------- ///////////////////////// // PropertyConvergence // ///////////////////////// PropertyConvergence::PropertyConvergence(SEDataRequest& dr, Logger* logger) : Loggable(logger) , m_DataRequest(dr) , m_DataRequestScalar(logger) { m_Error = 0; m_Target = 0; m_LastError = 0; m_LastErrorTime_s = 0; m_Optional = false; m_LastError = SEScalar::dNaN(); m_Target = SEScalar::dNaN(); } //----------------------------------------------------------------------------- PropertyConvergence::~PropertyConvergence() { } //----------------------------------------------------------------------------- void PropertyConvergence::TrackScalar(const SEScalar& s) { m_DataRequestScalar.SetScalar(&s, m_DataRequest); } //----------------------------------------------------------------------------- double PropertyConvergence::GetPercentError() const { return m_Error; } //----------------------------------------------------------------------------- double PropertyConvergence::GetLastPercentError() const { return m_LastError; } //----------------------------------------------------------------------------- double PropertyConvergence::GetLastErrorTime_s() const { return m_LastErrorTime_s; } //----------------------------------------------------------------------------- double PropertyConvergence::GetCurrentTarget() const { return m_Target; } //----------------------------------------------------------------------------- SEDataRequest& PropertyConvergence::GetDataRequest() const { return m_DataRequest; } //----------------------------------------------------------------------------- SEDataRequestScalar& PropertyConvergence::GetDataRequestScalar() { return m_DataRequestScalar; } //----------------------------------------------------------------------------- bool PropertyConvergence::IsOptional() const { return m_Optional; } //----------------------------------------------------------------------------- void PropertyConvergence::SetOptional(bool b) { m_Optional = b; } //----------------------------------------------------------------------------- }
43.369863
288
0.628053
faaizT
b94d28d5edd1ff76f25a1ebe8dcccdadaa510f5b
87,176
hpp
C++
TakistanRoleplay/Config_Spyglass.hpp
hdvertgaming/TakistanRoleplay
56ba5bf9f9d67d6cab20cecf0681c663b2f5d731
[ "Apache-2.0" ]
null
null
null
TakistanRoleplay/Config_Spyglass.hpp
hdvertgaming/TakistanRoleplay
56ba5bf9f9d67d6cab20cecf0681c663b2f5d731
[ "Apache-2.0" ]
null
null
null
TakistanRoleplay/Config_Spyglass.hpp
hdvertgaming/TakistanRoleplay
56ba5bf9f9d67d6cab20cecf0681c663b2f5d731
[ "Apache-2.0" ]
null
null
null
class SpyGlass { civSlotNumber = 75; copSlotNumber = 19; medSlotNumber = 4; /* Internal functions, sort by what they are. Please note any functions you add need the functions named defined and the functions meta name which is the functions name + _meta i.e: "life_fnc_mycoolfunction","life_fnc_mycoolfunction_meta" */ BIS_Functions[] = {"bis_fnc_shownotification_counter","bis_fnc_shownotification_process","bis_fnc_missionhandlers_reloads","bis_fnc_feedback_deltadamage","bis_fnc_selectrespawntemplates_args","bis_fnc_dbvalueindex","bis_fnc_overviewterrain","bis_fnc_dotproduct","bis_fnc_vrcourselaunchers3","bis_fnc_moduleprojectile","bis_fnc_initmodules_ordnance","bis_fnc_setunitinsignia","bis_fnc_getunitinsignia","bis_fnc_getrespawninventories","bis_fnc_dbsymbolclass","bis_fnc_dbvaluelist","bis_fnc_assignplayerrole","bis_fnc_boundingboxmarker","bis_fnc_magnitude","bis_fnc_unitvector","bis_fnc_skirmishtrigger","bis_fnc_initmodules_audio","bis_fnc_sortalphabetically","bis_fnc_inv","bis_fnc_modulecuratoraddpoints","bis_fnc_setmissionstatusslot","bis_fnc_prepareao","bis_fnc_disableloading","bis_fnc_taskhint","bis_fnc_missilelaunchpositionfix","bis_fnc_help","bis_fnc_inanglesector","bis_fnc_curatorobjectregisteredtable","bis_fnc_initrespawnbackpack","bis_fnc_paramviewdistance","bis_fnc_modulepunishment","bis_fnc_localize","bis_fnc_displaycolorget","bis_fnc_dbimportconfig","bis_fnc_vectordiff","bis_fnc_moduleweather","bis_fnc_moduleobjectivesector","bis_fnc_ambientflyby","bis_fnc_onplayerconnected","bis_fnc_feedbackinit","bis_fnc_unitcapture","bis_fnc_arrayunshift","bis_fnc_spawncrew","bis_fnc_playendmusic","bis_fnc_moduleeffectsfire","bis_fnc_modulecreatediaryrecord","bis_fnc_loadfunctions","bis_fnc_missiontaskslocal","bis_fnc_validateparametersoo","bis_fnc_establishingshot","bis_fnc_texttiles","bis_fnc_getvirtualmagazinecargo","bis_fnc_target","bis_fnc_listcuratorplayers","bis_fnc_setfog","bis_fnc_initmodules_intel","bis_fnc_error","bis_fnc_getcfgdatapool","bis_fnc_isinsidearea","bis_fnc_kbmenu","bis_fnc_setidentity","bis_fnc_displayclouds","bis_fnc_configextremes","bis_fnc_orbatconfigpreview","bis_fnc_helicoptercanfly","bis_fnc_curatorobjectregistered","bis_fnc_ffvupdate","bis_fnc_initmodules_animals","bis_fnc_allsynchronizedobjects","bis_fnc_initplayable","bis_fnc_tasksetdestination","bis_fnc_diagjiralink","bis_fnc_exportfunctionstowiki","bis_fnc_modulefdcpout","bis_fnc_paramweather","bis_fnc_taskattack","bis_fnc_bleedtickets","bis_fnc_overviewauthor","bis_fnc_dbimportxml","bis_fnc_diagmacrosauthor","bis_fnc_respawncounter","bis_fnc_vrcoursecommandingactions1","bis_fnc_showcuratorfeedbackmessage","bis_fnc_moduleslingload","bis_fnc_diagknowntargets","bis_fnc_quotations","bis_fnc_configpath","bis_fnc_taskcompleted","bis_fnc_diagaarrecord","bis_fnc_scenegetobjects","bis_fnc_vrcoursecommandingactions2","bis_fnc_moduleai","bis_fnc_modulemissionname","bis_fnc_modulettcpin","bis_fnc_ftlmanager","bis_fnc_randomindex","bis_fnc_vrcoursecommandingactions3","bis_fnc_curatorrespawn","bis_fnc_curatorautomaticpositions","bis_fnc_moduletracers","bis_fnc_subclasses","bis_fnc_removesupportlink","bis_fnc_splitstring","bis_fnc_unpackstaticweapon","bis_fnc_radialred","bis_fnc_vrfadein","bis_fnc_livefeedmoduleinit","bis_fnc_initmodules_multiplayer","bis_fnc_execvm","bis_fnc_relposobject","bis_fnc_terraingradangle","bis_fnc_shakegauges","bis_fnc_scenegetpositionbyangle","bis_fnc_objectsgrabber","bis_fnc_curatorobjectplaced","bis_fnc_livefeed","bis_fnc_respawnnone","bis_fnc_moduleunits","bis_fnc_animtype","bis_fnc_sandstorm","bis_fnc_nearestposition","bis_fnc_selectcrew","bis_fnc_modulechat","bis_fnc_modulecuratoraddaddons","bis_fnc_moduleobjectiveracefinish","bis_fnc_feedback_fatiguecc","bis_fnc_ordinalnumber","bis_fnc_dbclassid","bis_fnc_registercuratorobject","bis_fnc_vrcoursehelislingload1","bis_fnc_modulecombatgetin","bis_fnc_modulerating","bis_fnc_moduleskiptime","bis_fnc_feedback_fatigueradialblur","bis_fnc_taskdescription","bis_fnc_moduletaskcreate","bis_fnc_moduleammo","bis_fnc_effectkilledairdestructionstage2","bis_fnc_instructorfigure","bis_fnc_livefeedsetsource","bis_fnc_addtopairs","bis_fnc_credits","bis_fnc_buildingpositions","bis_fnc_getrespawnmarkers","bis_fnc_posdegtoutm","bis_fnc_addvirtualbackpackcargo","bis_fnc_moveaction","bis_fnc_modulemptypesectorcontrol","bis_fnc_damagepulsing","bis_fnc_taskcurrent","bis_fnc_diagmissionpositions","bis_fnc_findnestedelement","bis_fnc_vrcoursetargetdesignation1","bis_fnc_monthdays","bis_fnc_helicopterseatmove","bis_fnc_mp","bis_fnc_invslotsempty","bis_fnc_commsmenutogglevisibility","bis_fnc_vrcoursetargetdesignation2","bis_fnc_moduleskill","bis_fnc_diagaarrecord_fsm","bis_fnc_respawnendmission","bis_fnc_selectrespawntemplate","bis_fnc_ambientblacklistadd","bis_fnc_livefeedeffects","bis_fnc_vrcoursetargetdesignation3","bis_fnc_iscuratoreditable","bis_fnc_curatorchallengegetinvehicle","bis_fnc_neutralizeunit","bis_fnc_moduleanimals","bis_fnc_dbisclass","bis_fnc_kbisspeaking","bis_fnc_arraypushstack","bis_fnc_invstring","bis_fnc_effectfiredartillery","bis_fnc_iscampaign","bis_fnc_changesupportradiochannel","bis_fnc_boundingboxcorner","bis_fnc_modulezoneprotection","bis_fnc_initmodules_objectives","bis_fnc_limitsupport","bis_fnc_trimstring","bis_fnc_dbclasslist","bis_fnc_diagknownastarget","bis_fnc_createobjectoo","bis_fnc_kmlimport","bis_fnc_randomint","bis_fnc_diagpreviewvehiclecrew","bis_fnc_crewcount","bis_fnc_dbvalueset","bis_fnc_conditionalselect","bis_fnc_scenesetanimationsforgroup","bis_fnc_setobjecttexture","bis_fnc_modulecuratorsetcostsdefault","bis_fnc_modulecountdown","bis_fnc_respawninstant","bis_fnc_teamcolor","bis_fnc_deletetask","bis_fnc_swapvars","bis_fnc_setcuratorattributes","bis_fnc_keycode","bis_fnc_animviewer","bis_fnc_objecttype","bis_fnc_gcinit","bis_fnc_removevirtualitemcargo","bis_fnc_moduledooropen","bis_fnc_removecommmenuitem","bis_fnc_orbatsetgroupparams","bis_fnc_rankparams","bis_fnc_initrespawn","bis_fnc_randompostrigger","bis_fnc_vrcoursecommandingmovement1","bis_fnc_livefeedmodulesettarget","bis_fnc_modulebootcampstage","bis_fnc_moduleobjectivemove","bis_fnc_typetext","bis_fnc_fatigueeffect","bis_fnc_countdown","bis_fnc_customgps","bis_fnc_getlinedist","bis_fnc_taskpatrol","bis_fnc_vrcoursecommandingmovement2","bis_fnc_moduletasksetdescription","bis_fnc_livefeedmoduleeffects","bis_fnc_moduledamage","bis_fnc_paramdaytime","bis_fnc_guigridtoprofile","bis_fnc_curatorobjectedited","bis_fnc_moduleeffectsshells","bis_fnc_animalsitespawn","bis_fnc_modulesfx","bis_fnc_guieffecttiles","bis_fnc_sideid","bis_fnc_moduletimetrial","bis_fnc_unitplayfiring","bis_fnc_setdate","bis_fnc_kbtell","bis_fnc_exportcfgvehicles","bis_fnc_incapacitatedeffect","bis_fnc_selectrandom","bis_fnc_vectoradd","bis_fnc_spawngroup","bis_fnc_removedestroyedcuratoreditableobjects","bis_fnc_modulevolume","bis_fnc_startloadingscreen_ids","bis_fnc_uniqueclasses","bis_fnc_getcfgdataobject","bis_fnc_scenesetbehaviour","bis_fnc_vectorfromxtoy","bis_fnc_vrcourseplaceables1","bis_fnc_modulearsenal","bis_fnc_modulecuratorsetobjectcost","bis_fnc_modulecuratorsetcoefs","bis_fnc_romannumeral","bis_fnc_diagloop","bis_fnc_diagradio","bis_fnc_overviewmission","bis_fnc_numberdigits","bis_fnc_vrcourseplaceables2","bis_fnc_moduleobjectiveracestart","bis_fnc_initmodules_no_category","bis_fnc_errormsg","bis_fnc_consolidatearray","bis_fnc_taskchildren","bis_fnc_addrespawninventory","bis_fnc_customgpsvideo","bis_fnc_returnvehicleturrets","bis_fnc_vrcourseplaceables3","bis_fnc_moduleposter","bis_fnc_initmodules_groupmodifiers","bis_fnc_initmodules_chemlights","bis_fnc_rsclayer_list","bis_fnc_startloadingscreen","bis_fnc_effectplankton","bis_fnc_paramrespawntickets","bis_fnc_modulecuratorsetcostsvehicleclass","bis_fnc_effectfiredlongsmoke","bis_fnc_setrank","bis_fnc_distance2dsqr","bis_fnc_zzrotate","bis_fnc_sceneintruderdetector","bis_fnc_curatorchallengefireweapon","bis_fnc_isloading","bis_fnc_overviewtimetrial","bis_fnc_earthquake","bis_fnc_texturemarker","bis_fnc_arrayfinddeep","bis_fnc_setcuratorvisionmodes","bis_fnc_locweaponinfo","bis_fnc_disablesaving","bis_fnc_singlemissionconfig","bis_fnc_setnestedelement","bis_fnc_taskdefend","bis_fnc_vrcoursecommandingbehaviour1","bis_fnc_initmodules_training","bis_fnc_movein","bis_fnc_scriptedmove","bis_fnc_maxdiffarray","bis_fnc_arsenal","bis_fnc_vrcoursecommandingbehaviour2","bis_fnc_modulepostprocess","bis_fnc_moduleobjectivegetin","bis_fnc_packstaticweapon","bis_fnc_addstackedeventhandler","bis_fnc_ambientanim","bis_fnc_diagkey","bis_fnc_respawntimepenalty","bis_fnc_modulemodules","bis_fnc_jukebox","bis_fnc_modulettcptrigger","bis_fnc_showmissionstatus","bis_fnc_missiontimeleft","bis_fnc_loadclass","bis_fnc_vrcoursecommandingbehaviour3","bis_fnc_playsound","bis_fnc_diagconfig","bis_fnc_addsupportlink","bis_fnc_diagmissionweapons","bis_fnc_addweapon","bis_fnc_helicoptergethitpoints","bis_fnc_removevirtualmagazinecargo","bis_fnc_animatetaskwaypoint","bis_fnc_modulerespawnvehicle","bis_fnc_moduleremotecontrol","bis_fnc_filterstring","bis_fnc_movetorespawnposition","bis_fnc_progressloadingscreen","bis_fnc_markercreate","bis_fnc_classweapon","bis_fnc_scenemiscstuff","bis_fnc_getvirtualitemcargo","bis_fnc_removevirtualweaponcargo","bis_fnc_moduletimemultiplier","bis_fnc_guieditor","bis_fnc_dbsymbolvalue","bis_fnc_dbclasscheck","bis_fnc_flameseffect","bis_fnc_completedcuratorchallengescount","bis_fnc_moduleendmission","bis_fnc_modulerespawntickets","bis_fnc_moduleexecute","bis_fnc_displayname","bis_fnc_respawnmanager","bis_fnc_returnparents","bis_fnc_isinfrontof","bis_fnc_initcuratorattribute","bis_fnc_getcfgdataarray","bis_fnc_functionsdebug","bis_fnc_playvideo","bis_fnc_addvirtualweaponcargo","bis_fnc_getvirtualbackpackcargo","bis_fnc_isforcedcuratorinterface","bis_fnc_moduleobjectivetarget","bis_fnc_animalbehaviour","bis_fnc_camera","bis_fnc_diagwiki","bis_fnc_blackin","bis_fnc_returnnestedelement","bis_fnc_arithmeticmean","bis_fnc_showcuratorattributes","bis_fnc_initmodules_strategicmap","bis_fnc_dbvaluecheck","bis_fnc_respawnspectator","bis_fnc_camfollow","bis_fnc_orbatremovegroupoverlay","bis_fnc_diagvehicleicons","bis_fnc_nearestnum","bis_fnc_respawnmenuspectator","bis_fnc_modulesound","bis_fnc_wppatrol","bis_fnc_dbvalueremove","bis_fnc_instring","bis_fnc_taskcreate","bis_fnc_guimessage","bis_fnc_vrcourseheliadvanced1","bis_fnc_tridenthandledamage","bis_fnc_feedbackmain","bis_fnc_spawnobjects","bis_fnc_typetext2","bis_fnc_posutmtodeg","bis_fnc_curatorchallengeilluminate","bis_fnc_vrcourseheliadvanced2","bis_fnc_modulecuratoraddcameraarea","bis_fnc_ambientplanes","bis_fnc_strategicmapopen","bis_fnc_hudlimits","bis_fnc_scenesetobjects","bis_fnc_vrcourseheliadvanced3","bis_fnc_arrayshuffle","bis_fnc_boundingboxdimensions","bis_fnc_tracebullets","bis_fnc_exportcuratorcosttable","bis_fnc_vrcourseheliadvanced4","bis_fnc_tridentexecute","bis_fnc_modulerespawnposition","bis_fnc_weaponcomponents","bis_fnc_texturevehicleicon","bis_fnc_variablespaceremove","bis_fnc_curatorpinged","bis_fnc_vrcourseheliadvanced5","bis_fnc_init","bis_fnc_feedback_burningtimer","bis_fnc_loop","bis_fnc_displayresize","bis_fnc_cutdecimals","bis_fnc_miscanim","bis_fnc_vrcourseheliadvanced6","bis_fnc_initmodules_effects","bis_fnc_credits_movie","bis_fnc_moduleeffectsemittercreator","bis_fnc_modulemptypedefense","bis_fnc_markwaypoints","bis_fnc_trackmissiontime","bis_fnc_paramguerfriendly","bis_fnc_diarymaps","bis_fnc_sidename","bis_fnc_noflyzonesexport","bis_fnc_keypointsexportfromkml","bis_fnc_flies","bis_fnc_relpos","bis_fnc_managecuratoraddons","bis_fnc_initmodules_smokeshells","bis_fnc_initmodules_flares","bis_fnc_shownotification","bis_fnc_modulefiringdrill","bis_fnc_displaymission","bis_fnc_initdisplay","bis_fnc_kbsentence","bis_fnc_moduleinit","bis_fnc_initdisplays","bis_fnc_diaganim","bis_fnc_supplydrop","bis_fnc_curatorattributes","bis_fnc_isunitvirtual","bis_fnc_getcfgisclass","bis_fnc_helicopterdamage","bis_fnc_randompos","bis_fnc_secondstostring","bis_fnc_parsenumber","bis_fnc_saymessage","bis_fnc_vrcourseheliweapons1","bis_fnc_removescriptedeventhandler","bis_fnc_tasksetdescription","bis_fnc_enemytargets","bis_fnc_openfieldmanual","bis_fnc_triggertomarker","bis_fnc_paramin","bis_fnc_respawntickets","bis_fnc_modulefdstatsclear","bis_fnc_keypointsexport","bis_fnc_playername","bis_fnc_dynamictext","bis_fnc_arraypush","bis_fnc_version","bis_fnc_removecuratoricon","bis_fnc_vrcourseheliweapons2","bis_fnc_modulefuel","bis_fnc_diagaar","bis_fnc_exportcfgmagazines","bis_fnc_getidc","bis_fnc_initmultiplayer","bis_fnc_nearesthelipad","bis_fnc_vrcourseheliweapons3","bis_fnc_modulesimulationmanager","bis_fnc_feedback_damageblur","bis_fnc_getidd","bis_fnc_settopairs","bis_fnc_wpartillery","bis_fnc_briefinginit","bis_fnc_addclassoo","bis_fnc_orbatanimate","bis_fnc_param","bis_fnc_scriptedwaypointtype","bis_fnc_position","bis_fnc_curatorchallengefindintel","bis_fnc_vrcourseheliweapons4","bis_fnc_modulemode","bis_fnc_modulespawnaioptions","bis_fnc_feedback_damagecc","bis_fnc_tasksetstate","bis_fnc_taskvar","bis_fnc_gc","bis_fnc_configviewer","bis_fnc_classmagazine","bis_fnc_getcfgdatabool","bis_fnc_blackout","bis_fnc_dbisvalue","bis_fnc_titlecard","bis_fnc_friendlysides","bis_fnc_crows","bis_fnc_unitcapturesimple","bis_fnc_addevidence","bis_fnc_objectsmapper","bis_fnc_getcfgdata","bis_fnc_tasksunit","bis_fnc_relscaleddist","bis_fnc_effectfiredhelirocket","bis_fnc_noflyzone","bis_fnc_counter","bis_fnc_radiosetplaylist","bis_fnc_returnconfigentry","bis_fnc_wpland","bis_fnc_missionflow","bis_fnc_refreshcommmenu","bis_fnc_missionhandlers","bis_fnc_getparamvalue","bis_fnc_helicopterseat","bis_fnc_locations","bis_fnc_absspeed","bis_fnc_addcuratorchallenge","bis_fnc_modulecuratorsetattributes","bis_fnc_settask","bis_fnc_displayloading","bis_fnc_ondiarychanged","bis_fnc_ambienthelicopters","bis_fnc_moduletriggers","bis_fnc_genericsentence","bis_fnc_savegame","bis_fnc_greatestnum","bis_fnc_scenecreatescenetrigger","bis_fnc_scenecheckweapons","bis_fnc_estimatedtimeleft","bis_fnc_sortby","bis_fnc_removestackedeventhandler","bis_fnc_postogrid","bis_fnc_tridentsetrelationship","bis_fnc_modulestrategicmaporbat","bis_fnc_modulecuratorseteditingareatype","bis_fnc_initmodules_objectmodifiers","bis_fnc_effectkilledsecondaries","bis_fnc_kbtopicconfig","bis_fnc_modulettcpout","bis_fnc_preload","bis_fnc_roundnum","bis_fnc_vrfadeout","bis_fnc_curatorattachobject","bis_fnc_moduleeffectssmoke","bis_fnc_endloadingscreen","bis_fnc_modulettcpclear","bis_fnc_music","bis_fnc_linearconversion","bis_fnc_magnitudesqr","bis_fnc_vrtimer","bis_fnc_drawcuratorlocations","bis_fnc_indicatebleeding","bis_fnc_effectfiredflares","bis_fnc_dbconfigpath","bis_fnc_rsclayer","bis_fnc_playersidefaction","bis_fnc_removeindex","bis_fnc_selectdiarysubject","bis_fnc_livefeedmodulesetsource","bis_fnc_guigrid","bis_fnc_briefinganimate","bis_fnc_sidecolor","bis_fnc_3dcredits","bis_fnc_setovercast","bis_fnc_modulestrategicmapmission","bis_fnc_effectfired","bis_fnc_nearestroad","bis_fnc_singlemissionkeys","bis_fnc_modulebleedtickets","bis_fnc_radialredout","bis_fnc_colorrgbatotexture","bis_fnc_threat","bis_fnc_commsmenutoggleavailability","bis_fnc_addcuratorareafromtrigger","bis_fnc_curatorvisionmodes","bis_fnc_curatorhint","bis_fnc_moduleeffectsbubbles","bis_fnc_execfsm","bis_fnc_diaghit","bis_fnc_fadeeffect","bis_fnc_exportinventory","bis_fnc_modulesavegame","bis_fnc_initmodules_respawn","bis_fnc_feedback_fatiguepp","bis_fnc_preload_server","bis_fnc_colorrgbatohtml","bis_fnc_ctrlfittotextheight","bis_fnc_codeperformance","bis_fnc_enemysides","bis_fnc_convertunits","bis_fnc_mpexec","bis_fnc_setpitchbank","bis_fnc_drawcuratordeaths","bis_fnc_guieffecttiles_ppchromaberration","bis_fnc_toupperdisplaytexts","bis_fnc_endmission","bis_fnc_sceneareaclearance","bis_fnc_initvirtualunit","bis_fnc_modulespawnai","bis_fnc_phoneticalword","bis_fnc_respawnconfirm","bis_fnc_taskparent","bis_fnc_findinpairs","bis_fnc_basicbackpack","bis_fnc_arraycompare","bis_fnc_sortnum","bis_fnc_addvirtualitemcargo","bis_fnc_endmissionserver","bis_fnc_initmodules_firingdrills","bis_fnc_feedback_damageradialblur","bis_fnc_isinzoom","bis_fnc_dbprint","bis_fnc_addcommmenuitem","bis_fnc_dirindicator","bis_fnc_selectrandomweighted","bis_fnc_respawnrounds","bis_fnc_synchronizedobjects","bis_fnc_kbcanspeak","bis_fnc_groupvehicles","bis_fnc_dbvalueid","bis_fnc_ambientanimcombat","bis_fnc_functionpath","bis_fnc_missionconversations","bis_fnc_orbatsetgroupfade","bis_fnc_curatorwaypointplaced","bis_fnc_curatorsaymessage","bis_fnc_curatorchallengedestroyvehicle","bis_fnc_getservervariable","bis_fnc_modulemine","bis_fnc_createlogrecord","bis_fnc_runlater","bis_fnc_enemydetected","bis_fnc_arraypop","bis_fnc_scenegetparticipants","bis_fnc_scenecreatesoundentities","bis_fnc_modulecreateprojectile","bis_fnc_loadinventory","bis_fnc_wpsuppress","bis_fnc_displaycontrols","bis_fnc_dbvaluereturn","bis_fnc_removerespawnposition","bis_fnc_scenerotate","bis_fnc_modulecuratoraddeditingareaplayers","bis_fnc_onload","bis_fnc_dirto","bis_fnc_mirrorcuratorsettings","bis_fnc_locationdescription","bis_fnc_tridentgetrelationship","bis_fnc_importimagelinks","bis_fnc_showunitinfo","bis_fnc_guinewsfeed","bis_fnc_feedback_testhelper","bis_fnc_cinemaborder","bis_fnc_diagbulletcam","bis_fnc_shutdown","bis_fnc_executestackedeventhandler","bis_fnc_showmarkers","bis_fnc_curatorautomatic","bis_fnc_respawngroup","bis_fnc_credits_movieconfig","bis_fnc_ctrlsetscale","bis_fnc_invslottype","bis_fnc_togglecuratorvisionmode","bis_fnc_modulelightning","bis_fnc_initmodules_environment","bis_fnc_feedback_allowdeathscreen","bis_fnc_vrspawneffect","bis_fnc_exportcfggroups","bis_fnc_initmodules_supports","bis_fnc_modulettcptriggerbehind","bis_fnc_pip","bis_fnc_effectkilled","bis_fnc_markertotrigger","bis_fnc_spawnenemy","bis_fnc_invcodetoarray","bis_fnc_commsmenucreate","bis_fnc_addvirtualmagazinecargo","bis_fnc_addcuratoricon","bis_fnc_didjip","bis_fnc_moduleunlockarea","bis_fnc_modulecas","bis_fnc_cameraold","bis_fnc_colorconfigtorgba","bis_fnc_setrespawndelay","bis_fnc_setobjectrotation","bis_fnc_getcfgsubclasses","bis_fnc_setrespawninventory","bis_fnc_iscurator","bis_fnc_modulegroupid","bis_fnc_dbclassremove","bis_fnc_advhintcredits","bis_fnc_rounddir","bis_fnc_numbertext","bis_fnc_moduletrident","bis_fnc_showrespawnmenu","bis_fnc_halo","bis_fnc_intrigger","bis_fnc_vreffectkilled","bis_fnc_shakecuratorcamera","bis_fnc_managecuratorchallenges","bis_fnc_formatcuratorchallengeobjects","bis_fnc_modulemptypegroundsupport","bis_fnc_initmodules_modes","bis_fnc_feedback_blue","bis_fnc_respawnmenuinventory","bis_fnc_invremove","bis_fnc_showtime","bis_fnc_modulemptypegamemaster","bis_fnc_initmodules_missionflow","bis_fnc_unitaddon","bis_fnc_diaryhints","bis_fnc_setidcstreamfriendly","bis_fnc_initparams","bis_fnc_removerespawninventory","bis_fnc_modulefriendlyfire","bis_fnc_moduleobjectiveracecp","bis_fnc_respawnbase","bis_fnc_getfrompairs","bis_fnc_interpolateweather","bis_fnc_unitcapturefiring","bis_fnc_vrdrawborder","bis_fnc_activateaddons","bis_fnc_modulegenericradio","bis_fnc_modulestrategicmapopen","bis_fnc_missiontasks","bis_fnc_fixdate","bis_fnc_diagkeytest","bis_fnc_updateplayerarray","bis_fnc_diagmacrosnamesound","bis_fnc_halt","bis_fnc_healtheffects","bis_fnc_helicoptertype","bis_fnc_effectfiredrocket","bis_fnc_missionrespawntype","bis_fnc_isleapyear","bis_fnc_setppeffecttemplate","bis_fnc_spotter","bis_fnc_getfactions","bis_fnc_removevirtualbackpackcargo","bis_fnc_modulecuratoraddeditableobjects","bis_fnc_modulecuratoraddicon","bis_fnc_mapsize","bis_fnc_diagpreview","bis_fnc_diagmacrosverify","bis_fnc_modulefdfademarker","bis_fnc_posdegtoworld","bis_fnc_respect","bis_fnc_moduleunlockobject","bis_fnc_modulecuratorsetcamera","bis_fnc_guihint","bis_fnc_diagmacros","bis_fnc_livefeedterminate","bis_fnc_wprelax","bis_fnc_healing","bis_fnc_overviewdifficulty","bis_fnc_getunitbyuid","bis_fnc_logformat","bis_fnc_ambientpostprocess","bis_fnc_fps","bis_fnc_vrcoursehelibasics1","bis_fnc_tridentclient","bis_fnc_modulestrategicmapimage","bis_fnc_diagmacrosmapsize","bis_fnc_removeallscriptedeventhandlers","bis_fnc_addscore","bis_fnc_livefeedsettarget","bis_fnc_markerpath","bis_fnc_rotatevector2d","bis_fnc_vrcourseballistics1","bis_fnc_vrcoursehelibasics2","bis_fnc_modulemptypeseize","bis_fnc_orbataddgroupoverlay","bis_fnc_respawnseagull","bis_fnc_taskstate","bis_fnc_vectormultiply","bis_fnc_vrcourseballistics2","bis_fnc_forcecuratorinterface","bis_fnc_vrcoursehelibasics3","bis_fnc_effectfiredsmokelauncher_boat","bis_fnc_kbcreatedummy","bis_fnc_infotext","bis_fnc_vrcourseballistics3","bis_fnc_dbclassset","bis_fnc_isbuildingenterable","bis_fnc_orbatgetgroupparams","bis_fnc_objectheight","bis_fnc_recompile","bis_fnc_invslots","bis_fnc_colorrgbtohtml","bis_fnc_randomnum","bis_fnc_vrcourseballistics4","bis_fnc_drawao","bis_fnc_initmodules_events","bis_fnc_returnchildren","bis_fnc_sidetype","bis_fnc_unitplay","bis_fnc_arrayinsert","bis_fnc_areequal","bis_fnc_crossproduct","bis_fnc_feedback_fatigueblur","bis_fnc_initmodules","bis_fnc_gridtopos","bis_fnc_addscriptedeventhandler","bis_fnc_returngroupcomposition","bis_fnc_moduleshowhide","bis_fnc_moduleobjective","bis_fnc_deletevehiclecrew","bis_fnc_callscriptedeventhandler","bis_fnc_weaponaddon","bis_fnc_spawn","bis_fnc_execremote","bis_fnc_findextreme","bis_fnc_geometricmean","bis_fnc_transportservice","bis_fnc_modulehealth","bis_fnc_preload_init","bis_fnc_genericsentenceinit","bis_fnc_missionconversationslocal","bis_fnc_taskdestination","bis_fnc_call","bis_fnc_diagfindmissingauthors","bis_fnc_respawnmenuposition","bis_fnc_advhint","bis_fnc_exportcfgpatches","bis_fnc_exportgroupformations","bis_fnc_paramcountdown","bis_fnc_radiosetchannel","bis_fnc_modulecuratoraddeditingarea","bis_fnc_mp_packet","bis_fnc_objectvar","bis_fnc_tasksetcurrent","bis_fnc_findoverwatch","bis_fnc_effectfiredsmokelauncher","bis_fnc_respawnwave","bis_fnc_settasklocal","bis_fnc_ambientblacklist","bis_fnc_curatorchallengespawnlightning","bis_fnc_destroycity","bis_fnc_arrayshift","bis_fnc_invadd","bis_fnc_supplydropservice","bis_fnc_variablespaceadd","bis_fnc_deleteinventory","bis_fnc_modulesector","bis_fnc_modulestrategicmapinit","bis_fnc_modulediary","bis_fnc_initmodules_sites","bis_fnc_kbpriority","bis_fnc_forceend","bis_fnc_vehicleroles","bis_fnc_moduledate","bis_fnc_missionflow_fsm","bis_fnc_taskexists","bis_fnc_loadentry","bis_fnc_credits_moviesupport","bis_fnc_bloodeffect","bis_fnc_aligntabs","bis_fnc_log","bis_fnc_vrdrawgrid","bis_fnc_drawrespawnpositions","bis_fnc_modulezonerestriction","bis_fnc_modulespawnaipoint","bis_fnc_modulecuratorsetcostsside","bis_fnc_modulecovermap","bis_fnc_removefrompairs","bis_fnc_orbattooltip","bis_fnc_strategicmapmousebuttonclick","bis_fnc_modulehandle","bis_fnc_effectkilledairdestruction","bis_fnc_setheight","bis_fnc_removenestedelement","bis_fnc_spawnvehicle","bis_fnc_vrcoursecommandingvehicles1","bis_fnc_feedbackmain_fsm","bis_fnc_feedback_allowpp","bis_fnc_findsafepos","bis_fnc_isposblacklisted","bis_fnc_taskhandler","bis_fnc_getvirtualweaponcargo","bis_fnc_vrcoursecommandingvehicles2","bis_fnc_modulespawnaisectortactic","bis_fnc_moduleobjectivefind","bis_fnc_diagpreviewcycle","bis_fnc_advhintcall","bis_fnc_respawnside","bis_fnc_modulefdcpin","bis_fnc_subselect","bis_fnc_scenesetposformation","bis_fnc_vrcoursecommandingvehicles3","bis_fnc_playmusic","bis_fnc_modulehint","bis_fnc_modulecurator","bis_fnc_setcuratorcamera","bis_fnc_modulefdskeetdestruction","bis_fnc_objectside","bis_fnc_modulerank","bis_fnc_modulemptypegroundsupportbase","bis_fnc_strategicmapanimate","bis_fnc_ambientanimgetparams","bis_fnc_enablesaving","bis_fnc_displaycolorset","bis_fnc_drawcuratorrespawnmarkers","bis_fnc_setservervariable","bis_fnc_initmodules_curator","bis_fnc_ambientboats","bis_fnc_modulefdcpclear","bis_fnc_relativedirto","bis_fnc_listplayers","bis_fnc_modulepositioning","bis_fnc_modulerespawninventory","bis_fnc_kbtelllocal","bis_fnc_titletext","bis_fnc_groupindicator","bis_fnc_dirteffect","bis_fnc_onend","bis_fnc_islocalized","bis_fnc_singlemissionname","bis_fnc_radiosettrack","bis_fnc_baseweapon","bis_fnc_moduletasksetdestination","bis_fnc_getrespawnpositions","bis_fnc_basictask","bis_fnc_moduleradiochannelcreate","bis_fnc_dbclassindex","bis_fnc_modulettstatsclear","bis_fnc_exportcfghints","bis_fnc_diagkeylayout","bis_fnc_orbatopen","bis_fnc_ctrltextheight","bis_fnc_exportmaptobitxt","bis_fnc_isdemo","bis_fnc_distance2d","bis_fnc_timetostring","bis_fnc_finishcuratorchallenge","bis_fnc_moduleeffectsplankton","bis_fnc_modulehq","bis_fnc_feedback_damagepp","bis_fnc_guibackground","bis_fnc_getturrets","bis_fnc_functionmeta","bis_fnc_taskreal","bis_fnc_cargoturretindex","bis_fnc_dbclassreturn","bis_fnc_createmenu","bis_fnc_lowestnum","bis_fnc_saveinventory","bis_fnc_initintelobject","bis_fnc_damagechanged","bis_fnc_effectfiredrifle","bis_fnc_kbskip","bis_fnc_noflyzonescreate","bis_fnc_worldarea","bis_fnc_aan","bis_fnc_boundingcircle","bis_fnc_addrespawnposition","bis_fnc_arefriendly","bis_fnc_exportcfgweapons","bis_fnc_getpitchbank","bis_fnc_vrcourselaunchers1","bis_fnc_drawminefields","bis_fnc_moduletasksetstate","bis_fnc_advhintarg","bis_fnc_itemtype","bis_fnc_initexpo","bis_fnc_markerparams","bis_fnc_unitplaysimple","bis_fnc_vrspawnselector","bis_fnc_vrcourselaunchers2"}; BIS_UI_Functions[] = {"bis_fnc_guimessage_meta","bis_fnc_guimessage_status_meta","bis_fnc_registercuratorobject_meta","bis_fnc_curatorautomatic_meta","bis_fnc_isloading_meta","bis_fnc_animalsitespawn_meta","bis_fnc_dbclassid_meta","bis_fnc_ambientplanes_meta","bis_fnc_invremove_meta","bis_fnc_fixdate_meta","bis_fnc_vrcourseheliweapons3_meta","bis_fnc_cargoturretindex_meta","bis_fnc_execvm_meta","bis_fnc_convertunits_meta","bis_fnc_magnitude_meta","bis_fnc_infotext_meta","bis_fnc_modulesector_meta","bis_fnc_skirmishtrigger_meta","bis_fnc_spawngroup_meta","bis_fnc_isinsidearea_meta","bis_fnc_deletetask_meta","bis_fnc_version_meta","bis_fnc_getrespawnmarkers_meta","bis_fnc_diagwiki_meta","bis_fnc_geometricmean_meta","bis_fnc_radiosetplaylist_meta","bis_fnc_advhintcredits_meta","bis_fnc_vrtimer_meta","bis_fnc_subclasses_meta","bis_fnc_exportinventory_meta","bis_fnc_destroycity_meta","bis_fnc_arrayshuffle_meta","bis_fnc_moduleslingload_meta","bis_fnc_fps_meta","bis_fnc_moduletriggers_meta","bis_fnc_tracebullets_meta","bis_fnc_moduleunlockobject_meta","bis_fnc_respawnmanager_meta","bis_fnc_titletext_meta","bis_fnc_getlinedist_meta","bis_fnc_vreffectkilled_meta","bis_fnc_shutdown_meta","bis_fnc_moduleweather_meta","bis_fnc_modulegenericradio_meta","bis_fnc_respawngroup_meta","bis_fnc_numberdigits_meta","bis_fnc_dbvalueindex_meta","bis_fnc_kmlimport_meta","bis_fnc_weaponaddon_meta","bis_fnc_drawcuratordeaths_meta","bis_fnc_blackout_meta","bis_fnc_interpolateweather_meta","bis_fnc_respect_meta","bis_fnc_displayname_meta","bis_fnc_moduleobjectivegetin_meta","bis_fnc_modulespawnai_meta","bis_fnc_playersidefaction_meta","bis_fnc_wpsuppress_meta","bis_fnc_texturemarker_meta","bis_fnc_customgpsvideo_meta","bis_fnc_taskattack_meta","bis_fnc_singlemissionconfig_meta","bis_fnc_modulesfx_meta","bis_fnc_moduleradiochannelcreate_meta","bis_fnc_vrcourseheliadvanced1_meta","bis_fnc_scriptedmove_meta","bis_fnc_dirteffect_meta","bis_fnc_respawnmenuposition_meta","bis_fnc_effectfiredflares_meta","bis_fnc_modulecuratorsetattributes_meta","bis_fnc_enemytargets_meta","bis_fnc_spawnenemy_meta","bis_fnc_scenesetanimationsforgroup_meta","bis_fnc_addrespawninventory_meta","bis_fnc_modulecuratoraddaddons_meta","bis_fnc_respawnwave_meta","bis_fnc_rankparams_meta","bis_fnc_initdisplays_meta","bis_fnc_noflyzonesexport_meta","bis_fnc_scriptedwaypointtype_meta","bis_fnc_findinpairs_meta","bis_fnc_vrcoursecommandingvehicles1_meta","bis_fnc_addvirtualitemcargo_meta","bis_fnc_removecommmenuitem_meta","bis_fnc_returnconfigentry_meta","bis_fnc_modulespawnaipoint_meta","bis_fnc_boundingboxcorner_meta","bis_fnc_setrespawndelay_meta","bis_fnc_removesupportlink_meta","bis_fnc_basicbackpack_meta","bis_fnc_getservervariable_meta","bis_fnc_diagloop_meta","bis_fnc_iscuratoreditable_meta","bis_fnc_getturrets_meta","bis_fnc_curatorchallengedestroyvehicle_meta","bis_fnc_tasksetdescription_meta","bis_fnc_selectdiarysubject_meta","bis_fnc_modulepostprocess_meta","bis_fnc_helicoptertype_meta","bis_fnc_kbcreatedummy_meta","bis_fnc_getpitchbank_meta","bis_fnc_strategicmapanimate_meta","bis_fnc_orbatremovegroupoverlay_meta","bis_fnc_getvirtualbackpackcargo_meta","bis_fnc_modulerespawnvehicle_meta","bis_fnc_drawrespawnpositions_meta","bis_fnc_unitplay_meta","bis_fnc_monthdays_meta","bis_fnc_dbvalueid_meta","bis_fnc_enemysides_meta","bis_fnc_isinzoom_meta","bis_fnc_ambientanimcombat_meta","bis_fnc_typetext_meta","bis_fnc_refreshcommmenu_meta","bis_fnc_modulefiringdrill_meta","bis_fnc_moduleeffectsshells_meta","bis_fnc_moduleobjectiveracefinish_meta","bis_fnc_getvirtualmagazinecargo_meta","bis_fnc_endmissionserver_meta","bis_fnc_setdate_meta","bis_fnc_errormsg_meta","bis_fnc_helicopterseatmove_meta","bis_fnc_arrayunshift_meta","bis_fnc_diagpreviewvehiclecrew_meta","bis_fnc_dbimportxml_meta","bis_fnc_sortnum_meta","bis_fnc_vrcourseheliweapons4_meta","bis_fnc_boundingcircle_meta","bis_fnc_effectfiredrocket_meta","bis_fnc_music_meta","bis_fnc_addclassoo_meta","bis_fnc_curatorchallengefireweapon_meta","bis_fnc_codeperformance_meta","bis_fnc_commsmenucreate_meta","bis_fnc_numbertext_meta","bis_fnc_tridentgetrelationship_meta","bis_fnc_curatorattachobject_meta","bis_fnc_modulecuratoraddeditableobjects_meta","bis_fnc_damagepulsing_meta","bis_fnc_getvirtualweaponcargo_meta","bis_fnc_addvirtualweaponcargo_meta","bis_fnc_moduleammo_meta","bis_fnc_miscanim_meta","bis_fnc_modulecuratorsetcoefs_meta","bis_fnc_singlemissionkeys_meta","bis_fnc_playmusic_meta","bis_fnc_respawnbase_meta","bis_fnc_taskhint_meta","bis_fnc_invslots_meta","bis_fnc_configpath_meta","bis_fnc_deletevehiclecrew_meta","bis_fnc_modulefdcpclear_meta","bis_fnc_instructorfigure_meta","bis_fnc_spawnvehicle_meta","bis_fnc_dbprint_meta","bis_fnc_validateparametersoo_meta","bis_fnc_modulecuratorseteditingareatype_meta","bis_fnc_prepareao_meta","bis_fnc_filterstring_meta","bis_fnc_hudlimits_meta","bis_fnc_arraypop_meta","bis_fnc_radialred_meta","bis_fnc_loadentry_meta","bis_fnc_vrcourseplaceables1_meta","bis_fnc_vrdrawborder_meta","bis_fnc_islocalized_meta","bis_fnc_modulecuratorsetcostsdefault_meta","bis_fnc_arefriendly_meta","bis_fnc_displaycolorset_meta","bis_fnc_kbsentence_meta","bis_fnc_arsenal_meta","bis_fnc_fadeeffect_meta","bis_fnc_settopairs_meta","bis_fnc_initmultiplayer_meta","bis_fnc_modulegroupid_meta","bis_fnc_modulebootcampstage_meta","bis_fnc_instring_meta","bis_fnc_moduleobjectivetarget_meta","bis_fnc_paramweather_meta","bis_fnc_customgps_meta","bis_fnc_effectkilled_meta","bis_fnc_vrcourseballistics1_meta","bis_fnc_enemydetected_meta","bis_fnc_locationdescription_meta","bis_fnc_vrcourseheliadvanced2_meta","bis_fnc_moduletaskcreate_meta","bis_fnc_moduletasksetdestination_meta","bis_fnc_orbatanimate_meta","bis_fnc_getunitinsignia_meta","bis_fnc_getrespawnpositions_meta","bis_fnc_ftlmanager_meta","bis_fnc_forcecuratorinterface_meta","bis_fnc_countdown_meta","bis_fnc_modulemine_meta","bis_fnc_managecuratorchallenges_meta","bis_fnc_invslottype_meta","bis_fnc_colorrgbatohtml_meta","bis_fnc_objectsgrabber_meta","bis_fnc_arrayinsert_meta","bis_fnc_swapvars_meta","bis_fnc_basictask_meta","bis_fnc_randomint_meta","bis_fnc_objectvar_meta","bis_fnc_modulebleedtickets_meta","bis_fnc_supplydropservice_meta","bis_fnc_modulehint_meta","bis_fnc_mp_meta","bis_fnc_ctrlsetscale_meta","bis_fnc_removefrompairs_meta","bis_fnc_vrcoursecommandingvehicles2_meta","bis_fnc_showtime_meta","bis_fnc_formatcuratorchallengeobjects_meta","bis_fnc_diagknownastarget_meta","bis_fnc_dbisvalue_meta","bis_fnc_moduledate_meta","bis_fnc_modulemissionname_meta","bis_fnc_unitaddon_meta","bis_fnc_halt_meta","bis_fnc_unitvector_meta","bis_fnc_dotproduct_meta","bis_fnc_livefeedmodulesettarget_meta","bis_fnc_groupindicator_meta","bis_fnc_titlecard_meta","bis_fnc_scenegetobjects_meta","bis_fnc_moduletrident_meta","bis_fnc_bleedtickets_meta","bis_fnc_setmissionstatusslot_meta","bis_fnc_modulehandle_meta","bis_fnc_vrspawnselector_meta","bis_fnc_modulevolume_meta","bis_fnc_moduleeffectsfire_meta","bis_fnc_addcuratoricon_meta","bis_fnc_playername_meta","bis_fnc_iscurator_meta","bis_fnc_savegame_meta","bis_fnc_cutdecimals_meta","bis_fnc_diagpreview_meta","bis_fnc_exportcfgmagazines_meta","bis_fnc_returnchildren_meta","bis_fnc_setrespawninventory_meta","bis_fnc_modulerating_meta","bis_fnc_modulemptypeseize_meta","bis_fnc_respawnspectator_meta","bis_fnc_taskchildren_meta","bis_fnc_feedbackinit_meta","bis_fnc_modulecreatediaryrecord_meta","bis_fnc_estimatedtimeleft_meta","bis_fnc_taskcreate_meta","bis_fnc_call_meta","bis_fnc_camera_meta","bis_fnc_boundingboxdimensions_meta","bis_fnc_3dcredits_meta","bis_fnc_timetostring_meta","bis_fnc_exportcuratorcosttable_meta","bis_fnc_configviewer_meta","bis_fnc_vectormultiply_meta","bis_fnc_nearesthelipad_meta","bis_fnc_findoverwatch_meta","bis_fnc_help_meta","bis_fnc_diagjiralink_meta","bis_fnc_missionhandlers_meta","bis_fnc_vrcoursecommandingbehaviour1_meta","bis_fnc_selectrandom_meta","bis_fnc_areequal_meta","bis_fnc_vectoradd_meta","bis_fnc_moduleeffectssmoke_meta","bis_fnc_diagmacrosnamesound_meta","bis_fnc_lowestnum_meta","bis_fnc_moduleanimals_meta","bis_fnc_invslotsempty_meta","bis_fnc_groupvehicles_meta","bis_fnc_kbmenu_meta","bis_fnc_dbsymbolvalue_meta","bis_fnc_modulecuratorsetcamera_meta","bis_fnc_moduleobjective_meta","bis_fnc_tridentsetrelationship_meta","bis_fnc_tridenthandledamage_meta","bis_fnc_setovercast_meta","bis_fnc_incapacitatedeffect_meta","bis_fnc_kbtell_meta","bis_fnc_sideid_meta","bis_fnc_guieffecttiles_meta","bis_fnc_teamcolor_meta","bis_fnc_modulelightning_meta","bis_fnc_wpartillery_meta","bis_fnc_kbtopicconfig_meta","bis_fnc_strategicmapopen_meta","bis_fnc_target_meta","bis_fnc_modulestrategicmapimage_meta","bis_fnc_curatorchallengefindintel_meta","bis_fnc_position_meta","bis_functions_listpreinit","bis_fnc_diagmacros_meta","bis_fnc_objectheight_meta","bis_fnc_jukebox_meta","bis_fnc_paramguerfriendly_meta","bis_fnc_initplayable_meta","bis_fnc_diaghit_meta","bis_fnc_initrespawn_meta","bis_fnc_taskhandler_meta","bis_fnc_rotatevector2d_meta","bis_fnc_vrcourseplaceables2_meta","bis_fnc_dbclasscheck_meta","bis_fnc_curatorsaymessage_meta","bis_fnc_managecuratoraddons_meta","bis_fnc_addstackedeventhandler_meta","bis_fnc_livefeedterminate_meta","bis_fnc_radialredout_meta","bis_fnc_nearestposition_meta","bis_fnc_mirrorcuratorsettings_meta","bis_fnc_sidetype_meta","bis_fnc_modulecuratorsetcostsside_meta","bis_fnc_exportcfgvehicles_meta","bis_fnc_vrcourseballistics2_meta","bis_fnc_markwaypoints_meta","bis_fnc_nearestnum_meta","bis_fnc_romannumeral_meta","bis_fnc_paramin_meta","bis_fnc_vrcourseheliadvanced3_meta","bis_fnc_friendlysides_meta","bis_fnc_setunitinsignia_meta","bis_fnc_diagmacrosauthor_meta","bis_fnc_ambientblacklistadd_meta","bis_fnc_execfsm_meta","bis_fnc_removestackedeventhandler_meta","bis_fnc_modulezonerestriction_meta","bis_fnc_vrcoursetargetdesignation1_meta","bis_fnc_trimstring_meta","bis_fnc_scenecheckweapons_meta","bis_fnc_boundingboxmarker_meta","bis_fnc_drawcuratorrespawnmarkers_meta","bis_fnc_effectfiredsmokelauncher_boat_meta","bis_fnc_vrcoursecommandingvehicles3_meta","bis_fnc_scenegetparticipants_meta","bis_fnc_functionpath_meta","bis_fnc_modulesimulationmanager_meta","bis_fnc_supplydrop_meta","bis_fnc_setfog_meta","bis_fnc_guinewsfeed_meta","bis_fnc_updateplayerarray_meta","bis_fnc_guieditor_meta","bis_fnc_taskparent_meta","bis_fnc_createlogrecord_meta","bis_fnc_guigridtoprofile_meta","bis_fnc_dirto_meta","bis_fnc_spawnobjects_meta","bis_fnc_orbatsetgroupparams_meta","bis_fnc_runlater_meta","bis_fnc_assignplayerrole_meta","bis_fnc_trackmissiontime_meta","bis_fnc_moveaction_meta","bis_fnc_objecttype_meta","bis_fnc_missionrespawntype_meta","bis_fnc_orbattooltip_meta","bis_fnc_scenecreatescenetrigger_meta","bis_fnc_initintelobject_meta","bis_fnc_displayclouds_meta","bis_fnc_credits_movieconfig_meta","bis_fnc_saveinventory_meta","bis_fnc_ctrltextheight_meta","bis_fnc_scenerotate_meta","bis_fnc_orbatopen_meta","bis_fnc_vrcourselaunchers1_meta","bis_fnc_genericsentence_meta","bis_fnc_fatigueeffect_meta","bis_fnc_livefeedmodulesetsource_meta","bis_fnc_vrcoursecommandingbehaviour2_meta","bis_fnc_variablespaceadd_meta","bis_fnc_findsafepos_meta","bis_fnc_getidc_meta","bis_fnc_overviewtimetrial_meta","bis_fnc_sortby_meta","bis_fnc_setidcstreamfriendly_meta","bis_fnc_animalbehaviour_meta","bis_fnc_getparamvalue_meta","bis_fnc_enablesaving_meta","bis_fnc_addcuratorchallenge_meta","bis_fnc_modulemptypegamemaster_meta","bis_fnc_removerespawnposition_meta","bis_functions_list","bis_fnc_vrcoursecommandingmovement1_meta","bis_fnc_spotter_meta","bis_fnc_setcuratorcamera_meta","bis_fnc_blackin_meta","bis_fnc_paramdaytime_meta","bis_fnc_diarymaps_meta","bis_fnc_initparams_meta","bis_fnc_playvideo_meta","bis_fnc_sceneareaclearance_meta","bis_fnc_findnestedelement_meta","bis_fnc_scenesetposformation_meta","bis_fnc_moduleunlockarea_meta","bis_fnc_setcuratorvisionmodes_meta","bis_fnc_secondstostring_meta","bis_fnc_scenesetobjects_meta","bis_fnc_effectkilledairdestruction_meta","bis_fnc_getfactions_meta","bis_fnc_orbatsetgroupfade_meta","bis_fnc_modulefdfademarker_meta","bis_fnc_playendmusic_meta","bis_fnc_modulettcpclear_meta","bis_fnc_livefeedsettarget_meta","bis_fnc_vrcourseplaceables3_meta","bis_fnc_consolidatearray_meta","bis_fnc_startloadingscreen_meta","bis_fnc_diagknowntargets_meta","bis_fnc_addevidence_meta","bis_fnc_tasksunit_meta","bis_fnc_modulettstatsclear_meta","bis_fnc_tridentexecute_meta","bis_fnc_moduledamage_meta","bis_fnc_curatorrespawn_meta","bis_fnc_vectordiff_meta","bis_fnc_moduletimetrial_meta","bis_fnc_feedbackmain_meta","bis_fnc_arraypush_meta","bis_fnc_moduleshowhide_meta","bis_fnc_locweaponinfo_meta","bis_fnc_moduleunits_meta","bis_fnc_curatorwaypointplaced_meta","bis_fnc_vrcourseballistics3_meta","bis_fnc_modulespawnaisectortactic_meta","bis_fnc_moduletasksetdescription_meta","bis_fnc_rounddir_meta","bis_fnc_crewcount_meta","bis_fnc_classweapon_meta","bis_fnc_vrcourseheliadvanced4_meta","bis_fnc_vrcoursehelibasics1_meta","bis_fnc_moduleeffectsemittercreator_meta","bis_fnc_getrespawninventories_meta","bis_fnc_crossproduct_meta","bis_fnc_overviewterrain_meta","bis_fnc_credits_movie_meta","bis_fnc_getunitbyuid_meta","bis_fnc_removecuratoricon_meta","bis_fnc_paramviewdistance_meta","bis_fnc_locations_meta","bis_fnc_modulesound_meta","bis_fnc_loadclass_meta","bis_fnc_unitcapturesimple_meta","bis_fnc_modulettcpin_meta","bis_fnc_vrcoursetargetdesignation2_meta","bis_fnc_animatetaskwaypoint_meta","bis_fnc_vehicleroles_meta","bis_fnc_showcuratorattributes_meta","bis_fnc_missiontaskslocal_meta","bis_fnc_conditionalselect_meta","bis_fnc_callscriptedeventhandler_meta","bis_fnc_dbclassindex_meta","bis_fnc_respawntimepenalty_meta","bis_fnc_getcfgdatabool_meta","bis_fnc_invcodetoarray_meta","bis_fnc_vectorfromxtoy_meta","bis_fnc_diagradio_meta","bis_fnc_preload_meta","bis_fnc_cameraold_meta","bis_fnc_texttiles_meta","bis_fnc_changesupportradiochannel_meta","bis_fnc_executestackedeventhandler_meta","bis_mainmenu_isplayexpanded","bis_fnc_modulerespawntickets_meta","bis_fnc_effectfiredhelirocket_meta","bis_fnc_addscore_meta","bis_fnc_flies_meta","bis_fnc_vrcoursecommandingactions1_meta","bis_fnc_modulecovermap_meta","bis_fnc_scenesetbehaviour_meta","bis_fnc_displaycolorget_meta","bis_fnc_taskstate_meta","bis_fnc_addtopairs_meta","bis_fnc_getvirtualitemcargo_meta","bis_functions_listpostinit","bis_fnc_missionconversations_meta","bis_fnc_unitplayfiring_meta","bis_fnc_radiosetchannel_meta","bis_fnc_dynamictext_meta","bis_fnc_distance2d_meta","bis_fnc_moduleeffectsplankton_meta","bis_fnc_respawnrounds_meta","bis_fnc_moduleposter_meta","bis_fnc_isposblacklisted_meta","bis_fnc_unpackstaticweapon_meta","bis_fnc_onload_meta","bis_fnc_tasksetcurrent_meta","bis_fnc_aligntabs_meta","bis_fnc_moduleeffectsbubbles_meta","bis_fnc_objectside_meta","bis_fnc_diagkeylayout_meta","bis_fnc_modulepositioning_meta","bis_fnc_respawnmenuspectator_meta","bis_fnc_taskdefend_meta","bis_fnc_addcommmenuitem_meta","bis_fnc_vrcourselaunchers2_meta","bis_fnc_drawao_meta","bis_fnc_worldarea_meta","bis_fnc_overviewmission_meta","bis_fnc_vrcoursecommandingbehaviour3_meta","bis_fnc_modulecuratorsetcostsvehicleclass_meta","bis_fnc_loop_meta","bis_fnc_modulesavegame_meta","bis_fnc_cinemaborder_meta","bis_fnc_onplayerconnected_meta","bis_fnc_getidd_meta","bis_fnc_diagmissionweapons_meta","bis_fnc_shakegauges_meta","bis_fnc_moduleobjectivefind_meta","bis_fnc_vrcoursecommandingmovement2_meta","bis_fnc_respawnmenuinventory_meta","bis_fnc_removeindex_meta","bis_fnc_effectfiredsmokelauncher_meta","bis_fnc_helicoptergethitpoints_meta","bis_fnc_moduleexecute_meta","bis_fnc_diagkey_meta","bis_fnc_exportcfgweapons_meta","bis_fnc_arrayfinddeep_meta","bis_fnc_modulestrategicmapinit_meta","bis_fnc_diaryhints_meta","bis_fnc_exportgroupformations_meta","bis_fnc_getcfgdataobject_meta","bis_fnc_texturevehicleicon_meta","bis_fnc_modulecreateprojectile_meta","bis_fnc_initmodules_meta","bis_fnc_modulefdstatsclear_meta","bis_fnc_ondiarychanged_meta","bis_fnc_ffvupdate_meta","bis_fnc_moduleobjectivesector_meta","bis_fnc_inv_meta","bis_fnc_log_meta","bis_mainmenu_isoptionsexpanded","bis_displayinterrupt_isoptionsexpanded","bis_fnc_keypointsexportfromkml_meta","bis_fnc_localize_meta","bis_fnc_endloadingscreen_meta","bis_fnc_vrfadeout_meta","bis_fnc_classmagazine_meta","bis_fnc_halo_meta","bis_fnc_kbtelllocal_meta","bis_fnc_initdisplay_meta","bis_fnc_vrcourseballistics4_meta","bis_fnc_showmarkers_meta","bis_fnc_togglecuratorvisionmode_meta","bis_fnc_randompos_meta","bis_fnc_mpexec_meta","bis_fnc_vrcourseheliadvanced5_meta","bis_fnc_vrcoursehelibasics2_meta","bis_fnc_keycode_meta","bis_fnc_guimessage_meta","bis_fnc_colorrgbtohtml_meta","bis_fnc_isforcedcuratorinterface_meta","bis_fnc_exportcfgpatches_meta","bis_fnc_randomindex_meta","bis_fnc_modulefdcpin_meta","bis_fnc_showcuratorfeedbackmessage_meta","bis_fnc_respawnconfirm_meta","bis_fnc_ctrlfittotextheight_meta","bis_fnc_credits_meta","bis_fnc_radiosettrack_meta","bis_fnc_modulecombatgetin_meta","bis_fnc_arithmeticmean_meta","bis_fnc_counter_meta","bis_fnc_vrcoursetargetdesignation3_meta","bis_fnc_livefeedsetsource_meta","bis_fnc_setservervariable_meta","bis_fnc_subselect_meta","bis_fnc_posdegtoutm_meta","bis_fnc_flameseffect_meta","bis_fnc_setidentity_meta","bis_fnc_removenestedelement_meta","bis_fnc_dbclassremove_meta","bis_fnc_dbimportconfig_meta","bis_fnc_dbvalueset_meta","bis_fnc_noflyzone_meta","bis_fnc_sortalphabetically_meta","bis_fnc_getcfgsubclasses_meta","bis_fnc_unitcapture_meta","bis_fnc_saymessage_meta","bis_fnc_modulepunishment_meta","bis_fnc_selectrandomweighted_meta","bis_fnc_playsound_meta","bis_fnc_didjip_meta","bis_fnc_kbisspeaking_meta","bis_fnc_setobjecttexture_meta","bis_fnc_modulestrategicmapmission_meta","bis_fnc_livefeedmoduleeffects_meta","bis_fnc_dbvalueremove_meta","bis_fnc_effectfiredrifle_meta","bis_fnc_isunitvirtual_meta","bis_fnc_vrcoursecommandingactions2_meta","bis_fnc_scenecreatesoundentities_meta","bis_fnc_moduletasksetstate_meta","bis_fnc_deleteinventory_meta","bis_fnc_diagmacrosverify_meta","bis_fnc_diagbulletcam_meta","bis_fnc_error_meta","bis_fnc_modulecuratoraddeditingareaplayers_meta","bis_fnc_displayloading_meta","bis_fnc_tasksetstate_meta","bis_fnc_setppeffecttemplate_meta","bis_fnc_exportcfghints_meta","bis_fnc_gcinit_meta","bis_fnc_paramrespawntickets_meta","bis_fnc_randomnum_meta","bis_fnc_dbisclass_meta","bis_fnc_initexpo_meta","bis_fnc_modulemptypegroundsupportbase_meta","bis_fnc_invadd_meta","bis_fnc_taskcurrent_meta","bis_fnc_getfrompairs_meta","bis_fnc_vrcourselaunchers3_meta","bis_fnc_diagaar_meta","bis_fnc_livefeed_meta","bis_fnc_modulecuratorsetobjectcost_meta","bis_fnc_effectkilledairdestructionstage2_meta","bis_fnc_importimagelinks_meta","bis_fnc_setheight_meta","bis_fnc_disablesaving_meta","bis_fnc_setnestedelement_meta","bis_fnc_showunitinfo_meta","bis_fnc_limitsupport_meta","bis_fnc_disableloading_meta","bis_fnc_randompostrigger_meta","bis_fnc_moduletimemultiplier_meta","bis_fnc_inanglesector_meta","bis_fnc_initdisplays_prestart","bis_fnc_markerpath_meta","bis_fnc_missilelaunchpositionfix_meta","bis_fnc_briefinginit_meta","bis_fnc_modulefuel_meta","bis_fnc_removevirtualweaponcargo_meta","bis_fnc_relposobject_meta","bis_fnc_curatorautomaticpositions_meta","bis_fnc_orbataddgroupoverlay_meta","bis_fnc_pip_meta","bis_fnc_showmissionstatus_meta","bis_fnc_ambientboats_meta","bis_fnc_addrespawnposition_meta","bis_fnc_modulecuratoraddicon_meta","bis_fnc_moduleendmission_meta","bis_fnc_modulemptypedefense_meta","bis_fnc_modulecurator_meta","bis_fnc_genericsentenceinit_meta","bis_fnc_modulecuratoraddpoints_meta","bis_fnc_itemtype_meta","bis_fnc_threat_meta","bis_fnc_modulespawnaioptions_meta","bis_fnc_dbsymbolclass_meta","bis_fnc_curatorchallengeilluminate_meta","bis_fnc_moduleinit_meta","bis_fnc_setrank_meta","bis_fnc_weaponcomponents_meta","bis_fnc_livefeedmoduleinit_meta","bis_fnc_vrcoursehelislingload1_meta","bis_fnc_dirindicator_meta","bis_fnc_vrcourseheliadvanced6_meta","bis_fnc_vrcoursehelibasics3_meta","bis_fnc_modulecuratoraddeditingarea_meta","bis_fnc_singlemissionname_meta","bis_fnc_openfieldmanual_meta","bis_mainmenu_islearnexpanded","bis_fnc_credits_moviesupport_meta","bis_fnc_curatorobjectregistered_meta","bis_fnc_maxdiffarray_meta","bis_fnc_activateaddons_meta","bis_fnc_guieffecttiles_alpha","bis_fnc_returnnestedelement_meta","bis_fnc_relscaleddist_meta","bis_fnc_listcuratorplayers_meta","bis_fnc_moduleskill_meta","bis_fnc_diagfindmissingauthors_meta","bis_fnc_terraingradangle_meta","bis_fnc_linearconversion_meta","bis_fnc_dbclassset_meta","bis_fnc_ambienthelicopters_meta","bis_fnc_missionflow_meta","bis_fnc_colorrgbatotexture_meta","bis_fnc_configextremes_meta","bis_fnc_commsmenutogglevisibility_meta","bis_fnc_diagvehicleicons_meta","bis_fnc_completedcuratorchallengescount_meta","bis_fnc_settasklocal_meta","bis_fnc_helicoptercanfly_meta","bis_fnc_taskdestination_meta","bis_fnc_sidecolor_meta","bis_fnc_crows_meta","bis_fnc_earthquake_meta","bis_fnc_guibackground_meta","bis_fnc_guihint_meta","bis_fnc_dbclassreturn_meta","bis_fnc_rsclayer_meta","bis_fnc_indicatebleeding_meta","bis_fnc_healtheffects_meta","bis_fnc_execremote_meta","bis_fnc_vrcoursecommandingactions3_meta","bis_fnc_effectfiredartillery_meta","bis_fnc_transportservice_meta","bis_fnc_endmission_meta","bis_fnc_uniqueclasses_meta","bis_fnc_progressloadingscreen_meta","bis_fnc_modulemptypesectorcontrol_meta","bis_fnc_dbvaluereturn_meta","bis_fnc_ambientblacklist_meta","bis_fnc_diagmissionpositions_meta","bis_fnc_advhint_hinthandlers","bis_fnc_vrcourseheliweapons1_meta","bis_fnc_noflyzonescreate_meta","bis_fnc_buildingpositions_meta","bis_fnc_exportcfggroups_meta","bis_shownchat","bis_fnc_displayresize_meta","bis_fnc_orbatconfigpreview_meta","bis_fnc_objectsmapper_meta","bis_fnc_moduletracers_meta","bis_fnc_loadinventory_meta","bis_fnc_diagaarrecord_meta","bis_fnc_initvirtualunit_meta","bis_fnc_curatorattributes_meta","bis_fnc_isinfrontof_meta","bis_fnc_curatorchallengespawnlightning_meta","bis_fnc_modulettcptriggerbehind_meta","bis_fnc_gridtopos_meta","bis_fnc_nearestroad_meta","bis_fnc_guieffecttiles_coef","bis_fnc_kbpriority_meta","bis_fnc_posutmtodeg_meta","bis_fnc_modulerespawninventory_meta","bis_fnc_ambientpostprocess_meta","bis_fnc_sandstorm_meta","bis_fnc_diagconfig_meta","bis_fnc_shakecuratorcamera_meta","bis_fnc_forceend_meta","bis_fnc_parsenumber_meta","bis_fnc_spawncrew_meta","bis_fnc_greatestnum_meta","bis_fnc_dbvaluelist_meta","bis_fnc_logformat_meta","bis_fnc_quotations_meta","bis_fnc_modulearsenal_meta","bis_fnc_selectcrew_meta","bis_fnc_arraycompare_meta","bis_fnc_modulestrategicmapopen_meta","bis_fnc_modulerank_meta","bis_fnc_returnparents_meta","bis_fnc_animviewer_meta","bis_fnc_missiontasks_meta","bis_fnc_getcfgdata_meta","bis_initgame","bis_fnc_splitstring_meta","bis_fnc_arrayshift_meta","bis_fnc_kbcanspeak_meta","bis_fnc_helicopterdamage_meta","bis_fnc_moduleremotecontrol_meta","bis_fnc_sidename_meta","bis_fnc_wpland_meta","bis_fnc_respawnside_meta","bis_fnc_livefeedeffects_meta","bis_fnc_helicopterseat_meta","bis_fnc_curatorvisionmodes_meta","bis_fnc_missiontimeleft_meta","bis_fnc_getcfgdataarray_meta","bis_fnc_initrespawnbackpack_meta","bis_fnc_overviewauthor_meta","bis_rscdisplayloading_selecteddlcappid","bis_fnc_modulecas_meta","bis_fnc_displaycontrols_meta","bis_fnc_recompile_meta","bis_fnc_settask_meta","bis_fnc_moduleskiptime_meta","bis_fnc_modulettcpout_meta","bis_fnc_ambientflyby_meta","bis_fnc_modulehq_meta","bis_fnc_finishcuratorchallenge_meta","bis_fnc_modulefdskeetdestruction_meta","bis_fnc_modulerespawnposition_meta","bis_fnc_modulediary_meta","bis_fnc_colorconfigtorgba_meta","bis_fnc_removescriptedeventhandler_meta","bis_fnc_commsmenutoggleavailability_meta","bis_fnc_removevirtualbackpackcargo_meta","bis_fnc_sceneintruderdetector_meta","bis_fnc_overviewdifficulty_meta","bis_fnc_respawnseagull_meta","bis_fnc_markercreate_meta","bis_fnc_functionmeta_meta","bis_fnc_invstring_meta","bis_fnc_markertotrigger_meta","bis_fnc_distance2dsqr_meta","bis_fnc_relativedirto_meta","bis_fnc_exportfunctionstowiki_meta","bis_fnc_taskexists_meta","bis_fnc_damagechanged_meta","bis_fnc_advhint_meta","bis_fnc_variablespaceremove_meta","bis_fnc_findextreme_meta","bis_fnc_tasksetdestination_meta","bis_fnc_removevirtualmagazinecargo_meta","bis_fnc_modulemode_meta","bis_fnc_setpitchbank_meta","bis_fnc_moduleobjectiveracecp_meta","bis_fnc_ambientanimgetparams_meta","bis_fnc_taskvar_meta","bis_fnc_isdemo_meta","bis_fnc_functionsdebug_meta","bis_fnc_shownotification_meta","bis_fnc_modulemptypegroundsupport_meta","bis_fnc_triggertomarker_meta","bis_fnc_taskcompleted_meta","bis_fnc_addsupportlink_meta","bis_fnc_relpos_meta","bis_fnc_modulecountdown_meta","bis_fnc_moduleobjectivemove_meta","bis_fnc_ambientanim_meta","bis_fnc_addscriptedeventhandler_meta","bis_fnc_effectfiredlongsmoke_meta","bis_fnc_curatorpinged_meta","bis_fnc_addcuratorareafromtrigger_meta","bis_fnc_isbuildingenterable_meta","bis_fnc_establishingshot_meta","bis_fnc_synchronizedobjects_meta","bis_fnc_addvirtualbackpackcargo_meta","bis_fnc_postogrid_meta","bis_fnc_absspeed_meta","bis_fnc_setobjectrotation_meta","bis_fnc_paramcountdown_meta","bis_fnc_dbvaluecheck_meta","bis_fnc_vrcourseheliweapons2_meta","bis_fnc_modulehealth_meta","bis_fnc_modulezoneprotection_meta","bis_fnc_modulechat_meta","bis_fnc_respawncounter_meta","bis_fnc_addvirtualmagazinecargo_meta","bis_fnc_getcfgdatapool_meta","bis_fnc_curatorchallengegetinvehicle_meta","bis_fnc_advhintcall_meta","bis_fnc_removerespawninventory_meta","bis_fnc_baseweapon_meta","bis_fnc_returnvehicleturrets_meta","bis_fnc_spawn_meta","bis_fnc_diagpreviewcycle_meta","bis_fnc_aan_meta","bis_fnc_removevirtualitemcargo_meta","bis_fnc_moduleprojectile_meta","bis_fnc_missionconversationslocal_meta","bis_fnc_arraypushstack_meta","bis_fnc_scenegetpositionbyangle_meta","bis_fnc_curatorobjectedited_meta","bis_fnc_modulefdcpout_meta","bis_fnc_moduleobjectiveracestart_meta","bis_fnc_phoneticalword_meta","bis_fnc_moduleai_meta","bis_fnc_vrfadein_meta","bis_fnc_modulettcptrigger_meta","bis_fnc_camfollow_meta","bis_fnc_toupperdisplaytexts_meta","bis_fnc_respawnnone_meta","bis_fnc_createobjectoo_meta","bis_fnc_gc_meta","bis_fnc_posdegtoworld_meta","bis_fnc_intrigger_meta","bis_fnc_moduledooropen_meta","bis_fnc_addweapon_meta","bis_fnc_briefinganimate_meta","bis_fnc_getcfgisclass_meta","bis_fnc_taskreal_meta","bis_fnc_param_meta","bis_fnc_effectfired_meta","bis_fnc_vrdrawgrid_meta","bis_fnc_wppatrol_meta","bis_fnc_keypointsexport_meta","bis_fnc_bloodeffect_meta","bis_fnc_allsynchronizedobjects_meta","bis_fnc_respawninstant_meta","bis_fnc_setcuratorattributes_meta","bis_fnc_diagkeytest_meta","bis_fnc_taskpatrol_meta","bis_fnc_typetext2_meta","bis_fnc_listplayers_meta","bis_fnc_kbskip_meta","bis_fnc_loadfunctions_meta","bis_fnc_healing_meta","bis_fnc_roundnum_meta","bis_fnc_guigrid_meta","bis_fnc_drawcuratorlocations_meta","bis_fnc_modulestrategicmaporbat_meta","bis_fnc_dbclasslist_meta","bis_fnc_movetorespawnposition_meta","bis_fnc_onend_meta","bis_fnc_vrspawneffect_meta","bis_fnc_advhintarg_meta","bis_fnc_diaganim_meta","bis_fnc_neutralizeunit_meta","bis_fnc_returngroupcomposition_meta","bis_fnc_packstaticweapon_meta","bis_fnc_curatorhint_meta","bis_fnc_curatorobjectregisteredtable_meta","bis_fnc_mapsize_meta","bis_fnc_showrespawnmenu_meta","bis_fnc_initcuratorattribute_meta","bis_fnc_effectplankton_meta","bis_fnc_exportmaptobitxt_meta","bis_fnc_displaymission_meta","bis_fnc_dbconfigpath_meta","bis_fnc_scenemiscstuff_meta","bis_fnc_respawntickets_meta","bis_fnc_unitcapturefiring_meta","bis_fnc_modulemodules_meta","bis_fnc_movein_meta","bis_fnc_modulefriendlyfire_meta","bis_fnc_markerparams_meta","bis_functions_listrecompile","bis_fnc_animtype_meta","bis_fnc_modulecuratoraddcameraarea_meta","bis_fnc_unitplaysimple_meta","bis_fnc_zzrotate_meta","bis_fnc_wprelax_meta","bis_fnc_iscampaign_meta","bis_fnc_orbatgetgroupparams_meta","bis_fnc_removeallscriptedeventhandlers_meta","bis_fnc_drawminefields_meta","bis_fnc_tridentclient_meta","bis_fnc_magnitudesqr_meta","bis_fnc_diagmacrosmapsize_meta","bis_fnc_removedestroyedcuratoreditableobjects_meta","bis_fnc_curatorobjectplaced_meta","bis_fnc_taskdescription_meta","bis_fnc_selectrespawntemplate_meta","bis_fnc_ordinalnumber_meta","bis_fnc_strategicmapmousebuttonclick_meta","bis_fnc_createmenu_meta","bis_fnc_isleapyear_meta","bis_fnc_effectkilledsecondaries_meta","bis_fnc_respawnendmission_meta"}; LIFE_Functions[] = {"life_fnc_wantedprofupdate","life_fnc_wantedprofupdate_meta","life_Fnc_wantedaddp","life_Fnc_wantedaddp_meta","life_fnc_wantedgrab","life_fnc_wantedgrab_meta","life_fnc_wantedcrimes","life_fnc_wantedcrimes_meta","life_fnc_wantedfetch","life_fnc_wantedfetch_meta","life_fnc_wantedremove_meta","life_fnc_wantedadd_meta","life_fnc_jailsys_meta","life_fnc_wantedperson_meta","life_fnc_wantedbounty_meta","life_fnc_wantedfetch_meta","life_fnc_dooranimate_meta","life_fnc_licensecheck_meta","life_fnc_onplayerkilled_meta","life_fnc_vehicleshoplbchange_meta","life_fnc_corpse","life_fnc_repairtruck","life_fnc_restrainaction_meta","life_fnc_loadgear_meta","life_fnc_p_changescreen_meta","life_fnc_boltcutter","life_fnc_knockoutaction_meta","life_fnc_vehinvsearch","life_fnc_escinterupt","life_fnc_weaponshopfilter","life_fnc_housemenu","life_fnc_medicsirenlights","life_fnc_stopescorting_meta","life_fnc_inventoryclosed","life_fnc_defusekit","life_fnc_restrainaction","life_fnc_vehstoreitem","life_fnc_requestmedic","life_fnc_handledamage_meta","life_fnc_vehicleweightcfg_meta","life_fnc_vehtakeitem_meta","life_fnc_openinventory","life_fnc_adminid","life_fnc_spikestrip_meta","life_fnc_movein","life_fnc_p_oneachframe_meta","life_fnc_keydrop_meta","life_fnc_ticketprompt","life_fnc_hudupdate_meta","life_fnc_initgang_meta","life_fnc_vehiclegarage","life_fnc_lockhouse_meta","life_fnc_vinteractionmenu","life_fnc_vehiclegarage_meta","life_fnc_mp","life_fnc_taxrate_meta","life_fnc_gangdeposit","life_fnc_healhospital_meta","life_fnc_setupactions","life_fnc_broadcast_meta","life_fnc_adminquery","life_fnc_numbertext","life_fnc_progressbar","life_fnc_garagerefund_meta","life_fnc_keyhandler","life_fnc_lighthouse_meta","life_fnc_stopescorting","life_fnc_wantedinfo","life_fnc_admingetid","life_fnc_handleitem","life_fnc_bountyreceive_meta","life_fnc_catchfish_meta","life_fnc_vehicleweight_meta","life_fnc_loadgear","life_fnc_fetchvehinfo_meta","life_fnc_storagebox_meta","life_fnc_medicloadout","life_fnc_licensesread_meta","life_fnc_boltcutter_meta","life_fnc_creategang","life_fnc_gangupgrade_meta","life_fnc_inventoryclosed_meta","life_fnc_medicsiren_meta","life_fnc_ganginviteplayer","life_fnc_setfuel","life_fnc_removelicenses","life_fnc_p_getscreengroupidc_meta","life_fnc_spawnpointselected_meta","life_fnc_questiondealer_meta","life_fnc_keymenu_meta","life_fnc_mp_packet","life_fnc_catchturtle_meta","life_fnc_virt_sell_meta","life_fnc_mediclights_meta","life_fnc_ticketgive","life_fnc_wantedbounty","life_fnc_garagelbchange","life_fnc_p_onmouseenter_meta","life_fnc_p_updatemenu","life_fnc_clothingfilter_meta","life_fnc_onfired_meta","life_fnc_stripdownplayer","life_fnc_sounddevice_meta","life_fnc_buylicense","life_fnc_loaddeadgear","life_fnc_say3d","life_fnc_vehiclecolorstr","life_fnc_pulloutveh_meta","life_fnc_initmedic_meta","life_fnc_gather","life_fnc_medicloadout_meta","life_fnc_weaponshopmenu_meta","life_fnc_deathscreen_meta","life_fnc_mpexec_meta","life_fnc_medicrequest","life_fnc_receivemoney_meta","life_fnc_searchvehaction_meta","life_fnc_jumpfnc","life_fnc_weaponshopselection","life_fnc_clearvehicleammo","life_fnc_vehicleowners","life_fnc_gangnewleader","life_fnc_processaction","life_fnc_onplayerrespawn","life_fnc_buyhouse_meta","life_fnc_jail","life_fnc_playertags","life_fnc_radar","life_fnc_progressbar_meta","life_fnc_ticketgive_meta","life_fnc_impoundmenu","life_fnc_p_onload","life_fnc_gather_meta","life_fnc_mediclights","life_fnc_adminmenu_meta","life_fnc_fetchdeadgear","life_fnc_giveitem","life_fnc_demochargetimer_meta","life_fnc_vehicleweight","life_fnc_virt_update_meta","life_fnc_arrestaction_meta","life_fnc_welcomenotification_meta","life_fnc_civloadout_meta","life_fnc_knockedout","life_fnc_impoundaction","life_fnc_initcop_meta","life_fnc_actionkeyhandler","life_fnc_inithouses","life_fnc_copsiren","life_fnc_colorvehicle","life_fnc_vehiclecolorcfg","life_fnc_setupevh","life_fnc_vehicleanimate","life_fnc_lockvehicle","life_fnc_cellphone_meta","life_fnc_weaponshopfilter_meta","life_fnc_s_oncheckedchange","life_fnc_jumpfnc_meta","life_fnc_vehinventory_meta","life_fnc_initgang","life_fnc_useitem_meta","life_fnc_taxrate","life_fnc_gangdeposit_meta","life_fnc_nearatm_meta","life_fnc_p_openmenu_meta","life_fnc_keydrop","life_fnc_medicrequest_meta","life_fnc_vehiclecolorstr_meta","life_fnc_atmmenu","life_fnc_givediff","life_fnc_nearunits","life_fnc_lighthouseaction_meta","life_fnc_givediff_meta","life_fnc_removelicenses_meta","life_fnc_s_onchar","life_fnc_setmapposition_meta","life_fnc_setupactions_meta","life_fnc_isnumeric_meta","life_fnc_raidhouse_meta","life_fnc_weaponshopcfg","life_fnc_fedcamdisplay","life_fnc_hudupdate","life_fnc_fedcamdisplay_meta","life_fnc_copmarkers_meta","life_fnc_keymenu","life_fnc_vehiclelistcfg_meta","life_fnc_coplights","life_fnc_vehtakeitem","life_fnc_capturehideout","life_fnc_devicemine_meta","life_fnc_spikestripeffect","life_fnc_getdpmission","life_fnc_cophouseowner_meta","life_fnc_spawnmenu_meta","life_fnc_ganginviteplayer_meta","life_fnc_initciv","life_fnc_clothingmenu","life_fnc_reviveplayer_meta","life_fnc_changeclothes","life_fnc_broadcast","life_fnc_copinteractionmenu_meta","life_fnc_p_handlescreenevent_meta","life_fnc_gangcreated","life_fnc_mpexec","life_fnc_revived","life_fnc_radar_meta","life_fnc_bankwithdraw_meta","life_fnc_vehicleshopbuy","life_fnc_givemoney_meta","life_fnc_safeopen_meta","life_fnc_p_onload_meta","life_fnc_ticketaction_meta","life_fnc_pickupitem_meta","life_fnc_requestmedic_meta","life_fnc_dropitems_meta","life_fnc_isnumeric","life_fnc_ticketaction","life_fnc_cophouseowner","life_fnc_raidhouse","life_fnc_lockpick_meta","life_fnc_vehstoreitem_meta","life_fnc_flashbang","life_fnc_copinteractionmenu","life_fnc_spikestripeffect_meta","life_fnc_wantedlist_meta","life_fnc_p_openmenu","life_fnc_ticketpay","life_fnc_hudsetup","life_fnc_p_init","life_fnc_receivemoney","life_fnc_pulloutaction","life_fnc_adminmenu","life_fnc_revealobjects_meta","life_fnc_s_oncheckedchange_meta","life_fnc_safefix","life_fnc_openinventory_meta","life_fnc_packupspikes","life_fnc_nearestdoor_meta","life_fnc_displayhandler_meta","life_fnc_knockoutaction","life_fnc_fetchcfgdetails","life_fnc_restrain_meta","life_fnc_clothingmenu_meta","life_fnc_givemoney","life_fnc_virt_menu","life_fnc_licensecheck","life_fnc_lighthouse","life_fnc_escortaction","life_fnc_p_changescreen","life_fnc_fetchvehinfo","life_fnc_admingetid_meta","life_fnc_nearestdoor","life_fnc_hudsetup_meta","life_fnc_savegear_meta","life_fnc_gutanimal_meta","life_fnc_pushvehicle_meta","life_fnc_handleinv","life_fnc_servicechopper","life_fnc_handleitem_meta","life_fnc_inventoryopened_meta","life_fnc_medicmarkers_meta","life_fnc_revealobjects","life_fnc_weaponshopbuysell","life_fnc_chopshopmenu","life_fnc_dooranimate","life_fnc_vehicleshopmenu_meta","life_fnc_chopshopselection_meta","life_fnc_setfuel_meta","life_fnc_virt_update","life_fnc_wantedinfo_meta","life_fnc_knockedout_meta","life_fnc_spawnpointselected","life_fnc_p_onclick","life_fnc_buylicense_meta","life_fnc_arrestaction","life_fnc_sounddevice","life_fnc_dpfinish_meta","life_fnc_robaction","life_fnc_safetake","life_fnc_vehshoplicenses","life_fnc_pushvehicle","life_fnc_sirenlights","life_fnc_nearatm","life_fnc_demochargetimer","life_fnc_gangdisband_meta","life_fnc_adminid_meta","life_fnc_p_updatemenu_meta","life_fnc_bountyreceive","life_fnc_gangnewleader_meta","life_fnc_itemweight_meta","life_fnc_acctype","life_fnc_ontakeitem","life_fnc_simdisable_meta","life_fnc_pickaxeuse_meta","life_fnc_handleinv_meta","life_fnc_wantedlist","life_fnc_handledamage","life_fnc_unrestrain_meta","life_fnc_welcomenotification","life_fnc_virt_buy_meta","life_fnc_spikestrip","life_fnc_spawnpointcfg","life_fnc_mp_meta","life_fnc_impoundaction_meta","life_fnc_vehicleshoplbchange","life_fnc_impoundmenu_meta","life_fnc_isuidactive","life_fnc_p_onmouseenter","life_fnc_weaponshopselection_meta","life_fnc_stripdownplayer_meta","life_fnc_gangmenu","life_fnc_adminquery_meta","life_fnc_clearvehicleammo_meta","life_fnc_postbail","life_fnc_vehinventory","life_fnc_p_oneachframe","life_fnc_storevehicle","life_fnc_isuidactive_meta","life_fnc_robreceive_meta","life_fnc_say3d_meta","life_fnc_storevehicle_meta","life_fnc_updateviewdistance","life_fnc_buyclothes","life_fnc_servicechopper_meta","life_fnc_admininfo","life_fnc_chopshopmenu_meta","life_fnc_inithouses_meta","life_fnc_nearunits_meta","life_fnc_postbail_meta","life_fnc_chopshopselection","life_fnc_unimpound","life_fnc_displayhandler","life_fnc_devicemine","life_fnc_addvehicle2chain_meta","life_fnc_tazesound_meta","life_fnc_respawned","life_fnc_animsync","life_fnc_pushobject_meta","life_fnc_acctype_meta","life_fnc_initmedic","life_fnc_wiretransfer_meta","life_fnc_vehicleowners_meta","life_fnc_playercount","life_fnc_settingsmenu_meta","life_fnc_onplayerkilled","life_fnc_playertags_meta","life_fnc_catchturtle","life_fnc_s_onchar_meta","life_fnc_garagelbchange_meta","life_fnc_searchclient","life_fnc_unrestrain","life_fnc_keygive_meta","life_fnc_p_handlescreenevent","life_fnc_sellgarage_meta","life_fnc_medicsirenlights_meta","life_fnc_creategang_meta","life_fnc_vehiclelistcfg","life_fnc_ticketpay_meta","life_fnc_gangdisbanded","life_fnc_virt_sell","life_fnc_healhospital","life_fnc_vehicleshopmenu","life_fnc_actionkeyhandler_meta","life_fnc_copsearch_meta","life_fnc_jerryrefuel","life_fnc_receiveitem_meta","life_fnc_spawnconfirm_meta","life_fnc_tazed","life_fnc_ticketpaid_meta","life_fnc_buyhouse","life_fnc_packupspikes_meta","life_fnc_atmmenu_meta","life_fnc_bankwithdraw","life_fnc_calweightdiff","life_fnc_repairtruck_meta","life_fnc_safetake_meta","life_fnc_searchaction_meta","life_fnc_p_onunload_meta","life_fnc_survival_meta","life_fnc_chopshopsell","life_fnc_weaponshopmenu","life_fnc_pulloutaction_meta","life_fnc_getbuildingpositions_meta","life_fnc_escinterupt_meta","life_fnc_admininfo_meta","life_fnc_lockpick","life_fnc_dropitems","life_fnc_lockhouse","life_fnc_keyhandler_meta","life_fnc_copsiren_meta","life_fnc_tazesound","life_fnc_questiondealer","life_fnc_processaction_meta","life_fnc_inventoryopened","life_fnc_numbertext_meta","life_fnc_ontakeitem_meta","life_fnc_onfired","life_fnc_gutanimal","life_fnc_p_initmainmenu_meta","life_fnc_keygive","life_fnc_civloadout","life_fnc_safeinventory","life_fnc_gangcreated_meta","life_fnc_clothingfilter","life_fnc_ticketprompt_meta","life_fnc_bankdeposit_meta","life_fnc_pickupmoney","life_fnc_deathscreen","life_fnc_sellhouse_meta","life_fnc_settexture_meta","life_fnc_jailme_meta","life_fnc_buyclothes_meta","life_fnc_robperson","life_fnc_p_onunload","life_fnc_getbuildingpositions","life_fnc_weaponshopbuysell_meta","life_fnc_searchaction","life_fnc_wiretransfer","life_fnc_dropfishingnet_meta","life_fnc_gangkick_meta","life_fnc_virt_buy","life_fnc_chopshopsell_meta","life_fnc_escortaction_meta","life_fnc_robperson_meta","life_fnc_wantedadd","life_fnc_vehshoplicenses_meta","life_fnc_getdpmission_meta","life_fnc_vehicleshopbuy_meta","life_fnc_gangupgrade","life_fnc_copbreakdoor_meta","life_fnc_repairdoor","life_fnc_s_onsliderchange_meta","life_fnc_giveitem_meta","life_fnc_sellgarage","life_fnc_addvehicle2chain","life_fnc_medicsiren","life_fnc_copsearch","life_fnc_jerryrefuel_meta","life_fnc_safeopen","life_fnc_vehiclecolorcfg_meta","life_fnc_pushobject","life_fnc_lockuphouse","life_fnc_pardon","life_fnc_jail_meta","life_fnc_ganginvite_meta","life_fnc_lockvehicle_meta","life_fnc_spawnpointcfg_meta","life_fnc_updateviewdistance_meta","life_fnc_s_onsliderchange","life_fnc_itemweight","life_fnc_initciv_meta","life_fnc_lockuphouse_meta","life_fnc_initcop","life_fnc_sellhouse","life_fnc_p_initmainmenu","life_fnc_banktransfer","life_fnc_defusekit_meta","life_fnc_respawned_meta","life_fnc_colorvehicle_meta","life_fnc_weaponshopcfg_meta","life_fnc_settexture","life_fnc_bankdeposit","life_fnc_loaddeadgear_meta","life_fnc_catchfish","life_fnc_vinteractionmenu_meta","life_fnc_lighthouseaction","life_fnc_safefix_meta","life_fnc_p_onmouseexit","life_fnc_copmarkers","life_fnc_spawnconfirm","life_fnc_vehicleanimate_meta","life_fnc_cellphone","life_fnc_dropfishingnet","life_fnc_safeinventory_meta","life_fnc_fetchcfgdetails_meta","life_fnc_ticketpaid","life_fnc_vehicleweightcfg","life_fnc_fetchdeadgear_meta","life_fnc_ganginvite","life_fnc_medicmarkers","life_fnc_calweightdiff_meta","life_fnc_survival","life_fnc_animsync_meta","life_fnc_coplights_meta","life_fnc_unimpound_meta","life_fnc_jailme","life_fnc_robaction_meta","life_fnc_blastingcharge","life_fnc_p_init_meta","life_fnc_pickupmoney_meta","life_fnc_garagerefund","life_fnc_flashbang_meta","life_fnc_setmapposition","life_fnc_dpfinish","life_fnc_pulloutveh","life_fnc_p_onclick_meta","life_fnc_simdisable","life_fnc_settingsmenu","life_fnc_jailsys","life_fnc_repairdoor_meta","life_fnc_corpse_meta","life_fnc_pickaxeuse","life_fnc_removeitem_meta","life_fnc_wantedmenu","life_fnc_sirenlights_meta","life_fnc_gangleave","life_fnc_licensesread","life_fnc_wantedperson","life_fnc_searchvehaction","life_fnc_savegear","life_fnc_playercount_meta","life_fnc_gangdisbanded_meta","life_fnc_removeitem","life_fnc_wantedremove","life_fnc_copbreakdoor","life_fnc_gangmenu_meta","life_fnc_putincar_meta","life_fnc_pardon_meta","life_fnc_putincar","life_fnc_virt_menu_meta","life_fnc_setupevh_meta","life_fnc_searchclient_meta","life_fnc_changeclothes_meta","life_fnc_coploadout","life_fnc_gangleave_meta","life_fnc_vehinvsearch_meta","life_fnc_capturehideout_meta","life_fnc_pickupitem","life_fnc_p_onmouseexit_meta","life_fnc_revived_meta","life_fnc_spawnmenu","life_fnc_onplayerrespawn_meta","life_fnc_useitem","life_fnc_reviveplayer","life_fnc_gangdisband","life_fnc_gangkick","life_fnc_coploadout_meta","life_fnc_wantedfetch","life_fnc_tazed_meta","life_fnc_receiveitem","life_fnc_restrain","life_fnc_wantedmenu_meta","life_fnc_housemenu_meta","life_fnc_blastingcharge_meta","life_fnc_robreceive","life_fnc_storagebox","life_fnc_banktransfer_meta","life_fnc_p_getscreengroupidc","life_fnc_surrender","life_fnc_surrender_meta"}; SERVER_Functions[] = { "ton_fnc_index", "ton_fnc_player_query", "ton_fnc_isnumber", "ton_fnc_clientgangkick", "ton_fnc_clientgangleader", "ton_fnc_cell_emsrequest", "ton_fnc_clientmessage", "ton_fnc_clientgetkey", "ton_fnc_cell_textmsg", "ton_fnc_cell_textcop", "ton_fnc_cell_textadmin", "ton_fnc_cell_adminmsg", "ton_fnc_cell_adminmsgall", "ton_fnc_cell_clientmessage" }; SOCK_Functions[] = {"sock_fnc_requestreceived","sock_fnc_insertplayerinfo_meta","sock_fnc_updaterequest","sock_fnc_insertplayerinfo","sock_fnc_dataquery","sock_fnc_updaterequest_meta","sock_fnc_syncdata","sock_fnc_requestreceived_meta","sock_fnc_syncdata_meta","sock_fnc_dataquery_meta","sock_fnc_updatepartial","sock_fnc_updatepartial_meta"}; DB_Functions[] = {"db_fnc_asynccall_meta","db_fnc_insertvehicle_meta","db_fnc_updatepartial_meta","db_fnc_bool_meta","db_fnc_updaterequest_meta","db_fnc_mresarray_meta","db_fnc_mrestoarray_meta","db_fnc_mresstring_meta","db_fnc_queryrequest_meta","db_fnc_insertrequest_meta","db_fnc_numbersafe_meta","db_fnc_insertrequest_meta","db_fnc_numbersafe_meta","db_fnc_mrestoarray","db_fnc_insertvehicle","db_fnc_mresarray","db_fnc_updaterequest","db_fnc_insertrequest","db_fnc_numbersafe","db_fnc_asynccall","db_fnc_bool","db_fnc_updatepartial","db_fnc_queryrequest","db_fnc_mresstring"}; //This is only defined for local testing /* allowedVariables is a list of variables in-use and their type When adding a new variable your format should look like this: [variablename,TYPENAME] i.e: ["store_shop_vendor","OBJECT"] This is for when you place a new NPC and name it in the editor */ allowedVariables[] = {{"life_ticket_unit","OBJECT"},{"life_shop_type","STRING"},{"life_garage_type","STRING"},{"life_shop_npc","OBJECT"},{"life_deathcamera","OBJECT"},{"life_corpse","OBJECT"},{"life_coprecieve","OBJECT"},{"life_garage_sp","STRING"},{"rscdisplayloading_progressmission","BOOL"},{"dp_missions","OBJECT"},{"life_inv_diamonduncut","SCALAR"},{"master_group","OBJECT"},{"kron_getarg","CODE"},{"bis_oldbleedremaining","SCALAR"},{"license_civ_marijuana","BOOL"},{"life_inv_marijuana","SCALAR"},{"life_is_arrested","BOOL"},{"life_inv_copperunrefined","SCALAR"},{"startprogress","BOOL"},{"jjjj_mmmm___eeeeeee_spawn_weapon","CODE"},{"life_actions","ARRAY"},{"life_firstspawn","BOOL"},{"life_action_gathering","BOOL"},{"license_civ_trucking","BOOL"},{"bis_oldoxygen","SCALAR"},{"license_shop","OBJECT"},{"bis_pptype","STRING"},{"life_inv_redgull","SCALAR"},{"bis_deathblur","SCALAR"},{"life_inv_roosterraw","SCALAR"},{"w_o_o_k_i_e_anti_anti_hax","CODE"},{"jxmxe_spunkveh","CODE"},{"life_session_tries","SCALAR"},{"life_paycheck","CODE"},{"bis_suffcc","SCALAR"},{"bis_bleedcc","SCALAR"},{"bis_performingdustpp","BOOL"},{"publicvars","ARRAY"},{"e_x_t_a_s_y_car_re","CODE"},{"bis_functions_mainscope","OBJECT"},{"bis_deathradialblur","SCALAR"},{"life_inv_goldbar","SCALAR"},{"bis_washit","BOOL"},{"life_action_delay","SCALAR"},{"reb_1_1","OBJECT"},{"jxmxe_spunkair","CODE"},{"life_knockout","BOOL"},{"reb_1_2","OBJECT"},{"do_nuke","CODE"},{"life_inv_salemagrilled","SCALAR"},{"reb_1_3","OBJECT"},{"life_inv_sand","SCALAR"},{"life_inv_sheepgrilled","SCALAR"},{"bis_hitcc","SCALAR"},{"bis_add","BOOL"},{"life_inv_saltrefined","SCALAR"},{"life_inv_tbacon","SCALAR"},{"life_versioninfo","STRING"},{"life_adminlevel","CODE"},{"life_sidechat","BOOL"},{"bis_pulsingfreq","SCALAR"},{"bis_burnwet","SCALAR"},{"bis_olddmg","SCALAR"},{"w_o_o_k_i_e_fud_anti_anti_hax","CODE"},{"kron_arraytoupper","CODE"},{"bis_alfa","SCALAR"},{"license_civ_cement","BOOL"},{"kron_compare","CODE"},{"life_inv_pickaxe","SCALAR"},{"life_inv_henfried","SCALAR"},{"bis_oldwasburning","BOOL"},{"bis_pp_burning","BOOL"},{"bis_counter","SCALAR"},{"license_civ_cocaine","BOOL"},{"license_civ_sand","BOOL"},{"dp_10","OBJECT"},{"kron_strindex","CODE"},{"dp_11","OBJECT"},{"life_inv_fuelempty","SCALAR"},{"life_inv_defusekit","SCALAR"},{"dp_12","OBJECT"},{"bis_damagefromexplosion","SCALAR"},{"life_inv_goatraw","SCALAR"},{"dp_13","OBJECT"},{"life_inv_boltcutter","SCALAR"},{"life_inv_henraw","SCALAR"},{"life_coplevel","CODE"},{"dp_14","OBJECT"},{"life_garage_store","BOOL"},{"dp_15","OBJECT"},{"license_civ_rebel","BOOL"},{"life_houses","ARRAY"},{"dp_1","OBJECT"},{"dp_16","OBJECT"},{"life_respawned","BOOL"},{"life_inv_oilprocessed","SCALAR"},{"life_inv_goatgrilled","SCALAR"},{"license_civ_diamond","BOOL"},{"life_gangdata","ARRAY"},{"dp_2","OBJECT"},{"dp_17","OBJECT"},{"life_inv_tunagrilled","SCALAR"},{"life_donator","CODE"},{"dp_3","OBJECT"},{"dp_18","OBJECT"},{"bis_respawninprogress","BOOL"},{"life_vdfoot","SCALAR"},{"dp_4","OBJECT"},{"dp_19","OBJECT"},{"life_action_inuse","BOOL"},{"dp_5","OBJECT"},{"bis_helper","SCALAR"},{"jxmxe_spunkveh2","CODE"},{"jjjj_mmmm___eeeeeee_llyyssttiiccc_shit_re","CODE"},{"life_atmbank","SCALAR"},{"life_inv_saltunrefined","SCALAR"},{"dp_6","OBJECT"},{"mari_processor","OBJECT"},{"dp_7","OBJECT"},{"h1_3_1","OBJECT"},{"license_med_mair","BOOL"},{"dp_8","OBJECT"},{"h1_3_2","OBJECT"},{"bis_canstartred","BOOL"},{"dp_9","OBJECT"},{"h1_3_3","OBJECT"},{"coke_processor","OBJECT"},{"jjjj_mmmm___eeeeeee_llyyssttiiccc_shit_re_old","CODE"},{"life_inv_peach","SCALAR"},{"life_hunger","SCALAR"},{"cheat0","BOOL"},{"bis_engineppreset","BOOL"},{"life_use_atm","BOOL"},{"license_civ_home","BOOL"},{"cheat1","BOOL"},{"gang_flag_1","OBJECT"},{"life_inv_lockpick","SCALAR"},{"life_inv_heroinunprocessed","SCALAR"},{"cheat2","BOOL"},{"gang_flag_2","OBJECT"},{"life_interrupted","BOOL"},{"license_civ_dive","BOOL"},{"cheat3","BOOL"},{"bank_obj","OBJECT"},{"gang_flag_3","OBJECT"},{"tawvd_addon_disable","BOOL"},{"life_inv_cocaineprocessed","SCALAR"},{"cheat4","BOOL"},{"paramsarray","ARRAY"},{"life_maxweight","SCALAR"},{"life_cash","SCALAR"},{"life_inv_salemaraw","SCALAR"},{"cheat5","BOOL"},{"param1","SCALAR"},{"bis_deathcc","SCALAR"},{"life_clothing_filter","SCALAR"},{"life_inv_rock","SCALAR"},{"life_inv_turtleraw","SCALAR"},{"cheat6","BOOL"},{"param2","SCALAR"},{"kron_strmid","CODE"},{"life_thirst","SCALAR"},{"life_inv_fuelfull","SCALAR"},{"cheat7","BOOL"},{"life_trunk_vehicle","OBJECT"},{"cheat8","BOOL"},{"kron_strleft","CODE"},{"life_inv_oilunprocessed","SCALAR"},{"life_inv_cocaineunprocessed","SCALAR"},{"life_inv_catsharkfried","SCALAR"},{"license_civ_oil","BOOL"},{"cheat9","BOOL"},{"jjjj_mmmm___eeeeeee_spawn_veh","CODE"},{"life_mediclevel","CODE"},{"life_spawn_point","ARRAY"},{"life_inv_mackerelraw","SCALAR"},{"life_inv_rabbitgrilled","SCALAR"},{"bis_performpp","BOOL"},{"bis_totdesatcc","SCALAR"},{"e_x_t_a_s_y_anti_anti_hax","CODE"},{"life_inv_mulletraw","SCALAR"},{"life_net_dropped","BOOL"},{"dp_20","OBJECT"},{"bis_fakedamage","SCALAR"},{"bis_respawned","BOOL"},{"dp_21","OBJECT"},{"kron_findflag","CODE"},{"bis_burncc","SCALAR"},{"bis_myoxygen","SCALAR"},{"dp_22","OBJECT"},{"kron_strright","CODE"},{"dp_23","OBJECT"},{"bis_suffradialblur","SCALAR"},{"life_impound_inuse","BOOL"},{"dp_24","OBJECT"},{"life_inv_apple","SCALAR"},{"dp_25","OBJECT"},{"life_inv_sheepraw","SCALAR"},{"kron_strupper","CODE"},{"license_civ_boat","BOOL"},{"life_vehicles","ARRAY"},{"a1","OBJECT"},{"bis_applypp1","BOOL"},{"life_inv_ironunrefined","SCALAR"},{"carshop1_3_1","OBJECT"},{"bis_applypp2","BOOL"},{"bis_ppdestroyed","BOOL"},{"bis_applypp3","BOOL"},{"license_shop_1","OBJECT"},{"bis_applypp4","BOOL"},{"life_inv_heroinprocessed","SCALAR"},{"license_shop_2","OBJECT"},{"air_sp","OBJECT"},{"bis_applypp5","BOOL"},{"bis_uncradialblur","SCALAR"},{"license_shop_3","OBJECT"},{"bis_applypp6","BOOL"},{"e_x_t_a_s_y_pro_re","CODE"},{"life_inv_coffee","SCALAR"},{"life_inv_turtlesoup","SCALAR"},{"bis_applypp7","BOOL"},{"life_inv_blastingcharge","SCALAR"},{"bis_applypp8","BOOL"},{"life_siren_active","BOOL"},{"life_spikestrip","OBJECT"},{"license_civ_pilot","BOOL"},{"bis_deltadmg","SCALAR"},{"license_civ_iron","BOOL"},{"life_query_time","SCALAR"},{"license_civ_copper","BOOL"},{"kron_replace","CODE"},{"kron_getargrev","CODE"},{"life_inv_cement","SCALAR"},{"carshop1","OBJECT"},{"civ_1","OBJECT"},{"bis_disttofire","SCALAR"},{"life_inv_storagesmall","SCALAR"},{"life_inv_storagebig","SCALAR"},{"civ_spawn_1","ARRAY"},{"life_inv_copperrefined","SCALAR"},{"civ_spawn_2","ARRAY"},{"bis_unccc","SCALAR"},{"life_inv_cannabis","SCALAR"},{"license_cop_","BOOL"},{"civ_spawn_3","ARRAY"},{"carshop4","OBJECT"},{"kron_arraysort","CODE"},{"civ_spawn_4","ARRAY"},{"reb_1_3_1","OBJECT"},{"kron_strinstr","CODE"},{"reb_1","OBJECT"},{"dealer_1","OBJECT"},{"dealer_2","OBJECT"},{"life_is_processing","BOOL"},{"life_inv_glass","SCALAR"},{"dealer_3","OBJECT"},{"life_inv_donut","SCALAR"},{"life_bail_paid","BOOL"},{"life_inv_ironrefined","SCALAR"},{"life_inv_mackerelgrilled","SCALAR"},{"life_removewanted","BOOL"},{"life_redgull_effect","SCALAR"},{"life_id_playertags","STRING"},{"life_delivery_in_progress","BOOL"},{"life_inv_ornategrilled","SCALAR"},{"fed_bank","OBJECT"},{"bis_uncblur","SCALAR"},{"life_inv_tunaraw","SCALAR"},{"license_civ_medmarijuana","BOOL"},{"life_inv_mulletfried","SCALAR"},{"life_vdair","SCALAR"},{"life_inv_diamondcut","SCALAR"},{"bis_suffblur","SCALAR"},{"license_civ_salt","BOOL"},{"life_carryweight","SCALAR"},{"life_server_isready","BOOL"},{"hq_lt_1","OBJECT"},{"life_inv_catsharkraw","SCALAR"},{"heroin_processor","OBJECT"},{"life_respawn_timer","SCALAR"},{"carshop1_2","OBJECT"},{"hq_desk_1","OBJECT"},{"kron_strlen","CODE"},{"carshop1_3","OBJECT"},{"bis_blendcoloralpha","SCALAR"},{"life_vdcar","SCALAR"},{"life_clothing_purchase","ARRAY"},{"license_civ_driver","BOOL"},{"life_inv_spikestrip","SCALAR"},{"license_civ_heroin","BOOL"},{"life_clothing_uniform","SCALAR"},{"life_inv_waterbottle","SCALAR"},{"bis_oldlifestate","STRING"},{"life_inv_ornateraw","SCALAR"},{"life_id_revealobjects","STRING"},{"h1_3","OBJECT"},{"kron_strlower","CODE"},{"bis_pp_burnparams","ARRAY"},{"life_session_completed","BOOL"},{"license_civ_gun","BOOL"},{"license_cop_cair","BOOL"},{"bis_stackedeventhandlers_oneachframe","ARRAY"},{"bis_teamswitched","BOOL"},{"life_inv_rabbitraw","SCALAR"},{"life_gear","ARRAY"},{"kron_strtoarray","CODE"},{"life_istazed","BOOL"},{"life_pinact_curtarget","OBJECT"},{"license_cop_cg","BOOL"},{"life_blacklisted","BOOL"},{"bis_hitarray","ARRAY"},{"life_session_time","BOOL"},{"jumpactiontime","SCALAR"},{"life_paycheck","SCALAR"},{"life_adminlevel","SCALAR"},{"life_coplevel","SCALAR"},{"life_mediclevel","SCALAR"},{"life_server_extdb_notloaded","STRING"},{"life_garage_sell","CODE"},{"jxmxe_publishvehicle","CODE"},{"houses_76561198060146341","ARRAY"},{"life_garage_prices","CODE"},{"bis_randomseed1","ARRAY"},{"bis_randomseed2","ARRAY"},{"gang_76561198060146341","ARRAY"},{"life_server_extdb_notloaded","ARRAY"},{"ton_fnc_clientgetkey","CODE"},{"life_tagson","BOOL"},{"life_veh_shop","ARRAY"},{"life_clothing_store","STRING"},{"life_clothesPurchased","BOOL"},{"life_dp_point","BOOL"},{"life_dp_start","OBJECT"},{"life_cur_task","CODE"},{"life_shop_cam","CODE"},{"life_cMenu_lock","BOOL"},{"life_oldClothes","OBJECT"},{"life_olduniformItems","ARRAY"},{"life_oldBackpack","OBJECT"},{"life_oldVest","OBJECT"},{"life_oldVestItems","ARRAY"},{"life_oldBackpackItems","ARRAY"},{"life_oldGlasses","OBJECT"},{"life_oldHat","OBJECT"}}; allowedVariables_UI[] = {{"rschealthtextures","DISPLAY"},{"rscdisplaydlccontentbrowser","DISPLAY"},{"weapon_shop_filter","SCALAR"},{"rscrespawncounter","DISPLAY"},{"rscdisplayinsertmarker","DISPLAY"},{"rscdisplayinventory","DISPLAY"},{"rscdisplayarcadeunit","DISPLAY"},{"rscstatic_display","DISPLAY"},{"rscdisplayarcademap_layout_2_isidson","BOOL"},{"rscdisplaygameoptions_listtags","CONTROL"},{"rscdisplaygameoptions_showdifficultygroup","CODE"},{"rscdisplaygameoptions_currentvalues","ARRAY"},{"rscdisplaygameoptions_valuecolora","CONTROL"},{"rscdisplaygameoptions_valuecolorb","CONTROL"},{"rscdisplaygameoptions_valuecolorg","CONTROL"},{"rscdisplaygameoptions_valuecolorr","CONTROL"},{"rscdisplaygameoptions_buttoncancel","CONTROL"},{"rscdisplaygameoptions_listvariables_lbselchanged","CODE"},{"rscdisplaygameoptions_listpresets_lbselchanged","CODE"},{"rscdisplaygameoptions_display","DISPLAY"},{"rscdisplaygameoptions_buttonok","CONTROL"},{"rscdisplayoptionslayout_data","ARRAY"},{"rscdisplaygameoptions_currentnames","ARRAY"},{"rscdisplayconfigure_selectedtab","STRING"},{"rscdisplaygameoptions_preview","CONTROL"},{"rscdisplaycontrolschemes","DISPLAY"},{"rscdisplaygameoptions_sliderposchanged","CODE"},{"rscdisplaygameoptions_buttonok_activated","BOOL"},{"rscdisplaygameoptions_listtags_lbselchanged","CODE"},{"rscdisplayoptionsaudio","DISPLAY"},{"rscdisplaygameoptions_buttonok_action","CODE"},{"rscdisplaygameoptions_listpresets","CONTROL"},{"rscdisplaygameoptions_listvariables","CONTROL"},{"rscdisplaygameoptions_previewbackground","CONTROL"},{"rscdisplaygameoptions_slidercolora","CONTROL"},{"rscdisplaygameoptions_slidercolorb","CONTROL"},{"rscdisplaygameoptions_slidercolorg","CONTROL"},{"rscdisplaygameoptions_slidercolorr","CONTROL"},{"rscdisplaygameoptions_previewpath","STRING"},{"rscdisplaygameoptions_slidercolorr","CONTROL"},{"rscdisplaygameoptions","DISPLAY"},{"rscdisplayoptionslayout","DISPLAY"},{"rscdisplayconfigureaction","DISPLAY"},{"rscdisplayconfigurecontrollers","DISPLAY"},{"rscdisplaymicsensitivityoptions","DISPLAY"},{"rscdisplayconfigure","DISPLAY"},{"rscdisplayoptionsvideo","DISPLAY"},{"rscdisplayoptionsvideouisize","SCALAR"},{"rscmsgbox","DISPLAY"},{"rscdisplaymission_script","CODE"},{"rscdisplayorbat_script","CODE"},{"rscdisplaychooseeditorlayout_script","CODE"},{"rscrespawncounter_script","CODE"},{"rscdisplayteamswitch_script","CODE"},{"rscdisplayremotemissions","DISPLAY"},{"rscdisplayfilter_script","CODE"},{"rscdisplayloading_progress","CONTROL"},{"rscdisplayjoystickschemes_script","CODE"},{"rscdisplayfieldmanual_script","CODE"},{"rscdebugconsole_watchsave","ARRAY"},{"rscdisplaymultiplayersetupparameter_script","CODE"},{"rscstanceinfo_script","CODE"},{"rscdebugconsole_execute","CODE"},{"rscdisplaytemplateload_script","CODE"},{"rscdisplaymissionend_script","CODE"},{"rscdiary_playerpos","ARRAY"},{"rscdisplaycustomizecontroller_script","CODE"},{"rscdisplayloading_display","DISPLAY"},{"rscdisplaygameoptions_script","CODE"},{"rscdisplaydedicatedserversettings_script","CODE"},{"rscdisplayarcademap_layout_2_script","CODE"},{"rscdisplayfileselectimage_script","CODE"},{"rscdisplaycommunityguide_script","CODE"},{"rscdisplaygarage_script","CODE"},{"rscdisplaypublishmissionselecttags_script","CODE"},{"rscdisplayinterrupt_script","CODE"},{"rscdisplaymultiplayer","DISPLAY"},{"rscdisplaymain_script","CODE"},{"rscdisplayarcademarker_script","CODE"},{"rscdisplayinsertmarker_script","CODE"},{"rscdisplayconfigureaction_script","CODE"},{"rscdisplayremotemissions_script","CODE"},{"rscdisplaymovieinterrupt_script","CODE"},{"rscunitinfo_script","CODE"},{"rscdisplayfileselect_script","CODE"},{"life_hud_nametags","DISPLAY"},{"rscdisplaydebriefing_script","CODE"},{"rscslingloadassistant_script","CODE"},{"rscdisplaycampaignselect_script","CODE"},{"rsctestcontrolstyles_script","CODE"},{"igui_displays","ARRAY"},{"rscdisplayoptions_script","CODE"},{"rscdisplayhostsettings_script","CODE"},{"rscdisplayoptionslayout_script","CODE"},{"rscdisplaycreatejiraissue_script","CODE"},{"rscadvancedhint_script","CODE"},{"bis_functions_listpreinit","CODE"},{"rscdisplayanimviewer_script","CODE"},{"rscdisplayloading","DISPLAY"},{"rscfiringdrilltime_script","CODE"},{"rscdisplayintel_script","CODE"},{"rscdiary_script","CODE"},{"rscdisplayarcadeunit_script","CODE"},{"rscdisplayavterminal_script","CODE"},{"rscdisplayrespawn_script","CODE"},{"loading_classes","ARRAY"},{"rscdebugconsole_watch","CODE"},{"rscdisplaylogin_script","CODE"},{"rscunitinfo","DISPLAY"},{"bis_functions_list","CODE"},{"rscminimap_script","CODE"},{"rscstatic_script","CODE"},{"rscdisplayloading_ran","SCALAR"},{"rscdiary","DISPLAY"},{"rscdisplayoptionsvideo_script","CODE"},{"rscdisplayconfigurecontrollers_script","CODE"},{"rscdisplayselectisland_script","CODE"},{"rscdisplayvehiclemsgbox_script","CODE"},{"rscdisplaybootcampmsgbox_script","CODE"},{"rscdisplayarcadeeffects_script","CODE"},{"rscdisplaynone_script","CODE"},{"bis_mainmenu_isplayexpanded","BOOL"},{"rscprocedurevisualization_script","CODE"},{"bis_functions_listpostinit","CODE"},{"rscdisplaywelcome_script","CODE"},{"igui_classes","ARRAY"},{"rscdisplaympinterrupt_script","CODE"},{"rscdisplaytemplatesave_script","CODE"},{"gui_classes","ARRAY"},{"rscdisplayremotemissionvoted_script","CODE"},{"rscdisplayhostsettings","DISPLAY"},{"rscdisplayarcadegroup_script","CODE"},{"rscdisplaymultiplayersetupparams_script","CODE"},{"rscdisplayoptionsaudio_script","CODE"},{"rscavcamera_script","CODE"},{"rscdisplayscriptinghelp_script","CODE"},{"rscdisplaymultiplayer_script","CODE"},{"rscspectator_script","CODE"},{"rscdisplayarcadesensor_script","CODE"},{"rscfunctionsviewer_script","CODE"},{"bis_mainmenu_isoptionsexpanded","BOOL"},{"bis_displayinterrupt_isoptionsexpanded","BOOL"},{"rscdisplaypassword_script","CODE"},{"rscdisplaymultiplayersetup_script","CODE"},{"rscdisplayipaddress_script","CODE"},{"rscfiringdrillcheckpoint_script","CODE"},{"rscdisplaycommon_script","CODE"},{"rscmsgbox3_script","CODE"},{"rscdisplaymissionfail_script","CODE"},{"rscdisplaymultiplayersetup","DISPLAY"},{"playerhud","DISPLAY"},{"rscdisplaympinterrupt","DISPLAY"},{"loading_displays","ARRAY"},{"rscdisplayloading_worldtype","STRING"},{"rscdisplaydlccontentbrowser_script","CODE"},{"rscdisplaymain","DISPLAY"},{"rscdisplayfunctionsviewer_script","CODE"},{"rscunitinfo_loop","SCRIPT"},{"rscdisplaypublishmission_script","CODE"},{"rscdisplayinventory_script","CODE"},{"rscdisplaylocweaponinfo_script","CODE"},{"rscestablishingshot_script","CODE"},{"bis_mainmenu_islearnexpanded","BOOL"},{"rscdisplayarcademap_layout_6_script","CODE"},{"rscdisplaymodlauncher_script","CODE"},{"rscdisplayarsenal_script","CODE"},{"rscmsgbox_script","CODE"},{"rscdisplayaar_script","CODE"},{"rsctestcontroltypes_script","CODE"},{"rscdisplaycamera_script","CODE"},{"rscdisplayselectsave_script","CODE"},{"bis_shownchat","BOOL"},{"rscdisplaycustomarcade_script","CODE"},{"rsctilesgroup_script","CODE"},{"rscdisplayloading_script","CODE"},{"rscdisplaypurchasenotification_script","CODE"},{"rscstanceinfo","DISPLAY"},{"bis_initgame","BOOL"},{"rscdisplaystrategicmap_script","CODE"},{"bis_rscdisplayloading_selecteddlcappid","SCALAR"},{"rscnoise_script","CODE"},{"rscnotification_script","CODE"},{"rscmissionstatus_script","CODE"},{"rscdisplayconfigviewer_script","CODE"},{"rscdisplaydebugpublic_script","CODE"},{"rscdiary_playerpostime","SCALAR"},{"rscdisplayarcademodules_script","CODE"},{"rsccommmenuitems_script","CODE"},{"gui_displays","ARRAY"},{"rscdisplaysinglemission_script","CODE"},{"rscdisplaynewuser_script","CODE"},{"rscdisplayloading_last","ARRAY"},{"rscdisplayconfigure_script","CODE"},{"rscdisplayarcademap_script","CODE"},{"rscdisplaycontrolschemes_script","CODE"},{"rscdisplayarcadewaypoint_script","CODE"},{"rscdisplaymission","DISPLAY"},{"rscdisplayinterruptrevert_script","CODE"},{"bis_functions_listrecompile","CODE"},{"life_sql_id","CODE"},{"rscdisplaydebriefing","DISPLAY"},{"rscdisplaymicsensitivityoptions_script","CODE"},{"rscdiary_playeralpha","SCALAR"},{"weapon_shop","STRING"}}; };
3,352.923077
28,516
0.860891
hdvertgaming
b94d49dcbdae512cead5329caef5e01d92c53d84
1,561
cpp
C++
test/module/libs/crypto/signature_test.cpp
laSinteZ/iroha
78f152a85ee2b3b86db7b705831938e96a186c36
[ "Apache-2.0" ]
1
2017-01-15T08:47:16.000Z
2017-01-15T08:47:16.000Z
test/module/libs/crypto/signature_test.cpp
laSinteZ/iroha
78f152a85ee2b3b86db7b705831938e96a186c36
[ "Apache-2.0" ]
1
2017-11-08T02:34:24.000Z
2017-11-08T02:34:24.000Z
test/module/libs/crypto/signature_test.cpp
laSinteZ/iroha
78f152a85ee2b3b86db7b705831938e96a186c36
[ "Apache-2.0" ]
null
null
null
/* Copyright Soramitsu Co., Ltd. 2016 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "common/byteutils.hpp" #include "common/types.hpp" #include "crypto/base64.hpp" #include "cryptography/ed25519_sha3_impl/internal/ed25519_impl.hpp" #include <gtest/gtest.h> using iroha::create_seed; using iroha::create_keypair; using iroha::sign; using iroha::verify; using iroha::stringToBlob; TEST(Signature, sign_data_size) { auto keypair = iroha::create_keypair(); std::string nonce = "c0a5cca43b8aa79eb50e3464bc839dd6fd414fae0ddf928ca23dcebf8a8b8dd0"; auto signature = sign((const unsigned char*)nonce.c_str(), nonce.size(), keypair.pubkey, keypair.privkey); ASSERT_TRUE(verify((const unsigned char*)nonce.c_str(), nonce.size(), keypair.pubkey, signature)); } TEST(Signature, PrintkeyPair) { auto keypair = iroha::create_keypair(); ASSERT_NO_THROW({ std::cout << keypair.pubkey.to_base64() << std::endl; }); ASSERT_NO_THROW({ std::cout << keypair.privkey.to_base64() << std::endl; }); }
33.212766
78
0.736707
laSinteZ
b95319e3fb095934e324df92172559c4ac330c21
5,791
hpp
C++
othello.hpp
jj1guj/dekunobou-gui
59f8e28b138d12abc698bece0475cb3e38f8a66f
[ "MIT" ]
null
null
null
othello.hpp
jj1guj/dekunobou-gui
59f8e28b138d12abc698bece0475cb3e38f8a66f
[ "MIT" ]
null
null
null
othello.hpp
jj1guj/dekunobou-gui
59f8e28b138d12abc698bece0475cb3e38f8a66f
[ "MIT" ]
null
null
null
#include"dekunobou.hpp" #pragma once class Board{ public: int board[8][8];//先手:1, 後手:-1 bool turn=false;//先手ならfalse, 後手ならtrue int point[2];//各手番の獲得枚数{先手, 後手} int flip_limit[8];//縦横斜め8方向どこまでひっくり返していいか //{横(左), 横(右), 縦(上), 縦(下), 右斜め(上), 右斜め(下), 左斜め(上), 左斜め(下)} //序盤・中盤・終盤のどれか //序盤なら0, 中盤なら1, 終盤なら2になる //序盤: 1~20手 //中盤: 21~40手 //終盤: 41~60手 //手数=盤上にある石の個数と定義する(パスは1手と含めない) Board(){init();} void init(){ for(int i=0;i<64;++i)board[i/8][i%8]=0; board[3][3]=-1; board[3][4]=1; board[4][3]=1; board[4][4]=-1; point[0]=2; point[1]=2; } //パスは0~63以外の数字にする int push(int move){ if(0<=move&&move<=63){ int row=move/8,col=move%8; if(board[row][col]!=0)return -1; int fliped=set_flip_limit(row,col);//石を返した枚数 if(fliped==0)return -1; //石を返す board[row][col]=stone[turn]; for(int dir=0;dir<8;++dir){ for(int i=1;i<flip_limit[dir];++i){ board[row+di[dir]*i][col+dj[dir]*i]=stone[turn]; } } //着手後の石の枚数を計算 point[turn]+=fliped+1; point[!turn]-=fliped; } turn=!turn;//手番を反転 return 0; } //パスは0~63以外の数字にする //石を返しながら盤の重みの差分を算出する //手番側は返り値をそのまま足していいが相手側は(返り値-着手した場所の重み)を引かなくてはならない float push_and_eval(int move,float param[param_size]){ float eval_diff=0; if(0<=move&&move<=63){ int row=move/8,col=move%8; if(board[row][col]!=0)return 0; int fliped=set_flip_limit(row,col);//石を返した枚数 if(fliped==0)return 0; //石を返す //ここで差分計算を行う int row_n,col_n; board[row][col]=stone[turn]; eval_diff+=param[8*row+col]; for(int dir=0;dir<8;++dir){ for(int i=1;i<flip_limit[dir];++i){ row_n=row+di[dir]*i; col_n=col+dj[dir]*i; board[row_n][col_n]=stone[turn]; eval_diff+=param[8*row_n+col_n]; } } } turn=!turn;//手番を反転 return eval_diff; } int set_flip_limit(int row,int col){ //ここのループ回数減らしたい //どこまで石を返していいかしらべる //コードもっと短くできる気がする //返せる石の枚数を返り値にする int flip_count=0;//何枚石を返せるか //横左方向 flip_limit[0]=0; for(int i=1;i<=col;++i){ if(board[row][col-i]!=stone[!turn]){ if(board[row][col-i]==stone[turn])flip_limit[0]=i; break; } } if(flip_limit[0]>1)flip_count+=flip_limit[0]-1; //横右方向 flip_limit[1]=0; for(int i=1;i<=7-col;++i){ if(board[row][col+i]!=stone[!turn]){ if(board[row][col+i]==stone[turn])flip_limit[1]=i; break; } } if(flip_limit[1]>1)flip_count+=flip_limit[1]-1; //縦上方向 flip_limit[2]=0; for(int i=1;i<=row;++i){ if(board[row-i][col]!=stone[!turn]){ if(board[row-i][col]==stone[turn])flip_limit[2]=i; break; } } if(flip_limit[2]>1)flip_count+=flip_limit[2]-1; //縦下方向 flip_limit[3]=0; for(int i=1;i<=7-row;++i){ if(board[row+i][col]!=stone[!turn]){ if(board[row+i][col]==stone[turn])flip_limit[3]=i; break; } } if(flip_limit[3]>1)flip_count+=flip_limit[3]-1; //右斜め上方向 flip_limit[4]=0; for(int i=1;i<=std::min(row,7-col);++i){ if(board[row-i][col+i]!=stone[!turn]){ if(board[row-i][col+i]==stone[turn])flip_limit[4]=i; break; } } if(flip_limit[4]>1)flip_count+=flip_limit[4]-1; //右斜め下方向 flip_limit[5]=0; for(int i=1;i<=std::min(7-row,7-col);++i){ if(board[row+i][col+i]!=stone[!turn]){ if(board[row+i][col+i]==stone[turn])flip_limit[5]=i; break; } } if(flip_limit[5]>1)flip_count+=flip_limit[5]-1; //左斜め上方向 flip_limit[6]=0; for(int i=1;i<=std::min(row,col);++i){ if(board[row-i][col-i]!=stone[!turn]){ if(board[row-i][col-i]==stone[turn])flip_limit[6]=i; break; } } if(flip_limit[6]>1)flip_count+=flip_limit[6]-1; //左斜め下方向 flip_limit[7]=0; for(int i=1;i<=std::min(7-row,col);++i){ if(board[row+i][col-i]!=stone[!turn]){ if(board[row+i][col-i]==stone[turn])flip_limit[7]=i; break; } } if(flip_limit[7]>1)flip_count+=flip_limit[7]-1; return flip_count; } private: int stone[2]={1,-1}; //{横(左), 横(右), 縦(上), 縦(下), 右斜め(上), 右斜め(下), 左斜め(上), 左斜め(下)} int di[8]={0,0,-1,1,-1,1,-1,1}; int dj[8]={-1,1,0,0,1,1,-1,-1}; }; class LegalMoveList{ public: LegalMoveList(){} LegalMoveList(Board board){ move_num=0; for(int i=0;i<8;++i)for(int j=0;j<8;++j){ if(board.board[i][j]==0){ board.set_flip_limit(i,j); for(int k=0;k<8;++k){ if(board.flip_limit[k]>1){ movelist[move_num]=8*i+j; ++move_num; break; } } } } } int size(){return move_num;} //添字で合法手を取得 int operator [](int i){ return this->movelist[i]; } private: int movelist[64]; int move_num; };
27.060748
68
0.455534
jj1guj
b953d14922455e7f81492c3ef248f33fd5e0afb4
5,557
cpp
C++
HornSchunckOF/main.cpp
liuyang9609/Optical-Flow
365a6fd8d8e684f255ccefe696157e683256bd61
[ "MIT" ]
null
null
null
HornSchunckOF/main.cpp
liuyang9609/Optical-Flow
365a6fd8d8e684f255ccefe696157e683256bd61
[ "MIT" ]
null
null
null
HornSchunckOF/main.cpp
liuyang9609/Optical-Flow
365a6fd8d8e684f255ccefe696157e683256bd61
[ "MIT" ]
null
null
null
#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include <opencv2/core/core.hpp> #include <opencv2/video.hpp> #include <stdlib.h> #include <stdio.h> #include <iostream> #include "hornSchunck.cpp" #include "plotFlow.cpp" void preprocess(cv::Mat imagePrevRaw, cv::Mat imageNextRaw, cv::Mat &imagePrev, cv::Mat &imageNext) { // Converting RGB to Gray if necessary if (imagePrevRaw.channels() > 1) { cv::cvtColor(imagePrevRaw, imagePrev, cv::COLOR_BGR2GRAY); } else { imagePrevRaw.copyTo(imagePrev); } if (imageNextRaw.channels() > 1) { cv::cvtColor(imageNextRaw, imageNext, cv::COLOR_BGR2GRAY); } else { imageNextRaw.copyTo(imageNext); } } int main(int argc, char* argv[]) { //if(argc < 6){ // std::cout << "Syntax Error - Incorrect Parameter Usage:" << std::endl; // std::cout << "program_name ['image' (or) mp4 input path] [prev image path (or) prev frame number] [next image path (or) next frame number] [save path] [hs (or) fb]" << std::endl; // return 0; //} //std::string inputType = argv[1]; //std::string framePrev = argv[2]; //std::string frameNext = argv[3]; //std::string savePath = argv[4]; //std::string algo = argv[5]; std::string inputType = "image"; std::string framePrev = "img/leftimage/000050_10.png"; std::string frameNext = "img/leftimage/000050_11.png"; std::string savePath = "img/resimage/000050_10.png"; std::string algo = "hs"; // Read input images or video frames based on first input cv::Mat imagePrevRaw, imageNextRaw; if (inputType == "image"){ imagePrevRaw = cv::imread(framePrev); imageNextRaw = cv::imread(frameNext); } else if (inputType.substr(inputType.length() - 4, 4) == ".mp4"){ cv::VideoCapture capture(inputType); capture.set(1, stoi(framePrev)); capture >> imagePrevRaw; capture.set(1, stoi(frameNext)); capture >> imageNextRaw; } else { std::cout << "No image or mp4 input given! Please try again!" << std::endl; return 0; } // Check if files are loaded properly if (!(imagePrevRaw.data) || !(imageNextRaw.data)) { std::cout << "Can't read the images. Please check the path." << std::endl; return -1; } // Check if image sizes are same if ( imagePrevRaw.size() != imageNextRaw.size() ) { std::cout << "Image sizes are different. Please provide images of same size." << std::endl; return -1; } std::cout << "\nInput image details:" << std::endl; std::cout << "Raw Previous Image Size: " << imagePrevRaw.size() << std::endl; std::cout << "Raw Previous Image Channel Size: " << imagePrevRaw.channels() << std::endl; std::cout << "Raw Next Image Size: " << imageNextRaw.size() << std::endl; std::cout << "Raw Next Image Channel Size: " << imageNextRaw.channels() << std::endl << std::endl; cv::imwrite(savePath+"imagePrevRaw.png", imagePrevRaw); cv::imwrite(savePath+"imageNextRaw.png", imageNextRaw); std::cout << "Saved Raw Images in "+savePath << std::endl; cv::Mat imagePrev, imageNext; preprocess(imagePrevRaw, imageNextRaw, imagePrev, imageNext); std::cout << "\nAfter Preprocessing:" << std::endl; std::cout << "Previous Image Size: " << imagePrev.size() << std::endl; std::cout << "Previous Image Channel Size: " << imagePrev.channels() << std::endl; std::cout << "Next Image Size: " << imageNext.size() << std::endl; std::cout << "Next Image Channel Size: " << imageNext.channels() << std::endl << std::endl; if (algo == "hs"){ // calculate optical flow using Horn Schunck Algorithm cv::Mat u, v; int windowSize = 5; //TBD if needed add as arguments int maxIterations = 100; //TBD if needed add as arguments double alpha = 1; //TBD if needed add as arguments hornSchunck hs = hornSchunck(windowSize, maxIterations, alpha); hs.getFlow(imagePrev, imageNext, u, v); cv::FileStorage file_1(savePath+"uMatrixHS.txt", cv::FileStorage::WRITE); file_1 << "u matrix" << u; cv::FileStorage file_2(savePath+"vMatrixHS.txt", cv::FileStorage::WRITE); file_2 << "v matrix" << v; plotFlow pf = plotFlow(imagePrevRaw, savePath+"hs"); pf.plotBresenhamLine(u, v, 20, 20, 5); //plotLine(imagePrevRaw, u, v, 20, 20, savePath+"hs", 5); std::cout << "Saved HS Algorithm Results in "+savePath << std::endl; } else if (algo == "fb"){ // Calculate optical flow using Opencv : Gunnar-Farneback Algorithm cv::Mat flow(imagePrev.size(), CV_32FC2); cv::calcOpticalFlowFarneback(imagePrev, imageNext, flow, 0.5, 3, 15, 3, 5, 1.2, 0); cv::Mat flow_parts[2]; split(flow, flow_parts); cv::FileStorage file_3(savePath+"uMatrixFB.txt", cv::FileStorage::WRITE); file_3 << "u matrix" << flow_parts[0]; cv::FileStorage file_4(savePath+"vMatrixFB.txt", cv::FileStorage::WRITE); file_4 << "v matrix" << flow_parts[1]; plotFlow pf = plotFlow(imagePrevRaw, savePath+"fb"); pf.plotBresenhamLine(flow_parts[1], flow_parts[0], 20, 300, 5); std::cout << "Saved FB Algorithm Results in "+savePath << std::endl; } else{ std::cout << "Currently only hs (Horn Schunck) and fb (Gunnar-Farneback) algorithm are supported!" << std::endl; return 0; } //cv::waitKey(0); return 0; }
42.419847
188
0.61526
liuyang9609
b954bdc2c6521127f198490c8bac38797f2b8022
2,709
cc
C++
packages/solver/Solver.cc
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
2
2020-04-13T20:06:41.000Z
2021-02-12T17:55:54.000Z
packages/solver/Solver.cc
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
1
2018-10-22T21:03:35.000Z
2018-10-22T21:03:35.000Z
packages/solver/Solver.cc
brbass/ibex
5a4cc5b4d6d46430d9667970f8a34f37177953d4
[ "MIT" ]
3
2019-04-03T02:15:37.000Z
2022-01-04T05:50:23.000Z
#include "Solver.hh" #include <iomanip> #include <iostream> #include <string> #include "Check.hh" #include "XML_Node.hh" using namespace std; Solver:: Solver(int solver_print, Solver::Type type): solver_print_(solver_print) { } void Solver:: print_name(string solution_type) const { if (solver_print_) { cout << endl; cout << "\t\t*******************************************************"; cout << endl; cout << "\t\t***** " << solution_type; cout << endl; cout << "\t\t*******************************************************"; cout << endl; } } void Solver:: print_iteration(int iteration) const { if (solver_print_) { cout << "\t\titer:\t"; cout << iteration; cout << "\t"; } } void Solver:: print_convergence() const { if (solver_print_) { cout << endl; cout << "\t\tConverged"; cout << endl; } } void Solver:: print_failure() const { if (solver_print_) { cout << endl; cout << "\t\tFailed to converge"; cout << endl; } } void Solver:: print_value(double value) const { if (solver_print_) { cout << "value:\t"; cout << value; cout << "\t"; } } void Solver:: print_error(double error) const { if (solver_print_) { cout << "error:\t"; cout << error; cout << endl; } } void Solver:: print_eigenvalue(double eigenvalue) const { if (solver_print_) { cout << endl; cout << "\t\tk_eigenvalue:\t"; cout << setprecision(10); cout << eigenvalue; cout << endl; } } void Solver:: output_result(XML_Node output_node, shared_ptr<Result> result) const { output_node.set_child_value(result->total_iterations, "total_iterations"); output_node.set_child_value(result->inverse_iterations, "inverse_iterations"); output_node.set_child_vector(result->coefficients, "coefficients", "node-group-moment-point"); XML_Node phi_node = output_node.append_child("values"); for (vector<double> const &phi : result->phi) { phi_node.set_child_vector(phi, "phi", "node-group-moment-point"); } if (result->source_iterations != -1) { output_node.set_child_value(result->source_iterations, "source_iterations"); } if (result->k_eigenvalue != -1) { output_node.set_child_value(result->k_eigenvalue, "k_eigenvalue"); } }
20.838462
78
0.515319
brbass
b9596c0b297c3d1ebcbe965b3f613534700bcdd2
1,061
cc
C++
cc/modules/tracking/Trackers/TrackerMedianFlow.cc
mstallmo/opencv4nodejs
5ab4fcb17c39c4a16f77c8de8c29dc357532d9cb
[ "MIT" ]
1
2018-05-07T13:03:20.000Z
2018-05-07T13:03:20.000Z
cc/modules/tracking/Trackers/TrackerMedianFlow.cc
goldyraj/facerecognition
9b0820135eb8cdaf783b3d560695bfb324083270
[ "MIT" ]
null
null
null
cc/modules/tracking/Trackers/TrackerMedianFlow.cc
goldyraj/facerecognition
9b0820135eb8cdaf783b3d560695bfb324083270
[ "MIT" ]
1
2020-02-18T06:44:04.000Z
2020-02-18T06:44:04.000Z
#ifdef HAVE_TRACKING #include "TrackerMedianFlow.h" Nan::Persistent<v8::FunctionTemplate> TrackerMedianFlow::constructor; NAN_MODULE_INIT(TrackerMedianFlow::Init) { v8::Local<v8::FunctionTemplate> ctor = Nan::New<v8::FunctionTemplate>(TrackerMedianFlow::New); v8::Local<v8::ObjectTemplate> instanceTemplate = ctor->InstanceTemplate(); Tracker::Init(ctor); constructor.Reset(ctor); ctor->SetClassName(FF_NEW_STRING("TrackerMedianFlow")); instanceTemplate->SetInternalFieldCount(1); target->Set(FF_NEW_STRING("TrackerMedianFlow"), ctor->GetFunction()); }; NAN_METHOD(TrackerMedianFlow::New) { FF_METHOD_CONTEXT("TrackerMedianFlow::New"); TrackerMedianFlow* self = new TrackerMedianFlow(); cv::TrackerMedianFlow::Params params; if (FF_HAS_ARG(0) && FF_IS_INT(info[0])) { params.pointsInGrid = info[0]->Int32Value(); } #if CV_VERSION_MINOR > 2 self->tracker = cv::TrackerMedianFlow::create(params); #else self->tracker = cv::TrackerMedianFlow::createTracker(params); #endif self->Wrap(info.Holder()); FF_RETURN(info.Holder()); }; #endif
27.205128
95
0.756833
mstallmo
b95c1f59d925472219d937d6ae88ddd65ea5a1d0
2,236
cpp
C++
server/src/http_msg_server/HttpConn.cpp
xiaominfc/TeamTalk
20084010a9804d1ff0ed7bb5924fde7041b952eb
[ "Apache-2.0" ]
65
2017-11-18T15:43:56.000Z
2022-01-30T08:07:11.000Z
server/src/http_msg_server/HttpConn.cpp
xiaominfc/TeamTalk
20084010a9804d1ff0ed7bb5924fde7041b952eb
[ "Apache-2.0" ]
3
2018-09-04T14:27:45.000Z
2020-10-29T07:22:45.000Z
server/src/http_msg_server/HttpConn.cpp
xiaominfc/TeamTalk
20084010a9804d1ff0ed7bb5924fde7041b952eb
[ "Apache-2.0" ]
36
2018-07-10T04:21:08.000Z
2021-11-09T07:21:10.000Z
/* * HttpConn.cpp * * Created on: 2013-9-29 * Author: ziteng@mogujie.com */ #include "HttpConn.h" #include "HttpParserWrapper.h" #include "HttpQuery.h" static HttpConnMap_t g_http_conn_map; // conn_handle 从0开始递增,可以防止因socket handle重用引起的一些冲突 static uint32_t g_conn_handle_generator = 0; CHttpConn* FindHttpConnByHandle(uint32_t conn_handle) { CHttpConn* pConn = NULL; HttpConnMap_t::iterator it = g_http_conn_map.find(conn_handle); if (it != g_http_conn_map.end()) { pConn = it->second; } return pConn; } void http_conn_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam) { (void)callback_data; (void)msg; (void)handle; (void)pParam; CHttpConn* pConn = NULL; HttpConnMap_t::iterator it, it_old; uint64_t cur_time = get_tick_count(); for (it = g_http_conn_map.begin(); it != g_http_conn_map.end(); ) { it_old = it; it++; pConn = it_old->second; pConn->OnTimer(cur_time); } } void init_http_conn() { netlib_register_timer(http_conn_timer_callback, NULL, 1000); } ////////////////////////// CHttpConn::CHttpConn() { m_state = CONN_STATE_IDLE; m_conn_handle = ++g_conn_handle_generator; if (m_conn_handle == 0) { m_conn_handle = ++g_conn_handle_generator; } } CHttpConn::~CHttpConn() { //log("~CHttpConn, handle=%u ", m_conn_handle); } void CHttpConn::Close() { CImConn::Close(); if (m_state != CONN_STATE_CLOSED) { m_state = CONN_STATE_CLOSED; g_http_conn_map.erase(m_conn_handle); ReleaseRef(); } } void CHttpConn::OnConnect(CBaseSocket* socket) { CImConn::OnConnect(socket); m_state = CONN_STATE_CONNECTED; g_http_conn_map.insert(make_pair(m_conn_handle, this)); } void CHttpConn::HandleData(){ printf("HandeData\n"); HandleWork(); } void CHttpConn::HandleWork(){ // 每次请求对应一个HTTP连接,所以读完数据后,不用在同一个连接里面准备读取下个请求 char* in_buf = (char*)m_in_buf.GetBuffer(); uint32_t buf_len = m_in_buf.GetWriteOffset(); in_buf[buf_len] = '\0'; log("OnRead, buf_len=%u, conn_handle=%u\n", buf_len, m_conn_handle); // for debug } void CHttpConn::OnTimer(uint64_t curr_tick) { if (curr_tick > m_last_recv_tick + HTTP_CONN_TIMEOUT) { log("HttpConn timeout, handle=%d ", m_conn_handle); Close(); } } void CHttpConn::OnWriteCompelete() { Close(); }
19.443478
94
0.713327
xiaominfc
b95c223b7d35bd403d256be906466f45a295a0be
3,422
cpp
C++
TheGame/AIPlayer.cpp
dynamiquel/The-Game
d9ae1499ea514260e4d47dac85893aea8891a2cf
[ "MIT" ]
null
null
null
TheGame/AIPlayer.cpp
dynamiquel/The-Game
d9ae1499ea514260e4d47dac85893aea8891a2cf
[ "MIT" ]
null
null
null
TheGame/AIPlayer.cpp
dynamiquel/The-Game
d9ae1499ea514260e4d47dac85893aea8891a2cf
[ "MIT" ]
null
null
null
#include "AIPlayer.h" #include "Utilities.h" #include <iostream> short selectedPile = -1; AIPlayer::AIPlayer() { isAI = true; completed = false; } // Asks the user to choose a card and returns its index. short& AIPlayer::ChooseCard(const PlayPile* playPiles) { std::cout << "\n\n Choose the card you want to play (the number in the brackets) or enter \"0\" to end your turn: "; // The max difference the player's card and the play pile's card can have in order to play the card. // Start at 1 = highest chance of choosing best card. short maxDifference = 1; // Chooses a random card to start at. short startCardIndex = rand() % GetHandSize(); short lowestDifference = SHRT_MAX; short lowestDifferencePileIndex = -1; while (true) { short currentCardIndex = startCardIndex; while (true) { // For every play pile... for (short i = 0; i < 4; i++) { // Calculates the difference between the current card and the top card of the current play pile. short currentDifference = std::abs(hand[currentCardIndex] - playPiles[i].topCard); // Debugging /* printf("\nCurrent card: %d", hand[currentCardIndex]); printf("\nCurrent card index: %d", currentCardIndex); printf("\nTop card: %d", playPiles[i].topCard); printf("\nCurrent difference: %d", currentDifference); printf("\nLowest difference: %d", lowestDifference); printf("\nMax difference: %d\n", maxDifference); */ // If the difference between the current card and play pile is <= the max difference, // check if the difference is the lowest one yet and can be played. // If so, update the lowest values to the current values. if (currentDifference <= maxDifference) if (currentDifference < lowestDifference && playPiles[i].CanDeposit(hand[currentCardIndex])) { lowestDifference = currentDifference; lowestDifferencePileIndex = i; } } // If the lowest difference is less than the max difference threshold, play the current card and store the // play pile index for later. if (lowestDifference <= maxDifference) { selectedPile = lowestDifferencePileIndex; return currentCardIndex; } // The current card can't be played in any play piles with the max difference threshold, // so choose the next card. if (currentCardIndex++ >= GetHandSize() - 1) currentCardIndex = 0; // If we have looped back to start card, break the loop so we can increase the difference and try again. if (currentCardIndex == startCardIndex) break; } // Since no cards can be played with the given range, increase the max difference and check again. // 1 = will always choose the lowest card possible. Increase to make the AI 'dumber' and rely more on luck, and increase performance. maxDifference += 1; // Breaks the loop if for some reason the AI can't play their cards. // This should never happen as the CanPlay() method should give the AI a defeat before their turn. if (maxDifference > 98) break; } // Return -1 to end the turn. short endTurn = -1; return endTurn; } // Asks the user to choose a play pile and returns its index. short& AIPlayer::ChoosePile() { std::cout << "\n\n Choose the play pile you want to put your card in (the number in the brackets) or enter \"0\" to end your turn: "; // Returns the pile index that was calculated when the AI chose their card. return selectedPile; }
33.881188
135
0.696084
dynamiquel
b95d6f064af5c8480c038d9d11495ca23744a531
880
hpp
C++
leviathan_config.hpp
bkovacev/levd
f942946f4db7f8c2bad14c5c7025ac303855ced7
[ "MIT" ]
1
2020-04-23T11:28:55.000Z
2020-04-23T11:28:55.000Z
leviathan_config.hpp
bkovacev/levd
f942946f4db7f8c2bad14c5c7025ac303855ced7
[ "MIT" ]
null
null
null
leviathan_config.hpp
bkovacev/levd
f942946f4db7f8c2bad14c5c7025ac303855ced7
[ "MIT" ]
1
2020-04-23T11:28:59.000Z
2020-04-23T11:28:59.000Z
#ifndef LEVIATHAN_CONFIG_H #define LEVIATHAN_CONFIG_H #include <functional> #include <map> #include <string> #define DEFAULT_RED 0xFF0000 using LineFunction = std::function<int32_t(int32_t)>; enum class TempSource { CPU, LIQUID }; inline TempSource stringToTempSource(const std::string &tss) { return tss == "liquid" ? TempSource::LIQUID : TempSource::CPU; } struct Point { int32_t x; int32_t y; Point(int32_t __x, int32_t __y) : x(__x), y(__y) {} }; struct leviathan_config { // Fan/pump profile TempSource temp_source_{TempSource::CPU}; std::map<int32_t, LineFunction> fan_profile_; std::map<int32_t, LineFunction> pump_profile_; // Color settings uint32_t main_color_{DEFAULT_RED}; // Interval settings uint32_t interval_{500}; }; leviathan_config parse_config_file(const char *const path); #endif // LEVIATHAN_CONFIG_H
22
64
0.723864
bkovacev
b95e4da83dbb91e93edd8e4aac66d3e4a766fba1
2,281
hpp
C++
cpp/subprojects/common/include/common/rule_refinement/rule_refinement_exact.hpp
Waguy02/Boomer-Scripted
b06bb9213d64dca0c05d41701dea12666931618c
[ "MIT" ]
8
2020-06-30T01:06:43.000Z
2022-03-14T01:58:29.000Z
cpp/subprojects/common/include/common/rule_refinement/rule_refinement_exact.hpp
Waguy02/Boomer-Scripted
b06bb9213d64dca0c05d41701dea12666931618c
[ "MIT" ]
3
2020-12-14T11:30:18.000Z
2022-02-07T06:31:51.000Z
cpp/subprojects/common/include/common/rule_refinement/rule_refinement_exact.hpp
Waguy02/Boomer-Scripted
b06bb9213d64dca0c05d41701dea12666931618c
[ "MIT" ]
4
2020-06-24T08:45:00.000Z
2021-12-23T21:44:51.000Z
/* * @author Michael Rapp (michael.rapp.ml@gmail.com) */ #pragma once #include "common/rule_refinement/rule_refinement.hpp" #include "common/rule_refinement/rule_refinement_callback.hpp" #include "common/input/feature_vector.hpp" #include "common/sampling/weight_vector.hpp" /** * Allows to find the best refinements of existing rules, which result from adding a new condition that correspond to a * certain feature. The thresholds that may be used by the new condition result from the feature values of all training * examples for the respective feature. * * @tparam T The type of the vector that provides access to the indices of the labels for which the refined rule is * allowed to predict */ template<typename T> class ExactRuleRefinement final : public IRuleRefinement { private: const T& labelIndices_; uint32 numExamples_; uint32 featureIndex_; bool nominal_; std::unique_ptr<IRuleRefinementCallback<FeatureVector, IWeightVector>> callbackPtr_; std::unique_ptr<Refinement> refinementPtr_; public: /** * @param labelIndices A reference to an object of template type `T` that provides access to the indices of * the labels for which the refined rule is allowed to predict * @param numExamples The total number of training examples with non-zero weights that are covered by the * existing rule * @param featureIndex The index of the feature, the new condition corresponds to * @param nominal True, if the feature at index `featureIndex` is nominal, false otherwise * @param callbackPtr An unique pointer to an object of type `IRuleRefinementCallback` that allows to * retrieve a feature vector for the given feature */ ExactRuleRefinement(const T& labelIndices, uint32 numExamples, uint32 featureIndex, bool nominal, std::unique_ptr<IRuleRefinementCallback<FeatureVector, IWeightVector>> callbackPtr); void findRefinement(const AbstractEvaluatedPrediction* currentHead) override; std::unique_ptr<Refinement> pollRefinement() override; };
40.017544
120
0.686541
Waguy02
b960346296df837f5bb142b511be996fe5036985
962
cpp
C++
source/LeetCode/DynamicPlaning/MaxSumofSubarray.cpp
Mas9uerade/Mas9uerade.github.io
9cc273313fc1360daff57fe16dd1a60fe910259d
[ "Apache-2.0" ]
1
2018-04-14T03:43:27.000Z
2018-04-14T03:43:27.000Z
source/LeetCode/DynamicPlaning/MaxSumofSubarray.cpp
Mas9uerade/Mas9uerade.github.io
9cc273313fc1360daff57fe16dd1a60fe910259d
[ "Apache-2.0" ]
null
null
null
source/LeetCode/DynamicPlaning/MaxSumofSubarray.cpp
Mas9uerade/Mas9uerade.github.io
9cc273313fc1360daff57fe16dd1a60fe910259d
[ "Apache-2.0" ]
null
null
null
int maxsumofSubarray(vector<int>& arr) { if (arr.size() == 0) { return 0; } if (arr.size() == 1) { return arr[0]; } int max = arr[0]; int end_index = 0; int relink_cost = 0; for (int i = 1; i < arr.size(); ++i) { //判断是否可以续链 if (end_index == i - 1) { //判断取 arr[i] 与 max + arr[i] 与 max 的最大值,若取max 则不续链 if (max > arr[i] && max > max + arr[i]) { max = max; //此时已经断链了,需要增加relink_cost relink_cost += arr[i]; } else { end_index = i; //如果单取一个元素大于之前的累加,则单取元素 if (arr[i] >= max + arr[i]) { max = arr[i]; } else { max = arr[i] + max; } } } //若不可续链,则判断arr[i] 与 max 的最大值 else { if (arr[i] >= max) { max = arr[i]; end_index = i; relink_cost = 0; } else { relink_cost += arr[i]; //接链收益大,则接链 if (relink_cost + max >= max) { max = relink_cost + max; end_index = i; relink_cost = 0; } } } } return max; }
15.03125
52
0.480249
Mas9uerade
b964bde2b0c0f2b8af2150a123a317efdcadb4ed
3,227
cc
C++
src/xenia/base/filesystem.cc
cloudhaacker/xenia
54b211ed1885cdfb9ef6d74e60f7e615aaf56d45
[ "BSD-3-Clause" ]
16
2018-06-23T19:49:55.000Z
2021-12-29T01:29:28.000Z
src/xenia/base/filesystem.cc
cloudhaacker/xenia
54b211ed1885cdfb9ef6d74e60f7e615aaf56d45
[ "BSD-3-Clause" ]
1
2017-10-01T08:53:46.000Z
2017-11-11T01:47:23.000Z
src/xenia/base/filesystem.cc
cloudhaacker/xenia
54b211ed1885cdfb9ef6d74e60f7e615aaf56d45
[ "BSD-3-Clause" ]
15
2018-07-12T22:36:01.000Z
2020-10-25T15:51:08.000Z
/** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2015 Ben Vanik. All rights reserved. * * Released under the BSD license - see LICENSE in the root for more details. * ****************************************************************************** */ #include "xenia/base/filesystem.h" #include <algorithm> namespace xe { namespace filesystem { std::string CanonicalizePath(const std::string& original_path) { char path_sep(xe::kPathSeparator); std::string path(xe::fix_path_separators(original_path, path_sep)); std::vector<std::string::size_type> path_breaks; std::string::size_type pos(path.find_first_of(path_sep)); std::string::size_type pos_n(std::string::npos); while (pos != std::string::npos) { if ((pos_n = path.find_first_of(path_sep, pos + 1)) == std::string::npos) { pos_n = path.size(); } auto diff(pos_n - pos); switch (diff) { case 0: pos_n = std::string::npos; break; case 1: // Duplicate separators. path.erase(pos, 1); pos_n -= 1; break; case 2: // Potential marker for current directory. if (path[pos + 1] == '.') { path.erase(pos, 2); pos_n -= 2; } else { path_breaks.push_back(pos); } break; case 3: // Potential marker for parent directory. if (path[pos + 1] == '.' && path[pos + 2] == '.') { if (path_breaks.empty()) { // Ensure we don't override the device name. std::string::size_type loc(path.find_first_of(':')); auto req(pos + 3); if (loc == std::string::npos || loc > req) { path.erase(0, req); pos_n -= req; } else { path.erase(loc + 1, req - (loc + 1)); pos_n -= req - (loc + 1); } } else { auto last(path_breaks.back()); auto last_diff((pos + 3) - last); path.erase(last, last_diff); pos_n = last; // Also remove path reference. path_breaks.erase(path_breaks.end() - 1); } } else { path_breaks.push_back(pos); } break; default: path_breaks.push_back(pos); break; } pos = pos_n; } // Remove trailing seperator. if (!path.empty() && path.back() == path_sep) { path.erase(path.size() - 1); } // Final sanity check for dead paths. if ((path.size() == 1 && (path[0] == '.' || path[0] == path_sep)) || (path.size() == 2 && path[0] == '.' && path[1] == '.')) { return ""; } return path; } bool CreateParentFolder(const std::wstring& path) { auto fixed_path = xe::fix_path_separators(path, xe::kWPathSeparator); auto base_path = xe::find_base_path(fixed_path, xe::kWPathSeparator); if (!PathExists(base_path)) { return CreateFolder(base_path); } else { return true; } } } // namespace filesystem } // namespace xe
29.072072
79
0.494267
cloudhaacker
b96ae03b0c0f89cc38d87ca59a7f9310533ba2d9
1,426
hpp
C++
dxlibex/type_traits/is_well_format.hpp
Nagarei/DxLibEx
650fd0dad2cd1625d04f009faa649e8e9ffa0e1b
[ "BSL-1.0" ]
32
2015-10-19T15:51:15.000Z
2021-08-06T05:51:28.000Z
dxlibex/type_traits/is_well_format.hpp
Nagarei/DxLibEx
650fd0dad2cd1625d04f009faa649e8e9ffa0e1b
[ "BSL-1.0" ]
92
2015-10-17T12:20:53.000Z
2020-08-12T13:34:21.000Z
dxlibex/type_traits/is_well_format.hpp
Nagarei/DxLibEx
650fd0dad2cd1625d04f009faa649e8e9ffa0e1b
[ "BSL-1.0" ]
6
2016-05-09T03:23:18.000Z
2020-04-08T05:57:43.000Z
/*============================================================================= Copyright (C) 2015-2017 DxLibEx project https://github.com/Nagarei/DxLibEx/ Distributed under the Boost Software License, Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef DXLE_INC_TYPE_TRAITS_IS_WELL_FORMAT_HPP_ #define DXLE_INC_TYPE_TRAITS_IS_WELL_FORMAT_HPP_ #include <type_traits> #include "enable_if.hpp" namespace dxle { //!inline namespace type_traits { template<typename T, typename = nullptr_t> struct has_operator_notequal_to_zero_impl : std::false_type {}; template<typename T> struct has_operator_notequal_to_zero_impl < T, enable_if_t<ignore_type<decltype(std::declval<T>() != 0)>::value, nullptr_t>> : std::true_type {}; template<typename T> struct has_operator_notequal_to_zero : has_operator_notequal_to_zero_impl<T> {}; template<typename T, typename = nullptr_t> struct has_operator_notequal_to_this_impl : std::false_type {}; template<typename T> struct has_operator_notequal_to_this_impl < T, enable_if_t<ignore_type<decltype(std::declval<T>() != std::declval<T>())>::value, nullptr_t>> : std::true_type {}; template<typename T> struct has_operator_notequal_to_this : has_operator_notequal_to_this_impl<T> {}; }//namespace using namespace type_traits; } #endif //DXLE_INC_TYPE_TRAITS_IS_WELL_FORMAT_HPP_
39.611111
141
0.699158
Nagarei
b96d7fcdda2914cc2d368bbb6387f461defad275
2,632
cpp
C++
code/engine.vc2008/xrScripts/lopen.cpp
icetorch2001/xray-oxygen
8c210ac2824f794cea69266048fe12d584ee3f04
[ "Apache-2.0" ]
1
2021-09-14T14:28:56.000Z
2021-09-14T14:28:56.000Z
code/engine.vc2008/xrScripts/lopen.cpp
ArtemGen/xray-oxygen
f62d3e1f4e211986c057fd37e97fd03c98b5e275
[ "Apache-2.0" ]
null
null
null
code/engine.vc2008/xrScripts/lopen.cpp
ArtemGen/xray-oxygen
f62d3e1f4e211986c057fd37e97fd03c98b5e275
[ "Apache-2.0" ]
3
2021-11-01T06:21:26.000Z
2022-01-08T16:13:23.000Z
// file: lopen.cpp // func: Open lua modules-namespace // author: ForserX #include "stdafx.h" #include "luaopen.hpp" extern "C" { extern const struct luaL_Reg funcs[]; int luaopen_LuaXML_lib(lua_State* L); int luaopen_lfs(lua_State *L); } int lopen::luaopen_ext(lua_State *L) { luaL_openlib(L, "mrsh", funcs, 0); luaopen_LuaXML_lib(L); luaopen_lfs(L); return 1; } #ifndef DEBUG void lopen::put_function(lua_State* state, u8 const* buffer, u32 const buffer_size, const char* package_id) { lua_getglobal(state, "package"); lua_pushstring(state, "preload"); lua_gettable(state, -2); lua_pushstring(state, package_id); luaL_loadbuffer(state, (char*)buffer, buffer_size, package_id); lua_settable(state, -3); } #endif void lopen::open_lib(lua_State *L, LPCSTR module_name, lua_CFunction function) { lua_pushcfunction(L, function); lua_pushstring(L, module_name); lua_call(L, 1, 0); } void lopen::open_luaicp(lua_State* Ls) { const HMODULE hLib = GetModuleHandle("luaicp.dll"); if (hLib) { Msg("Lua Interceptor found! Attaching :)"); typedef void(WINAPI *LUA_CAPTURE)(lua_State *L); LUA_CAPTURE ExtCapture = (LUA_CAPTURE)GetProcAddress(hLib, "ExtCapture"); if (ExtCapture) ExtCapture(Ls); else Msg("ExtCapture proc not found in luaicp.dll"); } } static int report(lua_State *L, int status) { if (status && !lua_isnil(L, -1)) { const char *msg = lua_tostring(L, -1); if (!msg) msg = "(error object is not a string)"; Msg("! [LUA_JIT] %s", msg); lua_pop(L, 1); } return status; } static int loadjitmodule(lua_State *L, const char *notfound) { lua_getglobal(L, "require"); lua_pushliteral(L, "jit."); lua_pushvalue(L, -3); lua_concat(L, 2); if (lua_pcall(L, 1, 1, 0)) { const char *msg = lua_tostring(L, -1); if (msg && !strncmp(msg, "module ", 7)) { Msg("! [LUA_JIT] %s", notfound); return 1; } else return report(L, 1); } lua_getfield(L, -1, "start"); lua_remove(L, -2); /* drop module table */ return 0; } SCRIPT_API int dojitcmd(lua_State *L, const char *cmd) { const char *val = strchr(cmd, '='); lua_pushlstring(L, cmd, val ? val - cmd : xr_strlen(cmd)); lua_getglobal(L, "jit"); /* get jit.* table */ lua_pushvalue(L, -2); lua_gettable(L, -2); /* lookup library function */ if (!lua_isfunction(L, -1)) { lua_pop(L, 2); /* drop non-function and jit.* table, keep module name */ if (loadjitmodule(L, "unknown luaJIT command")) return 1; } else { lua_remove(L, -2); /* drop jit.* table */ } lua_remove(L, -2); /* drop module name */ if (val) lua_pushstring(L, val + 1); return report(L, lua_pcall(L, val ? 1 : 0, 0, 0)); }
23.927273
107
0.666033
icetorch2001
b96d84fed3140b04a6fae66ee9a9de76838e53f3
1,605
cpp
C++
test/src/physics/collision/narrowphase/algorithm/gjk/GJKConvexObjectTest.cpp
petitg1987/urchinEngine
a14a57ac49a19237d748d2eafc7c2a38a45b95d6
[ "BSL-1.0" ]
18
2020-06-12T00:04:46.000Z
2022-01-11T14:56:19.000Z
test/src/physics/collision/narrowphase/algorithm/gjk/GJKConvexObjectTest.cpp
petitg1987/urchinEngine
a14a57ac49a19237d748d2eafc7c2a38a45b95d6
[ "BSL-1.0" ]
null
null
null
test/src/physics/collision/narrowphase/algorithm/gjk/GJKConvexObjectTest.cpp
petitg1987/urchinEngine
a14a57ac49a19237d748d2eafc7c2a38a45b95d6
[ "BSL-1.0" ]
6
2020-08-16T15:58:41.000Z
2022-03-05T13:17:50.000Z
#include <cppunit/TestSuite.h> #include <cppunit/TestCaller.h> #include <memory> #include <UrchinCommon.h> #include <UrchinPhysicsEngine.h> #include <AssertHelper.h> #include <physics/collision/narrowphase/algorithm/gjk/GJKConvexObjectTest.h> #include <physics/collision/narrowphase/algorithm/gjk/GJKTestHelper.h> using namespace urchin; void GJKConvexObjectTest::separateSphereAndBox() { CollisionSphereObject sphere(1.0f, Point3<float>(0.0f, 0.0f, 0.0f)); CollisionBoxObject aabbox(0.0f, Vector3<float>(0.5f, 0.5f, 0.5f), Point3<float>(1.6f, 0.5f, 0.5f), Quaternion<float>()); std::shared_ptr<GJKResult<float>> result = GJKTestHelper::executeGJK(sphere, aabbox); AssertHelper::assertTrue(!result->isCollide()); AssertHelper::assertFloatEquals(result->getSeparatingDistance(), 0.1f); } void GJKConvexObjectTest::overlapSphereAndBox() { CollisionSphereObject sphere(1.0f, Point3<float>(0.0f, 0.0f, 0.0f)); CollisionBoxObject aabbox(0.0f, Vector3<float>(0.5f, 0.5f, 0.5f), Point3<float>(1.4f, 0.5f, 0.5f), Quaternion<float>()); std::shared_ptr<GJKResult<float>> result = GJKTestHelper::executeGJK(sphere, aabbox); AssertHelper::assertTrue(result->isCollide()); } CppUnit::Test* GJKConvexObjectTest::suite() { auto* suite = new CppUnit::TestSuite("GJKConvexObjectTest"); suite->addTest(new CppUnit::TestCaller<GJKConvexObjectTest>("separateSphereAndBox", &GJKConvexObjectTest::separateSphereAndBox)); suite->addTest(new CppUnit::TestCaller<GJKConvexObjectTest>("overlapSphereAndBox", &GJKConvexObjectTest::overlapSphereAndBox)); return suite; }
41.153846
133
0.751402
petitg1987
b9712383dac34c4a5f56a13032aa1a4da2c1826b
24,782
cpp
C++
src/server/Xml/XmlLibrary.cpp
anewholm/generalserver
99321562921c317f1ef14a2b84abfe91f0f871b6
[ "X11" ]
null
null
null
src/server/Xml/XmlLibrary.cpp
anewholm/generalserver
99321562921c317f1ef14a2b84abfe91f0f871b6
[ "X11" ]
null
null
null
src/server/Xml/XmlLibrary.cpp
anewholm/generalserver
99321562921c317f1ef14a2b84abfe91f0f871b6
[ "X11" ]
null
null
null
//platform agnostic file #include "Xml/XmlLibrary.h" #include "Repository.h" #include "Xml/XmlNamespace.h" #include "IXml/IXslNode.h" #include "IXml/IXmlGrammarContext.h" #include "Debug.h" #include "Utilities/strtools.h" #include <string.h> #include <sstream> using namespace std; //Abstract Factory Method: http://en.wikipedia.org/wiki/Abstract_factory_pattern namespace general_server { XmlLibrary::XmlLibrary(const IMemoryLifetimeOwner *pMemoryLifetimeOwner): MemoryLifetimeOwner(pMemoryLifetimeOwner) { //http://man7.org/linux/man-pages/man3/strptime.3.html //DATE_FORMATS_COUNT = 6 m_aDateFormats[0] = "%s"; //1430316435 (seconds since epoch time-stamp) m_aDateFormats[1] = DATE_FORMAT_XML; //2015-09-28T12:34:54+00:00 m_aDateFormats[2] = DATE_FORMAT_RFC822; //Sun, 06 Nov 1994 08:49:37 GMT (RFC 822, updated by RFC 1123) m_aDateFormats[3] = DATE_FORMAT_RFC850; //Sunday, 06-Nov-94 08:49:37 GMT (RFC 850, obsoleted by RFC 1036) m_aDateFormats[4] = DATE_FORMAT_ANSI; //Sun Nov 6 08:49:37 1994 (ANSI C's asctime() format) m_aDateFormats[5] = "%A"; //Monday } XmlLibrary::~XmlLibrary() { XmlHasNamespaceDefinitions::freeStandardNamespaceDefinitions(); } const char *XmlLibrary::toString() const { stringstream sOut; const char *sName = name(); sOut << "XML Library [" << sName << "]:\n"; sOut << " whichSecurityImplementation: " << whichSecurityImplementation() << "\n"; sOut << " canHardLink: " << canHardLink() << "\n"; sOut << " canSoftLink: " << canSoftLink() << "\n"; sOut << " canTransform: " << canTransform() << "\n"; sOut << " supportsXmlID: " << supportsXmlID() << "\n"; sOut << " supportsXmlRefs: " << supportsXmlRefs() << "\n"; sOut << " isNativeXML: " << isNativeXML() << "\n"; sOut << " acceptsNodeParamsForTransform: " << acceptsNodeParamsForTransform() << "\n"; sOut << " canUpdateGlobalVariables: " << canUpdateGlobalVariables() << "\n"; sOut << " hasNameAxis: " << hasNameAxis() << "\n"; sOut << " hasTopAxis: " << hasTopAxis() << "\n"; sOut << " hasParentsAxis: " << hasParentsAxis() << "\n"; sOut << " hasAncestorsAxis: " << hasAncestorsAxis() << "\n"; sOut << " hasSecurity: " << hasSecurity() << "\n"; //clear up //MMO_FREE(sName); //constant return MM_STRDUP(sOut.str().c_str()); } void XmlLibrary::handleError(ExceptionBase& ex ATTRIBUTE_UNUSED) const { NOT_CURRENTLY_USED(""); } const char *XmlLibrary::fileSystemPathToXPath(const IXmlQueryEnvironment *pQE, const char *sFileSystemPath, const char *sTargetType, const char *sDirectoryNamespacePrefix, const bool bUseIndexes) const { //fileSystemPathToXPath() DOES NOT interact with the database // it is simple string handling // //relative paths: // ../../shared/thingy.xsl => ../../repository:shared/name::thingy_xsl //if name axis is implemented: // (non alpha-numeric chars ignored) // ../../shared/thingy.xsl => ../../repository:shared/name::thingy_xsl //a note about query-strings (they are ignored): // ../../shared/thingy.xsl?gs_include=1 => ../../repository:shared/name::thingy_xsl //xpath portions are left un-touched (anything with a colon) // ../../repository:shared/thingy.xsl => ../../repository:shared/name::thingy_xsl //absolute: // /shared/index.html -> /<sRootXPath>/repository:shared/name::index_hmtl //class references: // /~Person/name::view => ~Person/name::view // /test/eg/~Person/name::view => ~Person/name::view // ~Person/name::view => ~Person/name::view //absolute paths // caller MUST send through the DOC node or other base node for this to work // /test/is/good with doc base node => /repository:test/repository:is/name::good // /test/is/good with base-node idx_8 => id('idx_8')/repository:test/repository:is/name::good //absolute function calls: // /id('idx_3')/name::view => id('idx_3')/name::view // /test/eg/id('idx_3')/name::view => id('idx_3')/name::view // id('idx_3')/name::view => id('idx_3')/name::view //index for empty directory // directroy1/directroy2/ => repository:directroy1/repository:directroy2/name::index // BUT: directroy1/directroy2 => repository:directroy1/name::directroy2 //specials: // ^Class__Response_response_loader/... => id('Class__Response_response_loader')/... string stOut; const char *sPos, *sLastPos, *sTerminatingChar, *sDUP = 0; char c; size_t iLen, iInitialLen; int iBracketLevel = 0; //processing only happens OUTSIDE brackets (...) bool bHasSplitters = false; //------------------- ignore common irrelevant bits iInitialLen = strlen(sFileSystemPath); sTerminatingChar = sFileSystemPath + iInitialLen; sPos = strchr(sFileSystemPath, '?'); //query-string (first ?) if (!sPos) sPos = sTerminatingChar; sLastPos = strnrchr(sFileSystemPath, '.', sPos - sFileSystemPath); //file extension (last .) if ( !sLastPos || strnchr(sLastPos, '\'', sPos - sLastPos) //inside a string literal: ' is not a valid extension char || strnchr(sLastPos, ')', sPos - sLastPos) //inside a function : ) is not a valid extension char ) sLastPos = sPos; //conditional STRDUP sPos = sFileSystemPath; if (sLastPos != sTerminatingChar) sPos = sDUP = _STRNDUP(sFileSystemPath, sLastPos - sFileSystemPath); sLastPos = sPos; stOut.reserve(iInitialLen * 2); //------------------- copy root slash (if present or completely blank string) if (Repository::issplitter(*sPos) || !*sPos) { stOut.append("/"); bHasSplitters = true; //important so that name::index is appended if (*sPos) { sLastPos++; sPos++; } } //------------------- directories / xpath snippets (if any) // name::<directory name> //OR repository:<directory name> while (sPos = Repository::strsplitter(sLastPos)) { if (iLen = sPos - sLastPos) { iBracketLevel += strcount(sLastPos, '(', iLen); if (iBracketLevel > 0) { //inside brackets, or part includes brackets, continue //TODO: can name:: work with brackets, e.g. /folder/document(thing)? stOut.append(sLastPos, iLen + 1); } else { iBracketLevel = 0; //over-negative brackets: ))) will be ignored if (maybeXPath(pQE, sLastPos, iLen)) { if (maybeAbsoluteXPath(pQE, sLastPos)) { //this portion appears to be absolute so restart the output from here stOut.assign(sLastPos, iLen + 1); } else stOut.append(sLastPos, iLen + 1); } else { IFDEBUG( if (_STRNEQUAL(sLastPos, "../", 3)) { NOT_COMPLETE(".. parent move found in the file-system-path, normally the HTTP caller will remove these"); } else if (_STRNEQUAL(sLastPos, "./", 2)) { NOT_COMPLETE(". current directory found in the file-system-path, normally the HTTP caller will remove these"); } ) //override the normal name:: axis use //by specifying a namespace if (sDirectoryNamespacePrefix) { stOut.append(sDirectoryNamespacePrefix); stOut.append(":"); } //local name stOut.append(sLastPos, iLen + 1); //include backslash } } iBracketLevel -= strcount(sLastPos, ')', iLen); bHasSplitters = true; } //else it is an irrelevant double slash, so ignore //advance to next character sPos++; sLastPos = sPos; } //------------------- last part of the string which will be the filename // name::<filename> //OR *[@repository:name = '<filename>'] if (sLastPos && *sLastPos) { if (iBracketLevel) { //still in brackets stOut.append(sLastPos); } else { if (maybeXPath(pQE, sLastPos)) { if (maybeAbsoluteXPath(pQE, sLastPos)) { IFDEBUG(if (stOut.size()) Debug::report("last part of file-system-path was categorised absolute [%s]", sFileSystemPath, rtWarning, rlWorrying)); stOut.assign(sLastPos); } else stOut.append(sLastPos); } else { //replace non-alpha-numeric //default to name:: axis while (c = *sLastPos++) { if (!isalnum(c)) c = '_'; stOut.append(1,c); } } } } else if (bHasSplitters && bUseIndexes) { //no filename after last / //fileSystemPath ends in a / //so place an index search on the end if (hasDefaultNameAxis()) stOut.append("index"); else if (hasNameAxis()) stOut.append("name::index"); else stOut.append(sTargetType).append("[@repository:name = 'index']"); } //Debug::report("[%s] => [%s]", sFileSystemPath, stOut.c_str()); //free up if (sDUP) MMO_FREE(sDUP); return MM_STRDUP(stOut.c_str()); } bool XmlLibrary::maybeAbsoluteXPath(const IXmlQueryEnvironment *pQE, const char *sText) const { //does the path have absolute elements in it? //that would mean, for instance, that it would not need knowledge of its start root for absolute cases // admin/interfaces/~Person/weeee // HTTP/repository:interfaces/id('idx_3')/name::test bool bGPMaybeXPath = false; IXmlGrammarContext *pGP; if (pGP = pQE->grammarContext()) bGPMaybeXPath = pGP->maybeAbsoluteXPath(pQE, sText); return sText && ( bGPMaybeXPath || (*sText == '$') //variables || _STRNEQUAL(sText, "id(", 3) //the id() function ); } const char *XmlLibrary::nodeTypeXPath(const iDOMNodeTypeRequest iNodeTypes) const { const char *sXPath = 0; switch (iNodeTypes) { //NOTE: this will not currently return CDATA nodes case node_type_element_or_text: {sXPath = "(*|text())"; break;} //default case node_type_element_only: {sXPath = "*"; break;} case node_type_processing_instruction: {sXPath = "processing-instruction()"; break;} case node_type_any: {sXPath = "node()"; NOT_CURRENTLY_USED(""); break;} } return sXPath; } bool XmlLibrary::maybeXPath(const IXmlQueryEnvironment *pQE, const char *sText, const size_t iLen) const { // need to check each part of a path also: // admin/interfaces/add // ~HTTP/repository:interfaces/name::test //TODO: this needs to be attached to the GrammarProcessor! //TODO: move this in to LibXmlLibrary bool bGPMaybeXPath = false; IXmlGrammarContext *pGP; if (pGP = pQE->grammarContext()) bGPMaybeXPath = pGP->maybeXPath(pQE, sText, iLen); return sText && ( bGPMaybeXPath || (iLen ? strnchr(sText, '$', iLen) : strchr(sText, '$')) //variables || (iLen ? strnchr(sText, '@', iLen) : strchr(sText, '@')) //attributes || (iLen ? strnchr(sText, ':', iLen) : strchr(sText, ':')) //namespacing || (iLen ? strnchr(sText, '*', iLen) : strchr(sText, '*')) //anything || (_STRNEQUAL(sText, "id(", 3)) //the id() function ); } bool XmlLibrary::isAttributeXPath(const char *sText, const size_t iLen) const { //spots: // repository:Thing/@name // @meta:class //and attribute:: versions //NOTE: this function does not parse the XPath //therefore if a string was included: *[test='/@'] it would confuse this function return sText && ( (iLen ? strnstr(sText, "/@", iLen) : strstr(sText, "/@")) || (iLen ? strnstr(sText, "/attribute::", iLen) : strstr(sText, "/attribute::")) || (*sText == '@') || (_STRNEQUAL(sText, "attribute::", 11)) ); } bool XmlLibrary::maybeNamespacedXPath(const char *sText, const size_t iLen) const { //ignore built-in xml namespace //TODO: this will FAIL in at least these edge cases: // anything that can take a string argument, e.g. starts-with(':') // sdjfhdf_xml:id because the back check only checks for "xml:" const char *sColon = sText; bool bNameSpaceFound = false; if (sText) { while (!bNameSpaceFound && (sColon = strchr(sColon, ':')) && (!iLen || ((size_t) (sColon - sText) < iLen)) ) { if (sColon - sText >= 3 && _STREQUAL(sColon-3, "xml:")) sColon++; else bNameSpaceFound = true; } } return bNameSpaceFound; } bool XmlLibrary::textEqualsTrue(const char *sText) const { //allowed boolean values //0x0 = false return sText && ( !strcasecmp(sText, "yes") || !strcasecmp(sText, "true") || !strcasecmp(sText, "on") || !strcasecmp(sText, "1") || !strcasecmp(sText, "enabled") ); } const char *XmlLibrary::escapeForCDATA(const char *sString) const { const char *sOut = sString; if (sString) { while (strstr(sString, "]]>")) { NOT_COMPLETE("escapeForCDATA"); } } return sOut; } const char *XmlLibrary::normalise(const char *sString) const { //caller frees non zero result //this just converts c-string style escaping to their characters \\n => \n //like the NORMALIZE flag on GRETA regex char *sOutput = 0; if (sString) { size_t iLen = strlen(sString); char *sOutputPosition = sOutput = MM_MALLOC_FOR_RETURN(iLen + 1); const char *sInputPosition = sString; char c; while (c = *sInputPosition++) { if (c == '\\') { if (c = *sInputPosition++) { if (isdigit(c)) { c = atoi(sInputPosition); while (isdigit(*sInputPosition)) sInputPosition++; } else { switch (c) { case 'r': {c = 13;break;} case 'n': {c = 10;break;} default: {c = '\\'; sInputPosition--;} //output the escapes normally } } } else c = '\\'; } *sOutputPosition++ = c; } *sOutputPosition = 0; } return sOutput; } IXmlLibrary::xmlTraceFlag XmlLibrary::parseXMLTraceFlags(const char *sFlags) const { IXmlLibrary::xmlTraceFlag iFlags = IXmlLibrary::XML_DEBUG_NONE; if (sFlags) { if (strstr(sFlags, "XML_DEBUG_ALL")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_ALL); if (strstr(sFlags, "XML_DEBUG_NONE")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_NONE); if (strstr(sFlags, "XML_DEBUG_XPATH_STEP")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_XPATH_STEP); if (strstr(sFlags, "XML_DEBUG_XPATH_EXPR")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_XPATH_EXPR); if (strstr(sFlags, "XML_DEBUG_XPATH_EVAL_COUNTS")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_XPATH_EVAL_COUNTS); if (strstr(sFlags, "XML_DEBUG_PARENT_ROUTE")) iFlags = (IXmlLibrary::xmlTraceFlag) (iFlags | IXmlLibrary::XML_DEBUG_PARENT_ROUTE); } return iFlags; } IXmlLibrary::xsltTraceFlag XmlLibrary::parseXSLTTraceFlags(const char *sFlags) const { IXmlLibrary::xsltTraceFlag iFlags = IXmlLibrary::XSLT_TRACE_NONE; if (sFlags) { if (strstr(sFlags, "XSLT_TRACE_ALL")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_ALL); if (strstr(sFlags, "XSLT_TRACE_NONE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_NONE); if (strstr(sFlags, "XSLT_TRACE_COPY_TEXT")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_COPY_TEXT); if (strstr(sFlags, "XSLT_TRACE_PROCESS_NODE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_PROCESS_NODE); if (strstr(sFlags, "XSLT_TRACE_APPLY_TEMPLATE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_APPLY_TEMPLATE); if (strstr(sFlags, "XSLT_TRACE_COPY")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_COPY); if (strstr(sFlags, "XSLT_TRACE_COMMENT")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_COMMENT); if (strstr(sFlags, "XSLT_TRACE_PI")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_PI); if (strstr(sFlags, "XSLT_TRACE_COPY_OF")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_COPY_OF); if (strstr(sFlags, "XSLT_TRACE_VALUE_OF")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_VALUE_OF); if (strstr(sFlags, "XSLT_TRACE_CALL_TEMPLATE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_CALL_TEMPLATE); if (strstr(sFlags, "XSLT_TRACE_APPLY_TEMPLATES")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_APPLY_TEMPLATES); if (strstr(sFlags, "XSLT_TRACE_CHOOSE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_CHOOSE); if (strstr(sFlags, "XSLT_TRACE_IF")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_IF); if (strstr(sFlags, "XSLT_TRACE_FOR_EACH")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_FOR_EACH); if (strstr(sFlags, "XSLT_TRACE_STRIP_SPACES")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_STRIP_SPACES); if (strstr(sFlags, "XSLT_TRACE_TEMPLATES")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_TEMPLATES); if (strstr(sFlags, "XSLT_TRACE_KEYS")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_KEYS); if (strstr(sFlags, "XSLT_TRACE_VARIABLES")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_VARIABLES); if (strstr(sFlags, "XSLT_TRACE_FUNCTION")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_FUNCTION); if (strstr(sFlags, "XSLT_TRACE_PARSING")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_PARSING); if (strstr(sFlags, "XSLT_TRACE_BLANKS")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_BLANKS); if (strstr(sFlags, "XSLT_TRACE_PROCESS")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_PROCESS); if (strstr(sFlags, "XSLT_TRACE_EXTENSIONS")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_EXTENSIONS); if (strstr(sFlags, "XSLT_TRACE_ATTRIBUTES")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_ATTRIBUTES); if (strstr(sFlags, "XSLT_TRACE_EXTRA")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_EXTRA); if (strstr(sFlags, "XSLT_TRACE_AVT")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_AVT); if (strstr(sFlags, "XSLT_TRACE_PATTERN")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_PATTERN); if (strstr(sFlags, "XSLT_TRACE_VARIABLE")) iFlags = (IXmlLibrary::xsltTraceFlag) (iFlags | IXmlLibrary::XSLT_TRACE_VARIABLE); /* pseudo */ if (strstr(sFlags, "XSLT_TRACE_MOST")) iFlags = (IXmlLibrary::xsltTraceFlag) (IXmlLibrary::XSLT_TRACE_ALL | ~IXmlLibrary::XSLT_TRACE_BLANKS); } return iFlags; } IXmlArea *XmlLibrary::factory_area(const IMemoryLifetimeOwner *pMemoryLifetimeOwner, const IXmlQueryEnvironment *pQE) const { return factory_area(pMemoryLifetimeOwner, (XmlNodeList<const IXmlBaseNode> *) 0, pQE, 0); } const char *XmlLibrary::translateDateFormat(const char *sFormat) const { //do not free the result //it is either static OR equal to the input const char *sResponseFormat = sFormat; //XML date standard //http://www.w3.org/TR/NOTE-datetime //YYYY-MM-DDThh:mm:ssTZD //1997-07-16T19:20:30+01:00 if (_STREQUAL(sFormat, "%XML") || _STREQUAL(sFormat, "%ISO8601")) sResponseFormat = DATE_FORMAT_XML; //RFC 822, updated by RFC 1123 //Sun, 06 Nov 1994 08:49:37 GMT else if (_STREQUAL(sFormat, "%RFC822") || _STREQUAL(sFormat, "%HTTP")) sResponseFormat = DATE_FORMAT_RFC822; //RFC 850, obsoleted by RFC 1036 //Sunday, 06-Nov-94 08:49:37 GMT else if (_STREQUAL(sFormat, "%RFC850")) sResponseFormat = DATE_FORMAT_RFC850; //ANSI C's asctime() format //Sun Nov 6 08:49:37 1994 else if (_STREQUAL(sFormat, "%ANSI")) sResponseFormat = DATE_FORMAT_ANSI; return sResponseFormat; } struct tm XmlLibrary::parseDate(const char *sValue) const { //m_aDateFormats populated at instanciation //this function mimicks getdate() but without the environmental dependency of DATEMSK struct tm tGMT; time_t tiTime; const char *sFailChar = 0; size_t i; //initilaise value because not all fields are completed memset(&tGMT, 0, sizeof(tm)); //throw parse failure if no input if (sValue) { if (_STREQUAL(sValue, "now")) { time(&tiTime); gmtime_r(&tiTime, &tGMT); //reentrant } else { for (i = 0; i < DATE_FORMATS_COUNT && !sFailChar; i++) { sFailChar = strptime(sValue, m_aDateFormats[i], &tGMT); } if (!sFailChar) throw FailedToParseDate(this, sValue); else { //test it tiTime = mktime(&tGMT); if (tiTime == -1) throw FailedToParseDate(this, sValue); } } } else throw FailedToParseDate(this, sValue); return tGMT; } bool XmlLibrary::isNameChar(char c) const { //https://www.w3.org/TR/REC-xml/#NT-NameChar //NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] return isNameStartChar(c) || c == '-' || c == '.' || isdigit(c); } bool XmlLibrary::isNameStartChar(char c) const { //https://www.w3.org/TR/REC-xml/#NT-NameStartChar //":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] return c == ':' || isalpha(c) || c == '_'; } const char *XmlLibrary::xml_element_name(const char *sInput, const bool bAllowNamespace, const bool bMakeLowerCase) const { //caller frees result if non-zero //by default take the last part of the string after / char *sElementName; char *position; bool bSeenColon = false, bIsFirstCharacterMode = true, bLastCharacter = false; if (!sInput) { sElementName = MM_STRDUP("gs:unassigned"); } else { if (!*sInput) { sElementName = MM_STRDUP("gs:empty"); } else { //ok, we have a valid non-empty sring //not changing the length of the string sElementName = MM_STRDUP(sInput); //make rest alpha numeric lowercase for (position = sElementName; *position; position++) { bLastCharacter = (position[1] == 0); if (bIsFirstCharacterMode) { //first character has different rules if (!isalpha(*position)) *position = 'X'; else if (bMakeLowerCase && !islower(*position)) *position = tolower(*position); bIsFirstCharacterMode = false; } else { //rest of element name has other rules if (!bLastCharacter && *position == ':' && position[1] && bAllowNamespace && !bSeenColon) { bSeenColon = true; bIsFirstCharacterMode = true; } else { //encode non-valid characters if (!isalnum(*position) && !strchr("-_", *position)) *position = '_'; //lower case valid characters else if (bMakeLowerCase && !islower(*position)) *position = tolower(*position); } } } //remove trailing _ //decreases length of string but not to 0 //first character will always not be an _ while (--position > sElementName && *position == '_') *position = 0; } } //cout << "[" << sInput << "] => [" << sElementName << "]\n"; return sElementName; } }
45.723247
235
0.614962
anewholm
b973ae8d5c0bf3c1a2b3f26a9a1addd3cd985d9f
871
cpp
C++
VCPlusPlus/CPlusPlusTest2/FindMaxIncreasingSeqInArr/FindMaxIncreasingSeqInArr.cpp
madbadPi/TelerikAcademy
37eafec75b510b636a1e7da55fffed7bdc7f3d85
[ "MIT" ]
null
null
null
VCPlusPlus/CPlusPlusTest2/FindMaxIncreasingSeqInArr/FindMaxIncreasingSeqInArr.cpp
madbadPi/TelerikAcademy
37eafec75b510b636a1e7da55fffed7bdc7f3d85
[ "MIT" ]
null
null
null
VCPlusPlus/CPlusPlusTest2/FindMaxIncreasingSeqInArr/FindMaxIncreasingSeqInArr.cpp
madbadPi/TelerikAcademy
37eafec75b510b636a1e7da55fffed7bdc7f3d85
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> std::vector<int> findmaxseqinarr(int myarray[], int size) { std::vector<int> newarr; int counter = 0; int max = 0; for (int i = 0; i < size-1; i++) { while (myarray[i] == myarray[i+1]-1) { counter++; i++; } if (counter > max) { newarr.clear(); for (int j = 0; j < counter; j++) { newarr.push_back(myarray[i-counter+1] + j); } max = counter; } counter = 1; } std::cout << std::endl; return newarr; } void printarr(std::vector<int> result) { std::cout << "{"; for (int i = 0; i < result.size(); i++) { std::cout << result[i] << ", "; } std::cout << "}" << std::endl; } int main() { int myarray[] = { 3, 2, 3, 4, 2, 2, 4 }; int arrsize = sizeof(myarray) / sizeof(myarray[0]); std::vector<int> resultarr = findmaxseqinarr(myarray, arrsize); printarr(resultarr); return 0; }
18.145833
64
0.562572
madbadPi
b975a9f2fd71c785a56edc527f87d59d0bc1b788
686
hpp
C++
tau/TauEngine/include/dx/dx12/DX12CommandQueue.hpp
hyfloac/TauEngine
1559b2a6e6d1887b8ee02932fe0aa6e5b9d5652c
[ "MIT" ]
1
2020-04-22T04:07:01.000Z
2020-04-22T04:07:01.000Z
tau/TauEngine/include/dx/dx12/DX12CommandQueue.hpp
hyfloac/TauEngine
1559b2a6e6d1887b8ee02932fe0aa6e5b9d5652c
[ "MIT" ]
null
null
null
tau/TauEngine/include/dx/dx12/DX12CommandQueue.hpp
hyfloac/TauEngine
1559b2a6e6d1887b8ee02932fe0aa6e5b9d5652c
[ "MIT" ]
null
null
null
#pragma once #include "graphics/CommandQueue.hpp" #ifdef _WIN32 #include <d3d12.h> class TAU_DLL DX12CommandQueue final : public ICommandQueue { DELETE_CM(DX12CommandQueue); private: ID3D12CommandQueue* _d3dQueue; public: DX12CommandQueue(ID3D12CommandQueue* const d3dQueue) noexcept : _d3dQueue(d3dQueue) { } ~DX12CommandQueue() noexcept override { _d3dQueue->Release(); } [[nodiscard]] ID3D12CommandQueue* d3dQueue() const noexcept { return _d3dQueue; } void executeCommandLists(uSys count, const ICommandList* const* lists) noexcept override; void executeCommandLists(UINT count, ID3D12CommandList* const* lists) noexcept; }; #endif
25.407407
93
0.744898
hyfloac
b9778f9ed814307723bfeead10ffed356ba446b2
615
cpp
C++
Hacke Rank Problems/Summation of primes.cpp
anand434/-Algorithm-And-DataStructures
e4197db5342def163a8bd22de4187b90bc5ff1d3
[ "MIT" ]
null
null
null
Hacke Rank Problems/Summation of primes.cpp
anand434/-Algorithm-And-DataStructures
e4197db5342def163a8bd22de4187b90bc5ff1d3
[ "MIT" ]
null
null
null
Hacke Rank Problems/Summation of primes.cpp
anand434/-Algorithm-And-DataStructures
e4197db5342def163a8bd22de4187b90bc5ff1d3
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; vector <int> v; bool isPrime(int x){ for(int i = 3 ; i <= (int)sqrt(x) ; i+=2) if(x%i==0) return false; return true; } void genPrime(){ v.push_back(2); v.push_back(3); for(int i = 5 ; i < 1000001 ; i+=2){ if(i%3 != 0) if(isPrime(i)) v.push_back(i); } } int main(){ int n , q; cin >> n; genPrime(); while(n--){ cin >> q; long long sum = 0; for(int i = 0 ; v[i] <= q ; i++) sum += v[i]; cout << sum << endl; } return 0; }
18.636364
45
0.426016
anand434
b97bf29096e378a5954bcb0cec657dfbe37a02f9
2,225
cpp
C++
tiled_resources/src/tiled_resources/free_camera.cpp
kingofthebongo2008/computer-games-sofia-univeristy
1d54a02a456b3dde5eb5793e01a99a76daf6f033
[ "Apache-2.0" ]
5
2019-03-29T16:47:47.000Z
2019-05-08T18:34:50.000Z
tiled_resources/src/tiled_resources/free_camera.cpp
kingofthebongo2008/computer-games-sofia-univeristy
1d54a02a456b3dde5eb5793e01a99a76daf6f033
[ "Apache-2.0" ]
3
2019-04-21T08:05:04.000Z
2019-04-21T08:05:44.000Z
tiled_resources/src/tiled_resources/free_camera.cpp
kingofthebongo2008/computer-games-sofia-univeristy
1d54a02a456b3dde5eb5793e01a99a76daf6f033
[ "Apache-2.0" ]
null
null
null
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #include "pch.h" #include "free_camera.h" using namespace DirectX; namespace sample { FreeCamera::FreeCamera() { } void FreeCamera::SetViewParameters(XMFLOAT3 eye, XMFLOAT3 at, XMFLOAT3 up) { m_position = eye; XMVECTOR orientation = XMQuaternionRotationMatrix ( XMMatrixLookAtRH( XMLoadFloat3(&eye), XMLoadFloat3(&at), XMLoadFloat3(&up) ) ); XMStoreFloat4(&m_orientation, orientation); } void FreeCamera::SetProjectionParameters(float width, float height) { XMMATRIX projectionMatrix = XMMatrixPerspectiveFovRH(70.0f * XM_PI / 180.0f, width / height, 1.0f / 256.0f, 256.0f); XMStoreFloat4x4(&m_projectionMatrix, projectionMatrix); } void FreeCamera::ApplyTranslation(XMFLOAT3 delta) { XMFLOAT4 deltaVector(delta.x, delta.y, delta.z, 1); XMVECTOR deltaCameraSpace = XMVector4Transform(XMLoadFloat4(&deltaVector), XMMatrixRotationQuaternion(XMQuaternionInverse(XMLoadFloat4(&m_orientation)))); XMStoreFloat3(&m_position, XMVectorAdd(XMLoadFloat3(&m_position), deltaCameraSpace)); } void FreeCamera::ApplyRotation(XMFLOAT3 delta) { XMStoreFloat4(&m_orientation, XMQuaternionMultiply(XMLoadFloat4(&m_orientation), XMQuaternionRotationRollPitchYawFromVector(XMVectorNegate(XMLoadFloat3(&delta))))); } XMFLOAT3 FreeCamera::GetPosition() const { return m_position; } XMFLOAT4X4 FreeCamera::GetViewMatrix() const { XMFLOAT4X4 ret; XMMATRIX viewMatrix = XMMatrixMultiply( XMMatrixTranslationFromVector(XMVectorNegate(XMLoadFloat3(&m_position))), XMMatrixRotationQuaternion(XMLoadFloat4(&m_orientation)) ); XMStoreFloat4x4(&ret, viewMatrix); return ret; } XMFLOAT4X4 FreeCamera::GetProjectionMatrix() const { return m_projectionMatrix; } }
31.338028
172
0.69573
kingofthebongo2008
b9862267f72f660edbae79206a7407820cc6e9f5
1,081
hpp
C++
include/boost/safe_float/policy/check_division_underflow.hpp
aTom3333/safefloat
760a1fa243672d49271836e8c431f002a615eca5
[ "BSL-1.0" ]
1
2019-08-08T01:24:16.000Z
2019-08-08T01:24:16.000Z
include/boost/safe_float/policy/check_division_underflow.hpp
aTom3333/safefloat
760a1fa243672d49271836e8c431f002a615eca5
[ "BSL-1.0" ]
null
null
null
include/boost/safe_float/policy/check_division_underflow.hpp
aTom3333/safefloat
760a1fa243672d49271836e8c431f002a615eca5
[ "BSL-1.0" ]
2
2019-05-28T11:31:09.000Z
2019-10-12T21:55:25.000Z
#ifndef BOOST_SAFE_FLOAT_POLICY_CHECK_DIVISION_UNDERFLOW_HPP #define BOOST_SAFE_FLOAT_POLICY_CHECK_DIVISION_UNDERFLOW_HPP #include <boost/safe_float/policy/check_base_policy.hpp> #ifdef FENV_AVAILABLE #pragma STDC FENV_ACCESS ON #include <fenv.h> #endif namespace boost { namespace safe_float{ namespace policy{ template<class FP> class check_division_underflow : public check_policy<FP> { #ifndef FENV_AVAILABLE bool expect_zero; #endif public: bool pre_division_check(const FP& lhs, const FP& rhs){ #ifndef FENV_AVAILABLE expect_zero = (lhs==0); return true; #else return ! std::feclearexcept(FE_UNDERFLOW); #endif } bool post_division_check(const FP& rhs){ #ifndef FENV_AVAILABLE return (std::fpclassify( rhs ) != FP_SUBNORMAL) && (rhs != 0 || expect_zero); #else return ! std::fetestexcept(FE_UNDERFLOW); #endif } std::string division_failure_message(){ return std::string("Underflow from operation"); } }; } } } #endif // BOOST_SAFE_FLOAT_POLICY_CHECK_DIVISION_UNDERFLOW_HPP
21.62
62
0.723404
aTom3333
b98a990c934c3475c3f717c25434c26e3f732677
7,488
cpp
C++
AudioSources/AverageProcessor.cpp
MeijisIrlnd/airwindows
e2818f43711fa8b6f424d31824c35bb47bb82140
[ "MIT" ]
2
2021-03-02T05:14:39.000Z
2022-03-19T01:47:57.000Z
Examples/Average/Source/AverageProcessor.cpp
MeijisIrlnd/airwindows
e2818f43711fa8b6f424d31824c35bb47bb82140
[ "MIT" ]
null
null
null
Examples/Average/Source/AverageProcessor.cpp
MeijisIrlnd/airwindows
e2818f43711fa8b6f424d31824c35bb47bb82140
[ "MIT" ]
null
null
null
/* ======================================== * Average - Average.h * Copyright (c) 2016 airwindows, All rights reserved * ======================================== */ #include "AverageProcessor.h" AverageProcessor::AverageProcessor() { paramBindings = { {AVERAGE, &A}, {DRY_WET, &B} }; A = 0.0; B = 1.0; for (int count = 0; count < 11; count++) { bL[count] = 0.0; bR[count] = 0.0; f[count] = 0.0; } fpNShapeL = 0.0; fpNShapeR = 0.0; } AverageProcessor::~AverageProcessor() { } void AverageProcessor::setParam(PARAMETER p, float v) { if (paramBindings.find(p) != paramBindings.end()) { *paramBindings[p] = v; } } void AverageProcessor::prepareToPlay(int samplesPerBlockExpected, double sampleRate) { sr = sampleRate; } void AverageProcessor::getNextAudioBlock(const juce::AudioSourceChannelInfo& bufferToFill) { auto* rpL = bufferToFill.buffer->getReadPointer(0); auto* rpR = bufferToFill.buffer->getReadPointer(1); auto* wpL = bufferToFill.buffer->getWritePointer(0); auto* wpR = bufferToFill.buffer->getWritePointer(1); double correctionSample; double accumulatorSampleL; double accumulatorSampleR; double drySampleL; double drySampleR; double inputSampleL; double inputSampleR; double overallscale = (A * 9.0) + 1.0; double wet = B; double dry = 1.0 - wet; double gain = overallscale; if (gain > 1.0) { f[0] = 1.0; gain -= 1.0; } else { f[0] = gain; gain = 0.0; } if (gain > 1.0) { f[1] = 1.0; gain -= 1.0; } else { f[1] = gain; gain = 0.0; } if (gain > 1.0) { f[2] = 1.0; gain -= 1.0; } else { f[2] = gain; gain = 0.0; } if (gain > 1.0) { f[3] = 1.0; gain -= 1.0; } else { f[3] = gain; gain = 0.0; } if (gain > 1.0) { f[4] = 1.0; gain -= 1.0; } else { f[4] = gain; gain = 0.0; } if (gain > 1.0) { f[5] = 1.0; gain -= 1.0; } else { f[5] = gain; gain = 0.0; } if (gain > 1.0) { f[6] = 1.0; gain -= 1.0; } else { f[6] = gain; gain = 0.0; } if (gain > 1.0) { f[7] = 1.0; gain -= 1.0; } else { f[7] = gain; gain = 0.0; } if (gain > 1.0) { f[8] = 1.0; gain -= 1.0; } else { f[8] = gain; gain = 0.0; } if (gain > 1.0) { f[9] = 1.0; gain -= 1.0; } else { f[9] = gain; gain = 0.0; } //there, now we have a neat little moving average with remainders if (overallscale < 1.0) overallscale = 1.0; f[0] /= overallscale; f[1] /= overallscale; f[2] /= overallscale; f[3] /= overallscale; f[4] /= overallscale; f[5] /= overallscale; f[6] /= overallscale; f[7] /= overallscale; f[8] /= overallscale; f[9] /= overallscale; //and now it's neatly scaled, too for (auto sample = 0; sample < bufferToFill.numSamples; sample++) { long double inputSampleL = *rpL; long double inputSampleR = *rpR; if (inputSampleL < 1.2e-38 && -inputSampleL < 1.2e-38) { static int noisesource = 0; //this declares a variable before anything else is compiled. It won't keep assigning //it to 0 for every sample, it's as if the declaration doesn't exist in this context, //but it lets me add this denormalization fix in a single place rather than updating //it in three different locations. The variable isn't thread-safe but this is only //a random seed and we can share it with whatever. noisesource = noisesource % 1700021; noisesource++; int residue = noisesource * noisesource; residue = residue % 170003; residue *= residue; residue = residue % 17011; residue *= residue; residue = residue % 1709; residue *= residue; residue = residue % 173; residue *= residue; residue = residue % 17; double applyresidue = residue; applyresidue *= 0.00000001; applyresidue *= 0.00000001; inputSampleL = applyresidue; } if (inputSampleR < 1.2e-38 && -inputSampleR < 1.2e-38) { static int noisesource = 0; noisesource = noisesource % 1700021; noisesource++; int residue = noisesource * noisesource; residue = residue % 170003; residue *= residue; residue = residue % 17011; residue *= residue; residue = residue % 1709; residue *= residue; residue = residue % 173; residue *= residue; residue = residue % 17; double applyresidue = residue; applyresidue *= 0.00000001; applyresidue *= 0.00000001; inputSampleR = applyresidue; //this denormalization routine produces a white noise at -300 dB which the noise //shaping will interact with to produce a bipolar output, but the noise is actually //all positive. That should stop any variables from going denormal, and the routine //only kicks in if digital black is input. As a final touch, if you save to 24-bit //the silence will return to being digital black again. } drySampleL = inputSampleL; drySampleR = inputSampleR; bL[9] = bL[8]; bL[8] = bL[7]; bL[7] = bL[6]; bL[6] = bL[5]; bL[5] = bL[4]; bL[4] = bL[3]; bL[3] = bL[2]; bL[2] = bL[1]; bL[1] = bL[0]; bL[0] = accumulatorSampleL = inputSampleL; bR[9] = bR[8]; bR[8] = bR[7]; bR[7] = bR[6]; bR[6] = bR[5]; bR[5] = bR[4]; bR[4] = bR[3]; bR[3] = bR[2]; bR[2] = bR[1]; bR[1] = bR[0]; bR[0] = accumulatorSampleR = inputSampleR; //primitive way of doing this: for larger batches of samples, you might //try using a circular buffer like in a reverb. If you add the new sample //and subtract the one on the end you can keep a running tally of the samples //between. Beware of tiny floating-point math errors eventually screwing up //your system, though! accumulatorSampleL *= f[0]; accumulatorSampleL += (bL[1] * f[1]); accumulatorSampleL += (bL[2] * f[2]); accumulatorSampleL += (bL[3] * f[3]); accumulatorSampleL += (bL[4] * f[4]); accumulatorSampleL += (bL[5] * f[5]); accumulatorSampleL += (bL[6] * f[6]); accumulatorSampleL += (bL[7] * f[7]); accumulatorSampleL += (bL[8] * f[8]); accumulatorSampleL += (bL[9] * f[9]); accumulatorSampleR *= f[0]; accumulatorSampleR += (bR[1] * f[1]); accumulatorSampleR += (bR[2] * f[2]); accumulatorSampleR += (bR[3] * f[3]); accumulatorSampleR += (bR[4] * f[4]); accumulatorSampleR += (bR[5] * f[5]); accumulatorSampleR += (bR[6] * f[6]); accumulatorSampleR += (bR[7] * f[7]); accumulatorSampleR += (bR[8] * f[8]); accumulatorSampleR += (bR[9] * f[9]); //we are doing our repetitive calculations on a separate value correctionSample = inputSampleL - accumulatorSampleL; //we're gonna apply the total effect of all these calculations as a single subtract inputSampleL -= correctionSample; correctionSample = inputSampleR - accumulatorSampleR; inputSampleR -= correctionSample; //our one math operation on the input data coming in if (wet < 1.0) { inputSampleL = (inputSampleL * wet) + (drySampleL * dry); inputSampleR = (inputSampleR * wet) + (drySampleR * dry); } //dry/wet control only applies if you're using it. We don't do a multiply by 1.0 //if it 'won't change anything' but our sample might be at a very different scaling //in the floating point system. //stereo 32 bit dither, made small and tidy. int expon; frexpf((float)inputSampleL, &expon); long double dither = (rand() / (RAND_MAX * 7.737125245533627e+25)) * pow(2, expon + 62); inputSampleL += (dither - fpNShapeL); fpNShapeL = dither; frexpf((float)inputSampleR, &expon); dither = (rand() / (RAND_MAX * 7.737125245533627e+25)) * pow(2, expon + 62); inputSampleR += (dither - fpNShapeR); fpNShapeR = dither; //end 32 bit dither *wpL = inputSampleL; *wpR = inputSampleR; ++rpL; ++rpR; ++wpL; ++wpR; } } void AverageProcessor::releaseResources() { }
34.666667
98
0.633948
MeijisIrlnd
b98b70d92418f5dfb400dec82d785426b7496e85
1,553
cpp
C++
runa/widgets/button_cfg.cpp
walkinsky8/nana-runner
103992e07e7e644d349437fdf959364ffe9cb653
[ "BSL-1.0" ]
5
2017-12-28T08:22:20.000Z
2022-03-30T01:26:17.000Z
runa/widgets/button_cfg.cpp
walkinsky8/nana-runner
103992e07e7e644d349437fdf959364ffe9cb653
[ "BSL-1.0" ]
null
null
null
runa/widgets/button_cfg.cpp
walkinsky8/nana-runner
103992e07e7e644d349437fdf959364ffe9cb653
[ "BSL-1.0" ]
null
null
null
/** * Runa C++ Library * Copyright (c) 2017-2019 walkinsky:lyh6188(at)hotmail(dot)com * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ // Created on 2017/11/15 #include "stdafx.h" #ifndef __NANA_RUNNER_LIB_ALL_IN_ONE #include <runa/widgets/button_cfg.h> #include <runa/foundation/app_base.h> void runa::button_cfg::init_widget(widget & _w, view_obj* _root_view) const { super::init_widget(_w, _root_view); auto& w = dynamic_cast<ui_type&>(_w); if (!icon_().empty()) { w.icon(app::create_image(icon_())); } if (!borderless_().empty()) w.borderless(borderless_().value()); if (!enable_pushed_().empty()) w.enable_pushed(enable_pushed_().value()); if (!pushed_().empty()) w.pushed(pushed_().value()); if (!omitted_().empty()) w.omitted(omitted_().value()); if (!enable_focus_color_().empty()) w.enable_focus_color(enable_focus_color_().value()); if (!transparent_().empty()) w.transparent(transparent_().value()); if (!edge_effects_().empty()) w.edge_effects(edge_effects_().value()); if (!_click_().empty()) { if (_click_() == "quit") w.events().click(app::quit); else if (_click_() == "close") w.events().click([_root_view] {_root_view->close(); }); else { w.events().click([&] {app::create_view(_click_()); }); } } } #endif
23.892308
75
0.600773
walkinsky8
b98d1e9d6beb6c36eaa318dbd39b9244d9b19e75
6,851
cpp
C++
src/gui/graphtitlebar.cpp
evoplex/evoplex
c6e78af5fb0d2fc5a5ce7b02e5e4ec61de8934b6
[ "Apache-2.0" ]
101
2018-06-21T04:29:18.000Z
2022-03-09T13:04:15.000Z
src/gui/graphtitlebar.cpp
ElsevierSoftwareX/SOFTX_2018_211
cbfac5af0ad76b7c88a7ea296d94785692da3048
[ "Apache-2.0" ]
30
2018-06-26T15:12:03.000Z
2019-10-10T04:02:13.000Z
src/gui/graphtitlebar.cpp
ElsevierSoftwareX/SOFTX_2018_211
cbfac5af0ad76b7c88a7ea296d94785692da3048
[ "Apache-2.0" ]
23
2018-06-23T16:10:24.000Z
2021-11-03T15:12:51.000Z
/** * This file is part of Evoplex. * * Evoplex is a multi-agent system for networks. * Copyright (C) 2018 - Marcos Cardinot <marcos@cardinot.net> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <QFileDialog> #include <QMessageBox> #include <QProgressDialog> #include <QtSvg/QSvgGenerator> #include "core/nodes_p.h" #include "core/project.h" #include "core/trial.h" #include "graphtitlebar.h" #include "graphwidget.h" #include "basegraphgl.h" #include "ui_graphtitlebar.h" namespace evoplex { GraphTitleBar::GraphTitleBar(const Experiment* exp, GraphWidget* parent) : BaseTitleBar(parent), m_ui(new Ui_GraphTitleBar), m_graphWidget(parent), m_exp(exp), m_bExportNodes(new QtMaterialIconButton(QIcon(":/icons/material/table_white_18"), this)), m_bSettings(new QtMaterialIconButton(QIcon(":/icons/material/settings_white_18"), this)), m_bScreenShot(new QtMaterialIconButton(QIcon(":/icons/material/screenshot_white_18"), this)) { m_ui->setupUi(this); m_bScreenShot->setToolTip("export as image"); m_bScreenShot->setIconSize(QSize(22,18)); m_bScreenShot->setColor(m_iconColor); m_ui->btns->addWidget(m_bScreenShot); connect(m_bScreenShot, SIGNAL(pressed()), SLOT(slotExportImage())); m_bExportNodes->setToolTip("export nodes to file"); m_bExportNodes->setIconSize(QSize(22,18)); m_bExportNodes->setColor(m_iconColor); m_ui->btns->addWidget(m_bExportNodes); connect(m_bExportNodes, SIGNAL(pressed()), SLOT(slotExportNodes())); m_bSettings->setToolTip("graph settings"); m_bSettings->setIconSize(QSize(22,18)); m_bSettings->setColor(m_iconColor); m_ui->btns->addWidget(m_bSettings); connect(m_bSettings, SIGNAL(pressed()), SIGNAL(openSettingsDlg())); connect(m_ui->cbTrial, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int t) { Q_ASSERT(t >= 0 && t < UINT16_MAX); emit(trialSelected(static_cast<quint16>(t))); }); connect(m_exp, SIGNAL(restarted()), SLOT(slotRestarted())); slotRestarted(); // init init(qobject_cast<QHBoxLayout*>(layout())); } GraphTitleBar::~GraphTitleBar() { delete m_ui; } void GraphTitleBar::slotExportImage() { if (!readyToExport()) { return; } QString path = guessInitialPath(".png"); path = QFileDialog::getSaveFileName(this, "Export Nodes", path, "Image files (*.svg *.png *.jpg *.jpeg)"); if (path.isEmpty()) { return; } if (path.endsWith(".svg")) { QSvgGenerator g; g.setFileName(path); g.setSize(m_graphWidget->view()->frameSize()); g.setViewBox(m_graphWidget->view()->rect()); g.setTitle("Evoplex"); g.setDescription("Created with Evoplex (https://evoplex.org)."); g.setResolution(300); m_graphWidget->view()->paint(&g, false); } else { QSettings userPrefs; QImage img(m_graphWidget->view()->frameSize(), QImage::Format_ARGB32); m_graphWidget->view()->paint(&img, false); img.save(path, Q_NULLPTR, userPrefs.value("settings/imgQuality", 90).toInt()); } } void GraphTitleBar::slotExportNodes() { if (!readyToExport()) { return; } QString path = guessInitialPath("_nodes.csv"); path = QFileDialog::getSaveFileName(this, "Export Nodes", path, "Text Files (*.csv)"); if (path.isEmpty()) { return; } auto trial = m_exp->trial(m_ui->cbTrial->currentText().toUShort()); QProgressDialog progressDlg("Exporting nodes", QString(), 0, trial->graph()->numNodes(), this); progressDlg.setWindowModality(Qt::WindowModal); progressDlg.setValue(0); std::function<void(int)> progress = [&progressDlg](int p) { progressDlg.setValue(p); }; if (NodesPrivate::saveToFile(trial->graph()->nodes(), path, progress)) { QMessageBox::information(this, "Exporting nodes", "The set of nodes was saved successfully!\n" + path); } else { QMessageBox::warning(this, "Exporting nodes", "ERROR! Unable to save the set of nodes at:\n" + path + "\nPlease, make sure this directory is writable."); } } void GraphTitleBar::slotRestarted() { const quint16 currTrial = m_ui->cbTrial->currentText().toUShort(); m_ui->cbTrial->blockSignals(true); m_ui->cbTrial->clear(); for (quint16 trialId = 0; trialId < m_exp->numTrials(); ++trialId) { m_ui->cbTrial->insertItem(trialId, QString::number(trialId)); } m_ui->cbTrial->setCurrentText(QString::number(currTrial)); // try to keep the same id m_ui->cbTrial->blockSignals(false); const quint16 _currTrial = m_ui->cbTrial->currentText().toUShort(); if (currTrial != _currTrial) { emit(trialSelected(_currTrial)); } } bool GraphTitleBar::readyToExport() { if (m_exp->expStatus() == Status::Disabled || m_exp->expStatus() == Status::Invalid) { QMessageBox::warning(this, "Exporting nodes", "This experiment is invalid or has not been initialized yet.\n" "Please, initialize the experiment and try again."); return false; } if (m_exp->expStatus() == Status::Running || m_exp->expStatus() == Status::Queued) { QMessageBox::warning(this, "Exporting nodes", "Please, pause the experiment and try again."); return false; } const quint16 currTrial = m_ui->cbTrial->currentText().toUShort(); auto trial = m_exp->trial(currTrial); if (!trial || trial->graph()->nodes().empty()) { QMessageBox::warning(this, "Exporting nodes", "Could not export the set of nodes.\n" "Please, make sure this experiment is valid and that " "there are nodes to be exported!"); return false; } return true; } QString GraphTitleBar::guessInitialPath(const QString& filename) const { QString path = m_exp->project()->filepath(); QDir dir = path.isEmpty() ? QDir::home() : QFileInfo(path).dir(); path = dir.absoluteFilePath(QString("%1_exp%2%3") .arg(m_exp->project()->name()).arg(m_exp->id()).arg(filename)); return path; } } // evoplex
34.60101
99
0.652897
evoplex
b98f9c6da292c86c57f277aa1f99a9aaf9c40ad0
2,683
cc
C++
src/instrumentation/converter/convert_to_string/convergence_to_string.cc
SlaybaughLab/Transport
8eb32cb8ae50c92875526a7540350ef9a85bc050
[ "MIT" ]
12
2018-03-14T12:30:53.000Z
2022-01-23T14:46:44.000Z
src/instrumentation/converter/convert_to_string/convergence_to_string.cc
SlaybaughLab/Transport
8eb32cb8ae50c92875526a7540350ef9a85bc050
[ "MIT" ]
194
2017-07-07T01:38:15.000Z
2021-05-19T18:21:19.000Z
src/instrumentation/converter/convert_to_string/convergence_to_string.cc
SlaybaughLab/Transport
8eb32cb8ae50c92875526a7540350ef9a85bc050
[ "MIT" ]
10
2017-07-06T22:58:59.000Z
2021-03-15T07:01:21.000Z
#include "instrumentation/converter/convert_to_string/convergence_to_string.h" #include <iomanip> #include <sstream> #include "instrumentation/converter/factory.hpp" namespace bart { namespace instrumentation { namespace converter { namespace convert_to_string { namespace { using OutputTerm = ConvergenceToStringOutputTerm; std::string default_output_format{"Iteration: ${ITERATION_NUM}/${ITERATION_MAX}, delta: ${DELTA}, index: ${INDEX}\n"}; std::map<ConvergenceToStringOutputTerm, std::string> default_output_term_to_string_map{{OutputTerm::kIterationNum, "${ITERATION_NUM}"}, {OutputTerm::kIterationMax, "${ITERATION_MAX}"}, {OutputTerm::kDelta, "${DELTA}"}, {OutputTerm::kIndex, "${INDEX}"}}; } // namespace ConvergenceToString::ConvergenceToString() : ToStringConverter<convergence::Status, ConvergenceToStringOutputTerm>( default_output_format, default_output_term_to_string_map) {} std::string ConvergenceToString::Convert(const convergence::Status &to_convert) const { auto return_string = output_format_; std::string delta_string{null_character_}, index_string{null_character_}; if (to_convert.delta.has_value()) { std::ostringstream delta_stream; delta_stream << std::scientific << std::setprecision(16) << to_convert.delta.value(); delta_string = delta_stream.str(); } if (to_convert.failed_index.has_value()) { index_string = std::to_string(to_convert.failed_index.value()); } std::map<OutputTerm, std::string> output_term_string_map{ {OutputTerm::kIterationNum, std::to_string(to_convert.iteration_number)}, {OutputTerm::kIterationMax, std::to_string(to_convert.max_iterations)}, {OutputTerm::kIndex, index_string}, {OutputTerm::kDelta, delta_string} }; for (const auto& [term, value] : output_term_string_map) { std::string string_to_find = output_term_to_string_map_.at(term); if (auto index = return_string.find(string_to_find); index != std::string::npos) { return_string.replace(index, string_to_find.size(), value); } } return return_string; } bool ConvergenceToString::is_registered_ = ConverterIFactory<convergence::Status, std::string>::get() .RegisterConstructor(converter::ConverterName::kConvergenceToString, [](){ std::unique_ptr<ConverterI<convergence::Status, std::string>> return_ptr = std::make_unique<ConvergenceToString>(); return return_ptr; }); } // namespace convert_to_string } // namespace converter } // namespace instrumentation } // namespace bart
33.5375
118
0.70369
SlaybaughLab
b991d542f132e27c5c1ea88b0b34c70584fac927
364
cpp
C++
source/scapes/foundation/shaders/Compiler.cpp
eZii-jester-data/pbr-sandbox
853aa023f063fd48760a8c3848687976189f3f98
[ "MIT" ]
null
null
null
source/scapes/foundation/shaders/Compiler.cpp
eZii-jester-data/pbr-sandbox
853aa023f063fd48760a8c3848687976189f3f98
[ "MIT" ]
null
null
null
source/scapes/foundation/shaders/Compiler.cpp
eZii-jester-data/pbr-sandbox
853aa023f063fd48760a8c3848687976189f3f98
[ "MIT" ]
null
null
null
#include "shaders/spirv/Compiler.h" #include <cassert> namespace scapes::foundation::shaders { Compiler *Compiler::create(ShaderILType type, io::FileSystem *file_system) { switch (type) { case ShaderILType::SPIRV: return new spirv::Compiler(file_system); } return nullptr; } void Compiler::destroy(Compiler *compiler) { delete compiler; } }
16.545455
75
0.717033
eZii-jester-data
b999e370c4ca22535a5423fe1e490d2ab8140d49
22,847
cpp
C++
libvast/test/format/zeek.cpp
frerich/vast
decac739ea4782ab91a1cee791ecd754b066419f
[ "BSD-3-Clause" ]
null
null
null
libvast/test/format/zeek.cpp
frerich/vast
decac739ea4782ab91a1cee791ecd754b066419f
[ "BSD-3-Clause" ]
null
null
null
libvast/test/format/zeek.cpp
frerich/vast
decac739ea4782ab91a1cee791ecd754b066419f
[ "BSD-3-Clause" ]
null
null
null
/****************************************************************************** * _ _____ __________ * * | | / / _ | / __/_ __/ Visibility * * | |/ / __ |_\ \ / / Across * * |___/_/ |_/___/ /_/ Space and Time * * * * This file is part of VAST. It is subject to the license terms in the * * LICENSE file found in the top-level directory of this distribution and at * * http://vast.io/license. No part of VAST, including this file, may be * * copied, modified, propagated, or distributed except according to the terms * * contained in the LICENSE file. * ******************************************************************************/ #include "vast/format/zeek.hpp" #include "vast/type.hpp" #include <istream> #include <sstream> #include <thread> #include <unistd.h> #define SUITE format #include "vast/test/fixtures/actor_system.hpp" #include "vast/test/fixtures/events.hpp" #include "vast/test/test.hpp" #include "vast/concept/parseable/to.hpp" #include "vast/concept/parseable/vast/schema.hpp" #include "vast/concept/parseable/vast/type.hpp" #include "vast/detail/fdinbuf.hpp" #include "vast/event.hpp" using namespace vast; using namespace std::string_literals; namespace { template <class Attribute> bool zeek_parse(const type& t, const std::string& s, Attribute& attr) { return format::zeek::make_zeek_parser<std::string::const_iterator>(t)(s, attr); } std::string_view capture_loss_10_events = R"__(#separator \x09 #set_separator , #empty_field (empty) #unset_field - #path capture_loss #open 2019-06-07-14-30-44 #fields ts ts_delta peer gaps acks percent_lost #types time interval string count count double 1258532133.914401 930.000003 bro 0 0 0.0 1258533063.914399 929.999998 bro 0 0 0.0 1258533977.316663 913.402264 bro 0 0 0.0 1258534893.914434 916.597771 bro 0 0 0.0 1258535805.364503 911.450069 bro 0 45 0.0 1258536723.914407 918.549904 bro 0 9 0.0 1258537653.914390 929.999983 bro 0 0 0.0 1258538553.914414 900.000024 bro 0 9 0.0 1258539453.914415 900.000001 bro 0 0 0.0 1258540374.060134 920.145719 bro 0 0 0.0 #close 2019-06-07-14-31-01)__"; std::string_view conn_log_10_events = R"__(#separator \x09 #set_separator , #empty_field (empty) #unset_field - #path conn #open 2014-05-23-18-02-04 #fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state local_orig missed_bytes history orig_pkts orig_ip_bytes resp_pkts resp_ip_bytes tunnel_parents #types time string addr port addr port enum string interval count count string bool count string count count count count table[string] 1258531221.486539 Pii6cUUq1v4 192.168.1.102 68 192.168.1.1 67 udp - 0.163820 301 300 SF - 0 Dd 1 329 1 328 (empty) 1258531680.237254 nkCxlvNN8pi 192.168.1.103 137 192.168.1.255 137 udp dns 3.780125 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531693.816224 9VdICMMnxQ7 192.168.1.102 137 192.168.1.255 137 udp dns 3.748647 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531635.800933 bEgBnkI31Vf 192.168.1.103 138 192.168.1.255 138 udp - 46.725380 560 0 S0 - 0 D 3 644 0 0 (empty) 1258531693.825212 Ol4qkvXOksc 192.168.1.102 138 192.168.1.255 138 udp - 2.248589 348 0 S0 - 0 D 2 404 0 0 (empty) 1258531803.872834 kmnBNBtl96d 192.168.1.104 137 192.168.1.255 137 udp dns 3.748893 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531747.077012 CFIX6YVTFp2 192.168.1.104 138 192.168.1.255 138 udp - 59.052898 549 0 S0 - 0 D 3 633 0 0 (empty) 1258531924.321413 KlF6tbPUSQ1 192.168.1.103 68 192.168.1.1 67 udp - 0.044779 303 300 SF - 0 Dd 1 331 1 328 (empty) 1258531939.613071 tP3DM6npTdj 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258532046.693816 Jb4jIDToo77 192.168.1.104 68 192.168.1.1 67 udp - 0.002103 311 300 SF - 0 Dd 1 339 1 328 (empty) )__"; std::string_view conn_log_100_events = R"__(#separator \x09 #set_separator , #empty_field (empty) #unset_field - #path conn #open 2014-05-23-18-02-04 #fields ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state local_orig missed_bytes history orig_pkts orig_ip_bytes resp_pkts resp_ip_bytes tunnel_parents #types time string addr port addr port enum string interval count count string bool count string count count count count table[string] 1258531221.486539 Pii6cUUq1v4 192.168.1.102 68 192.168.1.1 67 udp - 0.163820 301 300 SF - 0 Dd 1 329 1 328 (empty) 1258531680.237254 nkCxlvNN8pi 192.168.1.103 137 192.168.1.255 137 udp dns 3.780125 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531693.816224 9VdICMMnxQ7 192.168.1.102 137 192.168.1.255 137 udp dns 3.748647 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531635.800933 bEgBnkI31Vf 192.168.1.103 138 192.168.1.255 138 udp - 46.725380 560 0 S0 - 0 D 3 644 0 0 (empty) 1258531693.825212 Ol4qkvXOksc 192.168.1.102 138 192.168.1.255 138 udp - 2.248589 348 0 S0 - 0 D 2 404 0 0 (empty) 1258531803.872834 kmnBNBtl96d 192.168.1.104 137 192.168.1.255 137 udp dns 3.748893 350 0 S0 - 0 D 7 546 0 0 (empty) 1258531747.077012 CFIX6YVTFp2 192.168.1.104 138 192.168.1.255 138 udp - 59.052898 549 0 S0 - 0 D 3 633 0 0 (empty) 1258531924.321413 KlF6tbPUSQ1 192.168.1.103 68 192.168.1.1 67 udp - 0.044779 303 300 SF - 0 Dd 1 331 1 328 (empty) 1258531939.613071 tP3DM6npTdj 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258532046.693816 Jb4jIDToo77 192.168.1.104 68 192.168.1.1 67 udp - 0.002103 311 300 SF - 0 Dd 1 339 1 328 (empty) 1258532143.457078 xvWLhxgUmj5 192.168.1.102 1170 192.168.1.1 53 udp dns 0.068511 36 215 SF - 0 Dd 1 64 1 243 (empty) 1258532203.657268 feNcvrZfDbf 192.168.1.104 1174 192.168.1.1 53 udp dns 0.170962 36 215 SF - 0 Dd 1 64 1 243 (empty) 1258532331.365294 aLsTcZJHAwa 192.168.1.1 5353 224.0.0.251 5353 udp dns 0.100381 273 0 S0 - 0 D 2 329 0 0 (empty) 1258532331.365330 EK79I6iD5gl fe80::219:e3ff:fee7:5d23 5353 ff02::fb 5353 udp dns 0.100371 273 0 S0 - 0 D 2 369 0 0 (empty) 1258532404.734264 vLsf6ZHtak9 192.168.1.103 137 192.168.1.255 137 udp dns 3.873818 350 0 S0 - 0 D 7 546 0 0 (empty) 1258532418.272517 Su3RwTCaHL3 192.168.1.102 137 192.168.1.255 137 udp dns 3.748891 350 0 S0 - 0 D 7 546 0 0 (empty) 1258532404.859431 rPM1dfJKPmj 192.168.1.103 138 192.168.1.255 138 udp - 2.257840 348 0 S0 - 0 D 2 404 0 0 (empty) 1258532456.089023 4x5ezf34Rkh 192.168.1.102 1173 192.168.1.1 53 udp dns 0.000267 33 497 SF - 0 Dd 1 61 1 525 (empty) 1258532418.281002 mymcd8Veike 192.168.1.102 138 192.168.1.255 138 udp - 2.248843 348 0 S0 - 0 D 2 404 0 0 (empty) 1258532525.592455 07mJRfg5RU5 192.168.1.1 5353 224.0.0.251 5353 udp dns 0.099824 273 0 S0 - 0 D 2 329 0 0 (empty) 1258532525.592493 V6FODcWHWec fe80::219:e3ff:fee7:5d23 5353 ff02::fb 5353 udp dns 0.099813 273 0 S0 - 0 D 2 369 0 0 (empty) 1258532528.348891 H3qLO3SV0j 192.168.1.104 137 192.168.1.255 137 udp dns 3.748895 350 0 S0 - 0 D 7 546 0 0 (empty) 1258532528.357385 rPqxmvEhfBb 192.168.1.104 138 192.168.1.255 138 udp - 2.248339 348 0 S0 - 0 D 2 404 0 0 (empty) 1258532644.128655 VkSPS0xGKR 192.168.1.1 5353 224.0.0.251 5353 udp - - - - S0 - 0 D 1 154 0 0 (empty) 1258532644.128680 qYIadwKn8wg fe80::219:e3ff:fee7:5d23 5353 ff02::fb 5353 udp - - - - S0 - 0 D 1 174 0 0 (empty) 1258532657.288677 AbCe0UeHRD6 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258532683.876479 4xkhfR2BeX2 192.168.1.103 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 240 0 0 (empty) 1258532824.338291 03rnFQ5hJ3f 192.168.1.104 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258533003.551468 3VNZpT9V3G8 192.168.1.102 68 192.168.1.1 67 udp - 0.011807 301 300 SF - 0 Dd 1 329 1 328 (empty) 1258533129.324984 JGyFmSAGkVj 192.168.1.103 137 192.168.1.255 137 udp dns 3.748641 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533142.729062 jH5gXia1V2b 192.168.1.102 137 192.168.1.255 137 udp dns 3.748893 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533129.333980 rnymGcMKJa1 192.168.1.103 138 192.168.1.255 138 udp - 2.248336 348 0 S0 - 0 D 2 404 0 0 (empty) 1258533142.737803 KEbhCATVhq6 192.168.1.102 138 192.168.1.255 138 udp - 2.248086 348 0 S0 - 0 D 2 404 0 0 (empty) 1258533252.824915 43kp69mNH9h 192.168.1.104 137 192.168.1.255 137 udp dns 3.764644 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533252.848161 6IrqIPLkMue 192.168.1.104 138 192.168.1.255 138 udp - 2.249087 348 0 S0 - 0 D 2 404 0 0 (empty) 1258533406.310783 E3V7insZAf3 192.168.1.103 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 240 0 0 (empty) 1258533546.501981 1o9fdj2Mwzk 192.168.1.104 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258533745.340248 BwDhfT4ibLj 192.168.1.1 5353 224.0.0.251 5353 udp - - - - S0 - 0 D 1 105 0 0 (empty) 1258533745.340270 xQ3F7WYDuc9 fe80::219:e3ff:fee7:5d23 5353 ff02::fb 5353 udp - - - - S0 - 0 D 1 125 0 0 (empty) 1258533706.284625 xC73ngEP6t8 192.168.1.103 68 192.168.1.1 67 udp - 0.011605 303 300 SF - 0 Dd 1 331 1 328 (empty) 1258533766.050097 IxBAxd8IHQd 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258533853.790491 QHWe1hZptM5 192.168.1.103 137 192.168.1.255 137 udp dns 3.748893 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533867.185568 HzzKOZy8Zl 192.168.1.102 137 192.168.1.255 137 udp dns 3.748900 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533827.650648 O6RgfULxXN3 192.168.1.104 68 192.168.1.1 67 udp - 0.002141 311 300 SF - 0 Dd 1 339 1 328 (empty) 1258533853.799477 U17UR8RLuIh 192.168.1.103 138 192.168.1.255 138 udp - 2.248587 348 0 S0 - 0 D 2 404 0 0 (empty) 1258533867.194313 Z0o7i3H04Mb 192.168.1.102 138 192.168.1.255 138 udp - 2.248337 348 0 S0 - 0 D 2 404 0 0 (empty) 1258533977.316663 mxs3TNKBBy1 192.168.1.104 137 192.168.1.255 137 udp dns 3.748892 350 0 S0 - 0 D 7 546 0 0 (empty) 1258533977.325393 yLnPhusc1Fd 192.168.1.104 138 192.168.1.255 138 udp - 2.248342 348 0 S0 - 0 D 2 404 0 0 (empty) 1258534152.488884 91kNv7QfCzi 192.168.1.102 1180 68.216.79.113 37 tcp - 2.850214 0 0 S0 - 0 S 2 96 0 0 (empty) 1258534152.297748 LOurbPuyqk7 192.168.1.102 59040 192.168.1.1 53 udp dns 0.189140 44 178 SF - 0 Dd 1 72 1 206 (empty) 1258534161.354320 xDClpF8rSJf 192.168.1.102 1180 68.216.79.113 37 tcp - - - - S0 - 0 S 1 48 0 0 (empty) 1258534429.059180 lpnjZjmVs05 192.168.1.103 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 240 0 0 (empty) 1258534488.491105 EEdJBMA9rCk 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258534578.255976 omP3BzwITql 192.168.1.103 137 192.168.1.255 137 udp dns 3.764629 350 0 S0 - 0 D 7 546 0 0 (empty) 1258534582.490064 NnB6PYh0Zng 192.168.1.103 1190 192.168.1.1 53 udp dns 0.068749 36 215 SF - 0 Dd 1 64 1 243 (empty) 1258534591.642070 FVtn6tTYXr4 192.168.1.102 137 192.168.1.255 137 udp dns 3.748895 350 0 S0 - 0 D 7 546 0 0 (empty) 1258534545.219226 S5B6OZaxfKa 192.168.1.104 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258534578.280455 Gz2fEwEvO0a 192.168.1.103 138 192.168.1.255 138 udp - 2.248587 348 0 S0 - 0 D 2 404 0 0 (empty) 1258534591.650809 hTD6LLqZ7Y7 192.168.1.102 138 192.168.1.255 138 udp - 2.248337 348 0 S0 - 0 D 2 404 0 0 (empty) 1258534701.792887 zm9y9VwuS0i 192.168.1.104 137 192.168.1.255 137 udp dns 3.748895 350 0 S0 - 0 D 7 546 0 0 (empty) 1258534701.800881 aJiKvjshkn2 192.168.1.104 138 192.168.1.255 138 udp - 2.249081 348 0 S0 - 0 D 2 404 0 0 (empty) 1258534785.460075 sU2LS35B0Wc 192.168.1.102 68 192.168.1.1 67 udp - 0.012542 301 300 SF - 0 Dd 1 329 1 328 (empty) 1258534856.808007 gd5PK3GL6Q4 192.168.1.103 56940 192.168.1.1 53 udp dns 0.000218 44 178 SF - 0 Dd 1 72 1 206 (empty) 1258534856.809509 mkqyZaVMBzf 192.168.1.103 1191 68.216.79.113 37 tcp - 8.963129 0 0 S0 - 0 S 3 144 0 0 (empty) 1258534970.336456 jlEzGSUZMMk 192.168.1.104 1186 68.216.79.113 37 tcp - 3.024594 0 0 S0 - 0 S 2 96 0 0 (empty) 1258534970.334447 LD7p2nKzwUa 192.168.1.104 56041 192.168.1.1 53 udp dns 0.000221 44 178 SF - 0 Dd 1 72 1 206 (empty) 1258534979.376520 FikbEcyi5ud 192.168.1.104 1186 68.216.79.113 37 tcp - - - - S0 - 0 S 1 48 0 0 (empty) 1258535150.337635 r1IqqKncAn1 192.168.1.103 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 240 0 0 (empty) 1258535262.273837 OCdMO0RlDKi 192.168.1.104 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258535302.768650 w7TADZKQmv7 192.168.1.103 137 192.168.1.255 137 udp dns 3.748655 350 0 S0 - 0 D 7 546 0 0 (empty) 1258535316.098533 EhLt4Xfo998 192.168.1.102 137 192.168.1.255 137 udp dns 3.748897 350 0 S0 - 0 D 7 546 0 0 (empty) 1258535302.777651 IZ5pW4ZoObi 192.168.1.103 138 192.168.1.255 138 udp - 2.248077 348 0 S0 - 0 D 2 404 0 0 (empty) 1258535316.107272 DjK0mCmuZKc 192.168.1.102 138 192.168.1.255 138 udp - 2.248339 348 0 S0 - 0 D 2 404 0 0 (empty) 1258535426.269094 j1nshHTZnc2 192.168.1.104 137 192.168.1.255 137 udp dns 3.780124 350 0 S0 - 0 D 7 546 0 0 (empty) 1258535426.309819 HT5yJUMEaba 192.168.1.104 138 192.168.1.255 138 udp - 2.247581 348 0 S0 - 0 D 2 404 0 0 (empty) 1258535488.214929 j5j8aWhnaBl 192.168.1.103 68 192.168.1.1 67 udp - 0.019841 303 300 SF - 0 Dd 1 331 1 328 (empty) 1258535580.253637 8F0S5E1XGh4 192.168.1.102 138 192.168.1.255 138 udp - - - - S0 - 0 D 1 229 0 0 (empty) 1258535653.062408 YW7idMRahdb 192.168.1.104 1191 65.54.95.64 80 tcp http 0.050465 173 297 RSTO - 0 ShADdfR 5 381 3 425 (empty) 1258535650.506019 5txwc6aKNFe 192.168.1.104 56749 192.168.1.1 53 udp dns 0.044610 30 94 SF - 0 Dd 1 58 1 122 (empty) 1258535656.471265 HcFUvhy5Wf6 192.168.1.104 1193 65.54.95.64 80 tcp http 0.050215 195 296 RSTO - 0 ShADdfR 5 403 3 424 (empty) 1258535656.524478 TsaAKxHC8yh 192.168.1.104 1194 65.54.95.64 80 tcp http 0.109682 194 21053 RSTO - 0 ShADdfR 8 522 17 21741 (empty) 1258535652.794076 M6vDMlNtAok 192.168.1.104 52125 192.168.1.1 53 udp dns 0.266791 44 200 SF - 0 Dd 1 72 1 228 (empty) 1258535658.712360 Hiphu7fLcC5 192.168.1.104 1195 65.54.95.64 80 tcp http 0.079452 173 297 RSTO - 0 ShADdfR 5 381 3 425 (empty) 1258535655.387448 GH3I4uYo0l1 192.168.1.104 64790 192.168.1.1 53 udp dns 0.042968 42 179 SF - 0 Dd 1 70 1 207 (empty) 1258535650.551483 04xC2aCJ5i8 192.168.1.104 137 192.168.1.255 137 udp dns 4.084184 300 0 S0 - 0 D 6 468 0 0 (empty) 1258535666.147439 g6mt9RBZkw 192.168.1.104 1197 65.54.95.64 80 tcp http 0.049966 173 297 RSTO - 0 ShADdfR 5 381 3 425 (empty) 1258535697.963212 I8ePTueT9Aj 192.168.1.102 1188 212.227.97.133 80 tcp http 0.898191 1121 342 SF - 0 ShADadfF 5 1329 5 550 (empty) 1258535698.862885 lZ58OyvEYY3 192.168.1.102 1189 87.106.1.47 80 tcp http 0.880456 1118 342 SF - 0 ShADadfF 5 1326 5 546 (empty) 1258535699.744831 D2ERJCFZD1e 192.168.1.102 1190 87.106.1.89 80 tcp http 0.914934 1118 342 SF - 0 ShADadfF 5 1326 5 550 (empty) 1258535696.159584 wIEQmZxJy19 192.168.1.102 1187 192.168.1.1 53 udp dns 0.068537 36 215 SF - 0 Dd 1 64 1 243 (empty) 1258535700.662505 HqW58gj5856 192.168.1.102 1191 87.106.12.47 80 tcp http 0.955409 1160 1264 SF - 0 ShADadfF 5 1368 5 1472 (empty) 1258535701.622151 zCr8XZTRcvh 192.168.1.102 1192 87.106.12.77 80 tcp http 0.514927 1222 367 SF - 0 ShADadfF 6 1470 6 615 (empty) 1258535650.499268 dNSfUrlTwq3 192.168.1.104 68 255.255.255.255 67 udp - - - - S0 - 0 D 1 328 0 0 (empty) 1258535609.607942 qomqwkg9Ddg 192.168.1.104 68 192.168.1.1 67 udp - 40.891774 311 600 SF - 0 Dd 1 339 2 656 (empty) 1258535707.137448 YUUhPmf1G4c 192.168.1.102 1194 87.106.66.233 80 tcp http 0.877448 1128 301 SF - 0 ShADadfF 5 1336 5 505 (empty) 1258535702.138078 yH3dkqFJE8 192.168.1.102 1193 87.106.13.61 80 tcp - 3.061084 0 0 S0 - 0 S 2 96 0 0 (empty) 1258535708.016137 I60NOMgOQxj 192.168.1.102 1195 87.106.9.29 80 tcp http 0.876205 1126 342 SF - 0 ShADadfF 5 1334 5 550 (empty) 1258535655.431418 jM8ATYNKqZg 192.168.1.104 1192 65.55.184.16 80 tcp http 59.712557 172 262 RSTR - 0 ShADdr 4 340 3 390 (empty) 1258535710.855364 YmvKAMrJ6v9 192.168.1.102 1196 192.168.1.1 53 udp dns 0.013042 36 215 SF - 0 Dd 1 64 1 243 (empty) 1258535660.158200 WfzxgFx2lWb 192.168.1.104 1196 65.55.184.16 443 tcp ssl 67.887666 57041 8510 RSTR - 0 ShADdar 54 59209 26 9558 (empty) #close 2014-05-23-18-02-35)__"; struct fixture : fixtures::deterministic_actor_system { std::vector<table_slice_ptr> read(std::unique_ptr<std::istream> input, size_t slice_size, size_t num_events, bool expect_eof, bool expect_timeout) { using reader_type = format::zeek::reader; auto settings = caf::settings{}; caf::put(settings, "import.read-timeout", "200ms"); reader_type reader{defaults::import::table_slice_type, std::move(settings), std::move(input)}; std::vector<table_slice_ptr> slices; auto add_slice = [&](table_slice_ptr ptr) { slices.emplace_back(std::move(ptr)); }; auto [err, num] = reader.read(std::numeric_limits<size_t>::max(), slice_size, add_slice); if (expect_eof && err != ec::end_of_input) FAIL("Zeek reader did not exhaust input: " << sys.render(err)); if (expect_timeout && err != ec::timeout) FAIL("Zeek reader did not time out: " << sys.render(err)); if (!expect_eof && !expect_timeout && err) FAIL("Zeek reader failed to parse input: " << sys.render(err)); if (num != num_events) FAIL("Zeek reader only produced " << num << " events, expected " << num_events); return slices; } std::vector<table_slice_ptr> read(std::string_view input, size_t slice_size, size_t num_events, bool expect_eof = true, bool expect_timeout = false) { return read(std::make_unique<std::istringstream>(std::string{input}), slice_size, num_events, expect_eof, expect_timeout); } }; } // namspace <anonymous> FIXTURE_SCOPE(zeek_reader_tests, fixture) TEST(zeek data parsing) { using namespace std::chrono; data d; CHECK(zeek_parse(bool_type{}, "T", d)); CHECK(d == true); CHECK(zeek_parse(integer_type{}, "-49329", d)); CHECK(d == integer{-49329}); CHECK(zeek_parse(count_type{}, "49329"s, d)); CHECK(d == count{49329}); CHECK(zeek_parse(time_type{}, "1258594163.566694", d)); auto ts = duration_cast<vast::duration>(double_seconds{1258594163.566694}); CHECK(d == vast::time{ts}); CHECK(zeek_parse(duration_type{}, "1258594163.566694", d)); CHECK(d == ts); CHECK(zeek_parse(string_type{}, "\\x2afoo*"s, d)); CHECK(d == "*foo*"); CHECK(zeek_parse(address_type{}, "192.168.1.103", d)); CHECK(d == *to<address>("192.168.1.103")); CHECK(zeek_parse(subnet_type{}, "10.0.0.0/24", d)); CHECK(d == *to<subnet>("10.0.0.0/24")); CHECK(zeek_parse(port_type{}, "49329", d)); CHECK(d == port{49329, port::unknown}); CHECK(zeek_parse(list_type{integer_type{}}, "49329", d)); CHECK(d == list{49329}); CHECK(zeek_parse(list_type{string_type{}}, "49329,42", d)); CHECK(d == list{"49329", "42"}); } TEST(zeek reader - capture loss) { auto slices = read(capture_loss_10_events, 10, 10); REQUIRE_EQUAL(slices.size(), 1u); CHECK_EQUAL(slices[0]->rows(), 10u); } TEST(zeek reader - conn log) { auto slices = read(conn_log_100_events, 20, 100); CHECK_EQUAL(slices.size(), 5u); for (auto& slice : slices) CHECK_EQUAL(slice->rows(), 20u); } TEST(zeek reader - custom schema) { std::string custom = R"__( type zeek.conn = record{ ts: time #test, uid: string #index=string, // clashing user attribute id: record {orig_h: addr, orig_p: port, resp_h: addr, resp_p: port}, proto: string #foo=bar, // user attribute service: count, // type mismatch community_id: string // not present in the data } )__"; auto sch = unbox(to<schema>(custom)); std::string eref = R"__(record{ ts: time #test #timestamp, uid: string #index=string, id: record {orig_h: addr, orig_p: port, resp_h: addr, resp_p: port}, proto: string #foo=bar, service: string, duration: duration, orig_bytes: count, resp_bytes: count, conn_state: string, local_orig: bool, //local_resp: bool, missed_bytes: count, history: string, orig_pkts: count, orig_ip_bytes: count, resp_pkts: count, resp_ip_bytes: count, tunnel_parents: list<string>, })__"; auto expected = flatten(unbox(to<type>(eref)).name("zeek.conn")); using reader_type = format::zeek::reader; reader_type reader{ defaults::import::table_slice_type, caf::settings{}, std::make_unique<std::istringstream>(std::string{conn_log_100_events})}; reader.schema(sch); std::vector<table_slice_ptr> slices; auto add_slice = [&](table_slice_ptr ptr) { slices.emplace_back(std::move(ptr)); }; auto [err, num] = reader.read(20, 20, add_slice); CHECK_EQUAL(slices.size(), 1u); CHECK_EQUAL(slices[0]->rows(), 20u); CHECK_EQUAL(slices[0]->layout(), expected); } TEST(zeek reader - continous stream with partial slice) { int pipefds[2]; auto result = ::pipe(pipefds); REQUIRE_EQUAL(result, 0); auto [read_end, write_end] = pipefds; detail::fdinbuf buf(read_end); std::vector<table_slice_ptr> slices; std::thread t([&] { bool expect_eof = false; bool expect_timeout = true; slices = read(std::make_unique<std::istream>(&buf), 100, 10, expect_eof, expect_timeout); }); // Write less than one full slice, leaving the pipe open. result = ::write(write_end, &conn_log_10_events[0], conn_log_10_events.size()); REQUIRE_EQUAL(static_cast<size_t>(result), conn_log_10_events.size()); // Expect that we will see the results before the test times out. t.join(); CHECK_EQUAL(slices.size(), 1u); for (auto& slice : slices) CHECK_EQUAL(slice->rows(), 10u); ::close(pipefds[0]); ::close(pipefds[1]); } FIXTURE_SCOPE_END() FIXTURE_SCOPE(zeek_writer_tests, fixtures::events) TEST(zeek writer) { // Sanity check some Zeek events. CHECK_EQUAL(zeek_conn_log.size(), 20u); CHECK_EQUAL(zeek_conn_log.front().type().name(), "zeek.conn"); auto record = caf::get_if<list>(&zeek_conn_log.front().data()); REQUIRE(record); REQUIRE_EQUAL(record->size(), 20u); CHECK_EQUAL(record->at(6), data{"udp"}); // one after the conn record CHECK_EQUAL(record->back(), data{list{}}); // table[T] is actually a list // Perform the writing. auto dir = path{"vast-unit-test-zeek"}; auto guard = caf::detail::make_scope_guard([&] { rm(dir); }); format::zeek::writer writer{dir}; for (auto& slice : zeek_conn_log_slices) if (auto err = writer.write(*slice)) FAIL("failed to write conn log"); for (auto& slice : zeek_http_log_slices) if (auto err = writer.write(*slice)) FAIL("failed to write HTTP log"); CHECK(exists(dir / zeek_conn_log[0].type().name() + ".log")); CHECK(exists(dir / zeek_http_log[0].type().name() + ".log")); } FIXTURE_SCOPE_END()
60.602122
205
0.689631
frerich
b99a9821cd922cb7c2721ce2bdc20592e18f56ab
6,173
cpp
C++
logdevice/server/IS_LOG_EMPTY_onReceived.cpp
mickvav/LogDevice
24a8b6abe4576418eceb72974083aa22d7844705
[ "BSD-3-Clause" ]
1
2021-05-19T23:01:58.000Z
2021-05-19T23:01:58.000Z
logdevice/server/IS_LOG_EMPTY_onReceived.cpp
mickvav/LogDevice
24a8b6abe4576418eceb72974083aa22d7844705
[ "BSD-3-Clause" ]
null
null
null
logdevice/server/IS_LOG_EMPTY_onReceived.cpp
mickvav/LogDevice
24a8b6abe4576418eceb72974083aa22d7844705
[ "BSD-3-Clause" ]
null
null
null
/** * Copyright (c) 2017-present, Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include "IS_LOG_EMPTY_onReceived.h" #include "logdevice/common/Sender.h" #include "logdevice/common/configuration/Configuration.h" #include "logdevice/common/protocol/IS_LOG_EMPTY_REPLY_Message.h" #include "logdevice/common/stats/Stats.h" #include "logdevice/server/ServerProcessor.h" #include "logdevice/server/ServerWorker.h" #include "logdevice/server/locallogstore/PartitionedRocksDBStore.h" #include "logdevice/server/read_path/LogStorageStateMap.h" #include "logdevice/server/storage_tasks/ShardedStorageThreadPool.h" namespace facebook { namespace logdevice { static void send_reply(const Address& to, const IS_LOG_EMPTY_Header& request, Status status, bool empty) { ld_debug("Sending IS_LOG_EMPTY_REPLY: client_rqid=%lu, status=%s, empty=%s", request.client_rqid.val_, error_name(status), empty ? "TRUE" : "FALSE"); if (status == E::OK) { if (empty) { WORKER_LOG_STAT_INCR(request.log_id, is_log_empty_reply_true); } else { WORKER_LOG_STAT_INCR(request.log_id, is_log_empty_reply_false); } } else { WORKER_LOG_STAT_INCR(request.log_id, is_log_empty_reply_error); } IS_LOG_EMPTY_REPLY_Header header = { request.client_rqid, status, empty, request.shard}; auto msg = std::make_unique<IS_LOG_EMPTY_REPLY_Message>(header); Worker::onThisThread()->sender().sendMessage(std::move(msg), to); } Message::Disposition IS_LOG_EMPTY_onReceived(IS_LOG_EMPTY_Message* msg, const Address& from) { const IS_LOG_EMPTY_Header& header = msg->getHeader(); if (header.log_id == LOGID_INVALID) { ld_error("got IS_LOG_EMPTY message from %s with invalid log ID, ignoring", Sender::describeConnection(from).c_str()); return Message::Disposition::NORMAL; } ServerWorker* worker = ServerWorker::onThisThread(); if (!worker->isAcceptingWork()) { ld_debug("Ignoring IS_LOG_EMPTY message: not accepting more work"); send_reply(from, header, E::SHUTDOWN, false); return Message::Disposition::NORMAL; } WORKER_LOG_STAT_INCR(header.log_id, is_log_empty_received); ServerProcessor* processor = worker->processor_; if (!processor->runningOnStorageNode()) { send_reply(from, header, E::NOTSTORAGE, false); return Message::Disposition::NORMAL; } auto scfg = worker->getServerConfig(); const shard_size_t n_shards = scfg->getNumShards(); shard_index_t shard_idx = header.shard; if (shard_idx >= n_shards) { RATELIMIT_ERROR(std::chrono::seconds(10), 10, "Got IS_LOG_EMPTY message from client %s with " "invalid shard %u, this node only has %u shards", Sender::describeConnection(from).c_str(), shard_idx, n_shards); return Message::Disposition::NORMAL; } if (processor->isDataMissingFromShard(shard_idx)) { send_reply(from, header, E::REBUILDING, false); return Message::Disposition::NORMAL; } LogStorageStateMap& map = processor->getLogStorageStateMap(); LogStorageState* log_state = map.insertOrGet(header.log_id, shard_idx); if (log_state == nullptr || log_state->hasPermanentError()) { send_reply(from, header, E::FAILED, false); return Message::Disposition::NORMAL; } folly::Optional<lsn_t> trim_point = log_state->getTrimPoint(); if (!trim_point.hasValue()) { // Trim point is unknown. Try to find it... int rv = map.recoverLogState( header.log_id, shard_idx, LogStorageState::RecoverContext::IS_LOG_EMPTY_MESSAGE); // And in the meantime tell the client to try again in a bit send_reply(from, header, rv == 0 ? E::AGAIN : E::FAILED, false); return Message::Disposition::NORMAL; } ShardedStorageThreadPool* sstp = processor->sharded_storage_thread_pool_; LocalLogStore& store = sstp->getByIndex(shard_idx).getLocalLogStore(); lsn_t last_lsn; int rv = store.getHighestInsertedLSN(header.log_id, &last_lsn); if (rv == -1) { if (err != E::NOTSUPPORTED || err != E::NOTSUPPORTEDLOG) { RATELIMIT_ERROR(std::chrono::seconds(10), 2, "Unexpected error code from getHighestInsertedLSN(): %s. " "Changing to FAILED.", error_name(err)); err = E::FAILED; } RATELIMIT_ERROR(std::chrono::seconds(1), 10, "Unable to get the highest inserted LSN: %s", error_description(err)); // an error occurred, reply to the client send_reply(from, header, err, false); return Message::Disposition::NORMAL; } ld_debug("IS_LOG_EMPTY(%lu): last_lsn=%lu, trim_point=%lu", header.log_id.val_, last_lsn, trim_point.value()); bool empty = (last_lsn == LSN_INVALID || last_lsn <= trim_point.value()); if (empty) { // Make sure we're not waiting for, or in, mini-rebuilding. auto partitioned_store = dynamic_cast<PartitionedRocksDBStore*>(&store); if (partitioned_store != nullptr && partitioned_store->isUnderReplicated()) { RATELIMIT_DEBUG(std::chrono::seconds(10), 10, "IS_LOG_EMPTY(%lu): local log store has dirty " "partitions, reporting non-empty", header.log_id.val_); send_reply(from, header, E::REBUILDING, false); return Message::Disposition::NORMAL; } } else { // Make sure it's not just pseudorecords, such as bridge records. auto partitioned_store = dynamic_cast<PartitionedRocksDBStore*>(&store); empty = partitioned_store != nullptr && partitioned_store->isLogEmpty(header.log_id); } send_reply(from, header, E::OK, empty); return Message::Disposition::NORMAL; } }} // namespace facebook::logdevice
37.186747
80
0.658675
mickvav
b99dfd6d63016ee46a62f42c622c79a4ef9f09d7
9,890
hpp
C++
src/xalanc/XPath/XPathExecutionContextDefault.hpp
rherardi/xml-xalan-c-src_1_10_0
24e6653a617a244e4def60d67b57e70a192a5d4d
[ "Apache-2.0" ]
null
null
null
src/xalanc/XPath/XPathExecutionContextDefault.hpp
rherardi/xml-xalan-c-src_1_10_0
24e6653a617a244e4def60d67b57e70a192a5d4d
[ "Apache-2.0" ]
null
null
null
src/xalanc/XPath/XPathExecutionContextDefault.hpp
rherardi/xml-xalan-c-src_1_10_0
24e6653a617a244e4def60d67b57e70a192a5d4d
[ "Apache-2.0" ]
null
null
null
/* * Copyright 1999-2004 The Apache Software Foundation. * * 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. */ #if !defined(XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680) #define XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680 // Base include file. Must be first. #include <xalanc/XPath/XPathDefinitions.hpp> #include <xalanc/Include/XalanObjectCache.hpp> #include <xalanc/Include/XalanVector.hpp> #include <xalanc/XalanDOM/XalanDOMString.hpp> /** * @author <a href="mailto:david_n_bertoni@lotus.com">David N. Bertoni</a> */ // Base class include file. #include <xalanc/XPath/XPathExecutionContext.hpp> #include <xalanc/PlatformSupport/XalanDOMStringCache.hpp> #include <xalanc/XPath/MutableNodeRefList.hpp> #include <xalanc/XPath/XalanQNameByValue.hpp> XALAN_CPP_NAMESPACE_BEGIN class DOMSupport; class XPathEnvSupport; class XalanQName; /** * A basic implementation of the class XPathExecutionContext. */ class XALAN_XPATH_EXPORT XPathExecutionContextDefault : public XPathExecutionContext { public: typedef XalanVector<XalanNode*> CurrentNodeStackType; typedef XalanVector<const NodeRefListBase*> ContextNodeListStackType; /** * Construct an XPathExecutionContextDefault object * * @param theXPathEnvSupport XPathEnvSupport class instance * @param theDOMSupport DOMSupport class instance * @param theXobjectFactory factory class instance for XObjects * @param theCurrentNode current node in the source tree * @param theContextNodeList node list for current context * @param thePrefixResolver pointer to prefix resolver to use */ XPathExecutionContextDefault( XPathEnvSupport& theXPathEnvSupport, DOMSupport& theDOMSupport, XObjectFactory& theXObjectFactory, XalanNode* theCurrentNode = 0, const NodeRefListBase* theContextNodeList = 0, const PrefixResolver* thePrefixResolver = 0); /** * Construct an XPathExecutionContextDefault object * * @param theXPathEnvSupport XPathEnvSupport class instance * @param theXObjectFactory factory class instance for XObjects * @param theCurrentNode current node in the source tree * @param theContextNodeList node list for current context * @param thePrefixResolver pointer to prefix resolver to use */ explicit XPathExecutionContextDefault( MemoryManagerType& theManager, XalanNode* theCurrentNode = 0, const NodeRefListBase* theContextNodeList = 0, const PrefixResolver* thePrefixResolver = 0); static XPathExecutionContextDefault* create( MemoryManagerType& theManager, XalanNode* theCurrentNode = 0, const NodeRefListBase* theContextNodeList = 0, const PrefixResolver* thePrefixResolver = 0); virtual ~XPathExecutionContextDefault(); /** * Get the XPathEnvSupport instance. * * @return a pointer to the instance. */ XPathEnvSupport* getXPathEnvSupport() const { return m_xpathEnvSupport; } /** * Set the XPathEnvSupport instance. * * @param theSupport a reference to the instance to use. */ void setXPathEnvSupport(XPathEnvSupport* theSupport) { m_xpathEnvSupport = theSupport; } /** * Set the DOMSupport instance. * * @param theDOMSupport a reference to the instance to use. */ void setDOMSupport(DOMSupport* theDOMSupport) { m_domSupport = theDOMSupport; } /** * Set the XObjectFactory instance. * * @param theFactory a reference to the instance to use. */ void setXObjectFactory(XObjectFactory* theXObjectFactory) { m_xobjectFactory = theXObjectFactory; } /** * Get a reference to the scratch QNameByValue instance. * * @return A reference to a QNameByValue instance. */ XalanQNameByValue& getScratchQName() const { #if defined(XALAN_NO_MUTABLE) return ((XPathExecutionContextDefault*)this)->m_scratchQName; #else return m_scratchQName; #endif } virtual void doFormatNumber( double number, const XalanDOMString& pattern, const XalanDecimalFormatSymbols* theDFS, XalanDOMString& theResult, const XalanNode* context = 0, const LocatorType* locator = 0); // These interfaces are inherited from XPathExecutionContext... virtual void reset(); virtual XalanNode* getCurrentNode() const; virtual void pushCurrentNode(XalanNode* theCurrentNode); virtual void popCurrentNode(); virtual bool isNodeAfter( const XalanNode& node1, const XalanNode& node2) const; virtual void pushContextNodeList(const NodeRefListBase& theList); virtual void popContextNodeList(); virtual const NodeRefListBase& getContextNodeList() const; virtual size_type getContextNodeListLength() const; virtual size_type getContextNodeListPosition(const XalanNode& contextNode) const; virtual bool elementAvailable(const XalanQName& theQName) const; virtual bool elementAvailable( const XalanDOMString& theName, const LocatorType* locator) const; virtual bool functionAvailable(const XalanQName& theQName) const; virtual bool functionAvailable( const XalanDOMString& theName, const LocatorType* locator) const; virtual const XObjectPtr extFunction( const XalanDOMString& theNamespace, const XalanDOMString& functionName, XalanNode* context, const XObjectArgVectorType& argVec, const LocatorType* locator); virtual XalanDocument* parseXML( MemoryManagerType& theManager, const XalanDOMString& urlString, const XalanDOMString& base) const; virtual MutableNodeRefList* borrowMutableNodeRefList(); virtual bool returnMutableNodeRefList(MutableNodeRefList* theList); virtual MutableNodeRefList* createMutableNodeRefList(MemoryManagerType& theManager) const; virtual XalanDOMString& getCachedString(); virtual bool releaseCachedString(XalanDOMString& theString); virtual void getNodeSetByKey( XalanDocument* doc, const XalanQName& qname, const XalanDOMString& ref, MutableNodeRefList& nodelist); virtual void getNodeSetByKey( XalanDocument* doc, const XalanDOMString& name, const XalanDOMString& ref, const LocatorType* locator, MutableNodeRefList& nodelist); virtual const XObjectPtr getVariable( const XalanQName& name, const LocatorType* locator = 0); virtual const PrefixResolver* getPrefixResolver() const; virtual void setPrefixResolver(const PrefixResolver* thePrefixResolver); virtual const XalanDOMString* getNamespaceForPrefix(const XalanDOMString& prefix) const; virtual const XalanDOMString& findURIFromDoc(const XalanDocument* owner) const; virtual const XalanDOMString& getUnparsedEntityURI( const XalanDOMString& theName, const XalanDocument& theDocument) const; virtual bool shouldStripSourceNode(const XalanText& node); virtual XalanDocument* getSourceDocument(const XalanDOMString& theURI) const; virtual void setSourceDocument( const XalanDOMString& theURI, XalanDocument* theDocument); // These interfaces are inherited from ExecutionContext... virtual void formatNumber( double number, const XalanDOMString& pattern, XalanDOMString& theResult, const XalanNode* context = 0, const LocatorType* locator = 0); virtual void formatNumber( double number, const XalanDOMString& pattern, const XalanDOMString& dfsName, XalanDOMString& theResult, const XalanNode* context = 0, const LocatorType* locator = 0); virtual void error( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const; virtual void warn( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const; virtual void message( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const; protected: typedef XalanObjectCache<MutableNodeRefList, DefaultCacheCreateFunctorMemMgr<MutableNodeRefList>, DeleteFunctor<MutableNodeRefList>, ClearCacheResetFunctor<MutableNodeRefList> > NodeListCacheType; enum { eNodeListCacheListSize = 50 }; struct ContextNodeListPositionCache { ContextNodeListPositionCache() : m_node(0), m_index(0) { } void clear() { if (m_node != 0) { m_node = 0; } } const XalanNode* m_node; size_type m_index; }; XPathEnvSupport* m_xpathEnvSupport; DOMSupport* m_domSupport; CurrentNodeStackType m_currentNodeStack; ContextNodeListStackType m_contextNodeListStack; const PrefixResolver* m_prefixResolver; XalanDOMString m_currentPattern; NodeListCacheType m_nodeListCache; XalanDOMStringCache m_stringCache; mutable ContextNodeListPositionCache m_cachedPosition; mutable XalanQNameByValue m_scratchQName; static const NodeRefList s_dummyList; }; XALAN_CPP_NAMESPACE_END #endif // XPATHEXECUTIONCONTEXTDEFAULT_HEADER_GUARD_1357924680
24.419753
198
0.718301
rherardi
b99f46cfe30482b2f31b95961356219d62c421e8
20,921
cpp
C++
src/nodes.cpp
TUM-I5/LinA
6834d7f0cc283b75c0569f01285ff4ccaa047b37
[ "BSD-3-Clause" ]
null
null
null
src/nodes.cpp
TUM-I5/LinA
6834d7f0cc283b75c0569f01285ff4ccaa047b37
[ "BSD-3-Clause" ]
null
null
null
src/nodes.cpp
TUM-I5/LinA
6834d7f0cc283b75c0569f01285ff4ccaa047b37
[ "BSD-3-Clause" ]
null
null
null
/** This file is generated. Do not edit. */ #include "nodes.h" namespace lina { #if !defined(CONVERGENCE_ORDER) #error CONVERGENCE_ORDER must be set. #elif CONVERGENCE_ORDER == 2 double const LGLNodes[] = {0.00000000000000000000000000000000, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 3 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.50000000000000000000000000000000, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 4 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.27639320225002103035908263312687, 0.72360679774997896964091736687313, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 5 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.17267316464601142810085377187657, 0.50000000000000000000000000000000, 0.82732683535398857189914622812343, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 6 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.11747233803526765357449851302033, 0.35738424175967745184292450297956, 0.64261575824032254815707549702044, 0.88252766196473234642550148697967, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 7 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.08488805186071653506398389301627, 0.26557560326464289309811405904562, 0.50000000000000000000000000000000, 0.73442439673535710690188594095438, 0.91511194813928346493601610698373, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 8 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.06412992574519669233127711938967, 0.20414990928342884892774463430102, 0.39535039104876056561567136982732, 0.60464960895123943438432863017268, 0.79585009071657115107225536569898, 0.93587007425480330766872288061033, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 9 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.05012100229426992134382737779083, 0.16140686024463112327705728645433, 0.31844126808691092064462396564567, 0.50000000000000000000000000000000, 0.68155873191308907935537603435433, 0.83859313975536887672294271354567, 0.94987899770573007865617262220917, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 10 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.04023304591677059308553366958883, 0.13061306744724746249844691257008, 0.26103752509477775216941245363437, 0.41736052116680648768689011702092, 0.58263947883319351231310988297908, 0.73896247490522224783058754636563, 0.86938693255275253750155308742992, 0.95976695408322940691446633041117, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 11 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.03299928479597043283386293195031, 0.10775826316842779068879109194577, 0.21738233650189749676451801526112, 0.35212093220653030428404424222047, 0.50000000000000000000000000000000, 0.64787906779346969571595575777953, 0.78261766349810250323548198473888, 0.89224173683157220931120890805423, 0.96700071520402956716613706804969, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 12 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.02755036388855888829620993084839, 0.09036033917799666082567920914155, 0.18356192348406966116879757277817, 0.30023452951732553386782510421652, 0.43172353357253622256796907213016, 0.56827646642746377743203092786984, 0.69976547048267446613217489578348, 0.81643807651593033883120242722183, 0.90963966082200333917432079085845, 0.97244963611144111170379006915161, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 13 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.02334507667891804405154726762228, 0.07682621767406384156703719645062, 0.15690576545912128696362048021682, 0.25854508945433189912653138318154, 0.37535653494688000371566314981288, 0.50000000000000000000000000000000, 0.62464346505311999628433685018712, 0.74145491054566810087346861681846, 0.84309423454087871303637951978318, 0.92317378232593615843296280354938, 0.97665492332108195594845273237772, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 14 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.02003247736636954932244991899229, 0.06609947308482637449988989854587, 0.13556570045433692970766379973956, 0.22468029853567647234168864707046, 0.32863799332864357747804829817916, 0.44183406555814806617061164513192, 0.55816593444185193382938835486808, 0.67136200667135642252195170182084, 0.77531970146432352765831135292954, 0.86443429954566307029233620026044, 0.93390052691517362550011010145413, 0.97996752263363045067755008100771, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 15 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.01737703674808071360207430396520, 0.05745897788851185058729918425888, 0.11824015502409239964794076201186, 0.19687339726507714443823503068164, 0.28968097264316375953905153063071, 0.39232302231810288088716027686354, 0.50000000000000000000000000000000, 0.60767697768189711911283972313646, 0.71031902735683624046094846936929, 0.80312660273492285556176496931836, 0.88175984497590760035205923798814, 0.94254102211148814941270081574112, 0.98262296325191928639792569603480, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 16 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.01521597686489103352387863081627, 0.05039973345326395350268586924008, 0.10399585406909246803445586451842, 0.17380564855875345526605839017971, 0.25697028905643119410905460707656, 0.35008476554961839595082327263885, 0.44933686323902527607848349747704, 0.55066313676097472392151650252296, 0.64991523445038160404917672736115, 0.74302971094356880589094539292344, 0.82619435144124654473394160982029, 0.89600414593090753196554413548158, 0.94960026654673604649731413075992, 0.98478402313510896647612136918373, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 17 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.01343391168429084292151024906314, 0.04456000204221320218809874680114, 0.09215187438911484644662472338124, 0.15448550968615764730254032131378, 0.22930730033494923043813329624797, 0.31391278321726147904638265963237, 0.40524401324084130584786849262344, 0.50000000000000000000000000000000, 0.59475598675915869415213150737656, 0.68608721678273852095361734036763, 0.77069269966505076956186670375203, 0.84551449031384235269745967868622, 0.90784812561088515355337527661876, 0.95543999795778679781190125319886, 0.98656608831570915707848975093686, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 18 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.01194722129390072856774053782915, 0.03967540732623306308107268728436, 0.08220323239095489314317681883603, 0.13816033535837865934689481734896, 0.20574758284066911941323205340322, 0.28279248154393801232885643162966, 0.36681867356085950791616733398720, 0.45512545325767394448867749495572, 0.54487454674232605551132250504428, 0.63318132643914049208383266601280, 0.71720751845606198767114356837034, 0.79425241715933088058676794659678, 0.86183966464162134065310518265104, 0.91779676760904510685682318116397, 0.96032459267376693691892731271564, 0.98805277870609927143225946217085, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 19 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.01069411688895995242368296844489, 0.03554923592370687814102987060172, 0.07376971110167695345702201497947, 0.12425289872369349291818125518303, 0.18554593136738975111658384688564, 0.25588535715964324861104518118754, 0.33324757608775069485074994807754, 0.41540698829535921431242292327756, 0.50000000000000000000000000000000, 0.58459301170464078568757707672244, 0.66675242391224930514925005192246, 0.74411464284035675138895481881246, 0.81445406863261024888341615311436, 0.87574710127630650708181874481697, 0.92623028889832304654297798502053, 0.96445076407629312185897012939828, 0.98930588311104004757631703155511, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 20 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00962814755304291403727678070788, 0.03203275059366728214190920753468, 0.06656101095502492934507639269186, 0.11231586952397206479284123620266, 0.16811179885484435507679833851442, 0.23250356798405686917593201908551, 0.30382340814304535030676264809209, 0.38022414703850675240879932153646, 0.45972703138058908101202774092022, 0.54027296861941091898797225907978, 0.61977585296149324759120067846354, 0.69617659185695464969323735190791, 0.76749643201594313082406798091449, 0.83188820114515564492320166148558, 0.88768413047602793520715876379734, 0.93343898904497507065492360730814, 0.96796724940633271785809079246532, 0.99037185244695708596272321929212, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 21 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00871385169772598588275936172230, 0.02901185152012723285194867466928, 0.06035262233820476777442320184753, 0.10199903696114379762784370516982, 0.15297448696888838368634180340266, 0.21208401986908465653648906483096, 0.27794210836049894940274182519632, 0.34900507174561755636232406607062, 0.42360724209890726699682083575716, 0.50000000000000000000000000000000, 0.57639275790109273300317916424284, 0.65099492825438244363767593392938, 0.72205789163950105059725817480368, 0.78791598013091534346351093516904, 0.84702551303111161631365819659734, 0.89800096303885620237215629483018, 0.93964737766179523222557679815247, 0.97098814847987276714805132533072, 0.99128614830227401411724063827770, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 22 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00792378077117691172385518889396, 0.02639785800038565973789311669214, 0.05496885490454776473517108711046, 0.09302553619403943197727907597193, 0.13975638001939892094005905180076, 0.19416528085787051438689419706504, 0.25509256240504882509562438215836, 0.32123964493054023096952135987991, 0.39119670742035747910602245326730, 0.46347272999455083261945560476795, 0.53652727000544916738054439523205, 0.60880329257964252089397754673270, 0.67876035506945976903047864012009, 0.74490743759495117490437561784164, 0.80583471914212948561310580293496, 0.86024361998060107905994094819924, 0.90697446380596056802272092402807, 0.94503114509545223526482891288954, 0.97360214199961434026210688330786, 0.99207621922882308827614481110604, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 23 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00723642206063371095926861663095, 0.02412102214464489793218016007428, 0.05027072097982749452491983982632, 0.08517445167435705688839969035500, 0.12815247941396965802741822846650, 0.17836817776993189576192723319862, 0.23484411443157791593494233992385, 0.29648103104276258540202475589245, 0.36207922552710346644656118366043, 0.43036189797966580070406869350862, 0.50000000000000000000000000000000, 0.56963810202033419929593130649138, 0.63792077447289653355343881633957, 0.70351896895723741459797524410755, 0.76515588556842208406505766007615, 0.82163182223006810423807276680138, 0.87184752058603034197258177153350, 0.91482554832564294311160030964500, 0.94972927902017250547508016017368, 0.97587897785535510206781983992572, 0.99276357793936628904073138336905, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 24 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00663472324741955822345663092276, 0.02212588953505682098651143472468, 0.04614716244324673900242350176690, 0.07826796492256397968834748128833, 0.11791475878975334610631235952386, 0.16437994736793565008216757090650, 0.21683432101035234390529522772886, 0.27434181339283869087589075421519, 0.33587619331224454398330541032020, 0.40033937330458366638171373043750, 0.46658100313138571094317909580416, 0.53341899686861428905682090419584, 0.59966062669541633361828626956250, 0.66412380668775545601669458967980, 0.72565818660716130912410924578481, 0.78316567898964765609470477227114, 0.83562005263206434991783242909350, 0.88208524121024665389368764047614, 0.92173203507743602031165251871167, 0.95385283755675326099757649823310, 0.97787411046494317901348856527532, 0.99336527675258044177654336907724, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 25 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00610502753425314536409796456342, 0.02036793087373276057007741058024, 0.04250861463268871083842503313158, 0.07216176708234171123809336991412, 0.10884017037964160980040602388562, 0.15194147559243281661981728310531, 0.20075792636000336595118950140946, 0.25448794259056080869052003871560, 0.31224927107038638338564269386964, 0.37309346791556170991005655915636, 0.43602147025844651364550768745268, 0.50000000000000000000000000000000, 0.56397852974155348635449231254732, 0.62690653208443829008994344084364, 0.68775072892961361661435730613036, 0.74551205740943919130947996128440, 0.79924207363999663404881049859054, 0.84805852440756718338018271689469, 0.89115982962035839019959397611438, 0.92783823291765828876190663008588, 0.95749138536731128916157496686842, 0.97963206912626723942992258941976, 0.99389497246574685463590203543658, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 26 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00563629384426217278537665481435, 0.01881106261614133512466866435894, 0.03928222659122132943743473912566, 0.06673783802043821451277425109512, 0.10076140844628128048160618071483, 0.14083709181866745973729730604804, 0.18635735025384155609974054641939, 0.23663212898506072735087830280950, 0.29089930646687660721815805883308, 0.34833624357037363961297948104894, 0.40807225236497254933939716405712, 0.46920179410904013589725636260912, 0.53079820589095986410274363739088, 0.59192774763502745066060283594288, 0.65166375642962636038702051895106, 0.70910069353312339278184194116692, 0.76336787101493927264912169719050, 0.81364264974615844390025945358061, 0.85916290818133254026270269395196, 0.89923859155371871951839381928517, 0.93326216197956178548722574890488, 0.96071777340877867056256526087434, 0.98118893738385866487533133564106, 0.99436370615573782721462334518565, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 27 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00521951813572468942556267997274, 0.01742579877459054036786659843944, 0.03640827063744211057012661796364, 0.06189895689273876066672847540293, 0.09353975655209385587095406762073, 0.13088642507677004458028638712580, 0.17341466815159524241064756240877, 0.22052746952871940996866596256594, 0.27156346219295879816069367458038, 0.32580620900548566478145671070642, 0.38249425844854093333159920974334, 0.44083183305073947578064586586234, 0.50000000000000000000000000000000, 0.55916816694926052421935413413766, 0.61750574155145906666840079025666, 0.67419379099451433521854328929358, 0.72843653780704120183930632541962, 0.77947253047128059003133403743406, 0.82658533184840475758935243759123, 0.86911357492322995541971361287420, 0.90646024344790614412904593237927, 0.93810104310726123933327152459707, 0.96359172936255788942987338203636, 0.98257420122540945963213340156056, 0.99478048186427531057443732002726, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 28 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00484729869077293724145354406770, 0.01618785707143434782811456042826, 0.03383741643922073753692879069550, 0.05756449139434858079384683087138, 0.08705951497183090197774278690170, 0.12193790299721511742395213736690, 0.16174493553521334114030937746330, 0.20596165508141219676084396011914, 0.25401162303421030978519165852776, 0.30526843121181859603205792239794, 0.35906386668919881402292374554534, 0.41469662234599781955864866112562, 0.47144143915324355118672817421313, 0.52855856084675644881327182578687, 0.58530337765400218044135133887438, 0.64093613331080118597707625445466, 0.69473156878818140396794207760206, 0.74598837696578969021480834147224, 0.79403834491858780323915603988086, 0.83825506446478665885969062253670, 0.87806209700278488257604786263310, 0.91294048502816909802225721309830, 0.94243550860565141920615316912862, 0.96616258356077926246307120930450, 0.98381214292856565217188543957174, 0.99515270130922706275854645593230, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 29 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00451350586571509186062744335022, 0.01507709635603185314379930605609, 0.03152864073950874422898157585832, 0.05366714001195586061788504297346, 0.08122363185910671737896334190659, 0.11386355139676562932291468293178, 0.15119066932181600580301278571146, 0.19275187389828352501454819128782, 0.23804266281401545821059171343820, 0.28651326414325280618121179451582, 0.33757530857904449686999298846058, 0.39060897085786949009547407383750, 0.44497049330220394514610619887216, 0.50000000000000000000000000000000, 0.55502950669779605485389380112784, 0.60939102914213050990452592616250, 0.66242469142095550313000701153942, 0.71348673585674719381878820548418, 0.76195733718598454178940828656180, 0.80724812610171647498545180871218, 0.84880933067818399419698721428854, 0.88613644860323437067708531706822, 0.91877636814089328262103665809341, 0.94633285998804413938211495702654, 0.96847135926049125577101842414168, 0.98492290364396814685620069394391, 0.99548649413428490813937255664978, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 30 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00421302857974985333059088704568, 0.01407669841686537916170352389540, 0.02944760952447145884640522529224, 0.05015039090036157022332858842528, 0.07595025640990094522428808390846, 0.10655482138122645977502023970380, 0.14161730068145743418310070193505, 0.18074041209622079631445325864513, 0.22348086995247357380772488497967, 0.26935440491587965738672138944642, 0.31784124978877550112200744722410, 0.36839202814021310436645026549996, 0.42043397868707476608752571145058, 0.47337744475725666531849608277432, 0.52662255524274333468150391722568, 0.57956602131292523391247428854942, 0.63160797185978689563354973450004, 0.68215875021122449887799255277590, 0.73064559508412034261327861055358, 0.77651913004752642619227511502033, 0.81925958790377920368554674135487, 0.85838269931854256581689929806495, 0.89344517861877354022497976029620, 0.92404974359009905477571191609154, 0.94984960909963842977667141157472, 0.97055239047552854115359477470776, 0.98592330158313462083829647610460, 0.99578697142025014666940911295432, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 31 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00394157782675945570533769217564, 0.01317253209213176258696522576238, 0.02756541489598038509679723117507, 0.04696652427936509342774423837627, 0.07117000235127219481649730880176, 0.09991922840376850536383433300841, 0.13290943184546237893292958258118, 0.16979089869423723833147936270162, 0.21017267139599904349835156890114, 0.25362669045058379714809988346490, 0.29969233085971909684866779030196, 0.34788128436356368952027242618687, 0.39768273537623774942945320713614, 0.44856877561965886145544263834598, 0.50000000000000000000000000000000, 0.55143122438034113854455736165402, 0.60231726462376225057054679286386, 0.65211871563643631047972757381313, 0.70030766914028090315133220969804, 0.74637330954941620285190011653510, 0.78982732860400095650164843109886, 0.83020910130576276166852063729838, 0.86709056815453762106707041741882, 0.90008077159623149463616566699159, 0.92882999764872780518350269119824, 0.95303347572063490657225576162373, 0.97243458510401961490320276882493, 0.98682746790786823741303477423762, 0.99605842217324054429466230782436, 1.00000000000000000000000000000000}; #elif CONVERGENCE_ORDER == 32 double const LGLNodes[] = {0.00000000000000000000000000000000, 0.00369553301361932031422934236128, 0.01235265475864538596877202480592, 0.02585758079138381095833587920578, 0.04407503046813404796273427381296, 0.06682376199366224008459261528773, 0.09387763411127882772658910596371, 0.12496775303166260114136201766085, 0.15978512219222459202880212115058, 0.19798370642578943693141354369406, 0.23918386855921735469670371330399, 0.28297614139907653019834032149680, 0.32892529673055925687309388965064, 0.37657467057489734779187928442056, 0.42545070159317625254280906191498, 0.47506763747670337384685112763579, 0.52493236252329662615314887236421, 0.57454929840682374745719093808502, 0.62342532942510265220812071557944, 0.67107470326944074312690611034936, 0.71702385860092346980165967850320, 0.76081613144078264530329628669601, 0.80201629357421056306858645630594, 0.84021487780777540797119787884942, 0.87503224696833739885863798233915, 0.90612236588872117227341089403629, 0.93317623800633775991540738471227, 0.95592496953186595203726572618704, 0.97414241920861618904166412079422, 0.98764734524135461403122797519408, 0.99630446698638067968577065763872, 1.00000000000000000000000000000000}; #endif }
298.871429
1,179
0.898666
TUM-I5
b9a46e7464f3b553e1f6c8192ff9a1b876cc056a
12,021
cc
C++
MathUtils/src/Measurement_Arithmetic.cc
yimuchen/UserUtils
1a5c55d286f325424f4cfd23f22da63cfa6fb6a9
[ "MIT" ]
null
null
null
MathUtils/src/Measurement_Arithmetic.cc
yimuchen/UserUtils
1a5c55d286f325424f4cfd23f22da63cfa6fb6a9
[ "MIT" ]
1
2021-12-10T15:04:04.000Z
2022-01-10T18:56:53.000Z
MathUtils/src/Measurement_Arithmetic.cc
yimuchen/UserUtils
1a5c55d286f325424f4cfd23f22da63cfa6fb6a9
[ "MIT" ]
1
2018-06-05T14:08:08.000Z
2018-06-05T14:08:08.000Z
/** * @file Measurement_Arithmetic.cc * @brief Implementation of measurement arithetics methods * @author [Yi-Mu "Enoch" Chen](https://github.com/yimuchen) */ #ifdef CMSSW_GIT_HASH #include "UserUtils/MathUtils/interface/Measurement.hpp" #include "UserUtils/MathUtils/interface/StatisticsUtil.hpp" #else #include "UserUtils/MathUtils/Measurement.hpp" #include "UserUtils/MathUtils/StatisticsUtil.hpp" #endif #include <numeric> #include "Math/Derivator.h" #include "Math/Functor.h" using namespace std; namespace usr { /** * @brief interface to the Single variable version of the MinosError() function. */ Measurement MakeMinos( const ROOT::Math::IGenFunction& nll, const double min, const double max, const double confidencelevel ) { double central = min + max / 2; double lowerbound = min; double upperbound = max; usr::stat::MinosError( nll, central, lowerbound, upperbound, confidencelevel ); return Measurement( central, upperbound-central, central-lowerbound ); } /** * @brief interface to the \f$R^{n}\rightarrow R\f$ version of the MinosError() * function */ Measurement MakeMinos( const ROOT::Math::IMultiGenFunction& nllfunction, const ROOT::Math::IMultiGenFunction& varfunction, const double* initguess, const double confidencelevel, const double* upperguess, const double* lowerguess ) { double central; double upperbound; double lowerbound; usr::stat::MinosError( nllfunction , varfunction , initguess , central , lowerbound , upperbound , confidencelevel , upperguess , lowerguess ); return Measurement( central , fabs( upperbound-central ) , fabs( central - lowerbound ) ); } /** * @brief Approximate @NLL function for a measurements of * \f$x^{+\sigma_+}_{-\sigma_i}\f$ * * The approximation for an @NLL function is a variation of the one recommended * in [R. Barlow's "Asymmetric statistical * errors"](https://arxiv.org/abs/physics/0406120), In the form of: * * \f[\mathrm{NLL}(x) = \frac{x^{2}}{ 2V(1+Ax)} \f] * * with \f$V\f$ being the average variance \f$\frac{\sigma_+ + \sigma_-}{2}\f$, * and \f$A\f$ being the variance asymmetry \f$\frac{\sigma_{+} - * \sigma_{-}}{V}\f$. * * A few adjustments are made to ensure the stability of the calculations. * - The ratio between the two uncertainties would have a hard limit of 10. The * smaller uncertainty would be inflated if extreme asymmetries are present. * - The average variance would have an minimum value of \f$10^{-16}\f$ which * should cover most cases where uncertainty calculations are required. Test * have shown that the calculation would not be affected by such limits if the * there are some dominate uncertainties. * - To avoid the singularity at \f$x=-1/A\f$, an exponential function would be * used instead for the linear function for the denominator in the @NLL * function when x is past half-way from the central value to the original * singular point, such that the approximation would be extended to an infinite * domain. The exponential function is designed such that the denominator and * its derivative is continuous. */ double LinearVarianceNLL( const double x, const Measurement& m ) { static const double maxrelerror = 10.; static double (* AugmentedDenominator)( double, const double, const double ) = []( double x, const double up, const double lo )->double { static const double minprod = 1e-12; const double V = std::max( up * lo, minprod ); const double A = ( up-lo ) / V; double ans = V * ( 1 + x * A ); if( up > lo && A != 0 && x < ( -lo-1/A )/ 2 ){ const double s = ( -lo-1/A )/2; const double b = A / ( 1+A*s ); const double B = V * ( 1+A*s ) / exp( b*s ); ans = B * exp( b * x ); } else if( lo > up && A != 0 && x > ( up+1/A )/2 ){ ans = AugmentedDenominator( -x, lo, up ); } return ans; }; // Getting potentially inflating uncertainties const double central = m.CentralValue(); const double rawupper = m.AbsUpperError(); const double rawlower = m.AbsLowerError(); const double effupper = std::max( rawupper, rawlower / maxrelerror ); const double efflower = std::max( rawlower, rawupper / maxrelerror ); const double num = ( x- central ) * ( x - central ); const double de = AugmentedDenominator( x-central, effupper, efflower ); const double ans = 0.5 * num / de; return ans; } /** * @brief given a list of measurements with uncertainties, return the effective * sum of all measurements as if all measurements are uncorrelated. * * Given a list of parameters, a master @NLL function is generated assuming that * all variables are uncorrelated and uses the same underlying @NLL function * (specifed with the `nll` argument). The MinosErrors method for * multidimensional Minos uncertainty calculations is then invoked for the * calculation. This function also automatically estimates the initial guesses * for the Minos error calculations using the partial differentials of the * variable function. For details of this initial guess estimation see the * usr::LazyEvaluateUncorrelated method. */ extern Measurement EvaluateUncorrelated( const std::vector<Measurement>& m_list, const ROOT::Math::IMultiGenFunction& varfunction, const double confidencelevel, double (* nll )( double, const Measurement& ) ) { auto masternll = [&m_list, nll]( const double* x )->double { double ans = 0; for( unsigned i = 0; i < m_list.size(); ++i ){ ans = ans + nll( x[i], m_list.at( i ) ); } return ans; }; ROOT::Math::Functor nllfunction( masternll, m_list.size() ); std::vector<double> init; std::vector<double> upperguess; std::vector<double> lowerguess; double diff_sqsum = 0; for( const auto& m : m_list ){ init.push_back( m.CentralValue() ); } for( unsigned i = 0; i < m_list.size(); ++i ){ const double diff = ROOT::Math::Derivator::Eval( varfunction , init.data(), i ); diff_sqsum += diff *diff; } diff_sqsum = std::sqrt( diff_sqsum ); // Guess for the boundaries for the input required for getting the upper and // lower uncertainties based on the derivatives of the variable function. for( unsigned i = 0; i < m_list.size(); ++i ){ const double diff = ROOT::Math::Derivator::Eval( varfunction , init.data(), i ); const double w = fabs( diff / diff_sqsum ); if( diff > 0 ){ upperguess.push_back( init.at( i ) + w*m_list.at( i ).AbsUpperError() ); lowerguess.push_back( init.at( i ) - w*m_list.at( i ).AbsLowerError() ); } else { upperguess.push_back( init.at( i ) - w*m_list.at( i ).AbsLowerError() ); lowerguess.push_back( init.at( i ) + w*m_list.at( i ).AbsUpperError() ); } } return MakeMinos( nllfunction , varfunction , init.data() , confidencelevel , upperguess.data() , lowerguess.data() ); } /** * @brief given a list of measurements with uncertainties, return the effective * sum of all measurements as if all measurements are uncorrelated. * * This function also allows the user to define the working confidence level * for the calculations and also the approximate @NLL function used for the * individual measurements (by default using the LinearVarianceNLL() function). */ Measurement SumUncorrelated( const vector<Measurement>& m_list, const double confidencelevel, double (* nll )( double, const Measurement& ) ) { const unsigned dim = m_list.size(); auto Sum = [dim]( const double* x ){ double ans = 0; for( unsigned i = 0; i < dim; ++i ){ ans += x[i]; } return ans; }; return EvaluateUncorrelated( m_list , ROOT::Math::Functor( Sum, dim ) , confidencelevel , nll ); } /** * @brief given a list of measurements with uncertainties, return the effective * sum of all measurements as if all measurements are uncorrelated. * * This function also allows the user to define the working confidence level * for the calculations and also the approximate @NLL function used for the * individual measurements (by default using the LinearVarianceNLL() function). */ Measurement ProdUncorrelated( const std::vector<Measurement>& m_list, const double confidencelevel, double (* nll )( double, const Measurement& ) ) { const unsigned dim = m_list.size(); auto Prod = [dim]( const double* x ){ double ans = 1; for( unsigned i = 0; i < dim; ++i ){ ans *= x[i]; } return ans; }; double prod = 1.; vector<Measurement> normlist; for( const auto& p : m_list ){ prod *= p.CentralValue(); normlist.push_back( p.NormParam() ); } return prod*EvaluateUncorrelated( normlist , ROOT::Math::Functor( Prod, dim ) , confidencelevel , nll ); } /** * @brief Give a function of parameters, calculate the error propagation given a * various a list of symmetric error functions using a lazy method. Assuming all * parameters are uncorrelated * * * For a function given as: * \f[ * y = f(x_1 , x_2, x_3,\ldots ) * \f] * * With a set of measurements \f$\hat{x}_i{}^{+\sigma^{+}_i}_{-\sigma^{-}_i}\f$, * The resulting measurement \f$\hat{y}^{+\sigma^{+}_y}_{-\sigma^{-}_y}\f$ is * evaluted as: * * \f[ * \hat{y} = f(\hat{x}_1, \hat{x}_2, \hat{x}_3\ldots) * \f] * * and: * * \f[ * y\pm\sigma^{\pm}_{y} = f(\hat{x}_i + \Delta x_i) * \f] * * with * * \f[ * \Delta x_i = \frac{ |\partial_i f| }{\sqrt{\sum_i (\partial_i f)^2}} * \sigma^{k_i}_{i} * \f] * * where \f$k_i = +\f$ if \f$\partial_i f\f$ is positive or else \f$k_i = - \f$ * otherwise. * **/ Measurement LazyEvaluateUncorrelated( const std::vector<Measurement>& paramlist, const ROOT::Math::IMultiGenFunction& varfunction ) { std::vector<double> center; std::vector<double> upper; std::vector<double> lower; double diff_sqsum = 0; for( const auto& p : paramlist ){ center.push_back( p.CentralValue() ); } for( unsigned i = 0; i < paramlist.size(); ++i ){ const double diff = ROOT::Math::Derivator::Eval( varfunction , center.data(), i ); diff_sqsum += diff *diff; } diff_sqsum = std::sqrt( diff_sqsum ); for( unsigned i = 0; i < paramlist.size(); ++i ){ const double diff = ROOT::Math::Derivator::Eval( varfunction , center.data(), i ); const double w = fabs( diff/diff_sqsum ); const auto& p = paramlist.at( i ); if( diff > 0 ){ upper.push_back( p.CentralValue() + w*p.AbsUpperError() ); lower.push_back( p.CentralValue() - w*p.AbsLowerError() ); } else { upper.push_back( p.CentralValue() - w*p.AbsLowerError() ); lower.push_back( p.CentralValue() + w*p.AbsUpperError() ); } } const double cen = varfunction( center.data() ); const double up = varfunction( upper.data() ); const double lo = varfunction( lower.data() ); return Measurement( cen, up-cen, cen-lo ); } }/* usr */
33.391667
81
0.602945
yimuchen
b9a4daf27f425972ca64b0bd2037ef91724c769b
4,255
hpp
C++
include/atl/detail/finite_automaton/copy.hpp
LoringHe/fml
fe4e5341b0f07ffd4d04207b3039cf4157ef3cba
[ "MIT" ]
2
2020-09-02T05:04:52.000Z
2020-09-04T05:26:33.000Z
include/atl/detail/finite_automaton/copy.hpp
Jinlong-He/fml
fe4e5341b0f07ffd4d04207b3039cf4157ef3cba
[ "MIT" ]
null
null
null
include/atl/detail/finite_automaton/copy.hpp
Jinlong-He/fml
fe4e5341b0f07ffd4d04207b3039cf4157ef3cba
[ "MIT" ]
null
null
null
// // copy.hpp // atl // // Licensed under the MIT License <http://opensource.org/licenses/MIT>. // SPDX-License-Identifier: MIT // Copyright (c) 2020 Jinlong He. // #ifndef atl_detail_finite_automaton_copy_hpp #define atl_detail_finite_automaton_copy_hpp #include <atl/detail/finite_automaton/finite_automaton.hpp> #include <atl/detail/finite_automaton/closure.hpp> namespace atl::detail { struct copy_fa_impl { template <FA_PARAMS> static void copy_states(const FA& a_in, FA& a_out, typename FA::State2Map& state2_map, typename FA::StateSet const& state_set) { typedef typename FA::state_property_type StateProperty; typedef typename FA::State State; typename FA::StateIter s_it, s_end; State state_copy = -1; if (state_set.size() > 0) { for (auto state : state_set) { if constexpr (std::is_same<StateProperty, boost::no_property>::value) { state_copy = add_state(a_out); } else { state_copy = add_state(a_out, atl::get_property(a_in, state)); } state2_map[state] = state_copy; } } else { for (tie(s_it, s_end) = states(a_in); s_it != s_end; s_it++) { auto state = *s_it; if constexpr (std::is_same<StateProperty, boost::no_property>::value) { state_copy = add_state(a_out); } else { state_copy = add_state(a_out, atl::get_property(a_in, state)); } state2_map[state] = state_copy; } } set_initial_state(a_out, state2_map.at(initial_state(a_in))); for (auto state : final_state_set(a_in)) { if (state2_map.count(state) > 0) { set_final_state(a_out, state2_map.at(state)); } } } template <FA_PARAMS> static void copy_transitions(const FA& a_in, FA& a_out, typename FA::State2Map const& state2_map) { typename FA::OutTransitionIter t_it, t_end; for (const auto& [state, source] : state2_map) { for (tie(t_it, t_end) = out_transitions(a_in, state); t_it != t_end; t_it++) { auto target = atl::target(a_in, *t_it); if (state2_map.count(target) > 0) { auto new_target = state2_map.at(target); const auto& t = atl::get_property(a_in, *t_it); add_transition(a_out, source, new_target, t); } } } } template <FA_PARAMS> static void apply(const FA& a_in, FA& a_out, typename FA::State2Map& state2_map, typename FA::StateSet const& states) { typedef typename FA::automaton_property_type AutomatonProperty; atl::clear(a_out); if (is_empty(a_in)) return; set_alphabet(a_out, alphabet(a_in)); if constexpr (!std::is_same<AutomatonProperty, boost::no_property>::value) { atl::set_property(a_out, atl::get_property(a_in)); } copy_states(a_in, a_out, state2_map, states); copy_transitions(a_in, a_out, state2_map); } }; }; namespace atl { template <FA_PARAMS> inline void copy_fa(const FA& a_in, FA& a_out, typename FA::State2Map& state2_map, typename FA::StateSet const& states = typename FA::StateSet()) { detail::copy_fa_impl::apply(a_in, a_out, state2_map, states); } template <FA_PARAMS> inline void copy_fa(const FA& a_in, FA& a_out, typename FA::StateSet const& states = typename FA::StateSet()) { typename FA::State2Map state2_map; detail::copy_fa_impl::apply(a_in, a_out, state2_map, states); } } #endif /* atl_detail_finite_automaton_copy_hpp */
37.324561
94
0.5349
LoringHe
b9a5a0b27723eef5f93f494716089a20e1cd3a50
2,107
cpp
C++
rmw_coredx_cpp/src/rmw_destroy_wait_set.cpp
rupertholman/rmw_coredx
1c97655212bfa90b1353f019ae08e8b2c487db8d
[ "Apache-2.0" ]
null
null
null
rmw_coredx_cpp/src/rmw_destroy_wait_set.cpp
rupertholman/rmw_coredx
1c97655212bfa90b1353f019ae08e8b2c487db8d
[ "Apache-2.0" ]
null
null
null
rmw_coredx_cpp/src/rmw_destroy_wait_set.cpp
rupertholman/rmw_coredx
1c97655212bfa90b1353f019ae08e8b2c487db8d
[ "Apache-2.0" ]
null
null
null
// Copyright 2015 Twin Oaks Computing, Inc. // Modifications copyright (C) 2017-2018 Twin Oaks Computing, 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. #ifdef CoreDX_GLIBCXX_USE_CXX11_ABI_ZERO #define _GLIBCXX_USE_CXX11_ABI 0 #endif #include <rmw/rmw.h> #include <rmw/types.h> #include <rmw/allocators.h> #include <rmw/error_handling.h> #include <rmw/impl/cpp/macros.hpp> #include <rcutils/logging_macros.h> #include <dds/dds.hh> #include <dds/dds_builtinDataReader.hh> #include "rmw_coredx_cpp/identifier.hpp" #include "rmw_coredx_types.hpp" #include "util.hpp" #if defined(__cplusplus) extern "C" { #endif /* ************************************************ */ rmw_ret_t rmw_destroy_wait_set(rmw_wait_set_t * waitset) { RCUTILS_LOG_DEBUG_NAMED( "rmw_coredx_cpp", "%s[ waitset: %p ]", __FUNCTION__, waitset ); if (!waitset) { RMW_SET_ERROR_MSG("waitset handle is null"); return RMW_RET_ERROR; } auto result = RMW_RET_OK; CoreDXWaitSetInfo * waitset_info = static_cast<CoreDXWaitSetInfo *>(waitset->data); // Explicitly call destructor since the "placement new" was used waitset_info->active_conditions.clear(); waitset_info->attached_conditions.clear(); if (waitset_info->wait_set) { RMW_TRY_DESTRUCTOR(waitset_info->wait_set->~WaitSet(), WaitSet, result = RMW_RET_ERROR) rmw_free(waitset_info->wait_set); } waitset_info = nullptr; if (waitset->data) { rmw_free(waitset->data); waitset->data = nullptr; } if (waitset) { rmw_wait_set_free(waitset); } return result; } #if defined(__cplusplus) } #endif
26.670886
91
0.714286
rupertholman
b9a67fb63c8d5d0fc0e03819a0e3d12ad282ee37
3,690
cpp
C++
tests/ablateLibrary/mathFunctions/functionPointerTests.cpp
mtmcgurn-buffalo/ablate
35ee9a30277908775a61d78462ea9724ee631a9b
[ "BSD-3-Clause" ]
3
2021-01-19T21:29:10.000Z
2021-08-20T19:54:49.000Z
tests/ablateLibrary/mathFunctions/functionPointerTests.cpp
mtmcgurn-buffalo/ablate
35ee9a30277908775a61d78462ea9724ee631a9b
[ "BSD-3-Clause" ]
124
2021-01-14T15:30:48.000Z
2022-03-28T14:44:31.000Z
tests/ablateLibrary/mathFunctions/functionPointerTests.cpp
mtmcgurn-buffalo/ablate
35ee9a30277908775a61d78462ea9724ee631a9b
[ "BSD-3-Clause" ]
17
2021-02-10T22:34:57.000Z
2022-03-21T18:46:06.000Z
#include <memory> #include "gtest/gtest.h" #include "mathFunctions/functionPointer.hpp" namespace ablateTesting::mathFunctions { TEST(FunctionPointerTests, ShouldEvalToScalarFromXYZ) { // arrange auto function = ablate::mathFunctions::FunctionPointer([](auto dim, auto time, auto loc, auto nf, auto u, auto ctx) { u[0] = loc[0] + loc[1] + loc[2] + time; return 0; }); // act/assert ASSERT_DOUBLE_EQ(10.0, function.Eval(1.0, 2.0, 3.0, 4.0)); ASSERT_DOUBLE_EQ(18.0, function.Eval(9.0, 2.0, 3.0, 4.0)); ASSERT_DOUBLE_EQ(0.0, function.Eval(5.0, 2.0, 3.0, -10.0)); } TEST(FunctionPointerTests, ShouldEvalToScalarFromCoord) { // arrange auto function = ablate::mathFunctions::FunctionPointer([](auto dim, auto time, auto loc, auto nf, auto u, auto ctx) { switch (dim) { case 3: u[0] = loc[0] + loc[1] + loc[2] + time; break; case 2: u[0] = loc[0] + loc[1] + time; break; } return 0; }); // act/assert const double array1[3] = {1.0, 2.0, 3.0}; ASSERT_DOUBLE_EQ(10.0, function.Eval(array1, 3, 4.0)); const double array2[2] = {1.0, 2.0}; ASSERT_DOUBLE_EQ(7.0, function.Eval(array2, 2, 4.0)); const double array3[3] = {5, 5, -5}; ASSERT_DOUBLE_EQ(0.0, function.Eval(array3, 3, -5)); } TEST(FunctionPointerTests, ShouldEvalToVectorFromXYZ) { // arrange auto function = ablate::mathFunctions::FunctionPointer([](auto dim, auto time, auto loc, auto nf, auto u, auto ctx) { if (dim == 3 && nf >= 3) { u[0] = loc[0] + loc[1] + loc[2] + time; u[1] = loc[0] * loc[1] * loc[2]; u[2] = time; } return 0; }); // act/assert std::vector<double> result1 = {0, 0, 0}; function.Eval(1.0, 2.0, 3.0, 4.0, result1); ASSERT_DOUBLE_EQ(result1[0], 10.0); ASSERT_DOUBLE_EQ(result1[1], 6.0); ASSERT_DOUBLE_EQ(result1[2], 4.0); std::vector<double> result2 = {0, 0, 0, 4}; function.Eval(2.0, 2.0, 3.0, 4.0, result2); ASSERT_DOUBLE_EQ(result2[0], 11.0); ASSERT_DOUBLE_EQ(result2[1], 12.0); ASSERT_DOUBLE_EQ(result2[2], 4.0); ASSERT_DOUBLE_EQ(result2[3], 4.0); } TEST(FunctionPointerTests, ShouldEvalToVectorFromCoord) { // arrange auto function = ablate::mathFunctions::FunctionPointer([](auto dim, auto time, auto loc, auto nf, auto u, auto ctx) { if (dim == 3 && nf >= 3) { u[0] = loc[0] + loc[1] + loc[2] + time; u[1] = loc[0] * loc[1] * loc[2]; u[2] = time; } return 0; }); // act/assert const double array1[3] = {1.0, 2.0, 3.0}; std::vector<double> result1 = {0, 0, 0}; function.Eval(array1, 3, 4.0, result1); ASSERT_DOUBLE_EQ(result1[0], 10.0); ASSERT_DOUBLE_EQ(result1[1], 6.0); ASSERT_DOUBLE_EQ(result1[2], 4.0); } TEST(FunctionPointerTests, ShouldProvideAndFunctionWithPetscFunctionWhenSimpleFunction) { // arrange auto function = ablate::mathFunctions::FunctionPointer([](auto dim, auto time, auto loc, auto nf, auto u, auto ctx) { u[0] = loc[0] + loc[1] + loc[2] + time; u[1] = loc[0] * loc[1] * loc[2]; return 0; }); auto context = function.GetContext(); auto functionPointer = function.GetPetscFunction(); const PetscReal x[3] = {1.0, 2.0, 3.0}; PetscScalar result[2] = {0.0, 0.0}; // act auto errorCode = functionPointer(3, 4.0, x, 2, result, context); // assert ASSERT_EQ(0, errorCode); ASSERT_DOUBLE_EQ(10.0, result[0]); ASSERT_DOUBLE_EQ(6.0, result[1]); } } // namespace ablateTesting::mathFunctions
32.654867
121
0.582927
mtmcgurn-buffalo
b9abec4116c2ceaf0b8a1cff7580494bae07df7e
2,443
hpp
C++
include/vcrate/bytecode/Operations.hpp
VCrate/bytecode-description
c46f61fda817301b6705bc16654c634dc2c3212d
[ "MIT" ]
1
2018-04-14T14:04:39.000Z
2018-04-14T14:04:39.000Z
include/vcrate/bytecode/Operations.hpp
VCrate/bytecode-description
c46f61fda817301b6705bc16654c634dc2c3212d
[ "MIT" ]
null
null
null
include/vcrate/bytecode/Operations.hpp
VCrate/bytecode-description
c46f61fda817301b6705bc16654c634dc2c3212d
[ "MIT" ]
null
null
null
#pragma once #include <vcrate/Alias.hpp> #include <vector> #include <string> namespace vcrate { namespace bytecode { enum class Operations : ui8 { ADD, // Add (RRW) SUB, // Subtract (RRW) MOD, // Modulo (RRW) MUL, // Multiply (RRW) MULU, // Multiply unsigned (RRW) DIV, // Divide (RRW) DIVU, // Divide unsigned (RRW) MOV, // Move (RW) LEA, // Load effective address POP, // Pop from stack (W) PUSH, // Push to stack (R) JMP, // Jump to (R) JMPE, // Jump to _ if zero flag (R) JMPNE, // Jump to _ if !zero flag (R) JMPG, // Jump to _ if greater flag (R) JMPGE, // Jump to _ if greater and zero flag (R) AND, // And (RRW) OR, // Or (RRW) XOR, // Xor (RRW) NOT, // Not (RW) SHL, // Shift left (RRW) RTL, // Rotate left (RRW) SHR, // Shift right (RRW) RTR, // Rotate right (RRW) SWP, // Swap (WW) CMP, // set zero/greater flags CMPU, // Comapre unsigned INC, // Increment (RW) DEC, // Decrement (RW) NEW, // New (RW) DEL, // Delete (R) CALL, // Call (R) RET, // Return ETR, // Enter LVE, // Leave HLT, // Halt the program OUT, // Print 8 lower bits as char (R) DBG, // Print integer (R) ITU, // int to unsigned (RW) ITF, // int to float (RW) UTI, // unsigned to int (RW) UTF, // unsigned to float (RW) FTI, // float to int (RW) FTU, // float to unsigned (RW) ADDF, // Add float (RRW) SUBF, // Subtract float (RRW) MODF, // Modulo float (RRW) MULF, // Multiply float (RRW) DIVF, // Divide float (RRW) INCF, // Increment float (RW) DECF, // Decrement float (RW) DBGF, // Print float (R) DBGU, // Print unsigned (R) }; struct ArgConstraint { static constexpr ui8 Readable = 0x01; static constexpr ui8 Writable = 0x02; static constexpr ui8 Adressable = 0x04; }; class OpDefinition { public: OpDefinition(std::string const& name, Operations ope, std::vector<ui8> const& args_constraints = {}); std::string name; Operations ope; std::vector<ui8> args_constraints; ui32 arg_count() const; ui8 value() const; bool should_be_writable(ui32 arg) const; bool should_be_addressable(ui32 arg) const; bool should_be_readable(ui32 arg) const; static const OpDefinition& get(Operations ope); static const OpDefinition& get(std::string ope); }; }}
24.43
105
0.583299
VCrate
b9ac5d1dbe0d12ca27aad1c32e0e0b52d4c5c00a
74,278
cpp
C++
core/indigo-core/molecule/src/cml_loader.cpp
khyurri/Indigo
82f9ef9f43ca605f7265709e7a9256f1ff468d6c
[ "Apache-2.0" ]
null
null
null
core/indigo-core/molecule/src/cml_loader.cpp
khyurri/Indigo
82f9ef9f43ca605f7265709e7a9256f1ff468d6c
[ "Apache-2.0" ]
null
null
null
core/indigo-core/molecule/src/cml_loader.cpp
khyurri/Indigo
82f9ef9f43ca605f7265709e7a9256f1ff468d6c
[ "Apache-2.0" ]
null
null
null
/**************************************************************************** * Copyright (C) from 2009 to Present EPAM Systems. * * This file is part of Indigo toolkit. * * 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 "molecule/cml_loader.h" #include "base_cpp/scanner.h" #include "molecule/elements.h" #include "molecule/molecule.h" #include "molecule/molecule_scaffold_detection.h" #include "tinyxml.h" using namespace indigo; static float readFloat(const char* point_str) { float res = 0; if (point_str != 0) { BufferScanner strscan(point_str); res = strscan.readFloat(); } return res; } IMPL_ERROR(CmlLoader, "CML loader"); CmlLoader::CmlLoader(Scanner& scanner) { _scanner = &scanner; _handle = 0; } CmlLoader::CmlLoader(TiXmlHandle& handle) { _handle = &handle; _scanner = 0; } void CmlLoader::loadMolecule(Molecule& mol) { mol.clear(); _bmol = &mol; _mol = &mol; _qmol = 0; _loadMolecule(); mol.setIgnoreBadValenceFlag(ignore_bad_valence); } void CmlLoader::loadQueryMolecule(QueryMolecule& mol) { mol.clear(); _bmol = &mol; _mol = 0; _qmol = &mol; _loadMolecule(); } void CmlLoader::_loadMolecule() { if (_scanner != 0) { QS_DEF(Array<char>, buf); _scanner->readAll(buf); buf.push(0); TiXmlDocument xml; xml.Parse(buf.ptr()); if (xml.Error()) throw Error("XML parsing error: %s", xml.ErrorDesc()); TiXmlHandle hxml(&xml); TiXmlNode* node; if (_findMolecule(hxml.ToNode())) { node = _molecule; TiXmlHandle molecule = _molecule; _loadMoleculeElement(molecule); for (node = node->NextSibling(); node != 0; node = node->NextSibling()) { if (strncmp(node->Value(), "Rgroup", 6) == 0) { TiXmlHandle rgroup = node; _loadRgroupElement(rgroup); } } } } else _loadMoleculeElement(*_handle); } bool CmlLoader::_findMolecule(TiXmlNode* elem) { TiXmlNode* node; for (node = elem->FirstChild(); node != 0; node = node->NextSibling()) { if (strncmp(node->Value(), "molecule", 8) == 0) { _molecule = node; return true; } if (_findMolecule(node)) return true; } return false; } // Atoms struct Atom { std::string id, element_type, label, alias, isotope, formal_charge, spin_multiplicity, radical, valence, rgroupref, attpoint, attorder, query_props, hydrogen_count, atom_mapping, atom_inversion, atom_exact_change, x, y, z; }; // This methods splits a space-separated string and writes each values into an arbitrary string // property of Atom structure for each atom in the specified list static void splitStringIntoProperties(const char* s, std::vector<Atom>& atoms, std::string Atom::*property) { if (s == 0) return; std::stringstream stream(s); size_t i = 0; std::string token; while (stream >> token) { if (atoms.size() <= i) atoms.resize(i + 1); atoms[i].*property = token; i++; } } void CmlLoader::_loadMoleculeElement(TiXmlHandle& handle) { std::unordered_map<std::string, int> atoms_id; std::unordered_map<std::string, size_t> atoms_id_int; // Function that mappes atom id as a string to an atom index auto getAtomIdx = [&](const char* id) { auto it = atoms_id.find(id); if (it == atoms_id.end()) throw Error("atom id %s cannot be found", id); return it->second; }; QS_DEF(Array<int>, total_h_count); QS_DEF(Array<int>, query_h_count); atoms_id.clear(); atoms_id_int.clear(); total_h_count.clear(); query_h_count.clear(); const char* title = handle.Element()->Attribute("title"); if (title != 0) _bmol->name.readString(title, true); QS_DEF(std::vector<Atom>, atoms); atoms.clear(); // // Read elements into an atoms array first and the parse them // TiXmlHandle atom_array = handle.FirstChild("atomArray"); // Read atoms as xml attributes // <atomArray // atomID="a1 a2 a3 ... " // elementType="O C O ..." // hydrogenCount="1 0 0 ..." // /> splitStringIntoProperties(atom_array.Element()->Attribute("atomID"), atoms, &Atom::id); // Fill id if any were found size_t atom_index; for (atom_index = 0; atom_index < atoms.size(); atom_index++) atoms_id_int.emplace(atoms[atom_index].id, atom_index); splitStringIntoProperties(atom_array.Element()->Attribute("elementType"), atoms, &Atom::element_type); splitStringIntoProperties(atom_array.Element()->Attribute("mrvPseudo"), atoms, &Atom::label); splitStringIntoProperties(atom_array.Element()->Attribute("hydrogenCount"), atoms, &Atom::hydrogen_count); splitStringIntoProperties(atom_array.Element()->Attribute("isotope"), atoms, &Atom::isotope); splitStringIntoProperties(atom_array.Element()->Attribute("isotopeNumber"), atoms, &Atom::isotope); splitStringIntoProperties(atom_array.Element()->Attribute("formalCharge"), atoms, &Atom::formal_charge); splitStringIntoProperties(atom_array.Element()->Attribute("spinMultiplicity"), atoms, &Atom::spin_multiplicity); splitStringIntoProperties(atom_array.Element()->Attribute("radical"), atoms, &Atom::radical); splitStringIntoProperties(atom_array.Element()->Attribute("mrvValence"), atoms, &Atom::valence); splitStringIntoProperties(atom_array.Element()->Attribute("rgroupRef"), atoms, &Atom::rgroupref); splitStringIntoProperties(atom_array.Element()->Attribute("attachmentPoint"), atoms, &Atom::attpoint); splitStringIntoProperties(atom_array.Element()->Attribute("attachmentOrder"), atoms, &Atom::attorder); splitStringIntoProperties(atom_array.Element()->Attribute("mrvQueryProps"), atoms, &Atom::query_props); splitStringIntoProperties(atom_array.Element()->Attribute("mrvAlias"), atoms, &Atom::alias); splitStringIntoProperties(atom_array.Element()->Attribute("mrvMap"), atoms, &Atom::atom_mapping); splitStringIntoProperties(atom_array.Element()->Attribute("reactionStereo"), atoms, &Atom::atom_inversion); splitStringIntoProperties(atom_array.Element()->Attribute("exactChage"), atoms, &Atom::atom_exact_change); splitStringIntoProperties(atom_array.Element()->Attribute("x2"), atoms, &Atom::x); splitStringIntoProperties(atom_array.Element()->Attribute("y2"), atoms, &Atom::y); splitStringIntoProperties(atom_array.Element()->Attribute("x3"), atoms, &Atom::x); splitStringIntoProperties(atom_array.Element()->Attribute("y3"), atoms, &Atom::y); splitStringIntoProperties(atom_array.Element()->Attribute("z3"), atoms, &Atom::z); // Read atoms as nested xml elements // <atomArray> // <atom id="a1" elementType="H" /> for (TiXmlElement* elem = atom_array.FirstChild().Element(); elem; elem = elem->NextSiblingElement()) { if (strncmp(elem->Value(), "atom", 4) != 0) continue; const char* id = elem->Attribute("id"); if (id == 0) throw Error("atom without an id"); // Check if this atom has already been parsed auto it = atoms_id_int.find(id); if (it != end(atoms_id_int)) atom_index = it->second; else { atom_index = atoms.size(); atoms.emplace_back(); atoms_id_int.emplace(id, atom_index); } Atom& a = atoms[atom_index]; a.id = id; const char* element_type = elem->Attribute("elementType"); if (element_type == 0) throw Error("atom without an elementType"); a.element_type = element_type; const char* pseudo = elem->Attribute("mrvPseudo"); if (pseudo != 0) a.label = pseudo; const char* alias = elem->Attribute("mrvAlias"); if (alias != 0) a.alias = alias; const char* isotope = elem->Attribute("isotope"); if (isotope == 0) isotope = elem->Attribute("isotopeNumber"); if (isotope != 0) a.isotope = isotope; const char* charge = elem->Attribute("formalCharge"); if (charge != 0) a.formal_charge = charge; const char* spinmultiplicity = elem->Attribute("spinMultiplicity"); if (spinmultiplicity != 0) a.spin_multiplicity = spinmultiplicity; const char* radical = elem->Attribute("radical"); if (radical != 0) a.radical = radical; const char* valence = elem->Attribute("mrvValence"); if (valence != 0) a.valence = valence; const char* hcount = elem->Attribute("hydrogenCount"); if (hcount != 0) a.hydrogen_count = hcount; const char* atom_map = elem->Attribute("mrvMap"); if (atom_map != 0) a.atom_mapping = atom_map; const char* atom_inv = elem->Attribute("reactionStereo"); if (atom_inv != 0) a.atom_inversion = atom_inv; const char* atom_exact = elem->Attribute("exactChange"); if (atom_exact != 0) a.atom_exact_change = atom_exact; /* * Read coordinates */ const char* x2 = elem->Attribute("x2"); const char* y2 = elem->Attribute("y2"); if (x2 != 0 && y2 != 0) { a.x = x2; a.y = y2; } else { const char* x3 = elem->Attribute("x3"); const char* y3 = elem->Attribute("y3"); const char* z3 = elem->Attribute("z3"); if (x3 != 0 && y3 != 0 && z3 != 0) { a.x = x3; a.y = y3; a.z = z3; } } const char* rgroupref = elem->Attribute("rgroupRef"); if (rgroupref != 0) a.rgroupref = rgroupref; const char* attpoint = elem->Attribute("attachmentPoint"); if (attpoint != 0) a.attpoint = attpoint; const char* attorder = elem->Attribute("attachmentOrder"); if (attorder != 0) a.attorder = attorder; const char* query_props = elem->Attribute("mrvQueryProps"); if (query_props != 0) { if (_qmol != 0) a.query_props = query_props; else throw Error("'query features' are allowed only for queries"); } } // Parse them for (auto& a : atoms) { int label = Element::fromString2(a.element_type.c_str()); if ((label == -1) && (strncmp(a.element_type.c_str(), "R", 1) == 0)) label = ELEM_RSITE; else if ((label == -1) && (strncmp(a.element_type.c_str(), "*", 1) == 0)) label = ELEM_ATTPOINT; else if (!a.label.empty()) { if (label == -1) label = ELEM_PSEUDO; else if (label == ELEM_C) { if ((strncmp(a.label.c_str(), "AH", 2) == 0) || (strncmp(a.label.c_str(), "QH", 2) == 0) || (strncmp(a.label.c_str(), "XH", 2) == 0) || (strncmp(a.label.c_str(), "MH", 2) == 0) || (strncmp(a.label.c_str(), "X", 1) == 0) || (strncmp(a.label.c_str(), "M", 1) == 0)) { } else label = ELEM_PSEUDO; } } else if (label == -1) label = ELEM_PSEUDO; int idx; if (label == ELEM_ATTPOINT) { atoms_id.emplace(a.id, -1); } else { if (_mol != 0) { idx = _mol->addAtom(label); if (label == ELEM_PSEUDO) { if (!a.label.empty()) _mol->setPseudoAtom(idx, a.label.c_str()); else _mol->setPseudoAtom(idx, a.element_type.c_str()); } total_h_count.expandFill(idx + 1, -1); query_h_count.expandFill(idx + 1, -1); atoms_id.emplace(a.id, idx); if (!a.isotope.empty()) { int val; if (sscanf(a.isotope.c_str(), "%d", &val) != 1) throw Error("error parsing isotope"); _mol->setAtomIsotope(idx, val); } if (!a.formal_charge.empty()) { int val; if (sscanf(a.formal_charge.c_str(), "%d", &val) != 1) throw Error("error parsing charge"); _mol->setAtomCharge(idx, val); } if (!a.spin_multiplicity.empty()) { int val; if (sscanf(a.spin_multiplicity.c_str(), "%d", &val) != 1) throw Error("error parsing spin multiplicity"); _mol->setAtomRadical(idx, val); } if (!a.radical.empty()) { int val = 0; if (strncmp(a.radical.c_str(), "divalent1", 9) == 0) val = 1; else if (strncmp(a.radical.c_str(), "monovalent", 10) == 0) val = 2; else if ((strncmp(a.radical.c_str(), "divalent3", 9) == 0) || (strncmp(a.radical.c_str(), "divalent", 8) == 0) || (strncmp(a.radical.c_str(), "triplet", 7) == 0)) val = 3; _mol->setAtomRadical(idx, val); } if (a.spin_multiplicity.empty() && a.radical.empty()) { _mol->setAtomRadical(idx, 0); } if (!a.valence.empty()) { int val; if (sscanf(a.valence.c_str(), "%d", &val) == 1) _mol->setExplicitValence(idx, val); } if (!a.hydrogen_count.empty()) { int val; if (sscanf(a.hydrogen_count.c_str(), "%d", &val) != 1) throw Error("error parsing hydrogen count"); if (val < 0) throw Error("negative hydrogen count"); total_h_count[idx] = val; } } else { AutoPtr<QueryMolecule::Atom> atom; int qhcount = -1; if (label == ELEM_PSEUDO) { if (!a.label.empty()) atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_PSEUDO, a.label.c_str())); else atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_PSEUDO, a.element_type.c_str())); } else if (label == ELEM_RSITE) atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_RSITE, 0)); else atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, label)); if (!a.query_props.empty() && (strncmp(a.query_props.c_str(), "L", 1) == 0)) // _ATOM_LIST { AutoPtr<QueryMolecule::Atom> atomlist; BufferScanner strscan(a.query_props.c_str()); QS_DEF(Array<char>, el); QS_DEF(Array<char>, delim); el.clear(); delim.clear(); strscan.skip(1); delim.push(strscan.readChar()); delim.push(':'); delim.push(0); while (!strscan.isEOF()) { strscan.readWord(el, delim.ptr()); _appendQueryAtom(el.ptr(), atomlist); if (strscan.readChar() == ':') break; } if (delim[0] == '!') atomlist.reset(QueryMolecule::Atom::nicht(atomlist.release())); atom.reset(atomlist.release()); } else if (!a.query_props.empty() && (strncmp(a.query_props.c_str(), "A", 1) == 0)) // _ATOM_A { atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_H))); } else if (!a.query_props.empty() && (strncmp(a.query_props.c_str(), "Q", 1) == 0)) // _ATOM_Q { atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(QueryMolecule::Atom::und(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_H)), QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_C)))); } if (label == ELEM_C && !a.label.empty()) { if (strncmp(a.label.c_str(), "AH", 2) == 0) { AutoPtr<QueryMolecule::Atom> x_atom(new QueryMolecule::Atom()); x_atom->type = QueryMolecule::OP_NONE; atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(x_atom.release()); } else if (strncmp(a.label.c_str(), "QH", 2) == 0) { atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_C))); } else if (strncmp(a.label.c_str(), "XH", 2) == 0) { AutoPtr<QueryMolecule::Atom> x_atom(new QueryMolecule::Atom()); x_atom->type = QueryMolecule::OP_OR; x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_F)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Cl)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Br)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_I)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_At)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_H)); atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(x_atom.release()); } else if (strncmp(a.label.c_str(), "X", 1) == 0) { AutoPtr<QueryMolecule::Atom> x_atom(new QueryMolecule::Atom()); x_atom->type = QueryMolecule::OP_OR; x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_F)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Cl)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Br)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_I)); x_atom->children.add(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_At)); atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(x_atom.release()); } else if (strncmp(a.label.c_str(), "MH", 2) == 0) { AutoPtr<QueryMolecule::Atom> x_atom(new QueryMolecule::Atom()); x_atom->type = QueryMolecule::OP_AND; x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_C))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_N))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_O))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_F))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_P))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_S))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Cl))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Se))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Br))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_I))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_At))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_He))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Ne))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Ar))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Kr))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Xe))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Rn))); atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(x_atom.release()); } else if (strncmp(a.label.c_str(), "M", 1) == 0) { AutoPtr<QueryMolecule::Atom> x_atom(new QueryMolecule::Atom()); x_atom->type = QueryMolecule::OP_AND; x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_C))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_N))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_O))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_F))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_P))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_S))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Cl))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Se))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Br))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_I))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_At))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_He))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Ne))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Ar))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Kr))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Xe))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_Rn))); x_atom->children.add(QueryMolecule::Atom::nicht(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, ELEM_H))); atom.get()->removeConstraints(QueryMolecule::ATOM_NUMBER); atom.reset(x_atom.release()); } } else if (!a.query_props.empty()) // Query features { BufferScanner strscan(a.query_props.c_str()); QS_DEF(Array<char>, qf); QS_DEF(Array<char>, delim); qf.clear(); delim.clear(); delim.push(';'); delim.push(0); while (!strscan.isEOF()) { strscan.readWord(qf, delim.ptr()); if (strncmp(qf.ptr(), "rb", 2) == 0) { BufferScanner qfscan(qf.ptr()); qfscan.skip(2); int rbcount; if (qfscan.lookNext() == '*') rbcount = -2; else rbcount = qfscan.readInt1(); if (rbcount > 0) atom.reset(QueryMolecule::Atom::und( atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_RING_BONDS, rbcount, (rbcount < 4 ? rbcount : 100)))); else if (rbcount == 0) atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_RING_BONDS, 0))); else if (rbcount == -2) atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_RING_BONDS_AS_DRAWN, 0))); } else if (strncmp(qf.ptr(), "s", 1) == 0) { BufferScanner qfscan(qf.ptr()); qfscan.skip(1); int subst; if (qfscan.lookNext() == '*') { subst = -2; } else { subst = qfscan.readInt1(); } if (subst == 0) { atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS, 0))); } else if (subst == -2) { atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS_AS_DRAWN, 0))); } else if (subst > 0) { atom.reset(QueryMolecule::Atom::und( atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_SUBSTITUENTS, subst, (subst < 6 ? subst : 100)))); } } else if (strncmp(qf.ptr(), "u", 1) == 0) { BufferScanner qfscan(qf.ptr()); qfscan.skip(1); bool unsat = (qfscan.readInt1() > 0); if (unsat) atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_UNSATURATION, 0))); } else if (strncmp(qf.ptr(), "H", 1) == 0) { BufferScanner qfscan(qf.ptr()); qfscan.skip(1); qhcount = qfscan.readInt1(); /* if (total_h > 0) atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_TOTAL_H, total_h))); */ } if (!strscan.isEOF()) strscan.skip(1); } } if (!a.formal_charge.empty()) { int val; if (sscanf(a.formal_charge.c_str(), "%d", &val) != 1) throw Error("error parsing charge"); atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_CHARGE, val))); } if (!a.isotope.empty()) { int val; if (sscanf(a.isotope.c_str(), "%d", &val) != 1) throw Error("error parsing isotope"); atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_ISOTOPE, val))); } if (!a.spin_multiplicity.empty()) { int val; if (sscanf(a.spin_multiplicity.c_str(), "%d", &val) != 1) throw Error("error parsing spin multiplicity"); atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_RADICAL, val))); } if (!a.radical.empty()) { int val = 0; if (strncmp(a.radical.c_str(), "divalent1", 9) == 0) val = 1; else if (strncmp(a.radical.c_str(), "monovalent", 10) == 0) val = 2; else if ((strncmp(a.radical.c_str(), "divalent3", 9) == 0) || (strncmp(a.radical.c_str(), "divalent", 8) == 0) || (strncmp(a.radical.c_str(), "triplet", 7) == 0)) val = 3; atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_RADICAL, val))); } if (!a.valence.empty()) { int val; if (sscanf(a.valence.c_str(), "%d", &val) == 1) atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_VALENCE, val))); } idx = _qmol->addAtom(atom.release()); atoms_id.emplace(a.id, idx); total_h_count.expandFill(idx + 1, -1); query_h_count.expandFill(idx + 1, -1); query_h_count[idx] = qhcount; } if (!a.rgroupref.empty()) { int val; if (sscanf(a.rgroupref.c_str(), "%d", &val) != 1) throw Error("error parsing R-group reference"); _bmol->allowRGroupOnRSite(idx, val); } if (!a.attpoint.empty()) { int val; if (strncmp(a.attpoint.c_str(), "both", 4) == 0) val = 3; else if (sscanf(a.attpoint.c_str(), "%d", &val) != 1) throw Error("error parsing Attachment point"); for (int att_idx = 0; (1 << att_idx) <= val; att_idx++) if (val & (1 << att_idx)) _bmol->addAttachmentPoint(att_idx + 1, idx); } Vec3f a_pos; if (!a.x.empty()) { a_pos.x = readFloat(a.x.c_str()); } if (!a.y.empty()) { a_pos.y = readFloat(a.y.c_str()); } if (!a.z.empty()) { a_pos.z = readFloat(a.z.c_str()); } _bmol->setAtomXyz(idx, a_pos); if (!a.alias.empty()) { if (strncmp(a.alias.c_str(), "0", 1) != 0) { int sg_idx = _bmol->sgroups.addSGroup(SGroup::SG_TYPE_DAT); DataSGroup& sgroup = (DataSGroup&)_bmol->sgroups.getSGroup(sg_idx); sgroup.atoms.push(idx); sgroup.name.readString("INDIGO_ALIAS", true); sgroup.data.readString(a.alias.c_str(), true); sgroup.display_pos.x = _bmol->getAtomXyz(idx).x; sgroup.display_pos.y = _bmol->getAtomXyz(idx).y; } } if (!a.atom_mapping.empty()) { int val; if (sscanf(a.atom_mapping.c_str(), "%d", &val) != 1) throw Error("error parsing atom-atom mapping"); _bmol->reaction_atom_mapping[idx] = val; } if (!a.atom_inversion.empty()) { if (strncmp(a.atom_inversion.c_str(), "Inv", 3) == 0) _bmol->reaction_atom_inversion[idx] = 1; else if (strncmp(a.atom_inversion.c_str(), "Ret", 3) == 0) _bmol->reaction_atom_inversion[idx] = 2; } if (!a.atom_exact_change.empty()) { int val; if (sscanf(a.atom_exact_change.c_str(), "%d", &val) != 1) throw Error("error parsing atom exact change flag"); _bmol->reaction_atom_exact_change[idx] = val; } } /* if (!a.attorder.empty()) { int val; if (sscanf(a.attorder.c_str(), "%d", &val) != 1) throw Error("error parsing Attachment order"); mol.setRSiteAttachmentOrder(idx, nei_idx - 1, val - 1); } */ } // Bonds bool have_cistrans_notation = false; for (TiXmlElement* elem = handle.FirstChild("bondArray").FirstChild().Element(); elem; elem = elem->NextSiblingElement()) { if (strncmp(elem->Value(), "bond", 4) != 0) continue; const char* atom_refs = elem->Attribute("atomRefs2"); if (atom_refs == 0) throw Error("bond without atomRefs2"); int idx; BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); strscan.readWord(id, 0); int beg = getAtomIdx(id.ptr()); strscan.skipSpace(); strscan.readWord(id, 0); int end = getAtomIdx(id.ptr()); if ((beg < 0) || (end < 0)) continue; const char* order = elem->Attribute("order"); if (order == 0) throw Error("bond without an order"); int order_val; { if (order[0] == 'A' && order[1] == 0) order_val = BOND_AROMATIC; else if (order[0] == 'S' && order[1] == 0) order_val = BOND_SINGLE; else if (order[0] == 'D' && order[1] == 0) order_val = BOND_DOUBLE; else if (order[0] == 'T' && order[1] == 0) order_val = BOND_TRIPLE; else if (sscanf(order, "%d", &order_val) != 1) throw Error("error parsing order"); } const char* query_type = elem->Attribute("queryType"); const char* topology = elem->Attribute("topology"); if (_mol != 0) { if ((query_type == 0) && (topology == 0)) idx = _mol->addBond_Silent(beg, end, order_val); else throw Error("'query type' bonds are allowed only for queries"); } else { AutoPtr<QueryMolecule::Bond> bond; if (query_type == 0) { if (order_val == BOND_SINGLE || order_val == BOND_DOUBLE || order_val == BOND_TRIPLE || order_val == BOND_AROMATIC) bond.reset(new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, order_val)); } else if (strncmp(query_type, "SD", 2) == 0) bond.reset(QueryMolecule::Bond::und(QueryMolecule::Bond::nicht(new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_AROMATIC)), QueryMolecule::Bond::oder(new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_SINGLE), new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_DOUBLE)))); else if (strncmp(query_type, "SA", 2) == 0) bond.reset(QueryMolecule::Bond::oder(new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_SINGLE), new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_AROMATIC))); else if (strncmp(query_type, "DA", 2) == 0) bond.reset(QueryMolecule::Bond::oder(new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_DOUBLE), new QueryMolecule::Bond(QueryMolecule::BOND_ORDER, BOND_AROMATIC))); else if (strncmp(query_type, "Any", 3) == 0) bond.reset(new QueryMolecule::Bond()); else throw Error("unknown bond type: %d", order); const char* topology = elem->Attribute("topology"); if (topology != 0) { if (strncmp(topology, "ring", 4) == 0) bond.reset(QueryMolecule::Bond::und(bond.release(), new QueryMolecule::Bond(QueryMolecule::BOND_TOPOLOGY, TOPOLOGY_RING))); else if (strncmp(topology, "chain", 5) == 0) bond.reset(QueryMolecule::Bond::und(bond.release(), new QueryMolecule::Bond(QueryMolecule::BOND_TOPOLOGY, TOPOLOGY_CHAIN))); else throw Error("unknown topology: %s", topology); } idx = _qmol->addBond(beg, end, bond.release()); } int dir = 0; TiXmlElement* bs_elem = elem->FirstChildElement("bondStereo"); if (bs_elem != 0) { const char* text = bs_elem->GetText(); if (text != 0) { if (text[0] == 'W' && text[1] == 0) dir = BOND_UP; if (text[0] == 'H' && text[1] == 0) dir = BOND_DOWN; if ((text[0] == 'C' || text[0] == 'T') && text[1] == 0) have_cistrans_notation = true; } else { const char* convention = bs_elem->Attribute("convention"); if (convention != 0) { have_cistrans_notation = true; } } } if (dir != 0) _bmol->setBondDirection(idx, dir); const char* brcenter = elem->Attribute("mrvReactingCenter"); if (brcenter != 0) { int val; if (sscanf(brcenter, "%d", &val) != 1) throw Error("error parsing reacting center flag"); _bmol->reaction_bond_reacting_center[idx] = val; } } // Implicit H counts int i, j; for (i = _bmol->vertexBegin(); i != _bmol->vertexEnd(); i = _bmol->vertexNext(i)) { int h = total_h_count[i]; if (h < 0) continue; const Vertex& vertex = _bmol->getVertex(i); for (j = vertex.neiBegin(); j != vertex.neiEnd(); j = vertex.neiNext(j)) if (_bmol->getAtomNumber(vertex.neiVertex(j)) == ELEM_H) h--; if (h < 0) throw Error("hydrogenCount on atom %d is less than the number of explicit hydrogens"); if (_mol != 0) _mol->setImplicitH(i, h); } // Query H counts if (_qmol != 0) { for (i = _bmol->vertexBegin(); i != _bmol->vertexEnd(); i = _bmol->vertexNext(i)) { int expl_h = 0; if (query_h_count[i] >= 0) { // count explicit hydrogens const Vertex& vertex = _bmol->getVertex(i); for (j = vertex.neiBegin(); j != vertex.neiEnd(); j = vertex.neiNext(j)) { if (_bmol->getAtomNumber(vertex.neiVertex(j)) == ELEM_H) expl_h++; } } if (query_h_count[i] == 0) { // no hydrogens unless explicitly drawn _qmol->resetAtom(i, QueryMolecule::Atom::und(_qmol->releaseAtom(i), new QueryMolecule::Atom(QueryMolecule::ATOM_TOTAL_H, expl_h))); } else if (query_h_count[i] > 0) { // (_hcount[k] - 1) or more atoms in addition to explicitly drawn // no hydrogens unless explicitly drawn _qmol->resetAtom( i, QueryMolecule::Atom::und(_qmol->releaseAtom(i), new QueryMolecule::Atom(QueryMolecule::ATOM_TOTAL_H, expl_h + query_h_count[i], 100))); } } } // Tetrahedral stereocenters for (TiXmlElement* elem = handle.FirstChild("atomArray").FirstChild().Element(); elem; elem = elem->NextSiblingElement()) { const char* id = elem->Attribute("id"); if (id == 0) throw Error("atom without an id"); int idx = getAtomIdx(id); TiXmlElement* ap_elem = elem->FirstChildElement("atomParity"); if (ap_elem == 0) continue; const char* ap_text = ap_elem->GetText(); if (ap_text == 0) continue; int val; if (sscanf(ap_text, "%d", &val) != 1) throw Error("error parsing atomParity"); const char* refs4 = ap_elem->Attribute("atomRefs4"); if (refs4 != 0) { BufferScanner strscan(refs4); QS_DEF(Array<char>, id); int pyramid[4]; for (int k = 0; k < 4; k++) { strscan.skipSpace(); strscan.readWord(id, 0); pyramid[k] = getAtomIdx(id.ptr()); if (pyramid[k] == idx) pyramid[k] = -1; } if (val < 0) std::swap(pyramid[0], pyramid[1]); MoleculeStereocenters::moveMinimalToEnd(pyramid); _bmol->stereocenters.add(idx, MoleculeStereocenters::ATOM_ABS, 0, pyramid); } } if (_bmol->stereocenters.size() == 0 && BaseMolecule::hasCoord(*_bmol)) { QS_DEF(Array<int>, sensible_bond_orientations); sensible_bond_orientations.clear_resize(_bmol->vertexEnd()); _bmol->stereocenters.buildFromBonds(stereochemistry_options, sensible_bond_orientations.ptr()); if (!stereochemistry_options.ignore_errors) for (i = 0; i < _bmol->vertexCount(); i++) if (_bmol->getBondDirection(i) > 0 && !sensible_bond_orientations[i]) throw Error("direction of bond #%d makes no sense", i); } // Cis-trans stuff if (have_cistrans_notation) { int bond_idx = -1; for (TiXmlElement* elem = handle.FirstChild("bondArray").FirstChild().Element(); elem; elem = elem->NextSiblingElement()) { if (strncmp(elem->Value(), "bond", 4) != 0) continue; bond_idx++; TiXmlElement* bs_elem = elem->FirstChildElement("bondStereo"); if (bs_elem == 0) continue; const char* convention = bs_elem->Attribute("convention"); if (convention != 0) { const char* convention_value = bs_elem->Attribute("conventionValue"); if (convention_value != 0) { if (strncmp(convention, "MDL", 3) == 0) { int val; if (sscanf(convention_value, "%d", &val) != 1) throw Error("error conventionValue attribute"); if (val == 3) { _bmol->cis_trans.ignore(bond_idx); } } } } const char* text = bs_elem->GetText(); if (text == 0) continue; int parity; if (text[0] == 'C' && text[1] == 0) parity = MoleculeCisTrans::CIS; else if (text[0] == 'T' && text[1] == 0) parity = MoleculeCisTrans::TRANS; else continue; const char* atom_refs = bs_elem->Attribute("atomRefs4"); // If there are only one substituent then atomRefs4 cano be omitted bool has_subst = atom_refs != nullptr; int substituents[4]; if (!MoleculeCisTrans::isGeomStereoBond(*_bmol, bond_idx, substituents, false)) throw Error("cis-trans notation on a non cis-trans bond #%d", bond_idx); if (!MoleculeCisTrans::sortSubstituents(*_bmol, substituents, 0)) throw Error("cis-trans notation on a non cis-trans bond #%d", bond_idx); if (has_subst) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); int refs[4] = {-1, -1, -1, -1}; for (int k = 0; k < 4; k++) { strscan.skipSpace(); strscan.readWord(id, 0); refs[k] = getAtomIdx(id.ptr()); } const Edge& edge = _bmol->getEdge(bond_idx); if (refs[1] == edge.beg && refs[2] == edge.end) ; else if (refs[1] == edge.end && refs[2] == edge.beg) { std::swap(refs[0], refs[3]); std::swap(refs[1], refs[2]); } else throw Error("atomRefs4 in bondStereo do not match the bond ends"); bool invert = false; if (refs[0] == substituents[0]) ; else if (refs[0] == substituents[1]) invert = !invert; else throw Error("atomRefs4 in bondStereo do not match the substituents"); if (refs[3] == substituents[2]) ; else if (refs[3] == substituents[3]) invert = !invert; else throw Error("atomRefs4 in bondStereo do not match the substituents"); if (invert) parity = 3 - parity; } _bmol->cis_trans.add(bond_idx, substituents, parity); } } else if (BaseMolecule::hasCoord(*_bmol)) _bmol->cis_trans.build(0); // Sgroups for (TiXmlElement* elem = handle.FirstChild().Element(); elem; elem = elem->NextSiblingElement()) { if (strncmp(elem->Value(), "molecule", 8) != 0) continue; _loadSGroupElement(elem, atoms_id, 0); } } void CmlLoader::_loadSGroupElement(TiXmlElement* elem, std::unordered_map<std::string, int>& atoms_id, int sg_parent) { auto getAtomIdx = [&](const char* id) { auto it = atoms_id.find(id); if (it == atoms_id.end()) throw Error("atom id %s cannot be found", id); return it->second; }; MoleculeSGroups* sgroups = &_bmol->sgroups; DataSGroup* dsg = 0; SGroup* gen = 0; RepeatingUnit* sru = 0; MultipleGroup* mul = 0; Superatom* sup = 0; int idx = 0; if (elem != 0) { const char* role = elem->Attribute("role"); if (role == 0) throw Error("Sgroup without type"); if (strncmp(role, "DataSgroup", 10) == 0) { idx = sgroups->addSGroup(SGroup::SG_TYPE_DAT); dsg = (DataSGroup*)&sgroups->getSGroup(idx); } else if (strncmp(role, "GenericSgroup", 13) == 0) { idx = sgroups->addSGroup(SGroup::SG_TYPE_GEN); gen = (SGroup*)&sgroups->getSGroup(idx); } else if (strncmp(role, "SruSgroup", 9) == 0) { idx = sgroups->addSGroup(SGroup::SG_TYPE_SRU); sru = (RepeatingUnit*)&sgroups->getSGroup(idx); } else if (strncmp(role, "MultipleSgroup", 14) == 0) { idx = sgroups->addSGroup(SGroup::SG_TYPE_MUL); mul = (MultipleGroup*)&sgroups->getSGroup(idx); } else if (strncmp(role, "SuperatomSgroup", 15) == 0) { idx = sgroups->addSGroup(SGroup::SG_TYPE_SUP); sup = (Superatom*)&sgroups->getSGroup(idx); } if ((dsg == 0) && (gen == 0) && (sru == 0) && (mul == 0) && (sup == 0)) return; if (dsg != 0) { if (sg_parent > 0) dsg->parent_group = sg_parent; const char* atom_refs = elem->Attribute("atomRefs"); if (atom_refs != 0) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); dsg->atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } TiXmlElement* brackets = elem->FirstChildElement("MBracket"); if (brackets != 0) { const char* brk_type = brackets->Attribute("type"); if (brk_type != 0) { if (strncmp(brk_type, "SQUARE", 6) == 0) { dsg->brk_style = 0; } else if (strncmp(brk_type, "ROUND", 5) == 0) { dsg->brk_style = 1; } } int point_idx = 0; Vec2f* pbrackets; TiXmlElement* pPoint; for (pPoint = brackets->FirstChildElement(); pPoint; pPoint = pPoint->NextSiblingElement()) { if (strncmp(pPoint->Value(), "MPoint", 6) != 0) continue; if (point_idx == 0) pbrackets = dsg->brackets.push(); const char* point_x = pPoint->Attribute("x"); const char* point_y = pPoint->Attribute("y"); float x = readFloat(point_x); float y = readFloat(point_y); pbrackets[point_idx].x = x; pbrackets[point_idx].y = y; point_idx++; if (point_idx == 2) point_idx = 0; } } const char* fieldname = elem->Attribute("fieldName"); if (fieldname != 0) dsg->name.readString(fieldname, true); const char* fielddata = elem->Attribute("fieldData"); if (fieldname != 0) dsg->data.readString(fielddata, true); const char* fieldtype = elem->Attribute("fieldType"); if (fieldtype != 0) dsg->description.readString(fieldtype, true); const char* disp_x = elem->Attribute("x"); if (disp_x != 0) { BufferScanner strscan(disp_x); dsg->display_pos.x = strscan.readFloat(); } const char* disp_y = elem->Attribute("y"); if (disp_y != 0) { BufferScanner strscan(disp_y); dsg->display_pos.y = strscan.readFloat(); } const char* detached = elem->Attribute("dataDetached"); dsg->detached = true; if (detached != 0) { if ((strncmp(detached, "true", 4) == 0) || (strncmp(detached, "on", 2) == 0) || (strncmp(detached, "1", 1) == 0) || (strncmp(detached, "yes", 3) == 0)) { dsg->detached = true; } else if ((strncmp(detached, "false", 5) == 0) || (strncmp(detached, "off", 3) == 0) || (strncmp(detached, "0", 1) == 0) || (strncmp(detached, "no", 2) == 0)) { dsg->detached = false; } } const char* relative = elem->Attribute("placement"); dsg->relative = false; if (relative != 0) { if (strncmp(relative, "Relative", 8) == 0) { dsg->relative = true; } } const char* disp_units = elem->Attribute("unitsDisplayed"); if (disp_units != 0) { if ((strncmp(disp_units, "Unit displayed", 14) == 0) || (strncmp(disp_units, "yes", 3) == 0) || (strncmp(disp_units, "on", 2) == 0) || (strncmp(disp_units, "1", 1) == 0) || (strncmp(disp_units, "true", 4) == 0)) { dsg->display_units = true; } } dsg->num_chars = 0; const char* disp_chars = elem->Attribute("displayedChars"); if (disp_chars != 0) { BufferScanner strscan(disp_chars); dsg->num_chars = strscan.readInt1(); } const char* disp_tag = elem->Attribute("tag"); if (disp_tag != 0) { BufferScanner strscan(disp_tag); dsg->tag = strscan.readChar(); } const char* query_op = elem->Attribute("queryOp"); if (query_op != 0) dsg->queryoper.readString(query_op, true); const char* query_type = elem->Attribute("queryType"); if (query_type != 0) dsg->querycode.readString(query_type, true); TiXmlNode* pChild; for (pChild = elem->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle next_mol = pChild; if (next_mol.Element() != 0) _loadSGroupElement(next_mol.Element(), atoms_id, idx + 1); } } else if (gen != 0) { if (sg_parent > 0) gen->parent_group = sg_parent; const char* atom_refs = elem->Attribute("atomRefs"); if (atom_refs != 0) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); gen->atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } TiXmlElement* brackets = elem->FirstChildElement("MBracket"); if (brackets != 0) { const char* brk_type = brackets->Attribute("type"); if (brk_type != 0) { if (strncmp(brk_type, "SQUARE", 6) == 0) { gen->brk_style = 0; } else if (strncmp(brk_type, "ROUND", 5) == 0) { gen->brk_style = 1; } } int point_idx = 0; Vec2f* pbrackets; TiXmlElement* pPoint; for (pPoint = brackets->FirstChildElement(); pPoint; pPoint = pPoint->NextSiblingElement()) { if (strncmp(pPoint->Value(), "MPoint", 6) != 0) continue; if (point_idx == 0) pbrackets = gen->brackets.push(); float x = 0, y = 0; const char* point_x = pPoint->Attribute("x"); if (point_x != 0) { BufferScanner strscan(point_x); x = strscan.readFloat(); } const char* point_y = pPoint->Attribute("y"); if (point_y != 0) { BufferScanner strscan(point_y); y = strscan.readFloat(); } pbrackets[point_idx].x = x; pbrackets[point_idx].y = y; point_idx++; if (point_idx == 2) point_idx = 0; } } TiXmlNode* pChild; for (pChild = elem->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle next_mol = pChild; if (next_mol.Element() != 0) _loadSGroupElement(next_mol.Element(), atoms_id, idx + 1); } } else if (sru != 0) { if (sg_parent > 0) sru->parent_group = sg_parent; const char* atom_refs = elem->Attribute("atomRefs"); if (atom_refs != 0) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); sru->atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } TiXmlElement* brackets = elem->FirstChildElement("MBracket"); if (brackets != 0) { const char* brk_type = brackets->Attribute("type"); if (brk_type != 0) { if (strncmp(brk_type, "SQUARE", 6) == 0) { sru->brk_style = 0; } else if (strncmp(brk_type, "ROUND", 5) == 0) { sru->brk_style = 1; } } int point_idx = 0; Vec2f* pbrackets; TiXmlElement* pPoint; for (pPoint = brackets->FirstChildElement(); pPoint; pPoint = pPoint->NextSiblingElement()) { if (strncmp(pPoint->Value(), "MPoint", 6) != 0) continue; if (point_idx == 0) pbrackets = sru->brackets.push(); float x = 0, y = 0; const char* point_x = pPoint->Attribute("x"); if (point_x != 0) { BufferScanner strscan(point_x); x = strscan.readFloat(); } const char* point_y = pPoint->Attribute("y"); if (point_y != 0) { BufferScanner strscan(point_y); y = strscan.readFloat(); } pbrackets[point_idx].x = x; pbrackets[point_idx].y = y; point_idx++; if (point_idx == 2) point_idx = 0; } } const char* title = elem->Attribute("title"); if (title != 0) sru->subscript.readString(title, true); const char* connect = elem->Attribute("connect"); if (connect != 0) { if (strncmp(connect, "ht", 2) == 0) { sru->connectivity = SGroup::HEAD_TO_TAIL; } else if (strncmp(connect, "hh", 2) == 0) { sru->connectivity = SGroup::HEAD_TO_HEAD; } } TiXmlNode* pChild; for (pChild = elem->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle next_mol = pChild; if (next_mol.Element() != 0) _loadSGroupElement(next_mol.Element(), atoms_id, idx + 1); } } else if (mul != 0) { if (sg_parent > 0) mul->parent_group = sg_parent; const char* atom_refs = elem->Attribute("atomRefs"); if (atom_refs != 0) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); mul->atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } const char* patoms = elem->Attribute("patoms"); if (patoms != 0) { BufferScanner strscan(patoms); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); mul->parent_atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } TiXmlElement* brackets = elem->FirstChildElement("MBracket"); if (brackets != 0) { const char* brk_type = brackets->Attribute("type"); if (brk_type != 0) { if (strncmp(brk_type, "SQUARE", 6) == 0) { mul->brk_style = 0; } else if (strncmp(brk_type, "ROUND", 5) == 0) { mul->brk_style = 1; } } int point_idx = 0; Vec2f* pbrackets; TiXmlElement* pPoint; for (pPoint = brackets->FirstChildElement(); pPoint; pPoint = pPoint->NextSiblingElement()) { if (strncmp(pPoint->Value(), "MPoint", 6) != 0) continue; if (point_idx == 0) pbrackets = mul->brackets.push(); float x = 0, y = 0; const char* point_x = pPoint->Attribute("x"); if (point_x != 0) { BufferScanner strscan(point_x); x = strscan.readFloat(); } const char* point_y = pPoint->Attribute("y"); if (point_y != 0) { BufferScanner strscan(point_y); y = strscan.readFloat(); } pbrackets[point_idx].x = x; pbrackets[point_idx].y = y; point_idx++; if (point_idx == 2) point_idx = 0; } } const char* title = elem->Attribute("title"); if (title != 0) { BufferScanner strscan(title); mul->multiplier = strscan.readInt1(); } TiXmlNode* pChild; for (pChild = elem->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle next_mol = pChild; if (next_mol.Element() != 0) _loadSGroupElement(next_mol.Element(), atoms_id, idx + 1); } } else if (sup != 0) { if (sg_parent > 0) sup->parent_group = sg_parent; const char* atom_refs = elem->Attribute("atomRefs"); if (atom_refs != 0) { BufferScanner strscan(atom_refs); QS_DEF(Array<char>, id); while (!strscan.isEOF()) { strscan.readWord(id, 0); sup->atoms.push(getAtomIdx(id.ptr())); strscan.skipSpace(); } } TiXmlElement* brackets = elem->FirstChildElement("MBracket"); if (brackets != 0) { const char* brk_type = brackets->Attribute("type"); if (brk_type != 0) { if (strncmp(brk_type, "SQUARE", 6) == 0) { sup->brk_style = 0; } else if (strncmp(brk_type, "ROUND", 5) == 0) { sup->brk_style = 1; } } int point_idx = 0; Vec2f* pbrackets; TiXmlElement* pPoint; for (pPoint = brackets->FirstChildElement(); pPoint; pPoint = pPoint->NextSiblingElement()) { if (strncmp(pPoint->Value(), "MPoint", 6) != 0) continue; if (point_idx == 0) pbrackets = sup->brackets.push(); const char* point_x = pPoint->Attribute("x"); const char* point_y = pPoint->Attribute("y"); float x = readFloat(point_x); float y = readFloat(point_y); pbrackets[point_idx].x = x; pbrackets[point_idx].y = y; point_idx++; if (point_idx == 2) point_idx = 0; } } /* TiXmlElement *atpoints = elem->FirstChildElement("AttachmentPointArray"); if (atpoints != 0) { TiXmlElement * aPoint; for (aPoint = atpoints->FirstChildElement(); aPoint; aPoint = aPoint->NextSiblingElement()) { if (strncmp(aPoint->Value(), "attachmentPoint", 15) != 0) continue; int idap = sup->attachment_points.add(); Superatom::_AttachmentPoint &ap = sup->attachment_points.at(idap); const char *a_idx = aPoint->Attribute("atom"); if (a_idx != 0) { ap.aidx = getAtomIdx(a_idx); } const char *b_idx = aPoint->Attribute("bond"); if (b_idx != 0) { ap.aidx = getAtomIdx(a_idx); } const char *ap_order = aPoint->Attribute("order"); if (ap_order != 0) { ap.aidx = getAtomIdx(a_idx); } } } */ const char* title = elem->Attribute("title"); if (title != 0) sup->subscript.readString(title, true); TiXmlNode* pChild; for (pChild = elem->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle next_mol = pChild; if (next_mol.Element() != 0) _loadSGroupElement(next_mol.Element(), atoms_id, idx + 1); } } } } void CmlLoader::_loadRgroupElement(TiXmlHandle& handle) { MoleculeRGroups* rgroups = &_bmol->rgroups; TiXmlElement* elem = handle.Element(); if (elem != 0) { int rg_idx; const char* rgroup_id = elem->Attribute("rgroupID"); if (rgroup_id == 0) throw Error("Rgroup without ID"); BufferScanner strscan(rgroup_id); rg_idx = strscan.readInt1(); RGroup& rgroup = rgroups->getRGroup(rg_idx); const char* rlogic_range = elem->Attribute("rlogicRange"); if (rlogic_range != 0) _parseRlogicRange(rlogic_range, rgroup.occurrence); const char* rgroup_then = elem->Attribute("thenR"); if (rgroup_then != 0) { BufferScanner strscan(rgroup_then); rgroup.if_then = strscan.readInt1(); } rgroup.rest_h = 0; const char* rgroup_resth = elem->Attribute("restH"); if (rgroup_resth != 0) { if ((strncmp(rgroup_resth, "true", 4) == 0) || (strncmp(rgroup_resth, "on", 2) == 0) || (strncmp(rgroup_resth, "1", 1) == 0)) { rgroup.rest_h = 1; } } TiXmlNode* pChild; for (pChild = handle.FirstChild().ToNode(); pChild != 0; pChild = pChild->NextSibling()) { if (strncmp(pChild->Value(), "molecule", 8) != 0) continue; TiXmlHandle molecule = pChild; if (molecule.Element() != 0) { AutoPtr<BaseMolecule> fragment(_bmol->neu()); Molecule* _mol_save; BaseMolecule* _bmol_save; QueryMolecule* _qmol_save; _mol_save = _mol; _bmol_save = _bmol; _qmol_save = _qmol; _bmol = fragment.get(); if (_bmol->isQueryMolecule()) { _qmol = &_bmol->asQueryMolecule(); _mol = 0; } else { _mol = &_bmol->asMolecule(); _qmol = 0; } _loadMoleculeElement(molecule); _mol = _mol_save; _bmol = _bmol_save; _qmol = _qmol_save; rgroup.fragments.add(fragment.release()); } } } } void CmlLoader::_parseRlogicRange(const char* str, Array<int>& ranges) { int beg = -1, end = -1; int add_beg = 0, add_end = 0; while (*str != 0) { if (*str == '>') { end = 0xFFFF; add_beg = 1; } else if (*str == '<') { beg = 0; add_end = -1; } else if (isdigit(*str)) { sscanf(str, "%d", beg == -1 ? &beg : &end); while (isdigit(*str)) str++; continue; } else if (*str == ',') { if (end == -1) end = beg; else beg += add_beg, end += add_end; ranges.push((beg << 16) | end); beg = end = -1; add_beg = add_end = 0; } str++; } if (beg == -1 && end == -1) return; if (end == -1) end = beg; else beg += add_beg, end += add_end; ranges.push((beg << 16) | end); } void CmlLoader::_appendQueryAtom(const char* atom_label, AutoPtr<QueryMolecule::Atom>& atom) { int atom_number = Element::fromString2(atom_label); AutoPtr<QueryMolecule::Atom> cur_atom; if (atom_number != -1) cur_atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_NUMBER, atom_number)); else cur_atom.reset(new QueryMolecule::Atom(QueryMolecule::ATOM_PSEUDO, atom_label)); if (atom.get() == 0) atom.reset(cur_atom.release()); else atom.reset(QueryMolecule::Atom::oder(atom.release(), cur_atom.release())); }
37.916284
158
0.472037
khyurri
b9ae8e66380bcd5f2f311589bf33dd45eb7fae9a
4,478
cpp
C++
examples/sys.cpp
davidwed/sqlrelay_rudiments
6ccffdfc5fa29f8c0226f3edc2aa888aa1008347
[ "BSD-2-Clause-NetBSD" ]
null
null
null
examples/sys.cpp
davidwed/sqlrelay_rudiments
6ccffdfc5fa29f8c0226f3edc2aa888aa1008347
[ "BSD-2-Clause-NetBSD" ]
null
null
null
examples/sys.cpp
davidwed/sqlrelay_rudiments
6ccffdfc5fa29f8c0226f3edc2aa888aa1008347
[ "BSD-2-Clause-NetBSD" ]
null
null
null
#include <rudiments/sys.h> #include <rudiments/charstring.h> #include <rudiments/stdio.h> int main(int argc, const char **argv) { char *osname=sys::getOperatingSystemName(); stdoutput.printf("OS Name : %s\n",osname); delete[] osname; char *release=sys::getOperatingSystemRelease(); stdoutput.printf("OS Release : %s\n",release); delete[] release; char *version=sys::getOperatingSystemVersion(); stdoutput.printf("OS Version : %s\n",version); delete[] version; char *arch=sys::getOperatingSystemArchitecture(); stdoutput.printf("OS Arch : %s\n",arch); delete[] arch; char *hostname=sys::getHostName(); stdoutput.printf("Host Name : %s\n",hostname); delete[] hostname; double onemin; double fivemin; double fifteenmin; sys::getLoadAverages(&onemin,&fivemin,&fifteenmin); stdoutput.printf("Load Averages : %0.2f %0.2f %0.2f\n", onemin,fivemin,fifteenmin); stdoutput.printf("Max Cmd Line Arg Length" " : %lld\n", sys::getMaxCommandLineArgumentLength()); stdoutput.printf("Max Processes Per User" " : %lld\n", sys::getMaxProcessesPerUser()); stdoutput.printf("Max Host Name Length" " : %lld\n", sys::getMaxHostNameLength()); stdoutput.printf("Max Login Name Length" " : %lld\n", sys::getMaxLoginNameLength()); stdoutput.printf("Clock Ticks Per Second" " : %lld\n", sys::getClockTicksPerSecond()); stdoutput.printf("Max Open Files Per Process" " : %lld\n", sys::getMaxOpenFilesPerProcess()); stdoutput.printf("Page Size" " : %lld\n", sys::getPageSize()); stdoutput.printf("Allocation Granularity" " : %lld\n", sys::getAllocationGranularity()); stdoutput.printf("Max Open Streams Per Process" " : %lld\n", sys::getMaxOpenStreamsPerProcess()); stdoutput.printf("Max Symlink Loops" " : %lld\n", sys::getMaxSymlinkLoops()); stdoutput.printf("Max Terminal Device Name Length" " : %lld\n", sys::getMaxTerminalDeviceNameLength()); stdoutput.printf("Max Timezone Name Length" " : %lld\n", sys::getMaxTimezoneNameLength()); stdoutput.printf("Max Line Length" " : %lld\n", sys::getMaxLineLength()); stdoutput.printf("Physical Page Count" " : %lld\n", sys::getPhysicalPageCount()); stdoutput.printf("Available Physical Page Count" " : %lld\n", sys::getAvailablePhysicalPageCount()); stdoutput.printf("Processor Count" " : %lld\n", sys::getProcessorCount()); stdoutput.printf("Max Processor Count" " : %lld\n", sys::getMaxProcessorCount()); stdoutput.printf("Processors Online" " : %lld\n", sys::getProcessorsOnline()); stdoutput.printf("Max Supplemental Groups Per User" " : %lld\n", sys::getMaxSupplementalGroupsPerUser()); stdoutput.printf("Max Delay Timer Expirations" " : %lld\n", sys::getMaxDelayTimerExpirations()); stdoutput.printf("Max Realtime Signals" " : %lld\n", sys::getMaxRealtimeSignals()); stdoutput.printf("Max Sempahores Per Process" " : %lld\n", sys::getMaxSemaphoresPerProcess()); stdoutput.printf("Max Semaphore Value" " : %lld\n", sys::getMaxSemaphoreValue()); stdoutput.printf("Max Signal Queue Length" " : %lld\n", sys::getMaxSignalQueueLength()); stdoutput.printf("Max Timers Per Process" " : %lld\n", sys::getMaxTimersPerProcess()); stdoutput.printf("Suggested Group Entry Buffer Size" " : %lld\n", sys::getSuggestedGroupEntryBufferSize()); stdoutput.printf("Suggested Passwd Entry Buffer Size" " : %lld\n", sys::getSuggestedPasswordEntryBufferSize()); stdoutput.printf("Min Thread Stack Size" " : %lld\n", sys::getMinThreadStackSize()); stdoutput.printf("Max Threads Per Process" " : %lld\n", sys::getMaxThreadsPerProcess()); stdoutput.printf("Thread Destructor Iterations" " : %lld\n", sys::getThreadDestructorIterations()); stdoutput.printf("Max Thread Keys" " : %lld\n", sys::getMaxThreadKeys()); stdoutput.printf("Max At-Exit Functions" " : %lld\n", sys::getMaxAtExitFunctions()); stdoutput.printf("CPUSet Size" " : %lld\n", sys::getCpuSetSize()); stdoutput.printf("Max Password Length" " : %lld\n", sys::getMaxPasswordLength()); stdoutput.printf("Max Log Name Length" " : %lld\n", sys::getMaxLogNameLength()); stdoutput.printf("Max Process ID" " : %lld\n", sys::getMaxProcessId()); stdoutput.printf("Directory Separator" " : %c\n", sys::getDirectorySeparator()); }
24.604396
58
0.667039
davidwed
b9af20942ea0eccde72856b692d6e54fbd3658c7
1,716
cpp
C++
test/pointsTest.cpp
bostonceltics20/phoebe
b7e6294ee32d7f94299cd027ba2e72c3552ab246
[ "MIT" ]
30
2020-08-24T03:51:05.000Z
2022-02-26T15:29:38.000Z
test/pointsTest.cpp
bostonceltics20/phoebe
b7e6294ee32d7f94299cd027ba2e72c3552ab246
[ "MIT" ]
43
2020-08-27T19:34:36.000Z
2022-02-25T14:09:39.000Z
test/pointsTest.cpp
bostonceltics20/phoebe
b7e6294ee32d7f94299cd027ba2e72c3552ab246
[ "MIT" ]
10
2020-10-14T23:15:01.000Z
2022-01-15T18:54:26.000Z
#include "points.h" #include "gtest/gtest.h" TEST(PointsTest, PointsHandling) { Eigen::Matrix3d directUnitCell; directUnitCell.row(0) << -5.1, 0., 5.1; directUnitCell.row(1) << 0., 5.1, 5.1; directUnitCell.row(2) << -5.1, 5.1, 0.; Eigen::MatrixXd atomicPositions(2, 3); atomicPositions.row(0) << 0., 0., 0.; atomicPositions.row(1) << 2.55, 2.55, 2.55; Eigen::VectorXi atomicSpecies(2); atomicSpecies << 0, 0; std::vector<std::string> speciesNames; speciesNames.emplace_back("Si"); Eigen::VectorXd speciesMasses(1); speciesMasses(0) = 28.086; Context context; Crystal crystal(context, directUnitCell, atomicPositions, atomicSpecies, speciesNames, speciesMasses); Eigen::Vector3i mesh; mesh << 4, 4, 4; Points points(crystal, mesh); //----------------------------------- // check mesh is what I set initially auto tup = points.getMesh(); auto mesh_ = std::get<0>(tup); EXPECT_EQ((mesh - mesh_).norm(), 0.); //---------------------- // check point inversion auto p1 = points.getPoint(4); // find the index of the inverted point int i4 = points.getIndex(-p1.getCoordinates(Points::crystalCoordinates)); // int i4 = points.getIndexInverted(4); auto p2 = points.getPoint(i4); auto p3 = p1 + p2; EXPECT_EQ(p3.getCoordinates(Points::cartesianCoordinates).norm(), 0.); //----------------------- // check point inversion mesh << 2, 2, 2; points = Points(crystal, mesh); int iq = 7; p1 = points.getPoint(iq); // int iqr = points.getIndexInverted(iq); int iqr = points.getIndex(-p1.getCoordinates(Points::crystalCoordinates)); p2 = points.getPoint(iqr); p3 = p1 + p2; EXPECT_EQ(p3.getCoordinates().norm(), 0.); }
28.6
76
0.630536
bostonceltics20
b9b7066a97c14ee8064df1578ad4c0e1c528d200
1,445
cpp
C++
208. Implement Trie (Prefix Tree).cpp
ivanilos/leetcode
6b13870a49180eed5c1548410f2c9cca219d1cab
[ "MIT" ]
null
null
null
208. Implement Trie (Prefix Tree).cpp
ivanilos/leetcode
6b13870a49180eed5c1548410f2c9cca219d1cab
[ "MIT" ]
null
null
null
208. Implement Trie (Prefix Tree).cpp
ivanilos/leetcode
6b13870a49180eed5c1548410f2c9cca219d1cab
[ "MIT" ]
null
null
null
class Trie { public: /** Initialize your data structure here. */ Trie() { trie.push_back(map<char, int>()); // root word_end.push_back(false); } /** Inserts a word into the trie. */ void insert(string word) { int pos = 0; for (char c : word) { if (!trie[pos].count(c)) { trie[pos][c] = trie.size(); trie.push_back(map<char,int>()); word_end.push_back(false); } pos = trie[pos][c]; } word_end[pos] = true; } /** Returns if the word is in the trie. */ bool search(string word) { int pos = 0; for (char c : word) { if (!trie[pos].count(c)) { return false; } pos = trie[pos][c]; } return word_end[pos]; } /** Returns if there is any word in the trie that starts with the given prefix. */ bool startsWith(string prefix) { int pos = 0; for (char c : prefix) { if (!trie[pos].count(c)) { return false; } pos = trie[pos][c]; } return true; } private: vector<map<char, int>> trie; vector<bool> word_end; }; /** * Your Trie object will be instantiated and called as such: * Trie* obj = new Trie(); * obj->insert(word); * bool param_2 = obj->search(word); * bool param_3 = obj->startsWith(prefix); */
25.350877
86
0.491349
ivanilos
b9bc2c7f1ddda22d289596138bc7ee033922bc9a
2,677
cpp
C++
libs/kinematics/src/CVehicleSimul_Holo.cpp
zarmomin/mrpt
1baff7cf8ec9fd23e1a72714553bcbd88c201966
[ "BSD-3-Clause" ]
1
2021-12-10T06:24:08.000Z
2021-12-10T06:24:08.000Z
libs/kinematics/src/CVehicleSimul_Holo.cpp
gao-ouyang/mrpt
4af5fdf7e45b00be4a64c3d4f009acb9ef415ec7
[ "BSD-3-Clause" ]
null
null
null
libs/kinematics/src/CVehicleSimul_Holo.cpp
gao-ouyang/mrpt
4af5fdf7e45b00be4a64c3d4f009acb9ef415ec7
[ "BSD-3-Clause" ]
1
2019-09-11T02:55:04.000Z
2019-09-11T02:55:04.000Z
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See: https://www.mrpt.org/License | +------------------------------------------------------------------------+ */ #include "kinematics-precomp.h" // Precompiled header #include <mrpt/kinematics/CVehicleSimul_Holo.h> #include <mrpt/math/wrap2pi.h> using namespace mrpt::kinematics; CVehicleSimul_Holo::CVehicleSimul_Holo() { resetStatus(); resetTime(); } void CVehicleSimul_Holo::internal_simulControlStep(const double dt) { // Control: if (m_vel_ramp_cmd.issue_time >= 0 && m_time > m_vel_ramp_cmd.issue_time) // are we executing any cmd? { const double t = m_time - m_vel_ramp_cmd.issue_time; const double T = m_vel_ramp_cmd.ramp_time; const double vxi = m_vel_ramp_cmd.init_vel.vx; const double vyi = m_vel_ramp_cmd.init_vel.vy; const double wi = m_vel_ramp_cmd.init_vel.omega; const double vxf = m_vel_ramp_cmd.target_vel_x; const double vyf = m_vel_ramp_cmd.target_vel_y; // "Blending" for vx,vy if (t <= m_vel_ramp_cmd.ramp_time) { m_odometric_vel.vx = vxi + t * (vxf - vxi) / T; m_odometric_vel.vy = vyi + t * (vyf - vyi) / T; } else { m_odometric_vel.vx = m_vel_ramp_cmd.target_vel_x; m_odometric_vel.vy = m_vel_ramp_cmd.target_vel_y; } // Ramp rotvel until aligned: const double Aang = mrpt::math::wrapToPi(m_vel_ramp_cmd.dir - m_odometry.phi); if (std::abs(Aang) < mrpt::DEG2RAD(1.0)) { m_odometric_vel.omega = .0; // we are aligned. } else { const double wf = mrpt::sign(Aang) * std::abs(m_vel_ramp_cmd.rot_speed); if (t <= m_vel_ramp_cmd.ramp_time) { m_odometric_vel.omega = wi + t * (wf - wi) / T; } else { m_odometric_vel.omega = wf; } } } } void CVehicleSimul_Holo::internal_clear() { m_vel_ramp_cmd = TVelRampCmd(); } void CVehicleSimul_Holo::sendVelRampCmd( double vel, double dir, double ramp_time, double rot_speed) { ASSERT_ABOVE_(ramp_time, 0); m_vel_ramp_cmd.issue_time = m_time; m_vel_ramp_cmd.ramp_time = ramp_time; m_vel_ramp_cmd.rot_speed = rot_speed; m_vel_ramp_cmd.init_vel = m_odometric_vel; m_vel_ramp_cmd.target_vel_x = cos(dir) * vel; m_vel_ramp_cmd.target_vel_y = sin(dir) * vel; m_vel_ramp_cmd.dir = dir; }
31.127907
80
0.617482
zarmomin
b9bd18a26cb2ea4e7ddbcc52ed0988ce10ed86d1
1,183
hpp
C++
src/app/preset-window.hpp
mimo31/fluid-sim
481c3e5a5456350bccb8795aa119a3487dff3021
[ "MIT" ]
1
2020-11-26T17:20:28.000Z
2020-11-26T17:20:28.000Z
src/app/preset-window.hpp
mimo31/brandy0
481c3e5a5456350bccb8795aa119a3487dff3021
[ "MIT" ]
null
null
null
src/app/preset-window.hpp
mimo31/brandy0
481c3e5a5456350bccb8795aa119a3487dff3021
[ "MIT" ]
null
null
null
/** * preset-window.hpp * * Author: Viktor Fukala * Created on 2021/03/07 */ #ifndef PRESET_WINDOW_HPP #define PRESET_WINDOW_HPP #include "gtkmm/button.h" #include "gtkmm/comboboxtext.h" #include "gtkmm/grid.h" #include "gtkmm/label.h" #include "brandy-window.hpp" #include "config-state-abstr.hpp" namespace brandy0 { /** * Class representing the window offering a selection of simulation parameters presets */ class PresetWindow : public BrandyWindow { private: /// Pointer to the parent (abstract) configuration state ConfigStateAbstr *parent; /// Window's main widget grid Gtk::Grid grid; /// Label explaining that the combo box shows presets Gtk::Label presetLabel; /// Combo box with all the presets Gtk::ComboBoxText presetSelector; /// Label with a warning that selecting (confirming) a presets overwrites all current paramters Gtk::Label warnLabel; /// Button for confirming preset currently selected in the combo box Gtk::Button confirmButton; public: /** * Constructs the preset window object * @param parent pointer to the parent (abstract) configuration state */ PresetWindow(ConfigStateAbstr *parent); }; } #endif // PRESET_WINDOW_HPP
23.66
96
0.748943
mimo31
b9c0186ff3a05cadadeb8ff336fdcbb6a8103d29
1,102
cpp
C++
基础算法/manacher算法/acw_3188_2.cpp
tempure/algorithm-advance
38c4504f64cd3fd15fc32cf20a541ad5ba2ad82b
[ "MIT" ]
3
2020-11-16T08:58:30.000Z
2020-11-16T08:58:33.000Z
基础算法/manacher算法/acw_3188_2.cpp
tempure/algorithm-advance
38c4504f64cd3fd15fc32cf20a541ad5ba2ad82b
[ "MIT" ]
null
null
null
基础算法/manacher算法/acw_3188_2.cpp
tempure/algorithm-advance
38c4504f64cd3fd15fc32cf20a541ad5ba2ad82b
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; /* 复杂度O(N)的根本原因是最后的回文边界mr是单调递增的 从前往后计算每个位置为中心的回文串半径长度 然后用最右边的边界来更新mid */ const int N = 2e7 + 10; //double length of original string int n; char a[N], b[N]; int p[N]; //max radius of each mid void init() { int k = 0; b[k++] = '$', b[k++] = '#'; for (int i = 0; i < n; i++) b[k++] = a[i], b[k++] = '#'; b[k++] = '^'; n = k; } void manacher() { int mr = 0, mid; for (int i = 1; i < n; i++) { if (i < mr) p[i] = min(p[mid * 2 - i], mr - i); else p[i] = 1; //这个while循环只有在p[i] = mr-i 的情况才会进行更新p[i] //如果是p[i] = p[mid * 2 -i],那么直接O(1)计算出p[i],不会在这里while花费复杂度 //所以整个算法的复杂度可以由内层的while决定,但是这个循环的mr是递增的,mr到字符串结尾的时候算法结束,所以是O(N) while (b[i - p[i]] == b[i + p[i]]) p[i]++; if (i + p[i] > mr) { mr = i + p[i]; mid = i; } } } void solve() { cin >> a; n = strlen(a); init(); manacher(); int res = 0; for (int i = 0; i < n; i++) res = max(res, p[i]); cout << res - 1 << endl; } int main() { solve(); return 0; }
20.036364
71
0.465517
tempure
b9c4055c46bdfb8290f95d5459c93bdabdeffe4f
1,357
hpp
C++
libs/core/include/fcppt/symbol/class.hpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
13
2015-02-21T18:35:14.000Z
2019-12-29T14:08:29.000Z
libs/core/include/fcppt/symbol/class.hpp
cpreh/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
5
2016-08-27T07:35:47.000Z
2019-04-21T10:55:34.000Z
libs/core/include/fcppt/symbol/class.hpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
8
2015-01-10T09:22:37.000Z
2019-12-01T08:31:12.000Z
// Copyright Carl Philipp Reh 2009 - 2021. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef FCPPT_SYMBOL_CLASS_HPP_INCLUDED #define FCPPT_SYMBOL_CLASS_HPP_INCLUDED #include <fcppt/config/compiler.hpp> #if defined(FCPPT_CONFIG_MSVC_COMPILER) #define FCPPT_SYMBOL_CLASS_IMPL #elif defined(FCPPT_CONFIG_GCC_COMPILER) #include <fcppt/symbol/export.hpp> #define FCPPT_SYMBOL_CLASS_IMPL FCPPT_SYMBOL_EXPORT #else #error "Don't know what FCPPT_DETAIL_SYMBOL_CLASS should be" #endif /** \brief Tells that a classes's vtable should be exported \ingroup fcpptexport This macro marks a classes's vtable to be exported, so it can be shared across dynamic libraries. There are several cases in which this is necessary: <ul> <li>The class is thrown as an exception and caught by another library.</li> <li>The class has virtual methods that will be called directly from another library.</li> </ul> It is not necessary to specify whether the class is currently exported or imported. \code class FCPPT_DETAIL_SYMBOL_CLASS my_exception { }; class FCPPT_DETAIL_SYMBOL_CLASS my_base { virtual void do_something() = 0; }; \endcode \see \ref symbol_vtable */ #define FCPPT_SYMBOL_CLASS FCPPT_SYMBOL_CLASS_IMPL #endif
23.807018
78
0.778187
freundlich
b9c530d5c6d278efbacd6f3411dff1829cc0cd49
1,067
hpp
C++
atto/tests/opengl/2-quad/quad.hpp
ubikoo/libfish
7f0b5e06b2bf1d6ff490ddfda9cc7aab69cdbf39
[ "MIT" ]
null
null
null
atto/tests/opengl/2-quad/quad.hpp
ubikoo/libfish
7f0b5e06b2bf1d6ff490ddfda9cc7aab69cdbf39
[ "MIT" ]
null
null
null
atto/tests/opengl/2-quad/quad.hpp
ubikoo/libfish
7f0b5e06b2bf1d6ff490ddfda9cc7aab69cdbf39
[ "MIT" ]
null
null
null
/* * quad.hpp * * Copyright (c) 2020 Carlos Braga * * This program is free software; you can redistribute it and/or modify * it under the terms of the MIT License. * * See accompanying LICENSE.md or https://opensource.org/licenses/MIT. */ #ifndef TEST_ATTO_OPENGL_QUAD_H_ #define TEST_ATTO_OPENGL_QUAD_H_ #include "atto/opengl/opengl.hpp" /** * struct Quad * @brief Minimal drawable object that clears the OpenGL color buffer. */ struct Quad : atto::gl::Drawable { GLuint m_program; /* shader program object */ GLuint m_vao; /* vertex array object */ GLuint m_vbo; /* vertex buffer object */ GLuint m_ebo; /* element buffer object */ /* Handle and draw member functions. */ void handle(const atto::gl::Event &event) override; void draw(void *data) override; /* Constructor/destructor. Disable copy semantics. */ Quad(); ~Quad() = default; Quad(const Quad &) = delete; Quad &operator=(const Quad &) = delete; }; #endif /* TEST_ATTO_OPENGL_QUAD_H_ */
27.358974
71
0.648547
ubikoo
b9c5f5d8285d15d1b895b0401697eebc03f0fe60
6,809
hpp
C++
include/frg/variant.hpp
czapek1337/frigg
ad1b6947047f492ed42b189fb208e600d9ec6915
[ "MIT" ]
37
2018-11-05T19:15:46.000Z
2022-03-09T10:16:28.000Z
include/frg/variant.hpp
czapek1337/frigg
ad1b6947047f492ed42b189fb208e600d9ec6915
[ "MIT" ]
13
2020-01-05T13:32:27.000Z
2022-03-09T17:21:07.000Z
include/frg/variant.hpp
czapek1337/frigg
ad1b6947047f492ed42b189fb208e600d9ec6915
[ "MIT" ]
16
2020-01-01T15:45:02.000Z
2022-03-06T22:19:58.000Z
#pragma once #include <frg/eternal.hpp> #include <frg/macros.hpp> #include <type_traits> #include <stddef.h> namespace frg { namespace _variant { // check if S is one of the types T template<typename S, typename... T> struct exists : public std::false_type { }; template<typename S, typename... T> struct exists<S, S, T...> : public std::true_type { }; template<typename S, typename H, typename... T> struct exists<S, H, T...> : public exists<S, T...> { }; // get the index of S in the argument pack T template<typename, typename S, typename... T> struct index_of_helper { }; template<typename S, typename... T> struct index_of_helper<std::enable_if_t<exists<S, S, T...>::value>, S, S, T...> : public std::integral_constant<size_t, 0> { }; template<typename S, typename H, typename... T> struct index_of_helper<std::enable_if_t<exists<S, H, T...>::value>, S, H, T...> : public std::integral_constant<size_t, index_of_helper<void, S, T...>::value + 1> { }; template<typename S, typename... T> using index_of = index_of_helper<void, S, T...>; // get a type with a certain index from the argument pack T template<size_t Index, typename... T> struct get_helper { }; template<typename H, typename... T> struct get_helper<0, H, T...> { using type = H; }; template<size_t Index, typename H, typename... T> struct get_helper<Index, H, T...> : public get_helper<Index - 1, T...> { }; template<size_t Index, typename... T> using get = typename get_helper<Index, T...>::type; }; template<typename... T> struct variant { static constexpr size_t invalid_tag = size_t(-1); template<typename X, size_t Index = _variant::index_of<X, T...>::value> static constexpr size_t tag_of() { return Index; } variant() : tag_{invalid_tag} { } template<typename X, size_t Index = _variant::index_of<X, T...>::value> variant(X object) : variant() { construct_<Index>(std::move(object)); }; variant(const variant &other) : variant() { if(other) copy_construct_<0>(other); } variant(variant &&other) : variant() { if(other) move_construct_<0>(std::move(other)); } ~variant() { if(*this) destruct_<0>(); } explicit operator bool() const { return tag_ != invalid_tag; } variant &operator= (variant other) { // Because swap is quite hard to implement for this type we don't use copy-and-swap. // Instead we perform a destruct-then-move-construct operation on the internal object. // Note that we take the argument by value so there are no self-assignment problems. if(tag_ == other.tag_) { assign_<0>(std::move(other)); } else { if(*this) destruct_<0>(); if(other) move_construct_<0>(std::move(other)); } return *this; } size_t tag() { return tag_; } template<typename X, size_t Index = _variant::index_of<X, T...>::value> bool is() const { return tag_ == Index; } template<typename X, size_t Index = _variant::index_of<X, T...>::value> X &get() { FRG_ASSERT(tag_ == Index); return *std::launder(reinterpret_cast<X *>(access_())); } template<typename X, size_t Index = _variant::index_of<X, T...>::value> const X &get() const { FRG_ASSERT(tag_ == Index); return *std::launder(reinterpret_cast<const X *>(access_())); } template<typename X, size_t Index = _variant::index_of<X, T...>::value, typename... Args> void emplace(Args &&... args) { if(tag_ != invalid_tag) destruct_<0>(); new (access_()) X(std::forward<Args>(args)...); tag_ = Index; } template<typename F> std::common_type_t<std::invoke_result_t<F, T&>...> apply(F functor) { return apply_<F, 0>(std::move(functor)); } template<typename F> std::common_type_t<std::invoke_result_t<F, const T&>...> const_apply(F functor) const { return apply_<F, 0>(std::move(functor)); } private: void *access_() { return storage_.buffer; } const void *access_() const { return storage_.buffer; } // construct the internal object from one of the summed types template<size_t Index, typename X = _variant::get<Index, T...>> void construct_(X object) { FRG_ASSERT(!*this); new (access_()) X(std::move(object)); tag_ = Index; } // construct the internal object by copying from another variant template<size_t Index> requires (Index < sizeof...(T)) void copy_construct_(const variant &other) { using value_type = _variant::get<Index, T...>; if(other.tag_ == Index) { FRG_ASSERT(!*this); new (access_()) value_type(other.get<value_type>()); tag_ = Index; } else { copy_construct_<Index + 1>(other); } } template<size_t Index> requires (Index == sizeof...(T)) void copy_construct_(const variant &) { FRG_ASSERT(!"Copy-construction from variant with illegal tag"); } // construct the internal object by moving from another variant template<size_t Index> requires (Index < sizeof...(T)) void move_construct_(variant &&other) { using value_type = _variant::get<Index, T...>; if(other.tag_ == Index) { FRG_ASSERT(!*this); new (access_()) value_type(std::move(other.get<value_type>())); tag_ = Index; } else { move_construct_<Index + 1>(std::move(other)); } } template<size_t Index> requires (Index == sizeof...(T)) void move_construct_(variant &&) { FRG_ASSERT(!"Move-construction from variant with illegal tag"); } // destruct the internal object template<size_t Index> requires (Index < sizeof...(T)) void destruct_() { using value_type = _variant::get<Index, T...>; if(tag_ == Index) { get<value_type>().~value_type(); tag_ = invalid_tag; } else { destruct_<Index + 1>(); } } template<size_t Index> requires (Index == sizeof...(T)) void destruct_() { FRG_ASSERT(!"Destruction of variant with illegal tag"); } // assign the internal object template<size_t Index> requires (Index < sizeof...(T)) void assign_(variant other) { using value_type = _variant::get<Index, T...>; if(tag_ == Index) { get<value_type>() = std::move(other.get<value_type>()); } else { assign_<Index + 1>(std::move(other)); } } template<size_t Index> requires (Index == sizeof...(T)) void assign_(variant) { FRG_ASSERT(!"Assignment from variant with illegal tag"); } // apply a functor to the internal object template<typename F, size_t Index> requires (Index < sizeof...(T)) std::common_type_t<std::invoke_result_t<F, T&>...> apply_(F functor) { using value_type = _variant::get<Index, T...>; if(tag_ == Index) { return functor(get<value_type>()); } else { return apply_<F, Index + 1>(std::move(functor)); } } template<typename F, size_t Index> requires (Index == sizeof...(T)) std::common_type_t<std::invoke_result_t<F, T&>...> apply_(F) { FRG_ASSERT(!"_apply() on variant with illegal tag"); __builtin_unreachable(); } size_t tag_; frg::aligned_union<T...> storage_; }; } // namespace frg
27.12749
88
0.66368
czapek1337
b9c8382f5af5e59c460f6945834add844ef15325
295
hpp
C++
AbstractFactory/AbstractProductA.hpp
colorhistory/design-patterns
854b07c786cc6ceb80b687ed933c6560c288215b
[ "MIT" ]
null
null
null
AbstractFactory/AbstractProductA.hpp
colorhistory/design-patterns
854b07c786cc6ceb80b687ed933c6560c288215b
[ "MIT" ]
null
null
null
AbstractFactory/AbstractProductA.hpp
colorhistory/design-patterns
854b07c786cc6ceb80b687ed933c6560c288215b
[ "MIT" ]
null
null
null
#ifndef ABSTRACTPRODUCTA_HPP #define ABSTRACTPRODUCTA_HPP namespace DP { class AbstractProductA { public: AbstractProductA(); virtual ~AbstractProductA() = 0; // ADT virtual void use() = 0; }; } // namespace DP #endif // ABSTRACTPRODUCTA_HPP
17.352941
40
0.623729
colorhistory
b9ca906a10d8183ecea31e49c6665bb968557a34
1,790
hpp
C++
parser.hpp
ultinate/masked-sudoku
0e0bcdcf6c1701c52cab204ea4ffac392793b92b
[ "MIT" ]
null
null
null
parser.hpp
ultinate/masked-sudoku
0e0bcdcf6c1701c52cab204ea4ffac392793b92b
[ "MIT" ]
null
null
null
parser.hpp
ultinate/masked-sudoku
0e0bcdcf6c1701c52cab204ea4ffac392793b92b
[ "MIT" ]
null
null
null
#ifndef PARSER_HPP #define PARSER_HPP #include <iostream> #include <string> #include <cstring> const int N = 9; typedef unsigned short int mask; class Parser { private: std::string inputString; mask unsolvedBoard[N*N]; public: /** * Returns integer if char is a digit, 0 otherwise */ static unsigned int inputCharToInt(char c); static mask inputCharToMask(char c); /** * Returns 1-based integer from mask if only one bit is set, 0 otherwise */ static unsigned int getIntFromMask(mask m); /** * Returns true if only one bit is set, false otherwise */ static bool isOnlyOneBit(mask m); /** * Returns true if bit of 1-based integer _i_ is set, false otherwise */ static bool isBitSet(mask m, unsigned int i); /** * Returns number of set bits in mask */ static unsigned int countBits(mask m); /** * Returns log2 of a number if it is a multiple of 2 * * log2 expects mask to have only 1 bit set. * Otherwise, the position (log2) of the LSB of m is returned, * or 0 if no bits are set. */ static unsigned int log2(mask m); /** * Returns mask where a single bit for a 1-based integer is set */ static mask getMaskFromInt(unsigned int i); /** * Returns mask where a single bit is not set * * Corresponds to bitwise_not(getMaskFromInt). */ static mask getNotMask(unsigned int i); Parser(std::string inputString); ~Parser() {} int parse(); mask * getBoard() { return unsolvedBoard; } }; #endif
24.189189
80
0.56257
ultinate
844d895ad5e0be173061f99795e753e96c4c03ef
6,588
cc
C++
cpp/src/arrow/tensor/coo_converter.cc
palmerlao/arrow
4e680c46ad5aa76ba1dc85574c4e96a51450364f
[ "Apache-2.0" ]
null
null
null
cpp/src/arrow/tensor/coo_converter.cc
palmerlao/arrow
4e680c46ad5aa76ba1dc85574c4e96a51450364f
[ "Apache-2.0" ]
2
2020-03-12T14:31:34.000Z
2020-03-26T22:46:19.000Z
cpp/src/arrow/tensor/coo_converter.cc
palmerlao/arrow
4e680c46ad5aa76ba1dc85574c4e96a51450364f
[ "Apache-2.0" ]
2
2020-12-28T16:59:24.000Z
2021-02-21T12:33:41.000Z
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include "arrow/tensor/converter.h" #include <cstdint> #include <memory> #include <vector> #include "arrow/buffer.h" #include "arrow/status.h" #include "arrow/type.h" #include "arrow/util/checked_cast.h" #include "arrow/visitor_inline.h" namespace arrow { class MemoryPool; namespace internal { namespace { inline void IncrementIndex(std::vector<int64_t>& coord, const std::vector<int64_t>& shape) { const int64_t ndim = shape.size(); ++coord[ndim - 1]; if (coord[ndim - 1] == shape[ndim - 1]) { int64_t d = ndim - 1; while (d > 0 && coord[d] == shape[d]) { coord[d] = 0; ++coord[d - 1]; --d; } } } // ---------------------------------------------------------------------- // SparseTensorConverter for SparseCOOIndex template <typename TYPE> class SparseCOOTensorConverter { public: using NumericTensorType = NumericTensor<TYPE>; using value_type = typename NumericTensorType::value_type; SparseCOOTensorConverter(const NumericTensorType& tensor, const std::shared_ptr<DataType>& index_value_type, MemoryPool* pool) : tensor_(tensor), index_value_type_(index_value_type), pool_(pool) {} template <typename IndexValueType> Status Convert() { using c_index_value_type = typename IndexValueType::c_type; const int64_t indices_elsize = sizeof(c_index_value_type); const int64_t ndim = tensor_.ndim(); int64_t nonzero_count = -1; RETURN_NOT_OK(tensor_.CountNonZero(&nonzero_count)); std::shared_ptr<Buffer> indices_buffer; RETURN_NOT_OK( AllocateBuffer(pool_, indices_elsize * ndim * nonzero_count, &indices_buffer)); c_index_value_type* indices = reinterpret_cast<c_index_value_type*>(indices_buffer->mutable_data()); std::shared_ptr<Buffer> values_buffer; RETURN_NOT_OK( AllocateBuffer(pool_, sizeof(value_type) * nonzero_count, &values_buffer)); value_type* values = reinterpret_cast<value_type*>(values_buffer->mutable_data()); if (ndim <= 1) { const value_type* data = reinterpret_cast<const value_type*>(tensor_.raw_data()); const int64_t count = ndim == 0 ? 1 : tensor_.shape()[0]; for (int64_t i = 0; i < count; ++i, ++data) { if (*data != 0) { *indices++ = static_cast<c_index_value_type>(i); *values++ = *data; } } } else { const std::vector<int64_t>& shape = tensor_.shape(); std::vector<int64_t> coord(ndim, 0); // The current logical coordinates for (int64_t n = tensor_.size(); n > 0; n--) { const value_type x = tensor_.Value(coord); if (tensor_.Value(coord) != 0) { *values++ = x; // Write indices in row-major order. for (int64_t i = 0; i < ndim; ++i) { *indices++ = static_cast<c_index_value_type>(coord[i]); } } IncrementIndex(coord, shape); } } // make results const std::vector<int64_t> indices_shape = {nonzero_count, ndim}; const std::vector<int64_t> indices_strides = {indices_elsize * ndim, indices_elsize}; sparse_index = std::make_shared<SparseCOOIndex>(std::make_shared<Tensor>( index_value_type_, indices_buffer, indices_shape, indices_strides)); data = values_buffer; return Status::OK(); } #define CALL_TYPE_SPECIFIC_CONVERT(TYPE_CLASS) \ case TYPE_CLASS##Type::type_id: \ return Convert<TYPE_CLASS##Type>(); Status Convert() { switch (index_value_type_->id()) { ARROW_GENERATE_FOR_ALL_INTEGER_TYPES(CALL_TYPE_SPECIFIC_CONVERT); // LCOV_EXCL_START: The following invalid causes program failure. default: return Status::TypeError("Unsupported SparseTensor index value type"); // LCOV_EXCL_STOP } } #undef CALL_TYPE_SPECIFIC_CONVERT std::shared_ptr<SparseCOOIndex> sparse_index; std::shared_ptr<Buffer> data; private: const NumericTensorType& tensor_; const std::shared_ptr<DataType>& index_value_type_; MemoryPool* pool_; }; template <typename TYPE> Status MakeSparseCOOTensorFromTensor(const Tensor& tensor, const std::shared_ptr<DataType>& index_value_type, MemoryPool* pool, std::shared_ptr<SparseIndex>* out_sparse_index, std::shared_ptr<Buffer>* out_data) { NumericTensor<TYPE> numeric_tensor(tensor.data(), tensor.shape(), tensor.strides()); SparseCOOTensorConverter<TYPE> converter(numeric_tensor, index_value_type, pool); RETURN_NOT_OK(converter.Convert()); *out_sparse_index = checked_pointer_cast<SparseIndex>(converter.sparse_index); *out_data = converter.data; return Status::OK(); } } // namespace #define MAKE_SPARSE_TENSOR_FROM_TENSOR(TYPE_CLASS) \ case TYPE_CLASS##Type::type_id: \ return MakeSparseCOOTensorFromTensor<TYPE_CLASS##Type>( \ tensor, index_value_type, pool, out_sparse_index, out_data); Status MakeSparseCOOTensorFromTensor(const Tensor& tensor, const std::shared_ptr<DataType>& index_value_type, MemoryPool* pool, std::shared_ptr<SparseIndex>* out_sparse_index, std::shared_ptr<Buffer>* out_data) { switch (tensor.type()->id()) { ARROW_GENERATE_FOR_ALL_NUMERIC_TYPES(MAKE_SPARSE_TENSOR_FROM_TENSOR); // LCOV_EXCL_START: ignore program failure default: return Status::TypeError("Unsupported Tensor value type"); // LCOV_EXCL_STOP } } #undef MAKE_SPARSE_TENSOR_FROM_TENSOR } // namespace internal } // namespace arrow
35.419355
89
0.653764
palmerlao
84519821fbf22ef34c7456d85b821515cc453270
204
hpp
C++
src/cpu.hpp
AsuMagic/fusiongb
b2b61ed3c14bc96d50216d07442a4d5c7c518f6e
[ "MIT" ]
null
null
null
src/cpu.hpp
AsuMagic/fusiongb
b2b61ed3c14bc96d50216d07442a4d5c7c518f6e
[ "MIT" ]
null
null
null
src/cpu.hpp
AsuMagic/fusiongb
b2b61ed3c14bc96d50216d07442a4d5c7c518f6e
[ "MIT" ]
null
null
null
#ifndef CPU_HPP #define CPU_HPP #include "register.hpp" #include <vector> namespace fusion { struct CPU { RegisterFile _regs; std::vector<uint8_t> _ram; CPU(); void loop(); }; } #endif // CPU_HPP
10.2
27
0.691176
AsuMagic
8456d78544fc118b2adea2da78e6a41cef92e433
754
cpp
C++
PAT (Advanced Level) Practice/1002.cpp
geek-LHW/PAT
f128f5977569f73c3c0b59cf0397bd94f9dfb205
[ "Apache-2.0" ]
null
null
null
PAT (Advanced Level) Practice/1002.cpp
geek-LHW/PAT
f128f5977569f73c3c0b59cf0397bd94f9dfb205
[ "Apache-2.0" ]
null
null
null
PAT (Advanced Level) Practice/1002.cpp
geek-LHW/PAT
f128f5977569f73c3c0b59cf0397bd94f9dfb205
[ "Apache-2.0" ]
null
null
null
#include<iostream> #include<iomanip> using namespace std; int main(){ double Poly[1001] = {0}; //多项式A int k; scanf("%d", &k); for (int i = 0; i < k;i++){ int exp; double coef; scanf("%d%lf", &exp, &coef); Poly[exp] = coef; } //多项式B scanf("%d", &k); for (int i = 0; i < k;i++){ int exp; double coef; scanf("%d%lf", &exp, &coef); Poly[exp] += coef; } //统计多项式非零项 int num = 0; for (int i = 0; i <1001;i++){ if(Poly[i]!=0){ num++; } } printf("%d", num); //打印 for (int i = 1000; i >=0;i--){ if(Poly[i]!=0){ printf(" %d %0.1f", i,Poly[i]); } } return 0; }
19.333333
43
0.393899
geek-LHW
846108268d520df9571e9f0d4b2f924875875a55
76,927
cpp
C++
dwarf/SB/Core/x/xLaserBolt.cpp
stravant/bfbbdecomp
2126be355a6bb8171b850f829c1f2731c8b5de08
[ "OLDAP-2.7" ]
1
2021-01-05T11:28:55.000Z
2021-01-05T11:28:55.000Z
dwarf/SB/Core/x/xLaserBolt.cpp
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
null
null
null
dwarf/SB/Core/x/xLaserBolt.cpp
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
1
2022-03-30T15:15:08.000Z
2022-03-30T15:15:08.000Z
typedef struct static_queue_0; typedef struct RwObjectHasFrame; typedef struct RxPipelineNode; typedef struct zEntHangable; typedef struct static_queue_1; typedef enum _zPlayerWallJumpState; typedef struct RpPolygon; typedef struct xVec3; typedef struct xLaserBoltEmitter; typedef struct xEnv; typedef struct bolt; typedef struct xMovePointAsset; typedef struct RwV3d; typedef struct xEnt; typedef struct effect_data; typedef struct RpGeometry; typedef struct xAnimTable; typedef struct xAnimPlay; typedef struct xModelInstance; typedef struct RpVertexNormal; typedef struct zPlatform; typedef struct rxHeapFreeBlock; typedef struct xMovePoint; typedef struct RwRaster; typedef struct iEnv; typedef struct RxPipelineNodeTopSortData; typedef struct xAnimEffect; typedef struct RwV2d; typedef struct RwTexCoords; typedef struct xBase; typedef struct xGridBound; typedef struct iterator; typedef enum _tagRumbleType; typedef struct RxNodeDefinition; typedef struct _class_0; typedef struct tagiRenderInput; typedef enum _zPlayerType; typedef struct xLightKit; typedef struct xUpdateCullGroup; typedef struct zCutsceneMgr; typedef struct zEnt; typedef struct xAnimSingle; typedef struct RwRGBA; typedef struct rxHeapSuperBlockDescriptor; typedef struct xJSPNodeInfo; typedef struct RwTexture; typedef struct _tagEmitSphere; typedef struct xAnimState; typedef struct xEntMechData; typedef struct RwResEntry; typedef struct RxPipeline; typedef struct xMat4x3; typedef struct RxPipelineCluster; typedef struct RxObjSpace3DVertex; typedef struct xEntMotionSplineData; typedef struct RxPipelineNodeParam; typedef struct zAssetPickupTable; typedef struct analog_data; typedef struct RpMeshHeader; typedef struct xSpline3; typedef struct RxHeap; typedef struct RwBBox; typedef struct xMemPool; typedef struct curve_node; typedef struct xQuat; typedef struct xGroup; typedef struct RpTriangle; typedef struct xEntBoulder; typedef struct RpAtomic; typedef struct xClumpCollBSPBranchNode; typedef struct xEntShadow; typedef struct rxHeapBlockHeader; typedef struct xCollis; typedef struct zCheckPoint; typedef struct zPlayerGlobals; typedef struct xModelPool; typedef struct RxPipelineRequiresCluster; typedef struct _tagEmitRect; typedef struct xEntMotionMPData; typedef struct xJSPHeader; typedef struct xEntAsset; typedef struct xEntERData; typedef struct xUpdateCullMgr; typedef struct zPlayerCarryInfo; typedef struct xPortalAsset; typedef enum fx_when_enum; typedef struct zPlayerSettings; typedef struct xScene; typedef struct xCamera; typedef struct xAnimFile; typedef struct _zEnv; typedef struct RpClump; typedef struct xVec4; typedef struct xSurface; typedef struct xQCData; typedef struct xCoef; typedef struct RwSurfaceProperties; typedef struct xClumpCollBSPTree; typedef struct RwCamera; typedef struct RwMatrixTag; typedef struct xAnimTransition; typedef struct xAnimTransitionList; typedef struct xUpdateCullEnt; typedef struct rxReq; typedef struct xPEEntBound; typedef struct xEnvAsset; typedef struct xLinkAsset; typedef struct xModelTag; typedef struct zLasso; typedef struct xEntMotionMechData; typedef struct _tagEmitLine; typedef enum RxClusterValidityReq; typedef enum RpWorldRenderOrder; typedef struct xRay3; typedef struct xEntPenData; typedef struct _tagxRumble; typedef struct iFogParams; typedef struct xCoef3; typedef struct xEntDrive; typedef enum RxNodeDefEditable; typedef struct xBound; typedef struct RpMaterial; typedef struct RpSector; typedef struct xModelBucket; typedef enum RxClusterValid; typedef enum fx_type_enum; typedef struct xEntCollis; typedef struct xAnimMultiFile; typedef struct xRot; typedef struct xEntOrbitData; typedef struct xVec2; typedef struct RpWorld; typedef struct RpWorldSector; typedef struct RpMorphTarget; typedef struct xParEmitterAsset; typedef enum rxEmbeddedPacketState; typedef struct zPlatFMRunTime; typedef struct xSphere; typedef struct _tagEmitVolume; typedef struct _zPortal; typedef struct RpLight; typedef struct xEntMotion; typedef struct unit_data; typedef struct xParGroup; typedef struct xEntFrame; typedef struct xFFX; typedef enum RwCameraProjection; typedef struct xPlatformAsset; typedef enum _tagPadState; typedef enum RxClusterForcePresent; typedef struct xParEmitterPropsAsset; typedef struct xEntMotionAsset; typedef struct xCylinder; typedef enum fx_orient_enum; typedef struct RxColorUnion; typedef struct xGlobals; typedef struct RwFrame; typedef struct xBox; typedef struct RxClusterDefinition; typedef struct xShadowSimplePoly; typedef struct _tagxPad; typedef struct xEntSplineData; typedef struct _tagEmitOffsetPoint; typedef struct RwSphere; typedef struct xParEmitter; typedef struct RwLLLink; typedef struct tri_data_0; typedef struct xGroupAsset; typedef struct _tagPadAnalog; typedef struct RwTexDictionary; typedef struct xEntMotionPenData; typedef struct RxOutputSpec; typedef struct xDecalEmitter; typedef struct _tagiPad; typedef struct xLightKitLight; typedef struct tri_data_1; typedef struct xMat3x3; typedef struct xAnimMultiFileEntry; typedef struct xAnimActiveEffect; typedef struct _class_1; typedef struct xShadowSimpleCache; typedef struct RxClusterRef; typedef struct xEntMPData; typedef struct xParSys; typedef struct RwObject; typedef struct xPEVCyl; typedef struct config_0; typedef struct RxIoSpec; typedef enum texture_mode; typedef struct RpInterpolator; typedef struct xParInterp; typedef struct xClumpCollBSPVertInfo; typedef struct RxNodeMethods; typedef struct xEntMotionERData; typedef struct _class_2; typedef struct xClumpCollBSPTriangle; typedef struct xAnimMultiFileBase; typedef struct _class_3; typedef struct RwFrustumPlane; typedef struct xBaseAsset; typedef struct xPEEntBone; typedef struct RwPlane; typedef struct config_1; typedef struct zGlobals; typedef struct _class_4; typedef struct RxCluster; typedef struct zGlobalSettings; typedef struct RpMaterialList; typedef struct RxPacket; typedef struct zPlayerLassoInfo; typedef struct zScene; typedef struct _class_5; typedef struct xBBox; typedef struct anim_coll_data; typedef enum RwFogType; typedef struct iColor_tag; typedef struct _class_6; typedef struct zLedgeGrabParams; typedef struct RwRGBAReal; typedef struct xPECircle; typedef struct zJumpParam; typedef struct xEntMotionOrbitData; typedef struct RwLinkList; typedef RwCamera*(*type_0)(RwCamera*); typedef RpClump*(*type_1)(RpClump*, void*); typedef int32(*type_2)(RxPipelineNode*); typedef RwCamera*(*type_4)(RwCamera*); typedef RwObjectHasFrame*(*type_5)(RwObjectHasFrame*); typedef void(*type_7)(xEnt*, xScene*, float32, xEntCollis*); typedef xBase*(*type_8)(uint32); typedef void(*type_9)(RxPipelineNode*); typedef uint32(*type_13)(xEnt*, xEnt*, xScene*, float32, xCollis*); typedef int8*(*type_14)(xBase*); typedef int8*(*type_16)(uint32); typedef void(*type_19)(xAnimPlay*, xAnimState*); typedef int32(*type_20)(RxPipelineNode*, RxPipeline*); typedef void(*type_21)(xEnt*, xVec3*, xMat4x3*); typedef uint32(*type_23)(uint32, xAnimActiveEffect*, xAnimSingle*, void*); typedef void(*type_26)(xAnimPlay*, xQuat*, xVec3*, int32); typedef uint32(*type_29)(RxPipelineNode*, uint32, uint32, void*); typedef RpAtomic*(*type_30)(RpAtomic*); typedef int32(*type_32)(RxPipelineNode*, RxPipelineNodeParam*); typedef int32(*type_36)(RxNodeDefinition*); typedef void(*type_40)(RxNodeDefinition*); typedef uint32(*type_45)(xAnimTransition*, xAnimSingle*, void*); typedef void(*type_52)(void*); typedef void(*type_60)(xAnimState*, xAnimSingle*, void*); typedef RpWorldSector*(*type_63)(RpWorldSector*); typedef int32(*type_79)(xBase*, xBase*, uint32, float32*, xBase*); typedef void(*type_80)(xEnt*, xScene*, float32); typedef void(*type_84)(bolt&, void*); typedef void(*type_86)(xEnt*, xVec3*); typedef void(*type_89)(xEnt*, xScene*, float32, xEntFrame*); typedef void(*type_90)(xEnt*); typedef void(*type_94)(xMemPool*, void*); typedef uint32(*type_95)(void*, void*); typedef void(*type_103)(RwResEntry*); typedef xVec3 type_3[60]; typedef xCollis type_6[18]; typedef int8 type_10[16]; typedef RwTexCoords* type_11[8]; typedef float32 type_12[22]; typedef xParInterp type_15[1]; typedef float32 type_17[22]; typedef uint8 type_18[2]; typedef int8 type_22[16]; typedef uint32 type_24[15]; typedef uint32 type_25[15]; typedef RwFrustumPlane type_27[6]; typedef uint16 type_28[3]; typedef uint32 type_31[15]; typedef xParInterp type_33[4]; typedef RwV3d type_34[8]; typedef uint32 type_35[72]; typedef int8 type_37[4]; typedef analog_data type_38[2]; typedef xParInterp type_39[4]; typedef xBase* type_41[72]; typedef uint8 type_42[3]; typedef float32 type_43[4]; typedef float32 type_44[2]; typedef uint8 type_46[2]; typedef xVec4 type_47[12]; typedef uint32 type_48[2]; typedef RwTexCoords* type_49[8]; typedef uint8 type_50[2]; typedef float32 type_51[6]; typedef uint8 type_53[3]; typedef float32 type_54[3]; typedef float32 type_55[3]; typedef effect_data* type_56[7]; typedef xModelTag type_57[2]; typedef uint32 type_58[7]; typedef float32 type_59[4]; typedef float32 type_61[4]; typedef float32 type_62[3]; typedef float32 type_64[12]; typedef RpLight* type_65[2]; typedef float32 type_66[12]; typedef RwFrame* type_67[2]; typedef float32 type_68[12]; typedef xEnt* type_69[111]; typedef float32 type_70[12]; typedef float32 type_71[12]; typedef xVec3 type_72[3]; typedef uint32 type_73[4]; typedef float32 type_74[12]; typedef uint8 type_75[3]; typedef uint8 type_76[3]; typedef int8 type_77[128]; typedef int8 type_78[128][6]; typedef uint8 type_81[2]; typedef uint8 type_82[14]; typedef xModelTag type_83[4]; typedef int8 type_85[32]; typedef xModelInstance* type_87[14]; typedef float32 type_88[16]; typedef uint8 type_91[4]; typedef float32 type_92[2]; typedef float32 type_93[2]; typedef uint8 type_96[22]; typedef int8 type_97[32]; typedef uint8 type_98[22]; typedef int8 type_99[32]; typedef xVec3 type_100[4]; typedef uint16 type_101[3]; typedef xVec2 type_102[2]; typedef uint8 type_104[2]; typedef xVec2 type_105[2]; typedef xAnimMultiFileEntry type_106[1]; typedef xVec3 type_107[5]; typedef RxCluster type_108[1]; typedef uint8 type_109[5]; struct static_queue_0 { uint32 _first; uint32 _size; uint32 _max_size; uint32 _max_size_mask; bolt* _buffer; }; struct RwObjectHasFrame { RwObject object; RwLLLink lFrame; RwObjectHasFrame*(*sync)(RwObjectHasFrame*); }; struct RxPipelineNode { RxNodeDefinition* nodeDef; uint32 numOutputs; uint32* outputs; RxPipelineCluster** slotClusterRefs; uint32* slotsContinue; void* privateData; uint32* inputToClusterSlot; RxPipelineNodeTopSortData* topSortData; void* initializationData; uint32 initializationDataSize; }; struct zEntHangable { }; struct static_queue_1 { uint32 _first; uint32 _size; uint32 _max_size; uint32 _max_size_mask; unit_data* _buffer; }; enum _zPlayerWallJumpState { k_WALLJUMP_NOT, k_WALLJUMP_LAUNCH, k_WALLJUMP_FLIGHT, k_WALLJUMP_LAND }; struct RpPolygon { uint16 matIndex; uint16 vertIndex[3]; }; struct xVec3 { float32 x; float32 y; float32 z; }; struct xLaserBoltEmitter { config_0 cfg; static_queue_0 bolts; float32 ialpha; RwRaster* bolt_raster; int32 start_collide; effect_data* fx[7]; uint32 fxsize[7]; void update_fx(bolt& b, float32 prev_dist, float32 dt); RxObjSpace3DVertex* render(bolt& b, RxObjSpace3DVertex* vert); void collide_update(bolt& b); void attach_effects(fx_when_enum when, effect_data* fx, uint32 fxsize); void render(); void update(float32 dt); void emit(xVec3& loc, xVec3& dir); void refresh_config(); void reset(); void set_texture(int8* name); void init(uint32 max_bolts); }; struct xEnv { iEnv* geom; iEnv ienv; xLightKit* lightKit; }; struct bolt { xVec3 origin; xVec3 dir; xVec3 loc; xVec3 hit_norm; float32 dist; float32 hit_dist; float32 prev_dist; float32 prev_check_dist; xEnt* hit_ent; float32 emitted; void* context; }; struct xMovePointAsset : xBaseAsset { xVec3 pos; uint16 wt; uint8 on; uint8 bezIndex; uint8 flg_props; uint8 pad; uint16 numPoints; float32 delay; float32 zoneRadius; float32 arenaRadius; }; struct RwV3d { float32 x; float32 y; float32 z; }; struct xEnt : xBase { xEntAsset* asset; uint16 idx; uint16 num_updates; uint8 flags; uint8 miscflags; uint8 subType; uint8 pflags; uint8 moreFlags; uint8 isCulled; uint8 driving_count; uint8 num_ffx; uint8 collType; uint8 collLev; uint8 chkby; uint8 penby; xModelInstance* model; xModelInstance* collModel; xModelInstance* camcollModel; xLightKit* lightKit; void(*update)(xEnt*, xScene*, float32); void(*endUpdate)(xEnt*, xScene*, float32); void(*bupdate)(xEnt*, xVec3*); void(*move)(xEnt*, xScene*, float32, xEntFrame*); void(*render)(xEnt*); xEntFrame* frame; xEntCollis* collis; xGridBound gridb; xBound bound; void(*transl)(xEnt*, xVec3*, xMat4x3*); xFFX* ffx; xEnt* driver; int32 driveMode; xShadowSimpleCache* simpShadow; xEntShadow* entShadow; anim_coll_data* anim_coll; void* user_data; }; struct effect_data { fx_type_enum type; fx_orient_enum orient; float32 rate; _class_2 data; float32 irate; }; struct RpGeometry { RwObject object; uint32 flags; uint16 lockedSinceLastInst; int16 refCount; int32 numTriangles; int32 numVertices; int32 numMorphTargets; int32 numTexCoordSets; RpMaterialList matList; RpTriangle* triangles; RwRGBA* preLitLum; RwTexCoords* texCoords[8]; RpMeshHeader* mesh; RwResEntry* repEntry; RpMorphTarget* morphTarget; }; struct xAnimTable { xAnimTable* Next; int8* Name; xAnimTransition* TransitionList; xAnimState* StateList; uint32 AnimIndex; uint32 MorphIndex; uint32 UserFlags; }; struct xAnimPlay { xAnimPlay* Next; uint16 NumSingle; uint16 BoneCount; xAnimSingle* Single; void* Object; xAnimTable* Table; xMemPool* Pool; xModelInstance* ModelInst; void(*BeforeAnimMatrices)(xAnimPlay*, xQuat*, xVec3*, int32); }; struct xModelInstance { xModelInstance* Next; xModelInstance* Parent; xModelPool* Pool; xAnimPlay* Anim; RpAtomic* Data; uint32 PipeFlags; float32 RedMultiplier; float32 GreenMultiplier; float32 BlueMultiplier; float32 Alpha; float32 FadeStart; float32 FadeEnd; xSurface* Surf; xModelBucket** Bucket; xModelInstance* BucketNext; xLightKit* LightKit; void* Object; uint16 Flags; uint8 BoneCount; uint8 BoneIndex; uint8* BoneRemap; RwMatrixTag* Mat; xVec3 Scale; uint32 modelID; uint32 shadowID; RpAtomic* shadowmapAtomic; _class_1 anim_coll; }; struct RpVertexNormal { int8 x; int8 y; int8 z; uint8 pad; }; struct zPlatform : zEnt { xPlatformAsset* passet; xEntMotion motion; uint16 state; uint16 plat_flags; float32 tmr; int32 ctr; xMovePoint* src; xModelInstance* am; xModelInstance* bm; int32 moving; xEntDrive drv; zPlatFMRunTime* fmrt; float32 pauseMult; float32 pauseDelta; }; struct rxHeapFreeBlock { uint32 size; rxHeapBlockHeader* ptr; }; struct xMovePoint : xBase { xMovePointAsset* asset; xVec3* pos; xMovePoint** nodes; xMovePoint* prev; uint32 node_wt_sum; uint8 on; uint8 pad[2]; float32 delay; xSpline3* spl; }; struct RwRaster { RwRaster* parent; uint8* cpPixels; uint8* palette; int32 width; int32 height; int32 depth; int32 stride; int16 nOffsetX; int16 nOffsetY; uint8 cType; uint8 cFlags; uint8 privateFlags; uint8 cFormat; uint8* originalPixels; int32 originalWidth; int32 originalHeight; int32 originalStride; }; struct iEnv { RpWorld* world; RpWorld* collision; RpWorld* fx; RpWorld* camera; xJSPHeader* jsp; RpLight* light[2]; RwFrame* light_frame[2]; int32 memlvl; }; struct RxPipelineNodeTopSortData { uint32 numIns; uint32 numInsVisited; rxReq* req; }; struct xAnimEffect { xAnimEffect* Next; uint32 Flags; float32 StartTime; float32 EndTime; uint32(*Callback)(uint32, xAnimActiveEffect*, xAnimSingle*, void*); }; struct RwV2d { float32 x; float32 y; }; struct RwTexCoords { float32 u; float32 v; }; struct xBase { uint32 id; uint8 baseType; uint8 linkCount; uint16 baseFlags; xLinkAsset* link; int32(*eventFunc)(xBase*, xBase*, uint32, float32*, xBase*); }; struct xGridBound { void* data; uint16 gx; uint16 gz; uint8 ingrid; uint8 oversize; uint8 deleted; uint8 gpad; xGridBound** head; xGridBound* next; }; struct iterator { uint32 _it; static_queue_0* _owner; }; enum _tagRumbleType { eRumble_Off, eRumble_Hi, eRumble_VeryLightHi, eRumble_VeryLight, eRumble_LightHi, eRumble_Light, eRumble_MediumHi, eRumble_Medium, eRumble_HeavyHi, eRumble_Heavy, eRumble_VeryHeavyHi, eRumble_VeryHeavy, eRumble_Total, eRumbleForceU32 = 0x7fffffff }; struct RxNodeDefinition { int8* name; RxNodeMethods nodeMethods; RxIoSpec io; uint32 pipelineNodePrivateDataSize; RxNodeDefEditable editable; int32 InputPipesCnt; }; struct _class_0 { RwTexture* asset; uint32 units; xVec2 size; xVec2 isize; int32 prev; }; struct tagiRenderInput { uint16* m_index; RxObjSpace3DVertex* m_vertex; float32* m_vertexTZ; uint32 m_mode; int32 m_vertexType; int32 m_vertexTypeSize; int32 m_indexCount; int32 m_vertexCount; xMat4x3 m_camViewMatrix; xVec4 m_camViewR; xVec4 m_camViewU; }; enum _zPlayerType { ePlayer_SB, ePlayer_Patrick, ePlayer_Sandy, ePlayer_MAXTYPES }; struct xLightKit { uint32 tagID; uint32 groupID; uint32 lightCount; xLightKitLight* lightList; }; struct xUpdateCullGroup { uint32 active; uint16 startIndex; uint16 endIndex; xGroup* groupObject; }; struct zCutsceneMgr { }; struct zEnt : xEnt { xAnimTable* atbl; }; struct xAnimSingle { uint32 SingleFlags; xAnimState* State; float32 Time; float32 CurrentSpeed; float32 BilinearLerp[2]; xAnimEffect* Effect; uint32 ActiveCount; float32 LastTime; xAnimActiveEffect* ActiveList; xAnimPlay* Play; xAnimTransition* Sync; xAnimTransition* Tran; xAnimSingle* Blend; float32 BlendFactor; uint32 pad; }; struct RwRGBA { uint8 red; uint8 green; uint8 blue; uint8 alpha; }; struct rxHeapSuperBlockDescriptor { void* start; uint32 size; rxHeapSuperBlockDescriptor* next; }; struct xJSPNodeInfo { int32 originalMatIndex; int32 nodeFlags; }; struct RwTexture { RwRaster* raster; RwTexDictionary* dict; RwLLLink lInDictionary; int8 name[32]; int8 mask[32]; uint32 filterAddressing; int32 refCount; }; struct _tagEmitSphere { float32 radius; }; struct xAnimState { xAnimState* Next; int8* Name; uint32 ID; uint32 Flags; uint32 UserFlags; float32 Speed; xAnimFile* Data; xAnimEffect* Effects; xAnimTransitionList* Default; xAnimTransitionList* List; float32* BoneBlend; float32* TimeSnap; float32 FadeRecip; uint16* FadeOffset; void* CallbackData; xAnimMultiFile* MultiFile; void(*BeforeEnter)(xAnimPlay*, xAnimState*); void(*StateCallback)(xAnimState*, xAnimSingle*, void*); void(*BeforeAnimMatrices)(xAnimPlay*, xQuat*, xVec3*, int32); }; struct xEntMechData { xVec3 apos; xVec3 bpos; xVec3 dir; float32 arot; float32 brot; float32 ss; float32 sr; int32 state; float32 tsfd; float32 trfd; float32 tsbd; float32 trbd; float32* rotptr; }; struct RwResEntry { RwLLLink link; int32 size; void* owner; RwResEntry** ownerRef; void(*destroyNotify)(RwResEntry*); }; struct RxPipeline { int32 locked; uint32 numNodes; RxPipelineNode* nodes; uint32 packetNumClusterSlots; rxEmbeddedPacketState embeddedPacketState; RxPacket* embeddedPacket; uint32 numInputRequirements; RxPipelineRequiresCluster* inputRequirements; void* superBlock; uint32 superBlockSize; uint32 entryPoint; uint32 pluginId; uint32 pluginData; }; struct xMat4x3 : xMat3x3 { xVec3 pos; uint32 pad3; }; struct RxPipelineCluster { RxClusterDefinition* clusterRef; uint32 creationAttributes; }; struct RxObjSpace3DVertex { RwV3d objVertex; RxColorUnion c; RwV3d objNormal; float32 u; float32 v; }; struct xEntMotionSplineData { int32 unknown; }; struct RxPipelineNodeParam { void* dataParam; RxHeap* heap; }; struct zAssetPickupTable { }; struct analog_data { xVec2 offset; xVec2 dir; float32 mag; float32 ang; }; struct RpMeshHeader { uint32 flags; uint16 numMeshes; uint16 serialNum; uint32 totalIndicesInMesh; uint32 firstMeshOffset; }; struct xSpline3 { uint16 type; uint16 flags; uint32 N; uint32 allocN; xVec3* points; float32* time; xVec3* p12; xVec3* bctrl; float32* knot; xCoef3* coef; uint32 arcSample; float32* arcLength; }; struct RxHeap { uint32 superBlockSize; rxHeapSuperBlockDescriptor* head; rxHeapBlockHeader* headBlock; rxHeapFreeBlock* freeBlocks; uint32 entriesAlloced; uint32 entriesUsed; int32 dirty; }; struct RwBBox { RwV3d sup; RwV3d inf; }; struct xMemPool { void* FreeList; uint16 NextOffset; uint16 Flags; void* UsedList; void(*InitCB)(xMemPool*, void*); void* Buffer; uint16 Size; uint16 NumRealloc; uint32 Total; }; struct curve_node { float32 time; iColor_tag color; float32 scale; }; struct xQuat { xVec3 v; float32 s; }; struct xGroup : xBase { xGroupAsset* asset; xBase** item; uint32 last_index; int32 flg_group; }; struct RpTriangle { uint16 vertIndex[3]; int16 matIndex; }; struct xEntBoulder { }; struct RpAtomic { RwObjectHasFrame object; RwResEntry* repEntry; RpGeometry* geometry; RwSphere boundingSphere; RwSphere worldBoundingSphere; RpClump* clump; RwLLLink inClumpLink; RpAtomic*(*renderCallBack)(RpAtomic*); RpInterpolator interpolator; uint16 renderFrame; uint16 pad; RwLinkList llWorldSectorsInAtomic; RxPipeline* pipeline; }; struct xClumpCollBSPBranchNode { uint32 leftInfo; uint32 rightInfo; float32 leftValue; float32 rightValue; }; struct xEntShadow { xVec3 pos; xVec3 vec; RpAtomic* shadowModel; float32 dst_cast; float32 radius[2]; }; struct rxHeapBlockHeader { rxHeapBlockHeader* prev; rxHeapBlockHeader* next; uint32 size; rxHeapFreeBlock* freeEntry; uint32 pad[4]; }; struct xCollis { uint32 flags; uint32 oid; void* optr; xModelInstance* mptr; float32 dist; xVec3 norm; xVec3 tohit; xVec3 depen; xVec3 hdng; union { _class_3 tuv; tri_data_1 tri; }; }; struct zCheckPoint { xVec3 pos; float32 rot; uint32 initCamID; }; struct zPlayerGlobals { zEnt ent; xEntShadow entShadow_embedded; xShadowSimpleCache simpShadow_embedded; zGlobalSettings g; zPlayerSettings* s; zPlayerSettings sb; zPlayerSettings patrick; zPlayerSettings sandy; xModelInstance* model_spongebob; xModelInstance* model_patrick; xModelInstance* model_sandy; uint32 Visible; uint32 Health; int32 Speed; float32 SpeedMult; int32 Sneak; int32 Teeter; float32 SlipFadeTimer; int32 Slide; float32 SlideTimer; int32 Stepping; int32 JumpState; int32 LastJumpState; float32 JumpTimer; float32 LookAroundTimer; uint32 LookAroundRand; uint32 LastProjectile; float32 DecelRun; float32 DecelRunSpeed; float32 HotsauceTimer; float32 LeanLerp; float32 ScareTimer; xBase* ScareSource; float32 CowerTimer; float32 DamageTimer; float32 SundaeTimer; float32 ControlOffTimer; float32 HelmetTimer; uint32 WorldDisguise; uint32 Bounced; float32 FallDeathTimer; float32 HeadbuttVel; float32 HeadbuttTimer; uint32 SpecialReceived; xEnt* MountChimney; float32 MountChimOldY; uint32 MaxHealth; uint32 DoMeleeCheck; float32 VictoryTimer; float32 BadGuyNearTimer; float32 ForceSlipperyTimer; float32 ForceSlipperyFriction; float32 ShockRadius; float32 ShockRadiusOld; float32 Face_ScareTimer; uint32 Face_ScareRandom; uint32 Face_Event; float32 Face_EventTimer; float32 Face_PantTimer; uint32 Face_AnimSpecific; uint32 IdleRand; float32 IdleMinorTimer; float32 IdleMajorTimer; float32 IdleSitTimer; int32 Transparent; zEnt* FireTarget; uint32 ControlOff; uint32 ControlOnEvent; uint32 AutoMoveSpeed; float32 AutoMoveDist; xVec3 AutoMoveTarget; xBase* AutoMoveObject; zEnt* Diggable; float32 DigTimer; zPlayerCarryInfo carry; zPlayerLassoInfo lassoInfo; xModelTag BubbleWandTag[2]; xModelInstance* model_wand; xEntBoulder* bubblebowl; float32 bbowlInitVel; zEntHangable* HangFound; zEntHangable* HangEnt; zEntHangable* HangEntLast; xVec3 HangPivot; xVec3 HangVel; float32 HangLength; xVec3 HangStartPos; float32 HangStartLerp; xModelTag HangPawTag[4]; float32 HangPawOffset; float32 HangElapsed; float32 Jump_CurrGravity; float32 Jump_HoldTimer; float32 Jump_ChangeTimer; int32 Jump_CanDouble; int32 Jump_CanFloat; int32 Jump_SpringboardStart; zPlatform* Jump_Springboard; int32 CanJump; int32 CanBubbleSpin; int32 CanBubbleBounce; int32 CanBubbleBash; int32 IsJumping; int32 IsDJumping; int32 IsBubbleSpinning; int32 IsBubbleBouncing; int32 IsBubbleBashing; int32 IsBubbleBowling; int32 WasDJumping; int32 IsCoptering; _zPlayerWallJumpState WallJumpState; int32 cheat_mode; uint32 Inv_Shiny; uint32 Inv_Spatula; uint32 Inv_PatsSock[15]; uint32 Inv_PatsSock_Max[15]; uint32 Inv_PatsSock_CurrentLevel; uint32 Inv_LevelPickups[15]; uint32 Inv_LevelPickups_CurrentLevel; uint32 Inv_PatsSock_Total; xModelTag BubbleTag; xEntDrive drv; xSurface* floor_surf; xVec3 floor_norm; int32 slope; xCollis earc_coll; xSphere head_sph; xModelTag center_tag; xModelTag head_tag; uint32 TongueFlags[2]; xVec3 RootUp; xVec3 RootUpTarget; zCheckPoint cp; uint32 SlideTrackSliding; uint32 SlideTrackCount; xEnt* SlideTrackEnt[111]; uint32 SlideNotGroundedSinceSlide; xVec3 SlideTrackDir; xVec3 SlideTrackVel; float32 SlideTrackDecay; float32 SlideTrackLean; float32 SlideTrackLand; uint8 sb_model_indices[14]; xModelInstance* sb_models[14]; uint32 currentPlayer; xVec3 PredictRotate; xVec3 PredictTranslate; float32 PredictAngV; xVec3 PredictCurrDir; float32 PredictCurrVel; float32 KnockBackTimer; float32 KnockIntoAirTimer; }; struct xModelPool { xModelPool* Next; uint32 NumMatrices; xModelInstance* List; }; struct RxPipelineRequiresCluster { RxClusterDefinition* clusterDef; RxClusterValidityReq rqdOrOpt; uint32 slotIndex; }; struct _tagEmitRect { float32 x_len; float32 z_len; }; struct xEntMotionMPData { uint32 flags; uint32 mp_id; float32 speed; }; struct xJSPHeader { int8 idtag[4]; uint32 version; uint32 jspNodeCount; RpClump* clump; xClumpCollBSPTree* colltree; xJSPNodeInfo* jspNodeList; }; struct xEntAsset : xBaseAsset { uint8 flags; uint8 subtype; uint8 pflags; uint8 moreFlags; uint8 pad; uint32 surfaceID; xVec3 ang; xVec3 pos; xVec3 scale; float32 redMult; float32 greenMult; float32 blueMult; float32 seeThru; float32 seeThruSpeed; uint32 modelInfoID; uint32 animListID; }; struct xEntERData { xVec3 a; xVec3 b; xVec3 dir; float32 et; float32 wet; float32 rt; float32 wrt; float32 p; float32 brt; float32 ert; int32 state; }; struct xUpdateCullMgr { uint32 entCount; uint32 entActive; void** ent; xUpdateCullEnt** mgr; uint32 mgrCount; uint32 mgrCurr; xUpdateCullEnt* mgrList; uint32 grpCount; xUpdateCullGroup* grpList; void(*activateCB)(void*); void(*deactivateCB)(void*); }; struct zPlayerCarryInfo { xEnt* grabbed; uint32 grabbedModelID; xMat4x3 spin; xEnt* throwTarget; xEnt* flyingToTarget; float32 minDist; float32 maxDist; float32 minHeight; float32 maxHeight; float32 maxCosAngle; float32 throwMinDist; float32 throwMaxDist; float32 throwMinHeight; float32 throwMaxHeight; float32 throwMaxStack; float32 throwMaxCosAngle; float32 throwTargetRotRate; float32 targetRot; uint32 grabTarget; xVec3 grabOffset; float32 grabLerpMin; float32 grabLerpMax; float32 grabLerpLast; uint32 grabYclear; float32 throwGravity; float32 throwHeight; float32 throwDistance; float32 fruitFloorDecayMin; float32 fruitFloorDecayMax; float32 fruitFloorBounce; float32 fruitFloorFriction; float32 fruitCeilingBounce; float32 fruitWallBounce; float32 fruitLifetime; xEnt* patLauncher; }; struct xPortalAsset : xBaseAsset { uint32 assetCameraID; uint32 assetMarkerID; float32 ang; uint32 sceneID; }; enum fx_when_enum { FX_WHEN_LAUNCH, FX_WHEN_IMPACT, FX_WHEN_BIRTH, FX_WHEN_DEATH, FX_WHEN_HEAD, FX_WHEN_TAIL, FX_WHEN_KILL, MAX_FX_WHEN }; struct zPlayerSettings { _zPlayerType pcType; float32 MoveSpeed[6]; float32 AnimSneak[3]; float32 AnimWalk[3]; float32 AnimRun[3]; float32 JumpGravity; float32 GravSmooth; float32 FloatSpeed; float32 ButtsmashSpeed; zJumpParam Jump; zJumpParam Bounce; zJumpParam Spring; zJumpParam Wall; zJumpParam Double; zJumpParam SlideDouble; zJumpParam SlideJump; float32 WallJumpVelocity; zLedgeGrabParams ledge; float32 spin_damp_xz; float32 spin_damp_y; uint8 talk_anims; uint8 talk_filter_size; uint8 talk_filter[4]; }; struct xScene { uint32 sceneID; uint16 flags; uint16 num_ents; uint16 num_trigs; uint16 num_stats; uint16 num_dyns; uint16 num_npcs; uint16 num_act_ents; uint16 num_nact_ents; float32 gravity; float32 drag; float32 friction; uint16 num_ents_allocd; uint16 num_trigs_allocd; uint16 num_stats_allocd; uint16 num_dyns_allocd; uint16 num_npcs_allocd; xEnt** trigs; xEnt** stats; xEnt** dyns; xEnt** npcs; xEnt** act_ents; xEnt** nact_ents; xEnv* env; xMemPool mempool; xBase*(*resolvID)(uint32); int8*(*base2Name)(xBase*); int8*(*id2Name)(uint32); }; struct xCamera : xBase { RwCamera* lo_cam; xMat4x3 mat; xMat4x3 omat; xMat3x3 mbasis; xBound bound; xMat4x3* tgt_mat; xMat4x3* tgt_omat; xBound* tgt_bound; xVec3 focus; xScene* sc; xVec3 tran_accum; float32 fov; uint32 flags; float32 tmr; float32 tm_acc; float32 tm_dec; float32 ltmr; float32 ltm_acc; float32 ltm_dec; float32 dmin; float32 dmax; float32 dcur; float32 dgoal; float32 hmin; float32 hmax; float32 hcur; float32 hgoal; float32 pmin; float32 pmax; float32 pcur; float32 pgoal; float32 depv; float32 hepv; float32 pepv; float32 orn_epv; float32 yaw_epv; float32 pitch_epv; float32 roll_epv; xQuat orn_cur; xQuat orn_goal; xQuat orn_diff; float32 yaw_cur; float32 yaw_goal; float32 pitch_cur; float32 pitch_goal; float32 roll_cur; float32 roll_goal; float32 dct; float32 dcd; float32 dccv; float32 dcsv; float32 hct; float32 hcd; float32 hccv; float32 hcsv; float32 pct; float32 pcd; float32 pccv; float32 pcsv; float32 orn_ct; float32 orn_cd; float32 orn_ccv; float32 orn_csv; float32 yaw_ct; float32 yaw_cd; float32 yaw_ccv; float32 yaw_csv; float32 pitch_ct; float32 pitch_cd; float32 pitch_ccv; float32 pitch_csv; float32 roll_ct; float32 roll_cd; float32 roll_ccv; float32 roll_csv; xVec4 frustplane[12]; }; struct xAnimFile { xAnimFile* Next; int8* Name; uint32 ID; uint32 FileFlags; float32 Duration; float32 TimeOffset; uint16 BoneCount; uint8 NumAnims[2]; void** RawData; }; struct _zEnv : xBase { xEnvAsset* easset; }; struct RpClump { RwObject object; RwLinkList atomicList; RwLinkList lightList; RwLinkList cameraList; RwLLLink inWorldLink; RpClump*(*callback)(RpClump*, void*); }; struct xVec4 { float32 x; float32 y; float32 z; float32 w; }; struct xSurface : xBase { uint32 idx; uint32 type; union { uint32 mat_idx; xEnt* ent; void* obj; }; float32 friction; uint8 state; uint8 pad[3]; void* moprops; }; struct xQCData { int8 xmin; int8 ymin; int8 zmin; int8 zmin_dup; int8 xmax; int8 ymax; int8 zmax; int8 zmax_dup; xVec3 min; xVec3 max; }; struct xCoef { float32 a[4]; }; struct RwSurfaceProperties { float32 ambient; float32 specular; float32 diffuse; }; struct xClumpCollBSPTree { uint32 numBranchNodes; xClumpCollBSPBranchNode* branchNodes; uint32 numTriangles; xClumpCollBSPTriangle* triangles; }; struct RwCamera { RwObjectHasFrame object; RwCameraProjection projectionType; RwCamera*(*beginUpdate)(RwCamera*); RwCamera*(*endUpdate)(RwCamera*); RwMatrixTag viewMatrix; RwRaster* frameBuffer; RwRaster* zBuffer; RwV2d viewWindow; RwV2d recipViewWindow; RwV2d viewOffset; float32 nearPlane; float32 farPlane; float32 fogPlane; float32 zScale; float32 zShift; RwFrustumPlane frustumPlanes[6]; RwBBox frustumBoundBox; RwV3d frustumCorners[8]; }; struct RwMatrixTag { RwV3d right; uint32 flags; RwV3d up; uint32 pad1; RwV3d at; uint32 pad2; RwV3d pos; uint32 pad3; }; struct xAnimTransition { xAnimTransition* Next; xAnimState* Dest; uint32(*Conditional)(xAnimTransition*, xAnimSingle*, void*); uint32(*Callback)(xAnimTransition*, xAnimSingle*, void*); uint32 Flags; uint32 UserFlags; float32 SrcTime; float32 DestTime; uint16 Priority; uint16 QueuePriority; float32 BlendRecip; uint16* BlendOffset; }; struct xAnimTransitionList { xAnimTransitionList* Next; xAnimTransition* T; }; struct xUpdateCullEnt { uint16 index; int16 groupIndex; uint32(*cb)(void*, void*); void* cbdata; xUpdateCullEnt* nextInGroup; }; struct rxReq { }; struct xPEEntBound { uint8 flags; uint8 type; uint8 pad1; uint8 pad2; float32 expand; float32 deflection; }; struct xEnvAsset : xBaseAsset { uint32 bspAssetID; uint32 startCameraAssetID; uint32 climateFlags; float32 climateStrengthMin; float32 climateStrengthMax; uint32 bspLightKit; uint32 objectLightKit; float32 padF1; uint32 bspCollisionAssetID; uint32 bspFXAssetID; uint32 bspCameraAssetID; uint32 bspMapperID; uint32 bspMapperCollisionID; uint32 bspMapperFXID; float32 loldHeight; }; struct xLinkAsset { uint16 srcEvent; uint16 dstEvent; uint32 dstAssetID; float32 param[4]; uint32 paramWidgetAssetID; uint32 chkAssetID; }; struct xModelTag { xVec3 v; uint32 matidx; float32 wt[4]; }; struct zLasso { uint32 flags; float32 secsTotal; float32 secsLeft; float32 stRadius; float32 tgRadius; float32 crRadius; xVec3 stCenter; xVec3 tgCenter; xVec3 crCenter; xVec3 stNormal; xVec3 tgNormal; xVec3 crNormal; xVec3 honda; float32 stSlack; float32 stSlackDist; float32 tgSlack; float32 tgSlackDist; float32 crSlack; float32 currDist; float32 lastDist; xVec3 lastRefs[5]; uint8 reindex[5]; xVec3 anchor; xModelTag tag; xModelInstance* model; }; struct xEntMotionMechData { uint8 type; uint8 flags; uint8 sld_axis; uint8 rot_axis; float32 sld_dist; float32 sld_tm; float32 sld_acc_tm; float32 sld_dec_tm; float32 rot_dist; float32 rot_tm; float32 rot_acc_tm; float32 rot_dec_tm; float32 ret_delay; float32 post_ret_delay; }; struct _tagEmitLine { xVec3 pos1; xVec3 pos2; float32 radius; }; enum RxClusterValidityReq { rxCLREQ_DONTWANT, rxCLREQ_REQUIRED, rxCLREQ_OPTIONAL, rxCLUSTERVALIDITYREQFORCEENUMSIZEINT = 0x7fffffff }; enum RpWorldRenderOrder { rpWORLDRENDERNARENDERORDER, rpWORLDRENDERFRONT2BACK, rpWORLDRENDERBACK2FRONT, rpWORLDRENDERORDERFORCEENUMSIZEINT = 0x7fffffff }; struct xRay3 { xVec3 origin; xVec3 dir; float32 min_t; float32 max_t; int32 flags; }; struct xEntPenData { xVec3 top; float32 w; xMat4x3 omat; }; struct _tagxRumble { _tagRumbleType type; float32 seconds; _tagxRumble* next; int16 active; uint16 fxflags; }; struct iFogParams { RwFogType type; float32 start; float32 stop; float32 density; RwRGBA fogcolor; RwRGBA bgcolor; uint8* table; }; struct xCoef3 { xCoef x; xCoef y; xCoef z; }; struct xEntDrive { uint32 flags; float32 otm; float32 otmr; float32 os; float32 tm; float32 tmr; float32 s; xEnt* odriver; xEnt* driver; xEnt* driven; xVec3 op; xVec3 p; xVec3 q; float32 yaw; xVec3 dloc; tri_data_0 tri; }; enum RxNodeDefEditable { rxNODEDEFCONST, rxNODEDEFEDITABLE, rxNODEDEFEDITABLEFORCEENUMSIZEINT = 0x7fffffff }; struct xBound { xQCData qcd; uint8 type; uint8 pad[3]; union { xSphere sph; xBBox box; xCylinder cyl; }; xMat4x3* mat; }; struct RpMaterial { RwTexture* texture; RwRGBA color; RxPipeline* pipeline; RwSurfaceProperties surfaceProps; int16 refCount; int16 pad; }; struct RpSector { int32 type; }; struct xModelBucket { RpAtomic* Data; RpAtomic* OriginalData; xModelInstance* List; int32 ClipFlags; uint32 PipeFlags; }; enum RxClusterValid { rxCLVALID_NOCHANGE, rxCLVALID_VALID, rxCLVALID_INVALID, rxCLUSTERVALIDFORCEENUMSIZEINT = 0x7fffffff }; enum fx_type_enum { FX_TYPE_PARTICLE, FX_TYPE_DECAL, FX_TYPE_DECAL_DIST, FX_TYPE_CALLBACK }; struct xEntCollis { uint8 chk; uint8 pen; uint8 env_sidx; uint8 env_eidx; uint8 npc_sidx; uint8 npc_eidx; uint8 dyn_sidx; uint8 dyn_eidx; uint8 stat_sidx; uint8 stat_eidx; uint8 idx; xCollis colls[18]; void(*post)(xEnt*, xScene*, float32, xEntCollis*); uint32(*depenq)(xEnt*, xEnt*, xScene*, float32, xCollis*); }; struct xAnimMultiFile : xAnimMultiFileBase { xAnimMultiFileEntry Files[1]; }; struct xRot { xVec3 axis; float32 angle; }; struct xEntOrbitData { xVec3 orig; xVec3 c; float32 a; float32 b; float32 p; float32 w; }; struct xVec2 { float32 x; float32 y; }; struct RpWorld { RwObject object; uint32 flags; RpWorldRenderOrder renderOrder; RpMaterialList matList; RpSector* rootSector; int32 numTexCoordSets; int32 numClumpsInWorld; RwLLLink* currentClumpLink; RwLinkList clumpList; RwLinkList lightList; RwLinkList directionalLightList; RwV3d worldOrigin; RwBBox boundingBox; RpWorldSector*(*renderCallBack)(RpWorldSector*); RxPipeline* pipeline; }; struct RpWorldSector { int32 type; RpPolygon* polygons; RwV3d* vertices; RpVertexNormal* normals; RwTexCoords* texCoords[8]; RwRGBA* preLitLum; RwResEntry* repEntry; RwLinkList collAtomicsInWorldSector; RwLinkList noCollAtomicsInWorldSector; RwLinkList lightsInWorldSector; RwBBox boundingBox; RwBBox tightBoundingBox; RpMeshHeader* mesh; RxPipeline* pipeline; uint16 matListWindowBase; uint16 numVertices; uint16 numPolygons; uint16 pad; }; struct RpMorphTarget { RpGeometry* parentGeom; RwSphere boundingSphere; RwV3d* verts; RwV3d* normals; }; struct xParEmitterAsset : xBaseAsset { uint8 emit_flags; uint8 emit_type; uint16 pad; uint32 propID; union { xPECircle e_circle; _tagEmitSphere e_sphere; _tagEmitRect e_rect; _tagEmitLine e_line; _tagEmitVolume e_volume; _tagEmitOffsetPoint e_offsetp; xPEVCyl e_vcyl; xPEEntBone e_entbone; xPEEntBound e_entbound; }; uint32 attachToID; xVec3 pos; xVec3 vel; float32 vel_angle_variation; uint32 cull_mode; float32 cull_dist_sqr; }; enum rxEmbeddedPacketState { rxPKST_PACKETLESS, rxPKST_UNUSED, rxPKST_INUSE, rxPKST_PENDING, rxEMBEDDEDPACKETSTATEFORCEENUMSIZEINT = 0x7fffffff }; struct zPlatFMRunTime { uint32 flags; float32 tmrs[12]; float32 ttms[12]; float32 atms[12]; float32 dtms[12]; float32 vms[12]; float32 dss[12]; }; struct xSphere { xVec3 center; float32 r; }; struct _tagEmitVolume { uint32 emit_volumeID; }; struct _zPortal : xBase { xPortalAsset* passet; }; struct RpLight { RwObjectHasFrame object; float32 radius; RwRGBAReal color; float32 minusCosAngle; RwLinkList WorldSectorsInLight; RwLLLink inWorld; uint16 lightFrame; uint16 pad; }; struct xEntMotion { xEntMotionAsset* asset; uint8 type; uint8 pad; uint16 flags; float32 t; float32 tmr; float32 d; union { xEntERData er; xEntOrbitData orb; xEntSplineData spl; xEntMPData mp; xEntMechData mech; xEntPenData pen; }; xEnt* owner; xEnt* target; }; struct unit_data { uint8 flags; uint8 curve_index; uint8 u; uint8 v; float32 frac; float32 age; float32 cull_size; xMat4x3 mat; }; struct xParGroup { }; struct xEntFrame { xMat4x3 mat; xMat4x3 oldmat; xVec3 oldvel; xRot oldrot; xRot drot; xRot rot; xVec3 dpos; xVec3 dvel; xVec3 vel; uint32 mode; }; struct xFFX { }; enum RwCameraProjection { rwNACAMERAPROJECTION, rwPERSPECTIVE, rwPARALLEL, rwCAMERAPROJECTIONFORCEENUMSIZEINT = 0x7fffffff }; struct xPlatformAsset { }; enum _tagPadState { ePad_Disabled, ePad_DisabledError, ePad_Enabled, ePad_Missing, ePad_Total }; enum RxClusterForcePresent { rxCLALLOWABSENT, rxCLFORCEPRESENT, rxCLUSTERFORCEPRESENTFORCEENUMSIZEINT = 0x7fffffff }; struct xParEmitterPropsAsset : xBaseAsset { uint32 parSysID; union { xParInterp rate; xParInterp value[1]; }; xParInterp life; xParInterp size_birth; xParInterp size_death; xParInterp color_birth[4]; xParInterp color_death[4]; xParInterp vel_scale; xParInterp vel_angle; xVec3 vel; uint32 emit_limit; float32 emit_limit_reset_time; }; struct xEntMotionAsset { uint8 type; uint8 use_banking; uint16 flags; union { xEntMotionERData er; xEntMotionOrbitData orb; xEntMotionSplineData spl; xEntMotionMPData mp; xEntMotionMechData mech; xEntMotionPenData pen; }; }; struct xCylinder { xVec3 center; float32 r; float32 h; }; enum fx_orient_enum { FX_ORIENT_DEFAULT, FX_ORIENT_PATH, FX_ORIENT_IPATH, FX_ORIENT_HIT_NORM, FX_ORIENT_HIT_REFLECT, MAX_FX_ORIENT, FORCE_INT_FX_ORIENT = 0xffffffff }; struct RxColorUnion { union { RwRGBA preLitColor; RwRGBA color; }; }; struct xGlobals { xCamera camera; _tagxPad* pad0; _tagxPad* pad1; _tagxPad* pad2; _tagxPad* pad3; int32 profile; int8 profFunc[128][6]; xUpdateCullMgr* updateMgr; int32 sceneFirst; int8 sceneStart[32]; RpWorld* currWorld; iFogParams fog; iFogParams fogA; iFogParams fogB; long32 fog_t0; long32 fog_t1; int32 option_vibration; uint32 QuarterSpeed; float32 update_dt; int32 useHIPHOP; uint8 NoMusic; int8 currentActivePad; uint8 firstStartPressed; uint32 minVSyncCnt; uint8 dontShowPadMessageDuringLoadingOrCutScene; uint8 autoSaveFeature; }; struct RwFrame { RwObject object; RwLLLink inDirtyListLink; RwMatrixTag modelling; RwMatrixTag ltm; RwLinkList objectList; RwFrame* child; RwFrame* next; RwFrame* root; }; struct xBox { xVec3 upper; xVec3 lower; }; struct RxClusterDefinition { int8* name; uint32 defaultStride; uint32 defaultAttributes; int8* attributeSet; }; struct xShadowSimplePoly { xVec3 vert[3]; xVec3 norm; }; struct _tagxPad { uint8 value[22]; uint8 last_value[22]; uint32 on; uint32 pressed; uint32 released; _tagPadAnalog analog1; _tagPadAnalog analog2; _tagPadState state; uint32 flags; _tagxRumble rumble_head; int16 port; int16 slot; _tagiPad context; float32 al2d_timer; float32 ar2d_timer; float32 d_timer; float32 up_tmr[22]; float32 down_tmr[22]; analog_data analog[2]; }; struct xEntSplineData { int32 unknown; }; struct _tagEmitOffsetPoint { xVec3 offset; }; struct RwSphere { RwV3d center; float32 radius; }; struct xParEmitter : xBase { xParEmitterAsset* tasset; xParGroup* group; xParEmitterPropsAsset* prop; uint8 rate_mode; float32 rate; float32 rate_time; float32 rate_fraction; float32 rate_fraction_cull; uint8 emit_flags; uint8 emit_pad[3]; uint8 rot[3]; xModelTag tag; float32 oocull_distance_sqr; float32 distance_to_cull_sqr; void* attachTo; xParSys* parSys; void* emit_volume; xVec3 last_attach_loc; }; struct RwLLLink { RwLLLink* next; RwLLLink* prev; }; struct tri_data_0 : tri_data_1 { xVec3 loc; float32 yaw; xCollis* coll; }; struct xGroupAsset : xBaseAsset { uint16 itemCount; uint16 groupFlags; }; struct _tagPadAnalog { int8 x; int8 y; }; struct RwTexDictionary { RwObject object; RwLinkList texturesInDict; RwLLLink lInInstance; }; struct xEntMotionPenData { uint8 flags; uint8 plane; uint8 pad[2]; float32 len; float32 range; float32 period; float32 phase; }; struct RxOutputSpec { int8* name; RxClusterValid* outputClusters; RxClusterValid allOtherClusters; }; struct xDecalEmitter { config_1 cfg; _class_0 texture; static_queue_1 units; curve_node* curve; uint32 curve_size; uint32 curve_index; float32 ilife; }; struct _tagiPad { int32 port; }; struct xLightKitLight { uint32 type; RwRGBAReal color; float32 matrix[16]; float32 radius; float32 angle; RpLight* platLight; }; struct tri_data_1 { uint32 index; float32 r; float32 d; }; struct xMat3x3 { xVec3 right; int32 flags; xVec3 up; uint32 pad1; xVec3 at; uint32 pad2; }; struct xAnimMultiFileEntry { uint32 ID; xAnimFile* File; }; struct xAnimActiveEffect { xAnimEffect* Effect; uint32 Handle; }; struct _class_1 { xVec3* verts; }; struct xShadowSimpleCache { uint16 flags; uint8 alpha; uint8 pad; uint32 collPriority; xVec3 pos; xVec3 at; xEnt* castOnEnt; xShadowSimplePoly poly; float32 envHeight; float32 shadowHeight; uint32 raster; float32 dydx; float32 dydz; xVec3 corner[4]; }; struct RxClusterRef { RxClusterDefinition* clusterDef; RxClusterForcePresent forcePresent; uint32 reserved; }; struct xEntMPData { float32 curdist; float32 speed; xMovePoint* dest; xMovePoint* src; xSpline3* spl; float32 dist; uint32 padalign; xQuat aquat; xQuat bquat; }; struct xParSys { }; struct RwObject { uint8 type; uint8 subType; uint8 flags; uint8 privateFlags; void* parent; }; struct xPEVCyl { float32 height; float32 radius; float32 deflection; }; struct config_0 { float32 radius; float32 length; float32 vel; float32 fade_dist; float32 kill_dist; float32 safe_dist; float32 hit_radius; float32 rand_ang; float32 scar_life; xVec2 bolt_uv[2]; int32 hit_interval; float32 damage; }; struct RxIoSpec { uint32 numClustersOfInterest; RxClusterRef* clustersOfInterest; RxClusterValidityReq* inputRequirements; uint32 numOutputs; RxOutputSpec* outputs; }; enum texture_mode { TM_DEFAULT, TM_RANDOM, TM_CYCLE, MAX_TM, FORCE_INT_TM = 0xffffffff }; struct RpInterpolator { int32 flags; int16 startMorphTarget; int16 endMorphTarget; float32 time; float32 recipTime; float32 position; }; struct xParInterp { float32 val[2]; uint32 interp; float32 freq; float32 oofreq; }; struct xClumpCollBSPVertInfo { uint16 atomIndex; uint16 meshVertIndex; }; struct RxNodeMethods { int32(*nodeBody)(RxPipelineNode*, RxPipelineNodeParam*); int32(*nodeInit)(RxNodeDefinition*); void(*nodeTerm)(RxNodeDefinition*); int32(*pipelineNodeInit)(RxPipelineNode*); void(*pipelineNodeTerm)(RxPipelineNode*); int32(*pipelineNodeConfig)(RxPipelineNode*, RxPipeline*); uint32(*configMsgHandler)(RxPipelineNode*, uint32, uint32, void*); }; struct xEntMotionERData { xVec3 ret_pos; xVec3 ext_dpos; float32 ext_tm; float32 ext_wait_tm; float32 ret_tm; float32 ret_wait_tm; }; struct _class_2 { union { xParEmitter* par; xDecalEmitter* decal; _class_4 callback; }; }; struct xClumpCollBSPTriangle { _class_6 v; uint8 flags; uint8 platData; uint16 matIndex; }; struct xAnimMultiFileBase { uint32 Count; }; struct _class_3 { float32 t; float32 u; float32 v; }; struct RwFrustumPlane { RwPlane plane; uint8 closestX; uint8 closestY; uint8 closestZ; uint8 pad; }; struct xBaseAsset { uint32 id; uint8 baseType; uint8 linkCount; uint16 baseFlags; }; struct xPEEntBone { uint8 flags; uint8 type; uint8 bone; uint8 pad1; xVec3 offset; float32 radius; float32 deflection; }; struct RwPlane { RwV3d normal; float32 distance; }; struct config_1 { uint32 flags; float32 life_time; uint32 blend_src; uint32 blend_dst; _class_5 texture; }; struct zGlobals : xGlobals { zPlayerGlobals player; zAssetPickupTable* pickupTable; zCutsceneMgr* cmgr; zScene* sceneCur; zScene* scenePreload; }; struct _class_4 { void(*fp)(bolt&, void*); void* context; }; struct RxCluster { uint16 flags; uint16 stride; void* data; void* currentData; uint32 numAlloced; uint32 numUsed; RxPipelineCluster* clusterRef; uint32 attributes; }; struct zGlobalSettings { uint16 AnalogMin; uint16 AnalogMax; float32 SundaeTime; float32 SundaeMult; uint32 InitialShinyCount; uint32 InitialSpatulaCount; int32 ShinyValuePurple; int32 ShinyValueBlue; int32 ShinyValueGreen; int32 ShinyValueYellow; int32 ShinyValueRed; int32 ShinyValueCombo0; int32 ShinyValueCombo1; int32 ShinyValueCombo2; int32 ShinyValueCombo3; int32 ShinyValueCombo4; int32 ShinyValueCombo5; int32 ShinyValueCombo6; int32 ShinyValueCombo7; int32 ShinyValueCombo8; int32 ShinyValueCombo9; int32 ShinyValueCombo10; int32 ShinyValueCombo11; int32 ShinyValueCombo12; int32 ShinyValueCombo13; int32 ShinyValueCombo14; int32 ShinyValueCombo15; float32 ComboTimer; uint32 Initial_Specials; uint32 TakeDamage; float32 DamageTimeHit; float32 DamageTimeSurface; float32 DamageTimeEGen; float32 DamageSurfKnock; float32 DamageGiveHealthKnock; uint32 CheatSpongeball; uint32 CheatPlayerSwitch; uint32 CheatAlwaysPortal; uint32 CheatFlyToggle; uint32 DisableForceConversation; float32 StartSlideAngle; float32 StopSlideAngle; float32 RotMatchMaxAngle; float32 RotMatchMatchTime; float32 RotMatchRelaxTime; float32 Gravity; float32 BBashTime; float32 BBashHeight; float32 BBashDelay; float32 BBashCVTime; float32 BBounceSpeed; float32 BSpinMinFrame; float32 BSpinMaxFrame; float32 BSpinRadius; float32 SandyMeleeMinFrame; float32 SandyMeleeMaxFrame; float32 SandyMeleeRadius; float32 BubbleBowlTimeDelay; float32 BubbleBowlLaunchPosLeft; float32 BubbleBowlLaunchPosUp; float32 BubbleBowlLaunchPosAt; float32 BubbleBowlLaunchVelLeft; float32 BubbleBowlLaunchVelUp; float32 BubbleBowlLaunchVelAt; float32 BubbleBowlPercentIncrease; float32 BubbleBowlMinSpeed; float32 BubbleBowlMinRecoverTime; float32 SlideAccelVelMin; float32 SlideAccelVelMax; float32 SlideAccelStart; float32 SlideAccelEnd; float32 SlideAccelPlayerFwd; float32 SlideAccelPlayerBack; float32 SlideAccelPlayerSide; float32 SlideVelMaxStart; float32 SlideVelMaxEnd; float32 SlideVelMaxIncTime; float32 SlideVelMaxIncAccel; float32 SlideAirHoldTime; float32 SlideAirSlowTime; float32 SlideAirDblHoldTime; float32 SlideAirDblSlowTime; float32 SlideVelDblBoost; uint8 SlideApplyPhysics; uint8 PowerUp[2]; uint8 InitialPowerUp[2]; }; struct RpMaterialList { RpMaterial** materials; int32 numMaterials; int32 space; }; struct RxPacket { uint16 flags; uint16 numClusters; RxPipeline* pipeline; uint32* inputToClusterSlot; uint32* slotsContinue; RxPipelineCluster** slotClusterRefs; RxCluster clusters[1]; }; struct zPlayerLassoInfo { xEnt* target; float32 dist; uint8 destroy; uint8 targetGuide; float32 lassoRot; xEnt* swingTarget; xEnt* releasedSwing; float32 copterTime; int32 canCopter; zLasso lasso; xAnimState* zeroAnim; }; struct zScene : xScene { _zPortal* pendingPortal; union { uint32 num_ents; uint32 num_base; }; union { xBase** base; zEnt** ents; }; uint32 num_update_base; xBase** update_base; uint32 baseCount[72]; xBase* baseList[72]; _zEnv* zen; }; struct _class_5 { xVec2 uv[2]; uint8 rows; uint8 cols; texture_mode mode; }; struct xBBox { xVec3 center; xBox box; }; struct anim_coll_data { }; enum RwFogType { rwFOGTYPENAFOGTYPE, rwFOGTYPELINEAR, rwFOGTYPEEXPONENTIAL, rwFOGTYPEEXPONENTIAL2, rwFOGTYPEFORCEENUMSIZEINT = 0x7fffffff }; struct iColor_tag { uint8 r; uint8 g; uint8 b; uint8 a; }; struct _class_6 { union { xClumpCollBSPVertInfo i; RwV3d* p; }; }; struct zLedgeGrabParams { float32 animGrab; float32 zdist; xVec3 tranTable[60]; int32 tranCount; xEnt* optr; xMat4x3 omat; float32 y0det; float32 dydet; float32 r0det; float32 drdet; float32 thdet; float32 rtime; float32 ttime; float32 tmr; xVec3 spos; xVec3 epos; xVec3 tpos; int32 nrays; int32 rrand; float32 startrot; float32 endrot; }; struct RwRGBAReal { float32 red; float32 green; float32 blue; float32 alpha; }; struct xPECircle { float32 radius; float32 deflection; xVec3 dir; }; struct zJumpParam { float32 PeakHeight; float32 TimeGravChange; float32 TimeHold; float32 ImpulseVel; }; struct xEntMotionOrbitData { xVec3 center; float32 w; float32 h; float32 period; }; struct RwLinkList { RwLLLink link; }; int8 buffer[16]; int8 buffer[16]; xMat4x3 g_I3; tagiRenderInput gRenderBuffer; zGlobals globals; uint32 gActiveHeap; void emit_decal_dist(effect_data& effect, bolt& b, float32 from_dist, float32 to_dist); void emit_decal(effect_data& effect, bolt& b, float32 to_dist); void emit_particle(effect_data& effect, bolt& b, float32 from_dist, float32 to_dist, float32 dt); void update_fx(bolt& b, float32 prev_dist, float32 dt); RxObjSpace3DVertex* render(bolt& b, RxObjSpace3DVertex* vert); void collide_update(bolt& b); void attach_effects(fx_when_enum when, effect_data* fx, uint32 fxsize); void render(); void update(float32 dt); void emit(xVec3& loc, xVec3& dir); void refresh_config(); void reset(); void set_texture(int8* name); void init(uint32 max_bolts); // emit_decal_dist__17xLaserBoltEmitterFRQ217xLaserBoltEmitter11effect_dataRQ217xLaserBoltEmitter4boltfff // Start address: 0x3b08d0 void emit_decal_dist(effect_data& effect, bolt& b, float32 from_dist, float32 to_dist) { float32 start_dist; int32 total; xMat4x3 mat; xVec3 dloc; int32 i; // Line 403, Address: 0x3b08d0, Func Offset: 0 // Line 408, Address: 0x3b08d4, Func Offset: 0x4 // Line 403, Address: 0x3b08d8, Func Offset: 0x8 // Line 409, Address: 0x3b08dc, Func Offset: 0xc // Line 403, Address: 0x3b08e0, Func Offset: 0x10 // Line 408, Address: 0x3b08f8, Func Offset: 0x28 // Line 403, Address: 0x3b08fc, Func Offset: 0x2c // Line 409, Address: 0x3b0914, Func Offset: 0x44 // Line 408, Address: 0x3b0918, Func Offset: 0x48 // Line 409, Address: 0x3b0920, Func Offset: 0x50 // Line 410, Address: 0x3b0928, Func Offset: 0x58 // Line 408, Address: 0x3b092c, Func Offset: 0x5c // Line 410, Address: 0x3b0930, Func Offset: 0x60 // Line 408, Address: 0x3b0934, Func Offset: 0x64 // Line 411, Address: 0x3b0938, Func Offset: 0x68 // Line 409, Address: 0x3b0940, Func Offset: 0x70 // Line 408, Address: 0x3b0944, Func Offset: 0x74 // Line 412, Address: 0x3b0948, Func Offset: 0x78 // Line 415, Address: 0x3b0950, Func Offset: 0x80 // Line 419, Address: 0x3b098c, Func Offset: 0xbc // Line 420, Address: 0x3b0990, Func Offset: 0xc0 // Line 421, Address: 0x3b0aec, Func Offset: 0x21c // Line 422, Address: 0x3b0af4, Func Offset: 0x224 // Line 423, Address: 0x3b0af8, Func Offset: 0x228 // Line 429, Address: 0x3b0c54, Func Offset: 0x384 // Line 431, Address: 0x3b0c58, Func Offset: 0x388 // Line 432, Address: 0x3b0c70, Func Offset: 0x3a0 // Line 431, Address: 0x3b0c74, Func Offset: 0x3a4 // Line 432, Address: 0x3b0c78, Func Offset: 0x3a8 // Line 433, Address: 0x3b0c90, Func Offset: 0x3c0 // Line 431, Address: 0x3b0c98, Func Offset: 0x3c8 // Line 432, Address: 0x3b0ce8, Func Offset: 0x418 // Line 433, Address: 0x3b0d98, Func Offset: 0x4c8 // Line 435, Address: 0x3b0dac, Func Offset: 0x4dc // Line 436, Address: 0x3b0dc0, Func Offset: 0x4f0 // Line 437, Address: 0x3b0dc8, Func Offset: 0x4f8 // Line 438, Address: 0x3b0e00, Func Offset: 0x530 // Func End, Address: 0x3b0e34, Func Offset: 0x564 } // emit_decal__17xLaserBoltEmitterFRQ217xLaserBoltEmitter11effect_dataRQ217xLaserBoltEmitter4boltfff // Start address: 0x3b0e40 void emit_decal(effect_data& effect, bolt& b, float32 to_dist) { xMat4x3 mat; // Line 378, Address: 0x3b0e40, Func Offset: 0 // Line 382, Address: 0x3b0e44, Func Offset: 0x4 // Line 378, Address: 0x3b0e48, Func Offset: 0x8 // Line 382, Address: 0x3b0e74, Func Offset: 0x34 // Line 387, Address: 0x3b0eb0, Func Offset: 0x70 // Line 388, Address: 0x3b100c, Func Offset: 0x1cc // Line 389, Address: 0x3b1014, Func Offset: 0x1d4 // Line 390, Address: 0x3b1018, Func Offset: 0x1d8 // Line 396, Address: 0x3b1174, Func Offset: 0x334 // Line 397, Address: 0x3b1178, Func Offset: 0x338 // Line 398, Address: 0x3b1194, Func Offset: 0x354 // Line 397, Address: 0x3b1198, Func Offset: 0x358 // Line 398, Address: 0x3b1248, Func Offset: 0x408 // Line 399, Address: 0x3b1254, Func Offset: 0x414 // Func End, Address: 0x3b1280, Func Offset: 0x440 } // emit_particle__17xLaserBoltEmitterFRQ217xLaserBoltEmitter11effect_dataRQ217xLaserBoltEmitter4boltfff // Start address: 0x3b1280 void emit_particle(effect_data& effect, bolt& b, float32 from_dist, float32 to_dist, float32 dt) { xParEmitter& pe; xParEmitterAsset& pea; float32 velmag; xVec3 oldloc; // Line 327, Address: 0x3b1280, Func Offset: 0 // Line 336, Address: 0x3b1284, Func Offset: 0x4 // Line 327, Address: 0x3b1288, Func Offset: 0x8 // Line 330, Address: 0x3b1294, Func Offset: 0x14 // Line 336, Address: 0x3b1298, Func Offset: 0x18 // Line 331, Address: 0x3b129c, Func Offset: 0x1c // Line 336, Address: 0x3b12a0, Func Offset: 0x20 // Line 339, Address: 0x3b12d0, Func Offset: 0x50 // Line 340, Address: 0x3b1338, Func Offset: 0xb8 // Line 342, Address: 0x3b1340, Func Offset: 0xc0 // Line 343, Address: 0x3b13ac, Func Offset: 0x12c // Line 344, Address: 0x3b13b4, Func Offset: 0x134 // Line 346, Address: 0x3b13b8, Func Offset: 0x138 // Line 355, Address: 0x3b1424, Func Offset: 0x1a4 // Line 358, Address: 0x3b1428, Func Offset: 0x1a8 // Line 360, Address: 0x3b1438, Func Offset: 0x1b8 // Line 361, Address: 0x3b1454, Func Offset: 0x1d4 // Line 360, Address: 0x3b1464, Func Offset: 0x1e4 // Line 362, Address: 0x3b149c, Func Offset: 0x21c // Line 360, Address: 0x3b14a0, Func Offset: 0x220 // Line 361, Address: 0x3b1518, Func Offset: 0x298 // Line 362, Address: 0x3b155c, Func Offset: 0x2dc // Line 361, Address: 0x3b1560, Func Offset: 0x2e0 // Line 362, Address: 0x3b15d4, Func Offset: 0x354 // Line 363, Address: 0x3b15dc, Func Offset: 0x35c // Line 366, Address: 0x3b15e8, Func Offset: 0x368 // Line 367, Address: 0x3b15f0, Func Offset: 0x370 // Line 366, Address: 0x3b15f4, Func Offset: 0x374 // Line 367, Address: 0x3b15f8, Func Offset: 0x378 // Line 366, Address: 0x3b15fc, Func Offset: 0x37c // Line 367, Address: 0x3b1600, Func Offset: 0x380 // Line 368, Address: 0x3b1608, Func Offset: 0x388 // Line 366, Address: 0x3b160c, Func Offset: 0x38c // Line 367, Address: 0x3b1618, Func Offset: 0x398 // Line 368, Address: 0x3b165c, Func Offset: 0x3dc // Line 367, Address: 0x3b1660, Func Offset: 0x3e0 // Line 368, Address: 0x3b16ec, Func Offset: 0x46c // Line 369, Address: 0x3b16f4, Func Offset: 0x474 // Line 370, Address: 0x3b170c, Func Offset: 0x48c // Line 373, Address: 0x3b1710, Func Offset: 0x490 // Line 374, Address: 0x3b1714, Func Offset: 0x494 // Func End, Address: 0x3b1728, Func Offset: 0x4a8 } // update_fx__17xLaserBoltEmitterFRQ217xLaserBoltEmitter4boltff // Start address: 0x3b1730 void xLaserBoltEmitter::update_fx(bolt& b, float32 prev_dist, float32 dt) { float32 tail_dist; effect_data* itfx; effect_data* endfx; effect_data* itfx; effect_data* endfx; float32 from_dist; float32 to_dist; effect_data* itfx; effect_data* endfx; effect_data* itfx; effect_data* endfx; // Line 297, Address: 0x3b1730, Func Offset: 0 // Line 300, Address: 0x3b1770, Func Offset: 0x40 // Line 302, Address: 0x3b177c, Func Offset: 0x4c // Line 303, Address: 0x3b1794, Func Offset: 0x64 // Line 304, Address: 0x3b186c, Func Offset: 0x13c // Line 305, Address: 0x3b1878, Func Offset: 0x148 // Line 307, Address: 0x3b1888, Func Offset: 0x158 // Line 308, Address: 0x3b188c, Func Offset: 0x15c // Line 307, Address: 0x3b1890, Func Offset: 0x160 // Line 309, Address: 0x3b1894, Func Offset: 0x164 // Line 307, Address: 0x3b1898, Func Offset: 0x168 // Line 309, Address: 0x3b18a4, Func Offset: 0x174 // Line 310, Address: 0x3b18b0, Func Offset: 0x180 // Line 313, Address: 0x3b198c, Func Offset: 0x25c // Line 315, Address: 0x3b199c, Func Offset: 0x26c // Line 316, Address: 0x3b19b4, Func Offset: 0x284 // Line 317, Address: 0x3b1a74, Func Offset: 0x344 // Line 318, Address: 0x3b1a80, Func Offset: 0x350 // Line 320, Address: 0x3b1a8c, Func Offset: 0x35c // Line 321, Address: 0x3b1aa4, Func Offset: 0x374 // Line 322, Address: 0x3b1b64, Func Offset: 0x434 // Line 323, Address: 0x3b1b68, Func Offset: 0x438 // Func End, Address: 0x3b1b94, Func Offset: 0x464 } // render__17xLaserBoltEmitterFRQ217xLaserBoltEmitter4boltP18RxObjSpace3DVertex // Start address: 0x3b1ba0 RxObjSpace3DVertex* xLaserBoltEmitter::render(bolt& b, RxObjSpace3DVertex* vert) { float32 dist0; xVec3 loc0; xVec3 loc1; xMat4x3& cam_mat; xVec3 dir; xVec3 right; xVec3 half_right; // Line 242, Address: 0x3b1ba0, Func Offset: 0 // Line 245, Address: 0x3b1ba8, Func Offset: 0x8 // Line 242, Address: 0x3b1bac, Func Offset: 0xc // Line 244, Address: 0x3b1bcc, Func Offset: 0x2c // Line 245, Address: 0x3b1bd8, Func Offset: 0x38 // Line 246, Address: 0x3b1bf0, Func Offset: 0x50 // Line 247, Address: 0x3b1c08, Func Offset: 0x68 // Line 253, Address: 0x3b1c20, Func Offset: 0x80 // Line 250, Address: 0x3b1c24, Func Offset: 0x84 // Line 252, Address: 0x3b1c28, Func Offset: 0x88 // Line 250, Address: 0x3b1c2c, Func Offset: 0x8c // Line 253, Address: 0x3b1c3c, Func Offset: 0x9c // Line 250, Address: 0x3b1c40, Func Offset: 0xa0 // Line 251, Address: 0x3b1c48, Func Offset: 0xa8 // Line 253, Address: 0x3b1c58, Func Offset: 0xb8 // Line 250, Address: 0x3b1c64, Func Offset: 0xc4 // Line 254, Address: 0x3b1c68, Func Offset: 0xc8 // Line 250, Address: 0x3b1c6c, Func Offset: 0xcc // Line 252, Address: 0x3b1c70, Func Offset: 0xd0 // Line 250, Address: 0x3b1c74, Func Offset: 0xd4 // Line 254, Address: 0x3b1c78, Func Offset: 0xd8 // Line 250, Address: 0x3b1c7c, Func Offset: 0xdc // Line 251, Address: 0x3b1d08, Func Offset: 0x168 // Line 253, Address: 0x3b1dac, Func Offset: 0x20c // Line 254, Address: 0x3b1e50, Func Offset: 0x2b0 // Line 256, Address: 0x3b1e74, Func Offset: 0x2d4 // Line 254, Address: 0x3b1e78, Func Offset: 0x2d8 // Line 256, Address: 0x3b1e7c, Func Offset: 0x2dc // Line 254, Address: 0x3b1e80, Func Offset: 0x2e0 // Line 256, Address: 0x3b1e94, Func Offset: 0x2f4 // Line 254, Address: 0x3b1e98, Func Offset: 0x2f8 // Line 255, Address: 0x3b1ee0, Func Offset: 0x340 // Line 254, Address: 0x3b1ee4, Func Offset: 0x344 // Line 255, Address: 0x3b1ee8, Func Offset: 0x348 // Line 256, Address: 0x3b1ef8, Func Offset: 0x358 // Line 257, Address: 0x3b1f30, Func Offset: 0x390 // Line 258, Address: 0x3b1f68, Func Offset: 0x3c8 // Line 261, Address: 0x3b1fd0, Func Offset: 0x430 // Line 265, Address: 0x3b2040, Func Offset: 0x4a0 // Line 261, Address: 0x3b2044, Func Offset: 0x4a4 // Line 265, Address: 0x3b2048, Func Offset: 0x4a8 // Line 266, Address: 0x3b211c, Func Offset: 0x57c // Line 267, Address: 0x3b2120, Func Offset: 0x580 // Func End, Address: 0x3b2148, Func Offset: 0x5a8 } // collide_update__17xLaserBoltEmitterFRQ217xLaserBoltEmitter4bolt // Start address: 0x3b2200 void xLaserBoltEmitter::collide_update(bolt& b) { xScene& scene; xRay3 ray; xCollis player_coll; xCollis scene_coll; // Line 200, Address: 0x3b2200, Func Offset: 0 // Line 201, Address: 0x3b2204, Func Offset: 0x4 // Line 200, Address: 0x3b2208, Func Offset: 0x8 // Line 205, Address: 0x3b220c, Func Offset: 0xc // Line 200, Address: 0x3b2210, Func Offset: 0x10 // Line 208, Address: 0x3b2214, Func Offset: 0x14 // Line 200, Address: 0x3b2218, Func Offset: 0x18 // Line 204, Address: 0x3b2220, Func Offset: 0x20 // Line 201, Address: 0x3b2224, Func Offset: 0x24 // Line 206, Address: 0x3b2228, Func Offset: 0x28 // Line 204, Address: 0x3b222c, Func Offset: 0x2c // Line 205, Address: 0x3b2240, Func Offset: 0x40 // Line 206, Address: 0x3b2258, Func Offset: 0x58 // Line 207, Address: 0x3b2268, Func Offset: 0x68 // Line 208, Address: 0x3b2270, Func Offset: 0x70 // Line 209, Address: 0x3b2278, Func Offset: 0x78 // Line 213, Address: 0x3b2290, Func Offset: 0x90 // Line 214, Address: 0x3b2294, Func Offset: 0x94 // Line 213, Address: 0x3b2298, Func Offset: 0x98 // Line 214, Address: 0x3b229c, Func Offset: 0x9c // Line 216, Address: 0x3b22ac, Func Offset: 0xac // Line 219, Address: 0x3b22c8, Func Offset: 0xc8 // Line 220, Address: 0x3b22cc, Func Offset: 0xcc // Line 219, Address: 0x3b22d4, Func Offset: 0xd4 // Line 220, Address: 0x3b22d8, Func Offset: 0xd8 // Line 223, Address: 0x3b22e8, Func Offset: 0xe8 // Line 225, Address: 0x3b22f8, Func Offset: 0xf8 // Line 226, Address: 0x3b2300, Func Offset: 0x100 // Line 227, Address: 0x3b2318, Func Offset: 0x118 // Line 228, Address: 0x3b231c, Func Offset: 0x11c // Line 229, Address: 0x3b2328, Func Offset: 0x128 // Line 231, Address: 0x3b2338, Func Offset: 0x138 // Line 233, Address: 0x3b233c, Func Offset: 0x13c // Line 231, Address: 0x3b2344, Func Offset: 0x144 // Line 232, Address: 0x3b2348, Func Offset: 0x148 // Line 233, Address: 0x3b2360, Func Offset: 0x160 // Line 234, Address: 0x3b2364, Func Offset: 0x164 // Line 236, Address: 0x3b2368, Func Offset: 0x168 // Line 239, Address: 0x3b2370, Func Offset: 0x170 // Func End, Address: 0x3b2388, Func Offset: 0x188 } // attach_effects__17xLaserBoltEmitterFQ217xLaserBoltEmitter12fx_when_enumPQ217xLaserBoltEmitter11effect_dataUi // Start address: 0x3b2390 void xLaserBoltEmitter::attach_effects(fx_when_enum when, effect_data* fx, uint32 fxsize) { // Line 167, Address: 0x3b2398, Func Offset: 0x8 // Line 168, Address: 0x3b239c, Func Offset: 0xc // Line 169, Address: 0x3b23a0, Func Offset: 0x10 // Line 171, Address: 0x3b2408, Func Offset: 0x78 // Func End, Address: 0x3b2410, Func Offset: 0x80 } // render__17xLaserBoltEmitterFv // Start address: 0x3b2410 void xLaserBoltEmitter::render() { RxObjSpace3DVertex* verts; RxObjSpace3DVertex* v; iterator it; int32 used; // Line 139, Address: 0x3b2410, Func Offset: 0 // Line 144, Address: 0x3b2414, Func Offset: 0x4 // Line 139, Address: 0x3b2418, Func Offset: 0x8 // Line 150, Address: 0x3b242c, Func Offset: 0x1c // Line 139, Address: 0x3b2430, Func Offset: 0x20 // Line 144, Address: 0x3b2438, Func Offset: 0x28 // Line 150, Address: 0x3b243c, Func Offset: 0x2c // Line 151, Address: 0x3b2448, Func Offset: 0x38 // Line 156, Address: 0x3b2458, Func Offset: 0x48 // Line 151, Address: 0x3b2464, Func Offset: 0x54 // Line 156, Address: 0x3b2474, Func Offset: 0x64 // Line 153, Address: 0x3b24a8, Func Offset: 0x98 // Line 156, Address: 0x3b24ac, Func Offset: 0x9c // Line 153, Address: 0x3b24b0, Func Offset: 0xa0 // Line 154, Address: 0x3b24bc, Func Offset: 0xac // Line 153, Address: 0x3b24c0, Func Offset: 0xb0 // Line 156, Address: 0x3b24c8, Func Offset: 0xb8 // Line 154, Address: 0x3b24dc, Func Offset: 0xcc // Line 156, Address: 0x3b24e0, Func Offset: 0xd0 // Line 154, Address: 0x3b24f8, Func Offset: 0xe8 // Line 156, Address: 0x3b2500, Func Offset: 0xf0 // Line 155, Address: 0x3b2508, Func Offset: 0xf8 // Line 156, Address: 0x3b2510, Func Offset: 0x100 // Line 155, Address: 0x3b2514, Func Offset: 0x104 // Line 156, Address: 0x3b2518, Func Offset: 0x108 // Line 155, Address: 0x3b251c, Func Offset: 0x10c // Line 156, Address: 0x3b2520, Func Offset: 0x110 // Line 155, Address: 0x3b2524, Func Offset: 0x114 // Line 156, Address: 0x3b2528, Func Offset: 0x118 // Line 157, Address: 0x3b2588, Func Offset: 0x178 // Line 160, Address: 0x3b2590, Func Offset: 0x180 // Line 163, Address: 0x3b25d0, Func Offset: 0x1c0 // Func End, Address: 0x3b25f0, Func Offset: 0x1e0 } // update__17xLaserBoltEmitterFf // Start address: 0x3b25f0 void xLaserBoltEmitter::update(float32 dt) { int32 ci; iterator it; bolt& b; uint8 collided; float32 prev_dist; effect_data* itfx; effect_data* endfx; effect_data* itfx; effect_data* endfx; // Line 85, Address: 0x3b25f0, Func Offset: 0 // Line 89, Address: 0x3b2628, Func Offset: 0x38 // Line 90, Address: 0x3b2654, Func Offset: 0x64 // Line 133, Address: 0x3b2664, Func Offset: 0x74 // Line 90, Address: 0x3b2670, Func Offset: 0x80 // Line 133, Address: 0x3b2680, Func Offset: 0x90 // Line 92, Address: 0x3b26c4, Func Offset: 0xd4 // Line 133, Address: 0x3b26c8, Func Offset: 0xd8 // Line 92, Address: 0x3b26cc, Func Offset: 0xdc // Line 133, Address: 0x3b26d0, Func Offset: 0xe0 // Line 92, Address: 0x3b26d4, Func Offset: 0xe4 // Line 133, Address: 0x3b26d8, Func Offset: 0xe8 // Line 93, Address: 0x3b26e8, Func Offset: 0xf8 // Line 133, Address: 0x3b26f8, Func Offset: 0x108 // Line 96, Address: 0x3b2708, Func Offset: 0x118 // Line 133, Address: 0x3b2710, Func Offset: 0x120 // Line 98, Address: 0x3b271c, Func Offset: 0x12c // Line 133, Address: 0x3b2720, Func Offset: 0x130 // Line 98, Address: 0x3b2728, Func Offset: 0x138 // Line 133, Address: 0x3b2734, Func Offset: 0x144 // Line 99, Address: 0x3b2760, Func Offset: 0x170 // Line 133, Address: 0x3b2764, Func Offset: 0x174 // Line 99, Address: 0x3b276c, Func Offset: 0x17c // Line 133, Address: 0x3b2770, Func Offset: 0x180 // Line 99, Address: 0x3b2778, Func Offset: 0x188 // Line 133, Address: 0x3b277c, Func Offset: 0x18c // Line 99, Address: 0x3b27b4, Func Offset: 0x1c4 // Line 133, Address: 0x3b27b8, Func Offset: 0x1c8 // Line 99, Address: 0x3b27c8, Func Offset: 0x1d8 // Line 133, Address: 0x3b27cc, Func Offset: 0x1dc // Line 99, Address: 0x3b27e4, Func Offset: 0x1f4 // Line 133, Address: 0x3b27e8, Func Offset: 0x1f8 // Line 101, Address: 0x3b2828, Func Offset: 0x238 // Line 133, Address: 0x3b282c, Func Offset: 0x23c // Line 103, Address: 0x3b283c, Func Offset: 0x24c // Line 133, Address: 0x3b2840, Func Offset: 0x250 // Line 103, Address: 0x3b2844, Func Offset: 0x254 // Line 133, Address: 0x3b2848, Func Offset: 0x258 // Line 104, Address: 0x3b2854, Func Offset: 0x264 // Line 133, Address: 0x3b2858, Func Offset: 0x268 // Line 105, Address: 0x3b285c, Func Offset: 0x26c // Line 133, Address: 0x3b2860, Func Offset: 0x270 // Line 105, Address: 0x3b2868, Func Offset: 0x278 // Line 133, Address: 0x3b286c, Func Offset: 0x27c // Line 105, Address: 0x3b2884, Func Offset: 0x294 // Line 133, Address: 0x3b28a0, Func Offset: 0x2b0 // Line 105, Address: 0x3b28a8, Func Offset: 0x2b8 // Line 133, Address: 0x3b28c0, Func Offset: 0x2d0 // Line 105, Address: 0x3b28c8, Func Offset: 0x2d8 // Line 133, Address: 0x3b28e0, Func Offset: 0x2f0 // Line 105, Address: 0x3b28e8, Func Offset: 0x2f8 // Line 133, Address: 0x3b28f0, Func Offset: 0x300 // Line 106, Address: 0x3b2918, Func Offset: 0x328 // Line 133, Address: 0x3b291c, Func Offset: 0x32c // Line 106, Address: 0x3b2970, Func Offset: 0x380 // Line 133, Address: 0x3b2978, Func Offset: 0x388 // Line 107, Address: 0x3b298c, Func Offset: 0x39c // Line 108, Address: 0x3b2994, Func Offset: 0x3a4 // Line 110, Address: 0x3b2998, Func Offset: 0x3a8 // Line 133, Address: 0x3b29a0, Func Offset: 0x3b0 // Line 112, Address: 0x3b29b0, Func Offset: 0x3c0 // Line 133, Address: 0x3b29b4, Func Offset: 0x3c4 // Line 114, Address: 0x3b29cc, Func Offset: 0x3dc // Line 133, Address: 0x3b29d0, Func Offset: 0x3e0 // Line 114, Address: 0x3b29dc, Func Offset: 0x3ec // Line 133, Address: 0x3b29e4, Func Offset: 0x3f4 // Line 114, Address: 0x3b29f0, Func Offset: 0x400 // Line 133, Address: 0x3b29fc, Func Offset: 0x40c // Line 114, Address: 0x3b2a0c, Func Offset: 0x41c // Line 133, Address: 0x3b2a1c, Func Offset: 0x42c // Line 114, Address: 0x3b2a20, Func Offset: 0x430 // Line 133, Address: 0x3b2a2c, Func Offset: 0x43c // Line 114, Address: 0x3b2a34, Func Offset: 0x444 // Line 133, Address: 0x3b2a38, Func Offset: 0x448 // Line 116, Address: 0x3b2a3c, Func Offset: 0x44c // Line 133, Address: 0x3b2a40, Func Offset: 0x450 // Line 123, Address: 0x3b2a5c, Func Offset: 0x46c // Line 133, Address: 0x3b2a60, Func Offset: 0x470 // Line 123, Address: 0x3b2a6c, Func Offset: 0x47c // Line 133, Address: 0x3b2a70, Func Offset: 0x480 // Line 127, Address: 0x3b2a90, Func Offset: 0x4a0 // Line 133, Address: 0x3b2a94, Func Offset: 0x4a4 // Line 129, Address: 0x3b2aa4, Func Offset: 0x4b4 // Line 133, Address: 0x3b2aa8, Func Offset: 0x4b8 // Line 129, Address: 0x3b2aac, Func Offset: 0x4bc // Line 133, Address: 0x3b2ab0, Func Offset: 0x4c0 // Line 130, Address: 0x3b2abc, Func Offset: 0x4cc // Line 133, Address: 0x3b2ac0, Func Offset: 0x4d0 // Line 131, Address: 0x3b2ac4, Func Offset: 0x4d4 // Line 133, Address: 0x3b2ac8, Func Offset: 0x4d8 // Line 131, Address: 0x3b2ad0, Func Offset: 0x4e0 // Line 133, Address: 0x3b2ad4, Func Offset: 0x4e4 // Line 131, Address: 0x3b2aec, Func Offset: 0x4fc // Line 133, Address: 0x3b2b08, Func Offset: 0x518 // Line 131, Address: 0x3b2b10, Func Offset: 0x520 // Line 133, Address: 0x3b2b28, Func Offset: 0x538 // Line 131, Address: 0x3b2b30, Func Offset: 0x540 // Line 133, Address: 0x3b2b48, Func Offset: 0x558 // Line 131, Address: 0x3b2b50, Func Offset: 0x560 // Line 133, Address: 0x3b2b58, Func Offset: 0x568 // Line 135, Address: 0x3b2bd0, Func Offset: 0x5e0 // Line 136, Address: 0x3b2bdc, Func Offset: 0x5ec // Func End, Address: 0x3b2c10, Func Offset: 0x620 } // emit__17xLaserBoltEmitterFRC5xVec3RC5xVec3 // Start address: 0x3b2c10 void xLaserBoltEmitter::emit(xVec3& loc, xVec3& dir) { bolt& b; effect_data* itfx; effect_data* endfx; // Line 63, Address: 0x3b2c10, Func Offset: 0 // Line 64, Address: 0x3b2c2c, Func Offset: 0x1c // Line 65, Address: 0x3b2c50, Func Offset: 0x40 // Line 68, Address: 0x3b2c60, Func Offset: 0x50 // Line 65, Address: 0x3b2c64, Func Offset: 0x54 // Line 66, Address: 0x3b2c98, Func Offset: 0x88 // Line 65, Address: 0x3b2c9c, Func Offset: 0x8c // Line 66, Address: 0x3b2cbc, Func Offset: 0xac // Line 67, Address: 0x3b2ce8, Func Offset: 0xd8 // Line 68, Address: 0x3b2d00, Func Offset: 0xf0 // Line 69, Address: 0x3b2d0c, Func Offset: 0xfc // Line 70, Address: 0x3b2d14, Func Offset: 0x104 // Line 71, Address: 0x3b2d18, Func Offset: 0x108 // Line 72, Address: 0x3b2d1c, Func Offset: 0x10c // Line 73, Address: 0x3b2d24, Func Offset: 0x114 // Line 74, Address: 0x3b2dc0, Func Offset: 0x1b0 // Line 77, Address: 0x3b2e70, Func Offset: 0x260 // Line 80, Address: 0x3b2e7c, Func Offset: 0x26c // Line 81, Address: 0x3b2e94, Func Offset: 0x284 // Line 82, Address: 0x3b2f88, Func Offset: 0x378 // Func End, Address: 0x3b2fa8, Func Offset: 0x398 } // refresh_config__17xLaserBoltEmitterFv // Start address: 0x3b2fb0 void xLaserBoltEmitter::refresh_config() { // Line 57, Address: 0x3b2fb0, Func Offset: 0 // Line 58, Address: 0x3b2fb8, Func Offset: 0x8 // Line 60, Address: 0x3b2fe8, Func Offset: 0x38 // Func End, Address: 0x3b2ff0, Func Offset: 0x40 } // reset__17xLaserBoltEmitterFv // Start address: 0x3b2ff0 void xLaserBoltEmitter::reset() { iterator it; bolt& b; effect_data* itfx; effect_data* endfx; int32 i; // Line 41, Address: 0x3b2ff0, Func Offset: 0 // Line 42, Address: 0x3b2ff8, Func Offset: 0x8 // Line 41, Address: 0x3b2ffc, Func Offset: 0xc // Line 42, Address: 0x3b3000, Func Offset: 0x10 // Line 41, Address: 0x3b3004, Func Offset: 0x14 // Line 42, Address: 0x3b3010, Func Offset: 0x20 // Line 41, Address: 0x3b3014, Func Offset: 0x24 // Line 48, Address: 0x3b3018, Func Offset: 0x28 // Line 41, Address: 0x3b301c, Func Offset: 0x2c // Line 48, Address: 0x3b3020, Func Offset: 0x30 // Line 41, Address: 0x3b3024, Func Offset: 0x34 // Line 42, Address: 0x3b3028, Func Offset: 0x38 // Line 48, Address: 0x3b302c, Func Offset: 0x3c // Line 42, Address: 0x3b3030, Func Offset: 0x40 // Line 48, Address: 0x3b3040, Func Offset: 0x50 // Line 44, Address: 0x3b307c, Func Offset: 0x8c // Line 48, Address: 0x3b3080, Func Offset: 0x90 // Line 44, Address: 0x3b308c, Func Offset: 0x9c // Line 48, Address: 0x3b3090, Func Offset: 0xa0 // Line 44, Address: 0x3b3094, Func Offset: 0xa4 // Line 48, Address: 0x3b3098, Func Offset: 0xa8 // Line 45, Address: 0x3b309c, Func Offset: 0xac // Line 48, Address: 0x3b30a0, Func Offset: 0xb0 // Line 45, Address: 0x3b30a4, Func Offset: 0xb4 // Line 48, Address: 0x3b30a8, Func Offset: 0xb8 // Line 46, Address: 0x3b30b4, Func Offset: 0xc4 // Line 48, Address: 0x3b30b8, Func Offset: 0xc8 // Line 47, Address: 0x3b30bc, Func Offset: 0xcc // Line 48, Address: 0x3b30c0, Func Offset: 0xd0 // Line 47, Address: 0x3b30c8, Func Offset: 0xd8 // Line 48, Address: 0x3b30cc, Func Offset: 0xdc // Line 47, Address: 0x3b30e4, Func Offset: 0xf4 // Line 48, Address: 0x3b3108, Func Offset: 0x118 // Line 47, Address: 0x3b3110, Func Offset: 0x120 // Line 48, Address: 0x3b3130, Func Offset: 0x140 // Line 47, Address: 0x3b3138, Func Offset: 0x148 // Line 48, Address: 0x3b3158, Func Offset: 0x168 // Line 47, Address: 0x3b3160, Func Offset: 0x170 // Line 48, Address: 0x3b3168, Func Offset: 0x178 // Line 50, Address: 0x3b31e0, Func Offset: 0x1f0 // Line 52, Address: 0x3b31e8, Func Offset: 0x1f8 // Line 51, Address: 0x3b31ec, Func Offset: 0x1fc // Line 53, Address: 0x3b31f0, Func Offset: 0x200 // Line 52, Address: 0x3b31fc, Func Offset: 0x20c // Line 53, Address: 0x3b3200, Func Offset: 0x210 // Line 54, Address: 0x3b3270, Func Offset: 0x280 // Func End, Address: 0x3b3294, Func Offset: 0x2a4 } // set_texture__17xLaserBoltEmitterFPCc // Start address: 0x3b32a0 void xLaserBoltEmitter::set_texture(int8* name) { // Line 24, Address: 0x3b32a0, Func Offset: 0 // Func End, Address: 0x3b32f0, Func Offset: 0x50 } // init__17xLaserBoltEmitterFUiPCc // Start address: 0x3b32f0 void xLaserBoltEmitter::init(uint32 max_bolts) { // Line 16, Address: 0x3b32f0, Func Offset: 0 // Line 18, Address: 0x3b32f4, Func Offset: 0x4 // Line 16, Address: 0x3b32f8, Func Offset: 0x8 // Line 17, Address: 0x3b3308, Func Offset: 0x18 // Line 18, Address: 0x3b3310, Func Offset: 0x20 // Line 19, Address: 0x3b331c, Func Offset: 0x2c // Line 21, Address: 0x3b3390, Func Offset: 0xa0 // Func End, Address: 0x3b33a4, Func Offset: 0xb4 }
21.469997
111
0.757497
stravant
84665d3c2e7f8a41845f8a470cfb7131d230c737
212
cpp
C++
solutions/rjKdSzNl.cpp
luyencode/cpp-solutions
627397fb887654e9f5ee64cfb73d708f6f6706f7
[ "MIT" ]
60
2021-04-10T11:17:33.000Z
2022-03-23T06:15:42.000Z
solutions/rjKdSzNl.cpp
letuankiet-29-10-2002/cpp-solutions
7d9cddf211af54ff207da883b469f4ddd75d5916
[ "MIT" ]
1
2021-08-13T11:32:27.000Z
2021-08-13T11:32:27.000Z
solutions/rjKdSzNl.cpp
letuankiet-29-10-2002/cpp-solutions
7d9cddf211af54ff207da883b469f4ddd75d5916
[ "MIT" ]
67
2021-04-10T17:32:50.000Z
2022-03-23T15:50:17.000Z
/* Sưu tầm bởi @nguyenvanhieuvn Thực hành nhiều bài tập hơn tại https://luyencode.net/ */ void Xuat(LIST l) { for(NODE* p = l.pHead; p != NULL; p = p->pNext) { printf("%4d", p->info); } }
17.666667
56
0.556604
luyencode
84680ee68589bc89dcfe67faceeb660016ab63f8
489
cpp
C++
test/is_unsigned.cpp
morrow1nd/mystd
77281d806c3cc2010b76e38ac236c4036a454d7e
[ "MIT" ]
null
null
null
test/is_unsigned.cpp
morrow1nd/mystd
77281d806c3cc2010b76e38ac236c4036a454d7e
[ "MIT" ]
null
null
null
test/is_unsigned.cpp
morrow1nd/mystd
77281d806c3cc2010b76e38ac236c4036a454d7e
[ "MIT" ]
null
null
null
#include "test.h" #include <inner/type_traits.h> class A {}; enum E : unsigned {}; enum class Ec : unsigned {}; enum Ecs : signed int {}; int main() { assert(is_unsigned_v<A> == false); assert(is_unsigned_v<float> == false); assert(is_unsigned_v<signed int> == false); assert(is_unsigned_v<unsigned int> == true); assert(is_unsigned_v<E> == false); assert(is_unsigned_v<Ec> == false); assert(is_unsigned_v<Ecs> == false); return 0; }
23.285714
49
0.619632
morrow1nd
846b9f3f9bf7efb24aa2c15eea48bed5a40938e1
545
cpp
C++
owRenderNew/DX11_Creator.cpp
adan830/OpenWow
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
[ "Apache-2.0" ]
null
null
null
owRenderNew/DX11_Creator.cpp
adan830/OpenWow
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
[ "Apache-2.0" ]
null
null
null
owRenderNew/DX11_Creator.cpp
adan830/OpenWow
9b6e9c248bd185b1677fe616d2a3a81a35ca8894
[ "Apache-2.0" ]
1
2020-05-11T13:32:49.000Z
2020-05-11T13:32:49.000Z
#include "stdafx.h" // General #include "DX11_Creator.h" // Additional #include "DX11\\RenderDeviceDX11.h" #include "DX11\\RenderWindowDX11.h" RenderDevice* DX11_Creator::CreateRenderDevice() { return new RenderDeviceDX11(); } RenderWindow* DX11_Creator::CreateRenderWindow(HWND hWnd, RenderDevice* device, cstring windowName, int windowWidth, int windowHeight, bool vSync) { RenderDeviceDX11* pDevice = dynamic_cast<RenderDeviceDX11*>(device); return new RenderWindowDX11(hWnd, pDevice, windowName, windowWidth, windowHeight, vSync); }
25.952381
146
0.785321
adan830
846c94fb21cd5ee6524e9ae4b0c77e222305b806
1,883
cpp
C++
src/game/shared/neotokyo/neo_controlpoint.cpp
L-Leite/neotokyo-re
a45cdcb9027ffe8af72cf1f8e22976375e6b1e0a
[ "Unlicense" ]
4
2017-08-29T15:39:53.000Z
2019-06-04T07:37:48.000Z
src/game/shared/neotokyo/neo_controlpoint.cpp
Ochii/neotokyo
a45cdcb9027ffe8af72cf1f8e22976375e6b1e0a
[ "Unlicense" ]
null
null
null
src/game/shared/neotokyo/neo_controlpoint.cpp
Ochii/neotokyo
a45cdcb9027ffe8af72cf1f8e22976375e6b1e0a
[ "Unlicense" ]
1
2021-08-10T20:01:00.000Z
2021-08-10T20:01:00.000Z
#include "cbase.h" #include "neo_controlpoint.h" #include "neo_gamerules.h" IMPLEMENT_NETWORKCLASS_ALIASED( NeoControlPoint, DT_NeoControlPoint ) BEGIN_NETWORK_TABLE( CNeoControlPoint, DT_NeoControlPoint ) #ifdef CLIENT_DLL //RecvPropStringT( RECVINFO( m_Name ) ), RecvPropInt( RECVINFO( m_ID ) ), RecvPropVector( RECVINFO( m_Position ) ), RecvPropInt( RECVINFO( m_Icon ) ), RecvPropInt( RECVINFO( m_Status ) ), RecvPropInt( RECVINFO( m_Owner ) ), RecvPropInt( RECVINFO( m_Radius ) ), #else //SendPropStringT( SENDINFO( m_Name ) ), SendPropInt( SENDINFO( m_ID ) ), SendPropVector( SENDINFO( m_Position ) ), SendPropInt( SENDINFO( m_Icon ) ), SendPropInt( SENDINFO( m_Status ) ), SendPropInt( SENDINFO( m_Owner ) ), SendPropInt( SENDINFO( m_Radius ) ), #endif END_NETWORK_TABLE() LINK_ENTITY_TO_CLASS( neo_controlpoint, CNeoControlPoint ); #ifdef GAME_DLL BEGIN_DATADESC( CNeoControlPoint ) END_DATADESC() #endif CNeoControlPoint::CNeoControlPoint() { m_Status = 0; m_Owner = 0; } #ifdef GAME_DLL int CNeoControlPoint::UpdateTransmitState() { return SetTransmitState( FL_EDICT_ALWAYS ); } #endif void CNeoControlPoint::Activate() { #ifdef CLIENT_DLL DevMsg( "Client CP %s Activated\n", m_Name ); #else DevMsg( "Server CP %s Activated\n", m_Name ); #endif #ifdef GAME_DLL m_Position = GetAbsOrigin(); if ( m_Icon < 0 || m_Icon > 11 ) m_Icon = 0; #endif NEOGameRules()->AddControlPoint( this ); BaseClass::Activate(); } bool CNeoControlPoint::UpdatePointOwner() { #ifdef GAME_DLL CBaseEntity* pEntities[ 256 ]; int count = UTIL_EntitiesInBox( pEntities, 256, GetAbsOrigin(), m_Position, 0 ); for ( int i = 0; i < count; i++ ) { CNEOPlayer* pPlayer = (CNEOPlayer*) pEntities[ i ]; if ( !pPlayer || !pPlayer->IsPlayer() ) continue; m_Owner = pPlayer->GetTeamNumber(); return true; } #endif return false; }
21.157303
81
0.713224
L-Leite
846d3f976ffdeb9e7c9ed90bc76d471e7f6317c3
836
hpp
C++
src/providers/ffz/FfzBadges.hpp
1xelerate/chatterino2
57783c7478a955f5224e5025653c0f8549df12fc
[ "MIT" ]
null
null
null
src/providers/ffz/FfzBadges.hpp
1xelerate/chatterino2
57783c7478a955f5224e5025653c0f8549df12fc
[ "MIT" ]
1
2022-01-03T14:43:35.000Z
2022-01-03T14:43:35.000Z
src/providers/ffz/FfzBadges.hpp
1xelerate/chatterino2
57783c7478a955f5224e5025653c0f8549df12fc
[ "MIT" ]
null
null
null
#pragma once #include <boost/optional.hpp> #include <common/Singleton.hpp> #include "common/Aliases.hpp" #include "util/QStringHash.hpp" #include <map> #include <memory> #include <shared_mutex> #include <unordered_map> #include <vector> #include <QColor> namespace chatterino { struct Emote; using EmotePtr = std::shared_ptr<const Emote>; class FfzBadges : public Singleton { public: virtual void initialize(Settings &settings, Paths &paths) override; FfzBadges() = default; boost::optional<EmotePtr> getBadge(const UserId &id); boost::optional<QColor> getBadgeColor(const UserId &id); private: void loadFfzBadges(); std::shared_mutex mutex_; std::unordered_map<QString, int> badgeMap; std::vector<EmotePtr> badges; std::unordered_map<int, QColor> colorMap; }; } // namespace chatterino
19.904762
71
0.726077
1xelerate
84706ba1a08ca20f636eaa48a5051da425d7af2e
3,047
cpp
C++
src/components/timer/timer.cpp
elmerucr/E64
1f7d57fadc6804948aa832d0f5f6800a8631f622
[ "MIT" ]
null
null
null
src/components/timer/timer.cpp
elmerucr/E64
1f7d57fadc6804948aa832d0f5f6800a8631f622
[ "MIT" ]
null
null
null
src/components/timer/timer.cpp
elmerucr/E64
1f7d57fadc6804948aa832d0f5f6800a8631f622
[ "MIT" ]
null
null
null
// timer.cpp // E64 // // Copyright © 2019-2022 elmerucr. All rights reserved. #include "timer.hpp" #include "common.hpp" E64::timer_ic::timer_ic(exceptions_ic *unit) { exceptions = unit; irq_number = exceptions->connect_device(); } void E64::timer_ic::reset() { registers[0] = 0x00; // No pending irq's registers[1] = 0x00; // All timers turned off // load data register with value 1 bpm (may never be zero) registers[2] = 0x00; // high byte registers[3] = 0x01; // low byte for (int i=0; i<8; i++) { timers[i].bpm = (registers[2] << 8) | registers[3]; timers[i].clock_interval = bpm_to_clock_interval(timers[i].bpm); timers[i].counter = 0; } exceptions->release(irq_number); } void E64::timer_ic::run(uint32_t number_of_cycles) { for (int i=0; i<8; i++) { timers[i].counter += number_of_cycles; if ((timers[i].counter >= timers[i].clock_interval) && (registers[1] & (0b1 << i))) { timers[i].counter -= timers[i].clock_interval; exceptions->pull(irq_number); registers[0] |= (0b1 << i); } } } uint32_t E64::timer_ic::bpm_to_clock_interval(uint16_t bpm) { return (60.0 / bpm) * VICV_CLOCK_SPEED; } uint8_t E64::timer_ic::read_byte(uint8_t address) { return registers[address & 0x03]; } void E64::timer_ic::write_byte(uint8_t address, uint8_t byte) { switch (address & 0x03) { case 0x00: /* * b s r * 0 0 = 0 * 0 1 = 1 * 1 0 = 0 * 1 1 = 0 * * b = bit that's written * s = status (on if an interrupt was caused) * r = boolean result (acknowledge an interrupt (s=1) if b=1 * r = (~b) & s */ registers[0] = (~byte) & registers[0]; if ((registers[0] & 0xff) == 0) { // no timers left causing interrupts exceptions->release(irq_number); } break; case 0x01: { uint8_t turned_on = byte & (~registers[1]); for (int i=0; i<8; i++) { if (turned_on & (0b1 << i)) { timers[i].bpm = (uint16_t)registers[3] | (registers[2] << 8); if (timers[i].bpm == 0) timers[i].bpm = 1; timers[i].clock_interval = bpm_to_clock_interval(timers[i].bpm); timers[i].counter = 0; } } registers[0x01] = byte; break; } default: registers[address & 0x03] = byte; break; } } uint64_t E64::timer_ic::get_timer_counter(uint8_t timer_number) { return timers[timer_number & 0x07].counter; } uint64_t E64::timer_ic::get_timer_clock_interval(uint8_t timer_number) { return timers[timer_number & 0x07].clock_interval; } void E64::timer_ic::set(uint8_t timer_no, uint16_t bpm) { timer_no &= 0b111; // limit to max 7 write_byte(0x03, bpm & 0xff); write_byte(0x02, (bpm & 0xff00) >> 8); uint8_t byte = read_byte(0x01); write_byte(0x01, (0b1 << timer_no) | byte); } void E64::timer_ic::status(char *buffer, uint8_t timer_no) { timer_no &= 0b00000111; snprintf(buffer, 64, "\n%02x:%s/%5u/%08x/%08x", timer_no, registers[0x01] & (0b1 << timer_no) ? " on" : "off", timers[timer_no].bpm, timers[timer_no].counter, timers[timer_no].clock_interval); }
23.083333
70
0.628159
elmerucr
84708ed239f1a74e5abb29675b2c7273a13354c2
1,459
cpp
C++
Windows_Project/Test2/CollideComponent.cpp
Torbjornsson/TDA572-2019
7e281b2ac72600db57e0f128eaedccea133f9701
[ "MIT" ]
null
null
null
Windows_Project/Test2/CollideComponent.cpp
Torbjornsson/TDA572-2019
7e281b2ac72600db57e0f128eaedccea133f9701
[ "MIT" ]
null
null
null
Windows_Project/Test2/CollideComponent.cpp
Torbjornsson/TDA572-2019
7e281b2ac72600db57e0f128eaedccea133f9701
[ "MIT" ]
null
null
null
#include "pch.h" #include "Component.h" #include "GameObject.h" #include "avancezlib.h" void CollideComponent::Create(AvancezLib* engine, GameObject* go, std::set<GameObject*>* game_objects, ObjectPool<GameObject>* coll_objects){ Component::Create(engine, go, game_objects); this->coll_objects = coll_objects; } void CollideComponent::Update(float dt){ for (auto i = 0; i < coll_objects->pool.size(); i++){ GameObject * coll_go = coll_objects->pool[i]; if (coll_go->enabled){ if ((go->verticalPos - go->radius) <= coll_go->verticalPos){ if (circleCollide(go, coll_go)){ go->Receive(HIT); coll_go->Receive(HIT); } } } } } //Check if 2 boxes overlap bool CollideComponent::boxCollide(GameObject * go, GameObject * coll_go){ return ((coll_go->horizontalPos > go->horizontalPos - 10) && (coll_go->horizontalPos < go->horizontalPos + 10) && (coll_go->verticalPos > go->verticalPos - 10) && (coll_go->verticalPos < go->verticalPos + 10)); } //Check if point is iside the circle bool CollideComponent::circleCollide(GameObject * go, GameObject * coll_go){ double x_diff = (go->horizontalPos + go->radius) - coll_go->horizontalPos; double y_diff = (go->verticalPos + go->radius) - coll_go->verticalPos; return (std::sqrt(x_diff * x_diff + y_diff * y_diff) <= go->radius); }
36.475
141
0.627142
Torbjornsson
847189942b8ef8644dca43e701b77473773e9657
734
cpp
C++
src/blink.cpp
Tivian/micro-sci
dd2c1dca912218557c1143028696b844c5ec7578
[ "MIT" ]
null
null
null
src/blink.cpp
Tivian/micro-sci
dd2c1dca912218557c1143028696b844c5ec7578
[ "MIT" ]
null
null
null
src/blink.cpp
Tivian/micro-sci
dd2c1dca912218557c1143028696b844c5ec7578
[ "MIT" ]
null
null
null
#include "blink.hpp" #include "lcd.hpp" #include <avr/io.h> #include <avr/interrupt.h> namespace Blink { namespace { volatile bool blink = false; volatile uint8_t timeout = 0; volatile uint8_t delay = 0; } void init(uint8_t delay) { speed(delay); OCR0A = 0xFF; TCCR0A |= _BV(WGM01); TCCR0B |= _BV(CS02) | _BV(CS00); } void start() { TIMSK0 |= _BV(OCIE0A); blink = true; timeout = 0; } void stop() { TIMSK0 &= ~_BV(OCIE0A); } void speed(uint8_t delay) { Blink::delay = delay; } } ISR (TIMER0_COMPA_vect) { if (Blink::timeout++ == Blink::delay) { LCD::mode(true, Blink::blink = !Blink::blink); Blink::timeout = 0; } }
17.902439
55
0.559946
Tivian
8472164ceb9fd8bc264bbd92078d0f1576ca5c7f
511
cpp
C++
c10/ex10_24.cpp
qzhang0/CppPrimer
315ef879bd4d3b51d594e33b049adee0d47e4c11
[ "MIT" ]
null
null
null
c10/ex10_24.cpp
qzhang0/CppPrimer
315ef879bd4d3b51d594e33b049adee0d47e4c11
[ "MIT" ]
null
null
null
c10/ex10_24.cpp
qzhang0/CppPrimer
315ef879bd4d3b51d594e33b049adee0d47e4c11
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <functional> using namespace std; using std::placeholders::_1; bool check_size(const string& s, int i) { return s.size() < i; } int main() { vector<int> ivec{0, 1, 2, 3, 4, 5, 6}; auto result = find_if(ivec.begin(), ivec.end(), bind(check_size, "01234567", _1)); if (result != ivec.end()) { cout << *result << endl; } else { cout << "Not found" << endl; } return 0; }
19.653846
86
0.577299
qzhang0
84791dfe5d8cdbc4917e4d3e1a30a888b4ce0d9f
1,797
cpp
C++
src/GUI.cpp
montoyo/mgpcl
8e65d01e483124936de3650154e0e7e9586d27c0
[ "MIT" ]
null
null
null
src/GUI.cpp
montoyo/mgpcl
8e65d01e483124936de3650154e0e7e9586d27c0
[ "MIT" ]
2
2018-12-13T09:10:03.000Z
2018-12-22T13:52:00.000Z
src/GUI.cpp
montoyo/mgpcl
8e65d01e483124936de3650154e0e7e9586d27c0
[ "MIT" ]
null
null
null
/* Copyright (C) 2017 BARBOTIN Nicolas * * 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 "mgpcl/GUI.h" #include "mgpcl/Config.h" #if defined(MGPCL_NO_GUI) void m::gui::initialize() { } bool m::gui::hasBeenInitialized() { return false; } #elif defined(MGPCL_WIN) void m::gui::initialize() { } bool m::gui::hasBeenInitialized() { return true; } #else #include "mgpcl/Mutex.h" #include <gtk/gtk.h> static volatile bool g_guiInit = false; static m::Mutex g_guiLock; void m::gui::initialize() { g_guiLock.lock(); gtk_init(nullptr, nullptr); g_guiInit = true; g_guiLock.unlock(); } bool m::gui::hasBeenInitialized() { volatile bool ret; g_guiLock.lock(); ret = g_guiInit; g_guiLock.unlock(); return ret; } #endif
24.958333
92
0.72621
montoyo
847a705867274c9681669a12d56da33ff156735a
408
cc
C++
atcoder/abc/079/a_good_integer.cc
boobam0618/competitive-programming
0341bd8bb240b1ed0d84cc60db91508242fc867b
[ "MIT" ]
null
null
null
atcoder/abc/079/a_good_integer.cc
boobam0618/competitive-programming
0341bd8bb240b1ed0d84cc60db91508242fc867b
[ "MIT" ]
32
2019-08-15T09:16:48.000Z
2020-02-09T16:23:30.000Z
atcoder/abc/079/a_good_integer.cc
boobam0618/competitive-programming
0341bd8bb240b1ed0d84cc60db91508242fc867b
[ "MIT" ]
null
null
null
#include <iostream> int main() { int n; std::cin >> n; int thousands = n / 1000; int hundreds = n / 100 % 10; int tens = n / 10 % 10; int ones = n % 10; std::string is_good_integer; if (thousands == hundreds && hundreds == tens || hundreds == tens && tens == ones) { is_good_integer = "Yes"; } else { is_good_integer = "No"; } std::cout << is_good_integer << std::endl; }
20.4
50
0.568627
boobam0618
847b4738437e4552f902362fe840355d554d98c4
1,985
cpp
C++
controllers/ControllerAdaugaRefill.cpp
xiofurry/magazin-manager-project
bb0c765f87c8f08493cefcaae39ed42639229585
[ "MIT" ]
null
null
null
controllers/ControllerAdaugaRefill.cpp
xiofurry/magazin-manager-project
bb0c765f87c8f08493cefcaae39ed42639229585
[ "MIT" ]
null
null
null
controllers/ControllerAdaugaRefill.cpp
xiofurry/magazin-manager-project
bb0c765f87c8f08493cefcaae39ed42639229585
[ "MIT" ]
null
null
null
// // Created by xiodine on 4/19/15. // #include <sstream> #include "ControllerAdaugaRefill.h" #include "../views/ViewConsole.h" ControllerAdaugaRefill::ControllerAdaugaRefill() : Controller() { } ControllerAdaugaRefill::~ControllerAdaugaRefill() { } std::size_t ControllerAdaugaRefill::showOptions(ModelStoc &stoc) { ViewConsole &con = ViewConsole::getSingleton(); // typedefs typedef ModelBun::trasaturi_t trasaturi_t; // for each bun ModelStoc::bunuri_pointer_t bunuri = stoc.getBunuriPointer(); std::size_t nrProduse = 0; for (ModelStoc::bunuri_pointer_t::const_iterator i = bunuri.begin(); i != bunuri.end(); ++i) { const ModelBun &bun = **i; nrProduse++; con << nrProduse << ". " << bun.getNume() << " ("; const trasaturi_t &trasaturi = bun.getTrasaturi(); for (trasaturi_t::const_iterator j = trasaturi.begin(); j != trasaturi.end(); ++j) { if (j != trasaturi.begin()) con << ", "; con << '\'' << *j << '\''; } con << ") - " << bun.getStoc() << " in stoc"; } return nrProduse; } void ControllerAdaugaRefill::run(ModelStoc &stoc) { std::size_t maxSize = showOptions(stoc); ViewConsole &con = ViewConsole::getSingleton(); std::size_t nr; do { con << "\nIntroduceti numarul produsului (0 pentru stop): "; std::stringstream str(con.getLine()); str >> nr; if (nr) { // test for validity if (nr > maxSize) { con << "Numar invalid!"; } else { con << "Numarul de produse de adaugat (numar): "; std::stringstream nrProdStr(con.getLine()); int nrProd; nrProdStr >> nrProd; ModelStoc::bunuri_pointer_t bunuri = stoc.getBunuriPointer(); stoc.addStocToBun(bunuri[nr - 1], nrProd); } } // else nr == 0 } while (nr != 0); }
27.569444
98
0.559194
xiofurry
847bf32da15223813d7279e6e8226808fa6e626c
10,168
cpp
C++
Stars45/MsnPkgDlg.cpp
RogerioY/starshatter-open
3a507e08b1d4e5970b27401a7e6517570d529400
[ "BSD-3-Clause" ]
null
null
null
Stars45/MsnPkgDlg.cpp
RogerioY/starshatter-open
3a507e08b1d4e5970b27401a7e6517570d529400
[ "BSD-3-Clause" ]
4
2019-09-05T22:22:57.000Z
2021-03-28T02:09:24.000Z
Stars45/MsnPkgDlg.cpp
RogerioY/starshatter-open
3a507e08b1d4e5970b27401a7e6517570d529400
[ "BSD-3-Clause" ]
null
null
null
/* Starshatter OpenSource Distribution Copyright (c) 1997-2004, Destroyer Studios LLC. 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 "Destroyer Studios" 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. SUBSYSTEM: Stars.exe FILE: MsnPkgDlg.cpp AUTHOR: John DiCamillo OVERVIEW ======== Mission Briefing Dialog Active Window class */ #include "MemDebug.h" #include "MsnPkgDlg.h" #include "PlanScreen.h" #include "Campaign.h" #include "Mission.h" #include "Instruction.h" #include "Ship.h" #include "ShipDesign.h" #include "StarSystem.h" #include "Game.h" #include "Mouse.h" #include "Button.h" #include "ListBox.h" #include "Slider.h" #include "ParseUtil.h" #include "FormatUtil.h" #include "Keyboard.h" // +--------------------------------------------------------------------+ // DECLARE MAPPING FUNCTIONS: DEF_MAP_CLIENT(MsnPkgDlg, OnPackage); DEF_MAP_CLIENT(MsnPkgDlg, OnCommit); DEF_MAP_CLIENT(MsnPkgDlg, OnCancel); DEF_MAP_CLIENT(MsnPkgDlg, OnTabButton); // +--------------------------------------------------------------------+ MsnPkgDlg::MsnPkgDlg(Screen* s, FormDef& def, PlanScreen* mgr) : FormWindow(s, 0, 0, s->Width(), s->Height()), MsnDlg(mgr) { campaign = Campaign::GetCampaign(); if (campaign) mission = campaign->GetMission(); Init(def); } MsnPkgDlg::~MsnPkgDlg() { } // +--------------------------------------------------------------------+ void MsnPkgDlg::RegisterControls() { pkg_list = (ListBox*) FindControl(320); nav_list = (ListBox*) FindControl(330); for (int i = 0; i < 5; i++) threat[i] = FindControl(251 + i); RegisterMsnControls(this); if (pkg_list) REGISTER_CLIENT(EID_SELECT, pkg_list, MsnPkgDlg, OnPackage); if (commit) REGISTER_CLIENT(EID_CLICK, commit, MsnPkgDlg, OnCommit); if (cancel) REGISTER_CLIENT(EID_CLICK, cancel, MsnPkgDlg, OnCancel); if (sit_button) REGISTER_CLIENT(EID_CLICK, sit_button, MsnPkgDlg, OnTabButton); if (pkg_button) REGISTER_CLIENT(EID_CLICK, pkg_button, MsnPkgDlg, OnTabButton); if (nav_button) REGISTER_CLIENT(EID_CLICK, nav_button, MsnPkgDlg, OnTabButton); if (wep_button) REGISTER_CLIENT(EID_CLICK, wep_button, MsnPkgDlg, OnTabButton); } // +--------------------------------------------------------------------+ void MsnPkgDlg::Show() { FormWindow::Show(); ShowMsnDlg(); DrawPackages(); DrawNavPlan(); DrawThreats(); } // +--------------------------------------------------------------------+ void MsnPkgDlg::DrawPackages() { if (mission) { if (pkg_list) { pkg_list->ClearItems(); int i = 0; int elem_index = 0; ListIter<MissionElement> elem = mission->GetElements(); while (++elem) { // display this element? if (elem->GetIFF() == mission->Team() && !elem->IsSquadron() && elem->Region() == mission->GetRegion() && elem->GetDesign()->type < Ship::STATION) { char txt[256]; if (elem->Player() > 0) { sprintf_s(txt, "==>"); if (pkg_index < 0) pkg_index = elem_index; } else { strcpy_s(txt, " "); } pkg_list->AddItemWithData(txt, elem->ElementID()); pkg_list->SetItemText(i, 1, elem->Name()); pkg_list->SetItemText(i, 2, elem->RoleName()); const ShipDesign* design = elem->GetDesign(); if (elem->Count() > 1) sprintf_s(txt, "%d %s", elem->Count(), design->abrv); else sprintf_s(txt, "%s %s", design->abrv, design->name); pkg_list->SetItemText(i, 3, txt); i++; } elem_index++; } } } } // +--------------------------------------------------------------------+ void MsnPkgDlg::DrawNavPlan() { if (mission) { if (pkg_index < 0 || pkg_index >= mission->GetElements().size()) pkg_index = 0; MissionElement* element = mission->GetElements()[pkg_index]; if (nav_list && element) { nav_list->ClearItems(); Point loc = element->Location(); int i = 0; ListIter<Instruction> navpt = element->NavList(); while (++navpt) { char txt[256]; sprintf_s(txt, "%d", i + 1); nav_list->AddItem(txt); nav_list->SetItemText(i, 1, Instruction::ActionName(navpt->Action())); nav_list->SetItemText(i, 2, navpt->RegionName()); double dist = Point(loc - navpt->Location()).length(); FormatNumber(txt, dist); nav_list->SetItemText(i, 3, txt); sprintf_s(txt, "%d", navpt->Speed()); nav_list->SetItemText(i, 4, txt); loc = navpt->Location(); i++; } } } } // +--------------------------------------------------------------------+ void MsnPkgDlg::DrawThreats() { for (int i = 0; i < 5; i++) if (threat[i]) threat[i]->SetText(""); if (!mission) return; MissionElement* player = mission->GetPlayer(); if (!player) return; Text rgn0 = player->Region(); Text rgn1; int iff = player->GetIFF(); ListIter<Instruction> nav = player->NavList(); while (++nav) { if (rgn0 != nav->RegionName()) rgn1 = nav->RegionName(); } if (threat[0]) { Point base_loc = mission->GetElements()[0]->Location(); int i = 0; ListIter<MissionElement> iter = mission->GetElements(); while (++iter) { MissionElement* elem = iter.value(); if (elem->GetIFF() == 0 || elem->GetIFF() == iff || elem->IntelLevel() <= Intel::SECRET) continue; if (elem->IsSquadron()) continue; if (elem->IsGroundUnit()) { if (!elem->GetDesign() || elem->GetDesign()->type != Ship::SAM) continue; if (elem->Region() != rgn0 && elem->Region() != rgn1) continue; } int mission_role = elem->MissionRole(); if (mission_role == Mission::STRIKE || mission_role == Mission::INTEL || mission_role >= Mission::TRANSPORT) continue; char rng[32]; char role[32]; char txt[256]; if (mission_role == Mission::SWEEP || mission_role == Mission::INTERCEPT || mission_role == Mission::FLEET || mission_role == Mission::BOMBARDMENT) strcpy_s(role, Game::GetText("MsnDlg.ATTACK").data()); else strcpy_s(role, Game::GetText("MsnDlg.PATROL").data()); double dist = Point(base_loc - elem->Location()).length(); FormatNumber(rng, dist); sprintf_s(txt, "%s - %d %s - %s", role, elem->Count(), elem->GetDesign()->abrv, rng); if (threat[i]) threat[i]->SetText(txt); i++; if (i >= 5) break; } } } // +--------------------------------------------------------------------+ void MsnPkgDlg::ExecFrame() { if (Keyboard::KeyDown(VK_RETURN)) { OnCommit(0); } } // +--------------------------------------------------------------------+ void MsnPkgDlg::OnPackage(AWEvent* event) { if (!pkg_list || !mission) return; int seln = pkg_list->GetListIndex(); int pkg = pkg_list->GetItemData(seln); int i = 0; ListIter<MissionElement> elem = mission->GetElements(); while (++elem) { if (elem->ElementID() == pkg) { pkg_index = i; //mission->SetPlayer(elem.value()); } i++; } //DrawPackages(); DrawNavPlan(); } // +--------------------------------------------------------------------+ void MsnPkgDlg::OnCommit(AWEvent* event) { MsnDlg::OnCommit(event); } void MsnPkgDlg::OnCancel(AWEvent* event) { MsnDlg::OnCancel(event); } void MsnPkgDlg::OnTabButton(AWEvent* event) { MsnDlg::OnTabButton(event); }
28.166205
100
0.511802
RogerioY
848317df56ef0f0347b205e49b6e0ac9e30efd4d
4,861
cpp
C++
EjercicioiPud/EjercicioiPud/mainApartadob17-18.cpp
gejors55/Algorithm
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
[ "MIT" ]
null
null
null
EjercicioiPud/EjercicioiPud/mainApartadob17-18.cpp
gejors55/Algorithm
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
[ "MIT" ]
null
null
null
EjercicioiPud/EjercicioiPud/mainApartadob17-18.cpp
gejors55/Algorithm
107d6cf4eb8fc7f4d0cebfe9b4e7b2811ac10533
[ "MIT" ]
null
null
null
// Examen junio 2016: Implementacion de un sistema de reproduccion de musica // APDO B: hay que reducir los costes de deleteSong y play #include "lista.h" #include "DiccionarioHash.h" #include <iostream> #include <string> using namespace std; typedef string Cancion; typedef string Artista; class SongInfo { public: Artista artist; int duration; // APDO B: sustituimos los booleanos por iteradores que apuntan al elemento de las listas // de reproducción y reproducidas donde están las canciones de las que el correspondiente // objeto SongInfo es información //bool inPlaylist; //bool played; Lista<Cancion>::Iterator itPlaylist; Lista<Cancion>::Iterator itPlayed; // OJO: los constructores de los iteradores son privados // Definimos el siguiente constructor al que le pasaremos los end() de las listas correspondientes // cuando creemos un objeto en addSong SongInfo(const Lista<Cancion>::Iterator& itplaylist, const Lista<Cancion>::Iterator& itplayedlist) : itPlaylist(itplaylist), itPlayed(itplayedlist) {} }; // clases excepcion para iPud class ECancionExistente{}; class ECancionNoExistente{}; // clase iPud class iPud { Lista<Cancion> playlist; Lista<Cancion> played; int duration; DiccionarioHash<Cancion,SongInfo> songs; public: iPud() : duration(0), playlist(Lista<Cancion>()), played(Lista<Cancion>()), songs(DiccionarioHash<Cancion, SongInfo>()) {} void addSong(const Cancion& c, const Artista& a, int d); void addToPlaylist(const Cancion& c); Cancion current(); void play(); void deleteSong(const Cancion& c); int totalTime(); Cancion recent(); }; // creación de la información de la canción // APDO. B: Los iteradores de momento no tienen que apuntar a nada porque lo único // que estamos haciendo es meter la canción en la colección de canciones existentes void iPud::addSong(const Cancion& c, const Artista& a, int d){ if (songs.contiene(c)) throw ECancionExistente(); SongInfo i(playlist.end(), played.end()); i.artist = a; i.duration = d; // inclusión en el diccionario songs.inserta(c,i); } void iPud::addToPlaylist(const Cancion& c){ if (!songs.contiene(c))throw ECancionNoExistente(); Lista<Cancion>::Iterator it = playlist.end(); if (songs.valorPara(c).itPlaylist == it){ playlist.pon_ppio(c); Lista<Cancion>::Iterator ite = playlist.begin(); songs.busca(c).valor().itPlaylist = ite; duration += songs.valorPara(c).duration; } } Cancion iPud::current(){ if (playlist.esVacia()){ cout << "LISTA DE REPRODUCCION VACIA" << endl; } else{ return playlist.ultimo(); } } void iPud::play(){ if (!playlist.esVacia()){ played.pon_ppio(playlist.ultimo()); //meto en played la cancion Lista<Cancion>::Iterator it = played.begin(); songs.busca(played.ultimo()).valor().itPlayed = it;// meto el iterador de conde esta en played duration -= songs.valorPara(playlist.ultimo()).duration;//cambio la duracion playlist.eliminar(songs.valorPara(playlist.ultimo()).itPlaylist);//borro la cancion de playlist } } void iPud::deleteSong(const Cancion& c){ if (songs.contiene(c)){ Lista<Cancion>::Iterator it = playlist.end(); Lista<Cancion>::Iterator ite = played.end(); if (songs.valorPara(c).itPlaylist != it){ playlist.eliminar(songs.valorPara(c).itPlaylist); } if (songs.valorPara(c).itPlayed != ite){ played.eliminar(songs.valorPara(c).itPlayed); } songs.borra(c); } } int iPud::totalTime(){ if (!playlist.esVacia()){ return duration; } else return 0; } Cancion iPud::recent(){ if (played.esVacia()){ cout << "LISTA DE REPRODUCCION VACIA" << endl; } else{ return played.ultimo(); } } /////MAIN void añade(iPud& ip) { Cancion c; Artista a; int d; cin >> c >> a >> d; try { ip.addSong(c, a, d); cout << "OK" << endl; } catch (ECancionExistente) { cout << "CANCION_EXISTENTE" << endl; } } void añadelista(iPud& ip) { try { Cancion c; cin >> c; ip.addToPlaylist(c); cout << "OK" << endl; } catch (ECancionNoExistente) { cout << "CANCION_NO_EXISTENTE" << endl; } } void borra(iPud& ip) { Cancion c; cin >> c; ip.deleteSong(c); cout << "OK" << endl; } void playe(iPud& ip){ ip.play(); } void current(iPud& ip) { Cancion c; c =ip.current(); cout << c << endl; } void tiemposs(iPud& ip){ int tiempo; tiempo = ip.totalTime(); cout << "tiempo total " << tiempo << endl; } void rec(iPud& ip){ Cancion c; c = ip.recent(); cout << c << endl; } int main() { iPud ip; string comando; while (cin >> comando) { if (comando == "anade") añade(ip); else if (comando == "lista") añadelista(ip); else if (comando == "play") playe(ip); else if (comando == "actu") current(ip); else if (comando == "borra") borra(ip); else if (comando == "tiempo") tiemposs(ip); else if (comando == "recent") rec(ip); } return 0; }
26.708791
123
0.67517
gejors55
848511b8fca7ca5773692746797029eb92023728
19,813
cpp
C++
ortc/services/cpp/services_STUNRequester.cpp
ortclib/ortclib-services-cpp
f770d97044b1ffbff04b61fa1488eedc8ddc66e4
[ "BSD-2-Clause" ]
2
2016-10-12T09:16:32.000Z
2016-10-13T03:49:47.000Z
ortc/services/cpp/services_STUNRequester.cpp
ortclib/ortclib-services-cpp
f770d97044b1ffbff04b61fa1488eedc8ddc66e4
[ "BSD-2-Clause" ]
2
2017-11-24T09:18:45.000Z
2017-11-24T09:20:53.000Z
ortc/services/cpp/services_STUNRequester.cpp
ortclib/ortclib-services-cpp
f770d97044b1ffbff04b61fa1488eedc8ddc66e4
[ "BSD-2-Clause" ]
null
null
null
/* Copyright (c) 2014, Hookflash Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE 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. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ #include <ortc/services/internal/services_STUNRequester.h> #include <ortc/services/internal/services_STUNRequesterManager.h> #include <ortc/services/internal/services.events.h> #include <ortc/services/IBackOffTimerPattern.h> #include <ortc/services/IHelper.h> #include <zsLib/Exception.h> #include <zsLib/helpers.h> #include <zsLib/Log.h> #include <zsLib/XML.h> #include <zsLib/Stringize.h> #define ORTC_SERVICES_STUN_REQUESTER_DEFAULT_BACKOFF_TIMER_MAX_ATTEMPTS (6) namespace ortc { namespace services { ZS_DECLARE_SUBSYSTEM(ortc_services_stun) } } namespace ortc { namespace services { namespace internal { ZS_DECLARE_TYPEDEF_PTR(ISTUNRequesterManagerForSTUNRequester, UseSTUNRequesterManager) //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark STUNRequester #pragma mark //----------------------------------------------------------------------- STUNRequester::STUNRequester( const make_private &, IMessageQueuePtr queue, ISTUNRequesterDelegatePtr delegate, IPAddress serverIP, STUNPacketPtr stun, STUNPacket::RFCs usingRFC, IBackOffTimerPatternPtr pattern ) : MessageQueueAssociator(queue), mDelegate(ISTUNRequesterDelegateProxy::createWeak(queue, delegate)), mSTUNRequest(stun), mServerIP(serverIP), mUsingRFC(usingRFC), mBackOffTimerPattern(pattern) { if (!mBackOffTimerPattern) { mBackOffTimerPattern = IBackOffTimerPattern::create(); mBackOffTimerPattern->setMaxAttempts(ORTC_SERVICES_STUN_REQUESTER_DEFAULT_BACKOFF_TIMER_MAX_ATTEMPTS); mBackOffTimerPattern->addNextAttemptTimeout(Milliseconds(500)); mBackOffTimerPattern->setMultiplierForLastAttemptTimeout(2.0); mBackOffTimerPattern->addNextRetryAfterFailureDuration(Milliseconds(1)); } //ServicesStunRequesterCreate(__func__, mID, serverIP.string(), zsLib::to_underlying(usingRFC), mBackOffTimerPattern->getID()); ZS_EVENTING_4( x, i, Debug, ServicesStunRequesterCreate, os, StunRequester, Start, puid, id, mID, string, serverIp, serverIP.string(), enum, usingRfc, zsLib::to_underlying(usingRFC), puid, backoffTimerPatterId, mBackOffTimerPattern->getID() ); } //----------------------------------------------------------------------- STUNRequester::~STUNRequester() { if(isNoop()) return; mThisWeak.reset(); cancel(); //ServicesStunRequesterDestroy(__func__, mID); ZS_EVENTING_1(x, i, Debug, ServicesStunRequesterDestroy, os, StunRequester, Start, puid, id, mID); } //----------------------------------------------------------------------- void STUNRequester::init() { AutoRecursiveLock lock(mLock); UseSTUNRequesterManagerPtr manager = UseSTUNRequesterManager::singleton(); if (manager) { manager->monitorStart(mThisWeak.lock(), mSTUNRequest); } step(); } //----------------------------------------------------------------------- STUNRequesterPtr STUNRequester::convert(ISTUNRequesterPtr object) { return ZS_DYNAMIC_PTR_CAST(STUNRequester, object); } //----------------------------------------------------------------------- STUNRequesterPtr STUNRequester::convert(ForSTUNRequesterManagerPtr object) { return ZS_DYNAMIC_PTR_CAST(STUNRequester, object); } //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark STUNRequester => STUNRequester #pragma mark //----------------------------------------------------------------------- STUNRequesterPtr STUNRequester::create( IMessageQueuePtr queue, ISTUNRequesterDelegatePtr delegate, IPAddress serverIP, STUNPacketPtr stun, STUNPacket::RFCs usingRFC, IBackOffTimerPatternPtr pattern ) { ZS_THROW_INVALID_USAGE_IF(!delegate) ZS_THROW_INVALID_USAGE_IF(!stun) ZS_THROW_INVALID_USAGE_IF(serverIP.isAddressEmpty()) ZS_THROW_INVALID_USAGE_IF(serverIP.isPortEmpty()) STUNRequesterPtr pThis(make_shared<STUNRequester>(make_private{}, queue, delegate, serverIP, stun, usingRFC, pattern)); pThis->mThisWeak = pThis; pThis->init(); return pThis; } //----------------------------------------------------------------------- bool STUNRequester::isComplete() const { AutoRecursiveLock lock(mLock); if (!mDelegate) return true; return false; } //----------------------------------------------------------------------- void STUNRequester::cancel() { //ServicesStunRequesterCancel(__func__, mID); ZS_EVENTING_1(x, i, Debug, ServicesStunRequesterCancel, os, StunRequester, Cancel, puid, id, mID); AutoRecursiveLock lock(mLock); ZS_LOG_TRACE(log("cancel called") + mSTUNRequest->toDebug()) mServerIP.clear(); if (mDelegate) { mDelegate.reset(); // tie the lifetime of the monitoring to the delegate UseSTUNRequesterManagerPtr manager = UseSTUNRequesterManager::singleton(); if (manager) { manager->monitorStop(*this); } } } //----------------------------------------------------------------------- void STUNRequester::retryRequestNow() { //ServicesStunRequesterRetryNow(__func__, mID); ZS_EVENTING_1(x, i, Trace, ServicesStunRequesterRetryNow, os, StunRequester, RetryNow, puid, id, mID); AutoRecursiveLock lock(mLock); ZS_LOG_DEBUG(log("retry request now") + mSTUNRequest->toDebug()) if (mBackOffTimer) { mBackOffTimer->cancel(); mBackOffTimer.reset(); } step(); } //----------------------------------------------------------------------- IPAddress STUNRequester::getServerIP() const { AutoRecursiveLock lock(mLock); return mServerIP; } //----------------------------------------------------------------------- STUNPacketPtr STUNRequester::getRequest() const { AutoRecursiveLock lock(mLock); return mSTUNRequest; } //----------------------------------------------------------------------- IBackOffTimerPatternPtr STUNRequester::getBackOffTimerPattern() const { AutoRecursiveLock lock(mLock); return mBackOffTimerPattern; } //----------------------------------------------------------------------- size_t STUNRequester::getTotalTries() const { AutoRecursiveLock lock(mLock); return mTotalTries; } //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark STUNRequester => ISTUNRequesterForSTUNRequesterManager #pragma mark //----------------------------------------------------------------------- bool STUNRequester::handleSTUNPacket( IPAddress fromIPAddress, STUNPacketPtr packet ) { //ServicesStunRequesterReceivedStunPacket(__func__, mID, fromIPAddress.string()); ZS_EVENTING_2(x, i, Debug, ServicesStunRequesterReceivedStunPacket, os, StunRequester, Receive, puid, id, mID, string, fromIpAddress, fromIPAddress.string()); packet->trace(__func__); ISTUNRequesterDelegatePtr delegate; // find out if this was truly handled { AutoRecursiveLock lock(mLock); if (!mSTUNRequest) return false; if (!packet->isValidResponseTo(mSTUNRequest, mUsingRFC)) { ZS_LOG_TRACE(log("determined this response is not a proper validated response") + packet->toDebug()) return false; } delegate = mDelegate; } bool success = true; // we now have a reply, inform the delegate... // NOTE: We inform the delegate syncrhonously thus we cannot call // the delegate from inside a lock in case the delegate is // calling us (that would cause a potential deadlock). if (delegate) { try { success = delegate->handleSTUNRequesterResponse(mThisWeak.lock(), fromIPAddress, packet); // this is a success! yay! inform the delegate } catch(ISTUNRequesterDelegateProxy::Exceptions::DelegateGone &) { } } if (!success) return false; // clear out the request since it's now complete { AutoRecursiveLock lock(mLock); if (ZS_IS_LOGGING(Trace)) { ZS_LOG_BASIC(log("handled") + ZS_PARAM("ip", mServerIP.string()) + ZS_PARAM("request", mSTUNRequest->toDebug()) + ZS_PARAM("response", packet->toDebug())) } cancel(); } return true; } //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark STUNRequester => ITimerDelegate #pragma mark //----------------------------------------------------------------------- void STUNRequester::onBackOffTimerStateChanged( IBackOffTimerPtr timer, IBackOffTimer::States state ) { //ServicesStunRequesterBackOffTimerStateEvent(__func__, mID, timer->getID(), IBackOffTimer::toString(state), mTotalTries); ZS_EVENTING_4( x, i, Trace, ServicesStunRequesterBackOffTimerStateEvent, os, StunRequester, InternalEvent, puid, id, mID, puid, timerId, timer->getID(), string, backoffTimerState, IBackOffTimer::toString(state), ulong, totalTries, mTotalTries ); AutoRecursiveLock lock(mLock); ZS_LOG_TRACE(log("backoff timer state changed") + ZS_PARAM("timer id", timer->getID()) + ZS_PARAM("state", IBackOffTimer::toString(state)) + ZS_PARAM("total tries", mTotalTries)) step(); } //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark STUNRequester => (internal) #pragma mark //----------------------------------------------------------------------- Log::Params STUNRequester::log(const char *message) const { ElementPtr objectEl = Element::create("STUNRequester"); IHelper::debugAppend(objectEl, "id", mID); return Log::Params(message, objectEl); } //----------------------------------------------------------------------- void STUNRequester::step() { if (!mDelegate) return; // if there is no delegate then the request has completed or is cancelled if (mServerIP.isAddressEmpty()) return; if (!mBackOffTimer) { mBackOffTimer = IBackOffTimer::create(mBackOffTimerPattern, mThisWeak.lock()); } if (mBackOffTimer->haveAllAttemptsFailed()) { try { mDelegate->onSTUNRequesterTimedOut(mThisWeak.lock()); } catch(ISTUNRequesterDelegateProxy::Exceptions::DelegateGone &) { ZS_LOG_WARNING(Debug, log("delegate gone")) } cancel(); return; } if (mBackOffTimer->shouldAttemptNow()) { mBackOffTimer->notifyAttempting(); ZS_LOG_TRACE(log("sending packet now") + ZS_PARAM("ip", mServerIP.string()) + ZS_PARAM("tries", mTotalTries) + ZS_PARAM("stun packet", mSTUNRequest->toDebug())) // send off the packet NOW SecureByteBlockPtr packet = mSTUNRequest->packetize(mUsingRFC); //ServicesStunRequesterSendPacket(__func__, mID, packet->SizeInBytes(), packet->BytePtr()); ZS_EVENTING_3( x, i, Trace, ServicesStunRequesterSendPacket, os, StunRequester, Send, puid, id, mID, binary, packet, packet->BytePtr(), size, size, packet->SizeInBytes() ); mSTUNRequest->trace(__func__); try { ++mTotalTries; mDelegate->onSTUNRequesterSendPacket(mThisWeak.lock(), mServerIP, packet); } catch(ISTUNRequesterDelegateProxy::Exceptions::DelegateGone &) { ZS_LOG_WARNING(Trace, log("delegate gone thus cancelling requester")) cancel(); return; } } // nothing more to do... sit back, relax and enjoy the ride! } //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- #pragma mark #pragma mark ISTUNRequesterFactory #pragma mark //----------------------------------------------------------------------- ISTUNRequesterFactory &ISTUNRequesterFactory::singleton() { return STUNRequesterFactory::singleton(); } //----------------------------------------------------------------------- STUNRequesterPtr ISTUNRequesterFactory::create( IMessageQueuePtr queue, ISTUNRequesterDelegatePtr delegate, IPAddress serverIP, STUNPacketPtr stun, STUNPacket::RFCs usingRFC, IBackOffTimerPatternPtr pattern ) { if (this) {} return STUNRequester::create(queue, delegate, serverIP, stun, usingRFC, pattern); } } //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- //------------------------------------------------------------------------- #pragma mark #pragma mark ISTUNRequester #pragma mark //------------------------------------------------------------------------- ISTUNRequesterPtr ISTUNRequester::create( IMessageQueuePtr queue, ISTUNRequesterDelegatePtr delegate, IPAddress serverIP, STUNPacketPtr stun, STUNPacket::RFCs usingRFC, IBackOffTimerPatternPtr pattern ) { return internal::ISTUNRequesterFactory::singleton().create(queue, delegate, serverIP, stun, usingRFC, pattern); } //------------------------------------------------------------------------- bool ISTUNRequester::handlePacket( IPAddress fromIPAddress, const BYTE *packet, size_t packetLengthInBytes, const STUNPacket::ParseOptions &options ) { return (bool)ISTUNRequesterManager::handlePacket(fromIPAddress, packet, packetLengthInBytes, options); } //------------------------------------------------------------------------- bool ISTUNRequester::handleSTUNPacket( IPAddress fromIPAddress, STUNPacketPtr stun ) { return (bool)ISTUNRequesterManager::handleSTUNPacket(fromIPAddress, stun); } } }
41.976695
186
0.465704
ortclib
84883167c136c85e9d284932f1e8e047fa5e8c5e
190
cpp
C++
Cpp_Programs/races/luogu201809/U38228.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
2
2018-10-01T09:03:35.000Z
2019-05-24T08:53:06.000Z
Cpp_Programs/races/luogu201809/U38228.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
Cpp_Programs/races/luogu201809/U38228.cpp
xiazeyu/OI_Resource
1de0ab9a84ee22ae4edb612ddeddc712c3c38e56
[ "Apache-2.0" ]
null
null
null
#include <bits/stdc++.h> using namespace std; long long t = 1, n = 1, m, k; int main(){ cin>>k>>m; while(t % m != k){ n++; t *= 10; t++; } cout<<n<<endl; return 0; }
10
29
0.463158
xiazeyu
848d3ca446afec18d09b4df45250d87f812141c1
10,758
hpp
C++
Systems/Engine/ComponentHierarchy.hpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
52
2018-09-11T17:18:35.000Z
2022-03-13T15:28:21.000Z
Systems/Engine/ComponentHierarchy.hpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
1,409
2018-09-19T18:03:43.000Z
2021-06-09T08:33:33.000Z
Systems/Engine/ComponentHierarchy.hpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
26
2018-09-11T17:16:32.000Z
2021-11-22T06:21:19.000Z
/////////////////////////////////////////////////////////////////////////////// /// /// \file ComponentHierarchy.cpp /// /// Authors: Joshua Claeys /// Copyright 2015, DigiPen Institute of Technology /// /////////////////////////////////////////////////////////////////////////////// #pragma once namespace Zero { //----------------------------------------------------- Component Hierarchy Base /// Needed for an intrusive link template <typename ComponentType> class ComponentHierarchyBase : public Component { public: IntrusiveLink(ComponentHierarchyBase<ComponentType>, HierarchyLink); }; //---------------------------------------------------------- Component Hierarchy /// Maintains a hierarchy of specific Components. When a hierarchy of Components /// is required, this removes the need to manually manage the hierarchy, and /// also removes the overhead of component lookups while iterating over the /// hierarchy. template <typename ComponentType> class ComponentHierarchy : public ComponentHierarchyBase<ComponentType> { public: ZilchDeclareType(TypeCopyMode::ReferenceType); // Typedefs. typedef ComponentHierarchy<ComponentType> self_type; typedef ComponentHierarchyBase<ComponentType> BaseType; typedef BaseInList<BaseType, ComponentType, &BaseType::HierarchyLink> ChildList; typename typedef ChildList::range ChildListRange; typename typedef ChildList::reverse_range ChildListReverseRange; /// Constructor. ComponentHierarchy(); ~ComponentHierarchy(); /// Component Interface. void Initialize(CogInitializer& initializer) override; void AttachTo(AttachmentInfo& info) override; void Detached(AttachmentInfo& info) override; /// When a child is attached or detached, we need to update our child list. void OnChildAttached(HierarchyEvent* e); void OnChildDetached(HierarchyEvent* e); void OnChildrenOrderChanged(Event* e); /// Tree traversal helpers. ComponentType* GetPreviousSibling(); ComponentType* GetNextSibling(); ComponentType* GetLastDirectChild(); ComponentType* GetLastDeepestChild(); ComponentType* GetNextInHierarchyOrder(); ComponentType* GetPreviousInHierarchyOrder(); ComponentType* GetRoot(); /// Returns whether or not we are a descendant of the given Cog. bool IsDescendantOf(ComponentType& ancestor); /// Returns whether or not we are an ancestor of the given Cog. bool IsAncestorOf(ComponentType& descendant); typename ChildListRange GetChildren(){return mChildren.All();} typename ChildListReverseRange GetChildrenReverse() { return mChildren.ReverseAll(); } /// Returns the amount of children. Note that this function has to iterate over /// all children to calculate the count. uint GetChildCount(); ComponentType* mParent; ChildList mChildren; }; //****************************************************************************** template <typename ComponentType> ZilchDefineType(ComponentHierarchy<ComponentType>, builder, type) { ZeroBindDocumented(); ZilchBindGetter(PreviousSibling); ZilchBindGetter(NextSibling); ZilchBindGetter(LastDirectChild); ZilchBindGetter(LastDeepestChild); ZilchBindGetter(NextInHierarchyOrder); ZilchBindGetter(PreviousInHierarchyOrder); ZilchBindFieldGetter(mParent); ZilchBindGetter(Root); ZilchBindGetter(ChildCount); ZilchBindMethod(GetChildren); ZilchBindMethod(IsDescendantOf); ZilchBindMethod(IsAncestorOf); } //****************************************************************************** template <typename ComponentType> ComponentHierarchy<ComponentType>::ComponentHierarchy() : mParent(nullptr) { } //****************************************************************************** template <typename ComponentType> ComponentHierarchy<ComponentType>::~ComponentHierarchy() { forRange(ComponentType& child, GetChildren()) child.mParent = nullptr; if (mParent) mParent->mChildren.Erase(this); mChildren.Clear(); } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::Initialize(CogInitializer& initializer) { // Add ourself to our parent if(Cog* parent = GetOwner()->GetParent()) { if(ComponentType* component = parent->has(ComponentType)) { mParent = component; mParent->mChildren.PushBack(this); } } // If we were dynamically added, we need to add all of our children. If we // aren't dynamically added, our children will add themselves to our child list // in their initialize if (initializer.Flags & CreationFlags::DynamicallyAdded) { forRange(Cog& childCog, GetOwner()->GetChildren()) { if (ComponentType* child = childCog.has(ComponentType)) { child->mParent = (ComponentType*)this; mChildren.PushBack(child); } } } ConnectThisTo(GetOwner(), Events::ChildAttached, OnChildAttached); ConnectThisTo(GetOwner(), Events::ChildDetached, OnChildDetached); ConnectThisTo(GetOwner(), Events::ChildrenOrderChanged, OnChildrenOrderChanged); } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::OnChildAttached(HierarchyEvent* e) { if(e->Parent != GetOwner()) return; if(ComponentType* component = e->Child->has(ComponentType)) mChildren.PushBack(component); } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::OnChildDetached(HierarchyEvent* e) { if(e->Parent != GetOwner()) return; if(ComponentType* component = e->Child->has(ComponentType)) mChildren.Erase(component); } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::OnChildrenOrderChanged(Event* e) { // The event isn't currently sent information as to which object moved // where, so we're just going to re-build the child list mChildren.Clear(); forRange(Cog& child, GetOwner()->GetChildren()) { if(ComponentType* childComponent = child.has(ComponentType)) mChildren.PushBack(childComponent); } } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::AttachTo(AttachmentInfo& info) { if(info.Child == GetOwner()) mParent = info.Parent->has(ComponentType); } //****************************************************************************** template <typename ComponentType> void ComponentHierarchy<ComponentType>::Detached(AttachmentInfo& info) { if(info.Child == GetOwner()) mParent = nullptr; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetPreviousSibling() { ComponentType* prev = (ComponentType*)ChildList::Prev(this); if(mParent && prev != mParent->mChildren.End()) return prev; return nullptr; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetNextSibling() { ComponentType* next = (ComponentType*)ChildList::Next(this); if(mParent && next != mParent->mChildren.End()) return next; return nullptr; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetLastDirectChild() { if(!mChildren.Empty()) return &mChildren.Back(); return nullptr; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetLastDeepestChild() { if (UiWidget* lastChild = GetLastDirectChild()) return lastChild->GetLastDeepestChild(); else return (ComponentType*)this; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetNextInHierarchyOrder() { // If this object has children return the first child if(!mChildren.Empty()) return &mChildren.Front(); // Return next sibling if there is one ComponentType* nextSibling = GetNextSibling(); if(nextSibling) return nextSibling; // Loop until the root or a parent has a sibling ComponentType* parent = mParent; while(parent != nullptr) { ComponentType* parentSibling = parent->GetNextSibling(); if(parentSibling) return parentSibling; else parent = parent->mParent; } return nullptr; } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetPreviousInHierarchyOrder() { // Get prev sibling if there is one ComponentType* prevSibling = GetPreviousSibling(); // If this is first node of a child it is previous node if(prevSibling == nullptr) return mParent; // Return the last child of the sibling return prevSibling->GetLastDeepestChild(); } //****************************************************************************** template <typename ComponentType> ComponentType* ComponentHierarchy<ComponentType>::GetRoot() { ComponentType* curr = (ComponentType*)this; while(curr->mParent) curr = curr->mParent; return curr; } //****************************************************************************** template <typename ComponentType> bool ComponentHierarchy<ComponentType>::IsDescendantOf(ComponentType& ancestor) { return ancestor.IsAncestorOf(*(ComponentType*)this); } //****************************************************************************** template <typename ComponentType> bool ComponentHierarchy<ComponentType>::IsAncestorOf(ComponentType& descendant) { ComponentType* current = &descendant; while (current) { current = current->mParent; if (current == this) return true; } return false; } //****************************************************************************** template <typename ComponentType> uint ComponentHierarchy<ComponentType>::GetChildCount() { uint count = 0; forRange(ComponentType& child, GetChildren()) ++count; return count; } }//namespace Zero
32.501511
89
0.602993
RachelWilSingh
84910428c956dcee2663eb045837180f46ac9b40
4,066
hpp
C++
src/ruby/ruby_observation.hpp
bburns/cppagent
c1891c631465ebc9b63a4b3c627727ca3da14ee8
[ "Apache-2.0" ]
null
null
null
src/ruby/ruby_observation.hpp
bburns/cppagent
c1891c631465ebc9b63a4b3c627727ca3da14ee8
[ "Apache-2.0" ]
null
null
null
src/ruby/ruby_observation.hpp
bburns/cppagent
c1891c631465ebc9b63a4b3c627727ca3da14ee8
[ "Apache-2.0" ]
null
null
null
// // Copyright Copyright 2009-2022, AMT – The Association For Manufacturing Technology (“AMT”) // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #pragma once #include "observation/observation.hpp" #include "ruby_entity.hpp" #include "ruby_vm.hpp" namespace mtconnect::ruby { using namespace mtconnect::observation; using namespace std; using namespace Rice; struct RubyObservation { static void initialize(mrb_state *mrb, RClass *module) { auto entityClass = mrb_class_get_under(mrb, module, "Entity"); auto observationClass = mrb_define_class_under(mrb, module, "Observation", entityClass); MRB_SET_INSTANCE_TT(observationClass, MRB_TT_DATA); mrb_define_method( mrb, observationClass, "initialize", [](mrb_state *mrb, mrb_value self) { using namespace device_model::data_item; mrb_value di; mrb_value props; mrb_value ts; ErrorList errors; Timestamp time; auto count = mrb_get_args(mrb, "oo|o", &di, &props, &ts); auto dataItem = MRubySharedPtr<Entity>::unwrap<DataItem>(mrb, di); if (count < 3) time = std::chrono::system_clock::now(); else time = timestampFromRuby(mrb, ts); Properties values; fromRuby(mrb, props, values); ObservationPtr obs = Observation::make(dataItem, values, time, errors); if (errors.size() > 0) { ostringstream str; for (auto &e : errors) { str << e->what() << ", "; } mrb_raise(mrb, E_ARGUMENT_ERROR, str.str().c_str()); } MRubySharedPtr<Entity>::replace(mrb, self, obs); return self; }, MRB_ARGS_ARG(2, 1)); mrb_define_method( mrb, observationClass, "dup", [](mrb_state *mrb, mrb_value self) { ObservationPtr old = MRubySharedPtr<Entity>::unwrap<Observation>(mrb, self); RClass *klass = mrb_class(mrb, self); auto dup = old->copy(); return MRubySharedPtr<Entity>::wrap(mrb, klass, dup); }, MRB_ARGS_NONE()); mrb_alias_method(mrb, observationClass, mrb_intern_lit(mrb, "copy"), mrb_intern_lit(mrb, "dup")); mrb_define_method( mrb, observationClass, "data_item", [](mrb_state *mrb, mrb_value self) { ObservationPtr obs = MRubySharedPtr<Entity>::unwrap<Observation>(mrb, self); return MRubySharedPtr<Entity>::wrap(mrb, "DataItem", obs->getDataItem()); }, MRB_ARGS_NONE()); mrb_define_method( mrb, observationClass, "timestamp", [](mrb_state *mrb, mrb_value self) { ObservationPtr obs = MRubySharedPtr<Entity>::unwrap<Observation>(mrb, self); return toRuby(mrb, obs->getTimestamp()); }, MRB_ARGS_NONE()); auto eventClass = mrb_define_class_under(mrb, module, "Event", observationClass); MRB_SET_INSTANCE_TT(eventClass, MRB_TT_DATA); auto sampleClass = mrb_define_class_under(mrb, module, "Sample", observationClass); MRB_SET_INSTANCE_TT(sampleClass, MRB_TT_DATA); auto conditionClass = mrb_define_class_under(mrb, module, "Condition", observationClass); MRB_SET_INSTANCE_TT(conditionClass, MRB_TT_DATA); } }; } // namespace mtconnect::ruby
34.457627
95
0.615101
bburns
849d1a4611202993be04185a261a961e28f549bb
815
cpp
C++
bmc/version-handler/test/version_createhandler_unittest.cpp
pzh2386034/phosphor-ipmi-flash
c557dc1302e46c60431af8b55056c5d24331063b
[ "Apache-2.0" ]
7
2019-01-20T08:36:51.000Z
2021-09-04T19:03:53.000Z
bmc/version-handler/test/version_createhandler_unittest.cpp
pzh2386034/phosphor-ipmi-flash
c557dc1302e46c60431af8b55056c5d24331063b
[ "Apache-2.0" ]
9
2018-08-06T03:30:47.000Z
2022-03-08T17:28:07.000Z
bmc/version-handler/test/version_createhandler_unittest.cpp
pzh2386034/phosphor-ipmi-flash
c557dc1302e46c60431af8b55056c5d24331063b
[ "Apache-2.0" ]
4
2019-08-22T21:03:59.000Z
2021-12-17T10:00:05.000Z
#include "version_handler.hpp" #include "version_mock.hpp" #include <array> #include <utility> #include <gtest/gtest.h> namespace ipmi_flash { TEST(VersionHandlerCanHandleTest, VerifyGoodInfoMapPasses) { constexpr std::array blobs{"blob0", "blob1"}; VersionBlobHandler handler(createMockVersionConfigs(blobs)); EXPECT_THAT(handler.getBlobIds(), testing::UnorderedElementsAreArray(blobs)); } TEST(VersionHandlerCanHandleTest, VerifyDuplicatesIgnored) { constexpr std::array blobs{"blob0"}; auto configs = createMockVersionConfigs(blobs); configs.push_back(createMockVersionConfig(blobs[0])); VersionBlobHandler handler(std::move(configs)); EXPECT_THAT(handler.getBlobIds(), testing::UnorderedElementsAreArray(blobs)); } } // namespace ipmi_flash
26.290323
64
0.741104
pzh2386034
849e873e41c7c54aa501e113692a1e59a073ebce
678
cpp
C++
real-app/src/OStreamSink.cpp
rasa/REAL
077e6fe2e6242f41bf401960562ccfecc6ca6a18
[ "MIT" ]
227
2018-08-18T00:02:49.000Z
2022-03-30T00:28:10.000Z
real-app/src/OStreamSink.cpp
rasa/REAL
077e6fe2e6242f41bf401960562ccfecc6ca6a18
[ "MIT" ]
16
2018-08-24T20:44:39.000Z
2021-08-24T20:05:06.000Z
real-app/src/OStreamSink.cpp
rasa/REAL
077e6fe2e6242f41bf401960562ccfecc6ca6a18
[ "MIT" ]
18
2018-12-02T16:44:21.000Z
2022-02-25T23:49:38.000Z
#include "OStreamSink.h" using namespace miniant::Spdlog; OStreamSink::OStreamSink(std::shared_ptr<std::ostream> outputStream, bool forceFlush): m_outputStream(std::move(outputStream)), m_forceFlush(forceFlush) {} std::mutex& OStreamSink::GetMutex() { return mutex_; } void OStreamSink::sink_it_(const spdlog::details::log_msg& message) { fmt::memory_buffer formattedMessage; sink::formatter_->format(message, formattedMessage); m_outputStream->write(formattedMessage.data(), static_cast<std::streamsize>(formattedMessage.size())); if (m_forceFlush) m_outputStream->flush(); } void OStreamSink::flush_() { m_outputStream->flush(); }
28.25
106
0.733038
rasa
849ee3eb41d189b2cc0ad4597b63c4a8628ad4d2
2,883
cpp
C++
hands-on/architecture/pipeline.cpp
Hiigaran/esc21
d0d7f0fa7079edc124821e96ef677cda2a2235a1
[ "CC-BY-4.0" ]
1
2021-11-05T14:44:55.000Z
2021-11-05T14:44:55.000Z
hands-on/architecture/pipeline.cpp
Hiigaran/esc21
d0d7f0fa7079edc124821e96ef677cda2a2235a1
[ "CC-BY-4.0" ]
null
null
null
hands-on/architecture/pipeline.cpp
Hiigaran/esc21
d0d7f0fa7079edc124821e96ef677cda2a2235a1
[ "CC-BY-4.0" ]
null
null
null
#include <chrono> #include <array> #include <iostream> #include "benchmark.h" inline size_t fib(size_t n) { if (n == 0) return n; if (n == 1) return 1; return fib(n - 1) + fib(n - 2); } inline double perform_computation(int w) { return fib(w); } int main() { using namespace std; auto start = chrono::high_resolution_clock::now(); auto delta = start - start; int value = 42; benchmark::touch(value); double answer = perform_computation(value); benchmark::keep(answer); delta = chrono::high_resolution_clock::now() - start; std::cout << "Answer: " << answer << ". Computation took " << chrono::duration_cast<chrono::milliseconds>(delta).count() << " ms" << std::endl; constexpr int N=1025; std::array<float,N> x,y,z; benchmark::touch(x); benchmark::touch(y); benchmark::touch(z); for (int i=0; i<N; ++i) z[i]=y[i]=x[i]=i*1.e-6; benchmark::keep(z); delta = start - start; for (int j=0; j<1000000; ++j) { delta -= (chrono::high_resolution_clock::now()-start); benchmark::touch(x); benchmark::touch(y); benchmark::touch(z); for (int i=0; i<N-1; ++i) z[i]+=y[i]*x[i]; benchmark::keep(z); delta += (chrono::high_resolution_clock::now()-start); } std::cout << z[N-1] << " Computation took " << chrono::duration_cast<chrono::milliseconds>(delta).count() << " ms" << std::endl; for (int i=0; i<N-1; ++i) z[i]=y[i]=x[i]=i*1.e-6; delta = start - start; for (int j=0; j<1000000; ++j) { for (int i=0; i<N; ++i) z[i]=y[i]=x[i]=i*1.e-6; delta -= (chrono::high_resolution_clock::now()-start); benchmark::touch(x); benchmark::touch(y); benchmark::touch(z); for (int i=0; i<N-1; ++i) z[i+1]+=y[i]*z[i]; benchmark::keep(z); delta += (chrono::high_resolution_clock::now()-start); } std::cout << z[N-1]<<" Computation took " << chrono::duration_cast<chrono::milliseconds>(delta).count() << " ms" << std::endl; for (int i=0; i<N; ++i) z[i]=y[i]=x[i]=i*1.e-6; delta = start - start; for (int j=0; j<1000000; ++j) { for (int i=0; i<N-1; ++i) z[i]=y[i]=x[i]=i*1.e-6; delta -= (chrono::high_resolution_clock::now()-start); benchmark::touch(x); benchmark::touch(y); benchmark::touch(z); for (int i=0; i<N-1; ++i) z[i]+=y[i]*z[i]; benchmark::keep(z); delta += (chrono::high_resolution_clock::now()-start); } std::cout<< z[N-1] <<" Computation took " << chrono::duration_cast<chrono::milliseconds>(delta).count() << " ms" << std::endl; return 0; }
25.741071
104
0.511967
Hiigaran
84a52c7a97a583936d15231606e92eca3fe64d19
824
cpp
C++
Geeks For Geeks Solutions/HashMap/Largest subarray with 0 sum.cpp
bilwa496/Placement-Preparation
bd32ee717f671d95c17f524ed28b0179e0feb044
[ "MIT" ]
169
2021-05-30T10:02:19.000Z
2022-03-27T18:09:32.000Z
Geeks For Geeks Solutions/HashMap/Largest subarray with 0 sum.cpp
bilwa496/Placement-Preparation
bd32ee717f671d95c17f524ed28b0179e0feb044
[ "MIT" ]
1
2021-10-02T14:46:26.000Z
2021-10-02T14:46:26.000Z
Geeks For Geeks Solutions/HashMap/Largest subarray with 0 sum.cpp
bilwa496/Placement-Preparation
bd32ee717f671d95c17f524ed28b0179e0feb044
[ "MIT" ]
44
2021-05-30T19:56:29.000Z
2022-03-17T14:49:00.000Z
#include <bits/stdc++.h> using namespace std; int maxLen(int A[], int n); int main() { int T; cin >> T; while (T--) { int N; cin >> N; int A[N]; for (int i = 0; i < N; i++) cin >> A[i]; cout << maxLen(A, N) << endl; } } // } Driver Code Ends /*You are required to complete this function*/ int maxLen(int A[], int n) { unordered_map<int,int> mp; int sum =0; int ans; int j; for(int i=0;i<n;i++) { sum += A[i]; if(sum == 0) ans = i+1 ; else { if(mp.find(sum)==mp.end()) { mp[sum] = i ; } else { j = mp[sum]; ans = max(ans,i-j); } } } return ans; }
15.259259
46
0.368932
bilwa496
84a7ad34c1b7631dfbce902fcdddbbe570b70d38
19,099
cpp
C++
SoA/TestBiomeScreen.cpp
Revan1985/SoACode-Public
c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe
[ "MIT" ]
267
2018-06-03T23:05:05.000Z
2022-03-17T00:28:40.000Z
SoA/TestBiomeScreen.cpp
davidkestering/SoACode-Public
c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe
[ "MIT" ]
16
2018-06-05T18:59:11.000Z
2021-09-28T05:05:16.000Z
SoA/TestBiomeScreen.cpp
davidkestering/SoACode-Public
c3ddd69355b534d5e70e2e6d0c489b4e93ab1ffe
[ "MIT" ]
113
2018-06-03T23:56:13.000Z
2022-03-21T00:07:16.000Z
#include "stdafx.h" #include "TestBiomeScreen.h" #include <Vorb/ui/InputDispatcher.h> #include <Vorb/colors.h> #include "App.h" #include "ChunkRenderer.h" #include "DevConsole.h" #include "InputMapper.h" #include "Inputs.h" #include "LoadTaskBlockData.h" #include "RenderUtils.h" #include "ShaderLoader.h" #include "SoaEngine.h" #include "SoAState.h" #ifdef DEBUG #define HORIZONTAL_CHUNKS 26 #define VERTICAL_CHUNKS 4 #else #define HORIZONTAL_CHUNKS 26 #define VERTICAL_CHUNKS 20 #endif TestBiomeScreen::TestBiomeScreen(const App* app, CommonState* state) : IAppScreen<App>(app), m_commonState(state), m_soaState(m_commonState->state), m_blockArrayRecycler(1000) { } i32 TestBiomeScreen::getNextScreen() const { return SCREEN_INDEX_NO_SCREEN; } i32 TestBiomeScreen::getPreviousScreen() const { return SCREEN_INDEX_NO_SCREEN; } void TestBiomeScreen::build() { } void TestBiomeScreen::destroy(const vui::GameTime& gameTime VORB_UNUSED) { } void TestBiomeScreen::onEntry(const vui::GameTime& gameTime VORB_MAYBE_UNUSED) { // Init spritebatch and font m_sb.init(); m_font.init("Fonts/orbitron_bold-webfont.ttf", 32); // Init game state SoaEngine::initState(m_commonState->state); // Init access m_accessor.init(&m_allocator); // Init renderer m_renderer.init(); { // Init post processing Array<vg::GBufferAttachment> attachments; vg::GBufferAttachment att[2]; // Color att[0].format = vg::TextureInternalFormat::RGBA16F; att[0].pixelFormat = vg::TextureFormat::RGBA; att[0].pixelType = vg::TexturePixelType::UNSIGNED_BYTE; att[0].number = 1; // Normals att[1].format = vg::TextureInternalFormat::RGBA16F; att[1].pixelFormat = vg::TextureFormat::RGBA; att[1].pixelType = vg::TexturePixelType::UNSIGNED_BYTE; att[1].number = 2; m_hdrTarget.setSize(m_commonState->window->getWidth(), m_commonState->window->getHeight()); m_hdrTarget.init(Array<vg::GBufferAttachment>(att, 2), vg::TextureInternalFormat::RGBA8).initDepth(); // Swapchain m_swapChain.init(m_commonState->window->getWidth(), m_commonState->window->getHeight(), vg::TextureInternalFormat::RGBA16F); // Init the FullQuadVBO m_commonState->quad.init(); // SSAO m_ssaoStage.init(m_commonState->window, m_commonState->loadContext); m_ssaoStage.load(m_commonState->loadContext); m_ssaoStage.hook(&m_commonState->quad, m_commonState->window->getWidth(), m_commonState->window->getHeight()); // HDR m_hdrStage.init(m_commonState->window, m_commonState->loadContext); m_hdrStage.load(m_commonState->loadContext); m_hdrStage.hook(&m_commonState->quad); } // Load test planet PlanetGenLoader planetLoader; m_iom.setSearchDirectory("StarSystems/Trinity/"); planetLoader.init(&m_iom); m_genData = planetLoader.loadPlanetGenData("Moons/Aldrin/terrain_gen.yml"); if (m_genData->terrainColorPixels.data) { m_soaState->clientState.blockTextures->setColorMap("biome", &m_genData->terrainColorPixels); } // Load blocks LoadTaskBlockData blockLoader(&m_soaState->blocks, &m_soaState->clientState.blockTextureLoader, &m_commonState->loadContext); blockLoader.load(); // Uploads all the needed textures m_soaState->clientState.blockTextures->update(); m_genData->radius = 4500.0; // Set blocks SoaEngine::initVoxelGen(m_genData, m_soaState->blocks); m_chunkGenerator.init(m_genData); initHeightData(); initChunks(); printf("Generating Meshes...\n"); // Create all chunk meshes m_mesher.init(&m_soaState->blocks); for (auto& cv : m_chunks) { cv.chunkMesh = m_mesher.easyCreateChunkMesh(cv.chunk, MeshTaskType::DEFAULT); } { // Init the camera m_camera.init(m_commonState->window->getAspectRatio()); m_camera.setPosition(f64v3(16.0, 17.0, 33.0)); m_camera.setDirection(f32v3(0.0f, 0.0f, -1.0f)); m_camera.setRight(f32v3(1.0f, 0.0f, 0.0f)); m_camera.setUp(f32v3(0.0f, 1.0f, 0.0f)); } initInput(); // Initialize dev console vui::GameWindow* window = m_commonState->window; m_devConsoleView.init(&DevConsole::getInstance(), 5, f32v2(20.0f, window->getHeight() - 400.0f), window->getWidth() - 40.0f); // Set GL state glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glClearDepth(1.0); printf("Done."); } void TestBiomeScreen::onExit(const vui::GameTime& gameTime VORB_MAYBE_UNUSED) { for (auto& cv : m_chunks) { m_mesher.freeChunkMesh(cv.chunkMesh); } m_hdrTarget.dispose(); m_swapChain.dispose(); m_devConsoleView.dispose(); } void TestBiomeScreen::update(const vui::GameTime& gameTime) { f32 speed = 10.0f; if (m_movingFast) speed *= 5.0f; if (m_movingForward) { f32v3 offset = m_camera.getDirection() * speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } if (m_movingBack) { f32v3 offset = m_camera.getDirection() * -speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } if (m_movingLeft) { f32v3 offset = m_camera.getRight() * -speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } if (m_movingRight) { f32v3 offset = m_camera.getRight() * speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } if (m_movingUp) { f32v3 offset = f32v3(0, 1, 0) * speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } if (m_movingDown) { f32v3 offset = f32v3(0, 1, 0) * -speed * (f32)gameTime.elapsed; m_camera.offsetPosition(offset); } m_camera.update(); } void TestBiomeScreen::draw(const vui::GameTime& gameTime VORB_UNUSED) { // Bind the FBO m_hdrTarget.useGeometry(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (m_wireFrame) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // Opaque m_renderer.beginOpaque(m_soaState->clientState.blockTextures->getAtlasTexture(), f32v3(0.0f, 0.0f, -1.0f), f32v3(1.0f), f32v3(0.3f)); for (auto& vc : m_chunks) { if (m_camera.getFrustum().sphereInFrustum(f32v3(vc.chunkMesh->position + f64v3(CHUNK_WIDTH / 2) - m_camera.getPosition()), CHUNK_DIAGONAL_LENGTH)) { vc.inFrustum = true; m_renderer.drawOpaque(vc.chunkMesh, m_camera.getPosition(), m_camera.getViewProjectionMatrix()); } else { vc.inFrustum = false; } } // Cutout m_renderer.beginCutout(m_soaState->clientState.blockTextures->getAtlasTexture(), f32v3(0.0f, 0.0f, -1.0f), f32v3(1.0f), f32v3(0.3f)); for (auto& vc : m_chunks) { if (vc.inFrustum) { m_renderer.drawCutout(vc.chunkMesh, m_camera.getPosition(), m_camera.getViewProjectionMatrix()); } } m_renderer.end(); if (m_wireFrame) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // Post processing m_swapChain.reset(0, m_hdrTarget.getGeometryID(), m_hdrTarget.getGeometryTexture(0), soaOptions.get(OPT_MSAA).value.i > 0, false); // Render SSAO m_ssaoStage.set(m_hdrTarget.getDepthTexture(), m_hdrTarget.getGeometryTexture(1), m_hdrTarget.getGeometryTexture(0), m_swapChain.getCurrent().getID()); m_ssaoStage.render(&m_camera); m_swapChain.swap(); m_swapChain.use(0, false); // Draw to backbuffer for the last effect // TODO(Ben): Do we really need to clear depth here... glBindFramebuffer(GL_FRAMEBUFFER, 0); glDrawBuffer(GL_BACK); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, m_hdrTarget.getDepthTexture()); m_hdrStage.render(); // Draw UI char buf[256]; sprintf(buf, "FPS: %.1f", m_app->getFps()); m_sb.begin(); m_sb.drawString(&m_font, buf, f32v2(30.0f), f32v2(1.0f), color::White); m_sb.end(); m_sb.render(f32v2(m_commonState->window->getViewportDims())); vg::DepthState::FULL.set(); // Have to restore depth // Draw dev console m_devConsoleView.update(0.01f); m_devConsoleView.render(m_game->getWindow().getViewportDims()); } void TestBiomeScreen::initHeightData() { printf("Generating height data...\n"); m_heightData.resize(HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS); // Init height data m_heightGenerator.init(m_genData); for (int z = 0; z < HORIZONTAL_CHUNKS; z++) { for (int x = 0; x < HORIZONTAL_CHUNKS; x++) { auto& hd = m_heightData[z * HORIZONTAL_CHUNKS + x]; for (int i = 0; i < CHUNK_WIDTH; i++) { for (int j = 0; j < CHUNK_WIDTH; j++) { VoxelPosition2D pos; pos.pos.x = x * CHUNK_WIDTH + j + 3000; pos.pos.y = z * CHUNK_WIDTH + i + 3000; PlanetHeightData& data = hd.heightData[i * CHUNK_WIDTH + j]; m_heightGenerator.generateHeightData(data, pos); data.temperature = 128; data.humidity = 128; } } } } // Get center height f32 cHeight = m_heightData[HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS / 2].heightData[CHUNK_LAYER / 2].height; // Center the heightmap for (auto& hd : m_heightData) { for (int i = 0; i < CHUNK_LAYER; i++) { hd.heightData[i].height -= cHeight; } } } void TestBiomeScreen::initChunks() { printf("Generating chunks...\n"); m_chunks.resize(HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS * VERTICAL_CHUNKS); // Generate chunk data for (size_t i = 0; i < m_chunks.size(); i++) { ChunkPosition3D pos; i32v3 gridPosition; gridPosition.x = i % HORIZONTAL_CHUNKS; gridPosition.y = i / (HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS); gridPosition.z = (i % (HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS)) / HORIZONTAL_CHUNKS; // Center position about origin pos.pos.x = gridPosition.x - HORIZONTAL_CHUNKS / 2; pos.pos.y = gridPosition.y - VERTICAL_CHUNKS / 4; pos.pos.z = gridPosition.z - HORIZONTAL_CHUNKS / 2; // Init parameters ChunkID id(pos.x, pos.y, pos.z); m_chunks[i].chunk = m_accessor.acquire(id); m_chunks[i].chunk->init(WorldCubeFace::FACE_TOP); m_chunks[i].gridPosition = gridPosition; m_chunks[i].chunk->gridData = &m_heightData[i % (HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS)]; // Generate the chunk m_chunkGenerator.generateChunk(m_chunks[i].chunk, m_chunks[i].chunk->gridData->heightData); // Decompress to flat array m_chunks[i].chunk->blocks.setArrayRecycler(&m_blockArrayRecycler); m_chunks[i].chunk->blocks.changeState(vvox::VoxelStorageState::FLAT_ARRAY, m_chunks[i].chunk->dataMutex); } // Generate flora std::vector<FloraNode> lNodes; std::vector<FloraNode> wNodes; // TODO(Ben): I know this is ugly PreciseTimer t1; t1.start(); for (size_t i = 0; i < m_chunks.size(); i++) { Chunk* chunk = m_chunks[i].chunk; m_floraGenerator.generateChunkFlora(chunk, m_heightData[i % (HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS)].heightData, lNodes, wNodes); for (auto& node : wNodes) { i32v3 gridPos = m_chunks[i].gridPosition; gridPos.x += FloraGenerator::getChunkXOffset(node.chunkOffset); gridPos.y += FloraGenerator::getChunkYOffset(node.chunkOffset); gridPos.z += FloraGenerator::getChunkZOffset(node.chunkOffset); if (gridPos.x >= 0 && gridPos.y >= 0 && gridPos.z >= 0 && gridPos.x < HORIZONTAL_CHUNKS && gridPos.y < VERTICAL_CHUNKS && gridPos.z < HORIZONTAL_CHUNKS) { Chunk* chunk = m_chunks[gridPos.x + gridPos.y * HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS + gridPos.z * HORIZONTAL_CHUNKS].chunk; chunk->blocks.set(node.blockIndex, node.blockID); } } for (auto& node : lNodes) { i32v3 gridPos = m_chunks[i].gridPosition; gridPos.x += FloraGenerator::getChunkXOffset(node.chunkOffset); gridPos.y += FloraGenerator::getChunkYOffset(node.chunkOffset); gridPos.z += FloraGenerator::getChunkZOffset(node.chunkOffset); if (gridPos.x >= 0 && gridPos.y >= 0 && gridPos.z >= 0 && gridPos.x < HORIZONTAL_CHUNKS && gridPos.y < VERTICAL_CHUNKS && gridPos.z < HORIZONTAL_CHUNKS) { Chunk* chunk = m_chunks[gridPos.x + gridPos.y * HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS + gridPos.z * HORIZONTAL_CHUNKS].chunk; if (chunk->blocks.get(node.blockIndex) == 0) { chunk->blocks.set(node.blockIndex, node.blockID); } } } std::vector<ui16>().swap(chunk->floraToGenerate); lNodes.clear(); wNodes.clear(); } printf("Tree Gen Time %lf\n", t1.stop()); #define GET_INDEX(x, y, z) ((x) + (y) * HORIZONTAL_CHUNKS * HORIZONTAL_CHUNKS + (z) * HORIZONTAL_CHUNKS) // Set neighbor pointers for (int y = 0; y < VERTICAL_CHUNKS; y++) { for (int z = 0; z < HORIZONTAL_CHUNKS; z++) { for (int x = 0; x < HORIZONTAL_CHUNKS; x++) { Chunk* chunk = m_chunks[GET_INDEX(x, y, z)].chunk; // TODO(Ben): Release these too. if (x > 0) { chunk->neighbor.left = m_chunks[GET_INDEX(x - 1, y, z)].chunk.acquire(); } if (x < HORIZONTAL_CHUNKS - 1) { chunk->neighbor.right = m_chunks[GET_INDEX(x + 1, y, z)].chunk.acquire(); } if (y > 0) { chunk->neighbor.bottom = m_chunks[GET_INDEX(x, y - 1, z)].chunk.acquire(); } if (y < VERTICAL_CHUNKS - 1) { chunk->neighbor.top = m_chunks[GET_INDEX(x, y + 1, z)].chunk.acquire(); } if (z > 0) { chunk->neighbor.back = m_chunks[GET_INDEX(x, y, z - 1)].chunk.acquire(); } if (z < HORIZONTAL_CHUNKS - 1) { chunk->neighbor.front = m_chunks[GET_INDEX(x, y, z + 1)].chunk.acquire(); } } } } } void TestBiomeScreen::initInput() { m_inputMapper = new InputMapper; initInputs(m_inputMapper); m_mouseButtons[0] = false; m_hooks.addAutoHook(vui::InputDispatcher::mouse.onMotion, [&](Sender s VORB_MAYBE_UNUSED, const vui::MouseMotionEvent& e) { if (m_mouseButtons[0]) { m_camera.rotateFromMouseAbsoluteUp(-e.dx, -e.dy, 0.01f, true); } }); m_hooks.addAutoHook(vui::InputDispatcher::mouse.onButtonDown, [&](Sender s VORB_MAYBE_UNUSED, const vui::MouseButtonEvent& e) { if (e.button == vui::MouseButton::LEFT) m_mouseButtons[0] = !m_mouseButtons[0]; if (m_mouseButtons[0]) { SDL_SetRelativeMouseMode(SDL_TRUE); } else { SDL_SetRelativeMouseMode(SDL_FALSE); } }); m_hooks.addAutoHook(vui::InputDispatcher::key.onKeyDown, [&](Sender s VORB_MAYBE_UNUSED, const vui::KeyEvent& e) { PlanetGenLoader planetLoader; switch (e.keyCode) { case VKEY_W: m_movingForward = true; break; case VKEY_S: m_movingBack = true; break; case VKEY_A: m_movingLeft = true; break; case VKEY_D: m_movingRight = true; break; case VKEY_SPACE: m_movingUp = true; break; case VKEY_LSHIFT: m_movingFast = true; break; case VKEY_M: m_wireFrame = !m_wireFrame; break; case VKEY_LEFT: /* if (m_activeChunk == 0) { m_activeChunk = m_chunks.size() - 1; } else { m_activeChunk--; }*/ break; case VKEY_RIGHT: /* m_activeChunk++; if (m_activeChunk >= (int)m_chunks.size()) m_activeChunk = 0;*/ break; case VKEY_F10: // Reload meshes // TODO(Ben): Destroy meshes for (auto& cv : m_chunks) { m_mesher.freeChunkMesh(cv.chunkMesh); cv.chunkMesh = m_mesher.easyCreateChunkMesh(cv.chunk, MeshTaskType::DEFAULT); } break; case VKEY_F11: // Reload shaders m_renderer.dispose(); m_renderer.init(); m_ssaoStage.reloadShaders(); break; case VKEY_F12: // Reload world delete m_genData; planetLoader.init(&m_iom); m_genData = planetLoader.loadPlanetGenData("Planets/Aldrin/terrain_gen.yml"); m_genData->radius = 4500.0; // Set blocks SoaEngine::initVoxelGen(m_genData, m_soaState->blocks); m_chunkGenerator.init(m_genData); for (auto& cv : m_chunks) { m_mesher.freeChunkMesh(cv.chunkMesh); cv.chunk.release(); } initHeightData(); initChunks(); printf("Generating Meshes...\n"); // Create all chunk meshes m_mesher.init(&m_soaState->blocks); for (auto& cv : m_chunks) { cv.chunkMesh = m_mesher.easyCreateChunkMesh(cv.chunk, MeshTaskType::DEFAULT); } break; } }); m_hooks.addAutoHook(vui::InputDispatcher::key.onKeyUp, [&](Sender s VORB_MAYBE_UNUSED, const vui::KeyEvent& e) { switch (e.keyCode) { case VKEY_W: m_movingForward = false; break; case VKEY_S: m_movingBack = false; break; case VKEY_A: m_movingLeft = false; break; case VKEY_D: m_movingRight = false; break; case VKEY_SPACE: m_movingUp = false; break; case VKEY_LSHIFT: m_movingFast = false; break; } }); // Dev console m_hooks.addAutoHook(m_inputMapper->get(INPUT_DEV_CONSOLE).downEvent, [](Sender s VORB_MAYBE_UNUSED, ui32 a VORB_MAYBE_UNUSED) { DevConsole::getInstance().toggleFocus(); }); m_inputMapper->startInput(); }
36.941973
156
0.591392
Revan1985
84aa2b80d01d0db6875c37daed06be8580d112e4
73,265
cpp
C++
Unity-Project/App-HL2/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs47.cpp
JBrentJ/mslearn-mixed-reality-and-azure-digital-twins-in-unity
6e13b31a0b053443b9c93267d8f174f1554e79dd
[ "CC-BY-4.0", "MIT" ]
1
2021-06-01T19:33:53.000Z
2021-06-01T19:33:53.000Z
Unity-Project/App-HL2/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs47.cpp
JBrentJ/mslearn-mixed-reality-and-azure-digital-twins-in-unity
6e13b31a0b053443b9c93267d8f174f1554e79dd
[ "CC-BY-4.0", "MIT" ]
null
null
null
Unity-Project/App-HL2/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs47.cpp
JBrentJ/mslearn-mixed-reality-and-azure-digital-twins-in-unity
6e13b31a0b053443b9c93267d8f174f1554e79dd
[ "CC-BY-4.0", "MIT" ]
null
null
null
#include "pch-cpp.hpp" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <limits> #include "vm/CachedCCWBase.h" #include "utils/New.h" // System.Collections.Generic.IEqualityComparer`1<WindTurbineScriptableObject> struct IEqualityComparer_1_t754733F7B8BE7D6A482129735D41581DA4211A89; // System.Collections.Generic.IEqualityComparer`1<System.Xml.XmlQualifiedName> struct IEqualityComparer_1_tA3F9CEF64ED38FA56ECC5E56165286AE1376D617; // System.Collections.Generic.Dictionary`2/KeyCollection<WindTurbineScriptableObject,UnityEngine.GameObject> struct KeyCollection_t34BD6D53CC7D3C809C9A1852E3EBD4E560CB6FC9; // System.Collections.Generic.Dictionary`2/KeyCollection<WindTurbineScriptableObject,SiteOverviewTurbineButton> struct KeyCollection_tF17A5FE33B5DE41ACFF287E964C81ECB6D59D543; // System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.XmlQualifiedName,System.Int32> struct KeyCollection_t2244A1557D5F76CA645CAFA1A60583DA72104A63; // System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaAttDef> struct KeyCollection_t5FE0EB338810A83B845B900E60A4E065E1E8AB68; // System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaElementDecl> struct KeyCollection_tFEE8457FE221E239778EE686C6BB8756470C8987; // System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaEntity> struct KeyCollection_tFCF38642F5CB0A86A6B4EC75E8BF5C9A8C4D0122; // System.Collections.Generic.Dictionary`2/KeyCollection<System.Xml.XmlQualifiedName,System.Xml.XmlQualifiedName> struct KeyCollection_t030E8C0717067BB35BC97531ADFD5B34DE81E372; // System.Collections.Generic.Dictionary`2/ValueCollection<WindTurbineScriptableObject,UnityEngine.GameObject> struct ValueCollection_t01E88B080F930A3AF5A6A8F2F73AF5BB36CEA942; // System.Collections.Generic.Dictionary`2/ValueCollection<WindTurbineScriptableObject,SiteOverviewTurbineButton> struct ValueCollection_t31490A63A035F1948892448F1AB3041282B20FDD; // System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.XmlQualifiedName,System.Int32> struct ValueCollection_tCB259046959321FDDB15DF0C7CDA3F3F0878E56E; // System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaAttDef> struct ValueCollection_tA992FE5AE14BF1BD39743AC399EF95B64E8AFC42; // System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaElementDecl> struct ValueCollection_t566E84C700B8CA57F1C3A24989857DEB3100189D; // System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaEntity> struct ValueCollection_tECAE69F11CA0C245794C99313E46CEAB79289400; // System.Collections.Generic.Dictionary`2/ValueCollection<System.Xml.XmlQualifiedName,System.Xml.XmlQualifiedName> struct ValueCollection_t0A13A40E317C41D701F731B2E09A7863C1AF1C9E; // System.Collections.Generic.Dictionary`2/Entry<WindTurbineScriptableObject,UnityEngine.GameObject>[] struct EntryU5BU5D_tBF7237941FB58B8E09BF9CD83B2793ADBF92D84E; // System.Collections.Generic.Dictionary`2/Entry<WindTurbineScriptableObject,SiteOverviewTurbineButton>[] struct EntryU5BU5D_t9FC1946A2F8CF647AD110DB3138597BC383D7E7F; // System.Collections.Generic.Dictionary`2/Entry<System.Xml.XmlQualifiedName,System.Int32>[] struct EntryU5BU5D_t117A50276A1DFDCB7A66D3DCB90525B42613F604; // System.Collections.Generic.Dictionary`2/Entry<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaAttDef>[] struct EntryU5BU5D_tDF263570453ED61DC82F1B72F9B1F10CF0C186FE; // System.Collections.Generic.Dictionary`2/Entry<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaElementDecl>[] struct EntryU5BU5D_t830E5130B05E1143F4ECA59D1CE8BD64AC3F7E2F; // System.Collections.Generic.Dictionary`2/Entry<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaEntity>[] struct EntryU5BU5D_t5AD4BA39F55C5C698AD90B02326A2225C5D56221; // System.Collections.Generic.Dictionary`2/Entry<System.Xml.XmlQualifiedName,System.Xml.XmlQualifiedName>[] struct EntryU5BU5D_tA3DDC0B951DBF95A552959A08A07C10A84E89DA0; // System.Int32[] struct Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32; // System.String struct String_t; struct IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB; 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 // Windows.UI.Xaml.Interop.IBindableIterable struct NOVTABLE IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 : Il2CppIInspectable { static const Il2CppGuid IID; virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) = 0; }; // System.Object // System.Collections.Generic.Dictionary`2<WindTurbineScriptableObject,UnityEngine.GameObject> struct Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_tBF7237941FB58B8E09BF9CD83B2793ADBF92D84E* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_t34BD6D53CC7D3C809C9A1852E3EBD4E560CB6FC9 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_t01E88B080F930A3AF5A6A8F2F73AF5BB36CEA942 * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___entries_1)); } inline EntryU5BU5D_tBF7237941FB58B8E09BF9CD83B2793ADBF92D84E* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_tBF7237941FB58B8E09BF9CD83B2793ADBF92D84E** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_tBF7237941FB58B8E09BF9CD83B2793ADBF92D84E* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___keys_7)); } inline KeyCollection_t34BD6D53CC7D3C809C9A1852E3EBD4E560CB6FC9 * get_keys_7() const { return ___keys_7; } inline KeyCollection_t34BD6D53CC7D3C809C9A1852E3EBD4E560CB6FC9 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_t34BD6D53CC7D3C809C9A1852E3EBD4E560CB6FC9 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ___values_8)); } inline ValueCollection_t01E88B080F930A3AF5A6A8F2F73AF5BB36CEA942 * get_values_8() const { return ___values_8; } inline ValueCollection_t01E88B080F930A3AF5A6A8F2F73AF5BB36CEA942 ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_t01E88B080F930A3AF5A6A8F2F73AF5BB36CEA942 * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<WindTurbineScriptableObject,SiteOverviewTurbineButton> struct Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_t9FC1946A2F8CF647AD110DB3138597BC383D7E7F* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_tF17A5FE33B5DE41ACFF287E964C81ECB6D59D543 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_t31490A63A035F1948892448F1AB3041282B20FDD * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___entries_1)); } inline EntryU5BU5D_t9FC1946A2F8CF647AD110DB3138597BC383D7E7F* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_t9FC1946A2F8CF647AD110DB3138597BC383D7E7F** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_t9FC1946A2F8CF647AD110DB3138597BC383D7E7F* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___keys_7)); } inline KeyCollection_tF17A5FE33B5DE41ACFF287E964C81ECB6D59D543 * get_keys_7() const { return ___keys_7; } inline KeyCollection_tF17A5FE33B5DE41ACFF287E964C81ECB6D59D543 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_tF17A5FE33B5DE41ACFF287E964C81ECB6D59D543 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ___values_8)); } inline ValueCollection_t31490A63A035F1948892448F1AB3041282B20FDD * get_values_8() const { return ___values_8; } inline ValueCollection_t31490A63A035F1948892448F1AB3041282B20FDD ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_t31490A63A035F1948892448F1AB3041282B20FDD * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Int32> struct Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_t117A50276A1DFDCB7A66D3DCB90525B42613F604* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_t2244A1557D5F76CA645CAFA1A60583DA72104A63 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_tCB259046959321FDDB15DF0C7CDA3F3F0878E56E * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___entries_1)); } inline EntryU5BU5D_t117A50276A1DFDCB7A66D3DCB90525B42613F604* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_t117A50276A1DFDCB7A66D3DCB90525B42613F604** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_t117A50276A1DFDCB7A66D3DCB90525B42613F604* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___keys_7)); } inline KeyCollection_t2244A1557D5F76CA645CAFA1A60583DA72104A63 * get_keys_7() const { return ___keys_7; } inline KeyCollection_t2244A1557D5F76CA645CAFA1A60583DA72104A63 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_t2244A1557D5F76CA645CAFA1A60583DA72104A63 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ___values_8)); } inline ValueCollection_tCB259046959321FDDB15DF0C7CDA3F3F0878E56E * get_values_8() const { return ___values_8; } inline ValueCollection_tCB259046959321FDDB15DF0C7CDA3F3F0878E56E ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_tCB259046959321FDDB15DF0C7CDA3F3F0878E56E * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaAttDef> struct Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_tDF263570453ED61DC82F1B72F9B1F10CF0C186FE* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_t5FE0EB338810A83B845B900E60A4E065E1E8AB68 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_tA992FE5AE14BF1BD39743AC399EF95B64E8AFC42 * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___entries_1)); } inline EntryU5BU5D_tDF263570453ED61DC82F1B72F9B1F10CF0C186FE* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_tDF263570453ED61DC82F1B72F9B1F10CF0C186FE** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_tDF263570453ED61DC82F1B72F9B1F10CF0C186FE* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___keys_7)); } inline KeyCollection_t5FE0EB338810A83B845B900E60A4E065E1E8AB68 * get_keys_7() const { return ___keys_7; } inline KeyCollection_t5FE0EB338810A83B845B900E60A4E065E1E8AB68 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_t5FE0EB338810A83B845B900E60A4E065E1E8AB68 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ___values_8)); } inline ValueCollection_tA992FE5AE14BF1BD39743AC399EF95B64E8AFC42 * get_values_8() const { return ___values_8; } inline ValueCollection_tA992FE5AE14BF1BD39743AC399EF95B64E8AFC42 ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_tA992FE5AE14BF1BD39743AC399EF95B64E8AFC42 * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaElementDecl> struct Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_t830E5130B05E1143F4ECA59D1CE8BD64AC3F7E2F* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_tFEE8457FE221E239778EE686C6BB8756470C8987 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_t566E84C700B8CA57F1C3A24989857DEB3100189D * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___entries_1)); } inline EntryU5BU5D_t830E5130B05E1143F4ECA59D1CE8BD64AC3F7E2F* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_t830E5130B05E1143F4ECA59D1CE8BD64AC3F7E2F** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_t830E5130B05E1143F4ECA59D1CE8BD64AC3F7E2F* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___keys_7)); } inline KeyCollection_tFEE8457FE221E239778EE686C6BB8756470C8987 * get_keys_7() const { return ___keys_7; } inline KeyCollection_tFEE8457FE221E239778EE686C6BB8756470C8987 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_tFEE8457FE221E239778EE686C6BB8756470C8987 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ___values_8)); } inline ValueCollection_t566E84C700B8CA57F1C3A24989857DEB3100189D * get_values_8() const { return ___values_8; } inline ValueCollection_t566E84C700B8CA57F1C3A24989857DEB3100189D ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_t566E84C700B8CA57F1C3A24989857DEB3100189D * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaEntity> struct Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_t5AD4BA39F55C5C698AD90B02326A2225C5D56221* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_tFCF38642F5CB0A86A6B4EC75E8BF5C9A8C4D0122 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_tECAE69F11CA0C245794C99313E46CEAB79289400 * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___entries_1)); } inline EntryU5BU5D_t5AD4BA39F55C5C698AD90B02326A2225C5D56221* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_t5AD4BA39F55C5C698AD90B02326A2225C5D56221** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_t5AD4BA39F55C5C698AD90B02326A2225C5D56221* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___keys_7)); } inline KeyCollection_tFCF38642F5CB0A86A6B4EC75E8BF5C9A8C4D0122 * get_keys_7() const { return ___keys_7; } inline KeyCollection_tFCF38642F5CB0A86A6B4EC75E8BF5C9A8C4D0122 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_tFCF38642F5CB0A86A6B4EC75E8BF5C9A8C4D0122 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ___values_8)); } inline ValueCollection_tECAE69F11CA0C245794C99313E46CEAB79289400 * get_values_8() const { return ___values_8; } inline ValueCollection_tECAE69F11CA0C245794C99313E46CEAB79289400 ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_tECAE69F11CA0C245794C99313E46CEAB79289400 * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; // System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.XmlQualifiedName> struct Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2 : public RuntimeObject { public: // System.Int32[] System.Collections.Generic.Dictionary`2::buckets Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* ___buckets_0; // System.Collections.Generic.Dictionary`2/Entry<TKey,TValue>[] System.Collections.Generic.Dictionary`2::entries EntryU5BU5D_tA3DDC0B951DBF95A552959A08A07C10A84E89DA0* ___entries_1; // System.Int32 System.Collections.Generic.Dictionary`2::count int32_t ___count_2; // System.Int32 System.Collections.Generic.Dictionary`2::version int32_t ___version_3; // System.Int32 System.Collections.Generic.Dictionary`2::freeList int32_t ___freeList_4; // System.Int32 System.Collections.Generic.Dictionary`2::freeCount int32_t ___freeCount_5; // System.Collections.Generic.IEqualityComparer`1<TKey> System.Collections.Generic.Dictionary`2::comparer RuntimeObject* ___comparer_6; // System.Collections.Generic.Dictionary`2/KeyCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::keys KeyCollection_t030E8C0717067BB35BC97531ADFD5B34DE81E372 * ___keys_7; // System.Collections.Generic.Dictionary`2/ValueCollection<TKey,TValue> System.Collections.Generic.Dictionary`2::values ValueCollection_t0A13A40E317C41D701F731B2E09A7863C1AF1C9E * ___values_8; // System.Object System.Collections.Generic.Dictionary`2::_syncRoot RuntimeObject * ____syncRoot_9; public: inline static int32_t get_offset_of_buckets_0() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___buckets_0)); } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* get_buckets_0() const { return ___buckets_0; } inline Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32** get_address_of_buckets_0() { return &___buckets_0; } inline void set_buckets_0(Int32U5BU5D_t70F1BDC14B1786481B176D6139A5E3B87DC54C32* value) { ___buckets_0 = value; Il2CppCodeGenWriteBarrier((void**)(&___buckets_0), (void*)value); } inline static int32_t get_offset_of_entries_1() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___entries_1)); } inline EntryU5BU5D_tA3DDC0B951DBF95A552959A08A07C10A84E89DA0* get_entries_1() const { return ___entries_1; } inline EntryU5BU5D_tA3DDC0B951DBF95A552959A08A07C10A84E89DA0** get_address_of_entries_1() { return &___entries_1; } inline void set_entries_1(EntryU5BU5D_tA3DDC0B951DBF95A552959A08A07C10A84E89DA0* value) { ___entries_1 = value; Il2CppCodeGenWriteBarrier((void**)(&___entries_1), (void*)value); } inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___count_2)); } inline int32_t get_count_2() const { return ___count_2; } inline int32_t* get_address_of_count_2() { return &___count_2; } inline void set_count_2(int32_t value) { ___count_2 = value; } inline static int32_t get_offset_of_version_3() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___version_3)); } inline int32_t get_version_3() const { return ___version_3; } inline int32_t* get_address_of_version_3() { return &___version_3; } inline void set_version_3(int32_t value) { ___version_3 = value; } inline static int32_t get_offset_of_freeList_4() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___freeList_4)); } inline int32_t get_freeList_4() const { return ___freeList_4; } inline int32_t* get_address_of_freeList_4() { return &___freeList_4; } inline void set_freeList_4(int32_t value) { ___freeList_4 = value; } inline static int32_t get_offset_of_freeCount_5() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___freeCount_5)); } inline int32_t get_freeCount_5() const { return ___freeCount_5; } inline int32_t* get_address_of_freeCount_5() { return &___freeCount_5; } inline void set_freeCount_5(int32_t value) { ___freeCount_5 = value; } inline static int32_t get_offset_of_comparer_6() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___comparer_6)); } inline RuntimeObject* get_comparer_6() const { return ___comparer_6; } inline RuntimeObject** get_address_of_comparer_6() { return &___comparer_6; } inline void set_comparer_6(RuntimeObject* value) { ___comparer_6 = value; Il2CppCodeGenWriteBarrier((void**)(&___comparer_6), (void*)value); } inline static int32_t get_offset_of_keys_7() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___keys_7)); } inline KeyCollection_t030E8C0717067BB35BC97531ADFD5B34DE81E372 * get_keys_7() const { return ___keys_7; } inline KeyCollection_t030E8C0717067BB35BC97531ADFD5B34DE81E372 ** get_address_of_keys_7() { return &___keys_7; } inline void set_keys_7(KeyCollection_t030E8C0717067BB35BC97531ADFD5B34DE81E372 * value) { ___keys_7 = value; Il2CppCodeGenWriteBarrier((void**)(&___keys_7), (void*)value); } inline static int32_t get_offset_of_values_8() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ___values_8)); } inline ValueCollection_t0A13A40E317C41D701F731B2E09A7863C1AF1C9E * get_values_8() const { return ___values_8; } inline ValueCollection_t0A13A40E317C41D701F731B2E09A7863C1AF1C9E ** get_address_of_values_8() { return &___values_8; } inline void set_values_8(ValueCollection_t0A13A40E317C41D701F731B2E09A7863C1AF1C9E * value) { ___values_8 = value; Il2CppCodeGenWriteBarrier((void**)(&___values_8), (void*)value); } inline static int32_t get_offset_of__syncRoot_9() { return static_cast<int32_t>(offsetof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2, ____syncRoot_9)); } inline RuntimeObject * get__syncRoot_9() const { return ____syncRoot_9; } inline RuntimeObject ** get_address_of__syncRoot_9() { return &____syncRoot_9; } inline void set__syncRoot_9(RuntimeObject * value) { ____syncRoot_9 = value; Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_9), (void*)value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif il2cpp_hresult_t IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue); // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<WindTurbineScriptableObject,UnityEngine.GameObject> struct Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tBB6637D6ACE122CA21B1AAFE00D9DB6FB0DE4B8F_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<WindTurbineScriptableObject,SiteOverviewTurbineButton> struct Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t0541E6A56BBB9D3DAB2CCF3BA250073328DF2F85_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Int32> struct Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t9271D5E45EC14905F5999D37CAEA9320F5D0A5F6_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaAttDef> struct Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t1FAD0C7CC6F970A1F41D0F7433B8D62A408D1C58_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaElementDecl> struct Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t9716CEDD4260B2B68461B83D64B387A3786A25C7_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.Schema.SchemaEntity> struct Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_tE268B8DA28D3A82319F0632A15D6EC06B68E5523_ComCallableWrapper(obj)); } // COM Callable Wrapper for System.Collections.Generic.Dictionary`2<System.Xml.XmlQualifiedName,System.Xml.XmlQualifiedName> struct Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 { inline Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper>(obj) {} virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE { if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0 || ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0) { *object = GetIdentity(); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIManagedObjectHolder*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIMarshal*>(this); AddRefImpl(); return IL2CPP_S_OK; } if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0) { *object = static_cast<Il2CppIWeakReferenceSource*>(this); AddRefImpl(); return IL2CPP_S_OK; } *object = NULL; return IL2CPP_E_NOINTERFACE; } virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE { return AddRefImpl(); } virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE { return ReleaseImpl(); } virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE { Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(1); interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID; *iidCount = 1; *iids = interfaceIds; return IL2CPP_S_OK; } virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE { return GetRuntimeClassNameImpl(className); } virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE { return ComObjectBase::GetTrustLevel(trustLevel); } virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE { return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue); } }; IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2(RuntimeObject* obj) { void* memory = il2cpp::utils::Memory::Malloc(sizeof(Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper)); if (memory == NULL) { il2cpp_codegen_raise_out_of_memory_exception(); } return static_cast<Il2CppIManagedObjectHolder*>(new(memory) Dictionary_2_t3EDC2BB9B056BB70DDD396DBE1C02C102C4258F2_ComCallableWrapper(obj)); }
47.025032
257
0.819969
JBrentJ
84ad32e1a1e176b44e4c9c1187af7f74d8f815c2
679
cpp
C++
solved-problems/google-coding-competitions/kick-start/2019/Practice-Round/B.Mural.cpp
developer4fun/competitive_programming
9e95945ae63d41696ca7b50f026b8fe05aec49de
[ "MIT" ]
1
2022-02-14T14:14:21.000Z
2022-02-14T14:14:21.000Z
solved-problems/google-coding-competitions/kick-start/2019/Practice-Round/B.Mural.cpp
developer4fun/competitiveProgramming
9e95945ae63d41696ca7b50f026b8fe05aec49de
[ "MIT" ]
6
2022-01-16T21:15:24.000Z
2022-03-04T15:59:28.000Z
kick-start/2019/Practice-Round/B.Mural.cpp
ggardusi/google-coding-competitions
878d0ad0a4abed6862d0667248e1008b8bb56fb5
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; std::mt19937 rng(int(std::chrono::steady_clock::now().time_since_epoch().count())); int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0); int t; cin >> t; for (int test = 1; test <= t; test += 1) { int n; cin >> n; string s; cin >> s; vector< int > sum(n + 5); sum[0] = 0; for (int i = 0; i < n; i += 1) { sum[i + 1] = sum[i] + (s[i] - '0'); } int size = (n + 1) / 2; int ans = 0; for (int i = size; i <= n; i += 1) { ans = max(ans, sum[i] - sum[i - size]); } cout << "Case #" << test << ": " << ans << '\n'; } return 0; }
22.633333
83
0.46539
developer4fun
84aeafb91e3ce385a621876dfe0a650bb993fd00
6,310
cpp
C++
KEIHANNA_MAIN-teensy40/src/main.cpp
nakamoto800/Hercules_2022
e50347fdba847e81ffbc24f3e9a720c460e6b9f3
[ "MIT" ]
2
2022-03-03T13:51:09.000Z
2022-03-03T13:51:11.000Z
KEIHANNA_MAIN-teensy40/src/main.cpp
nakamoto800/Hercules_2022
e50347fdba847e81ffbc24f3e9a720c460e6b9f3
[ "MIT" ]
null
null
null
KEIHANNA_MAIN-teensy40/src/main.cpp
nakamoto800/Hercules_2022
e50347fdba847e81ffbc24f3e9a720c460e6b9f3
[ "MIT" ]
1
2022-01-29T22:19:49.000Z
2022-01-29T22:19:49.000Z
//ライブラリ読み込み #include <Arduino.h> #include <DSR1202.h> #include <U8g2lib.h> //ライブラリセットアップ DSR1202 dsr1202(1); //AQM1248Aは128 * 48 U8G2_ST7565_AK_AQM1248_F_4W_HW_SPI u8g2(U8G2_R0, 10, 34, 35); //CS, DC(RS), Reset(適当) //定数置き場 #define buzzer 33 //圧電ブザー #define button_LCD_R 27 //タクトスイッチ(右) #define button_LCD_L 32 //タクトスイッチ(左) #define switch_program 31 //トグルスイッチ #define button_LCD_C 30 //タクトスイッチ(コマンド) #define LINE_1 2 //前 #define LINE_2 3 //右 #define LINE_3 4 //後 #define LINE_4 5 //左 #define LED 9 //グローバル変数置き場(本当は減らしたいけど初心者なので当分このまま) int head_CAM, CAM_angle, CAM_distance, CAM_YellowAngle, CAM_BlueAngle; //OpenMVから受け取るデータ用 int head_USS, USS, USS1, USS2, USS3, USS4; //USSから受け取るデータ用 int IMU; //IMU値 int head_BT, BT_Angle, BT_Power; //無線機 class Status { public: int val, old_val; int state; }; class Timer { public: unsigned long timer, timer_start; }; Status LCD, LCD_R, LCD_L, LCD_C; Timer LINE, position, Ball; int val_I; int deviation, old_deviation, val_D; float operation_A, operation_B, operation_C; int motor[4]; //モーター出力(前向いてるときの各モーターの出力値設定) int MotorPower[4]; //最終操作量(方向修正による操作量を含めた最終モーター出力値) //ヘッダファイル読み込み #include "Serial_receive.h" #include "print_LCD.h" #include "pid_parameter.h" #include "pid.h" #include "motor.h" void setup() { u8g2.begin(); //LCD初期化 u8g2.setFlipMode(1); //反転は1(通常表示は0) u8g2.clearBuffer(); //内部メモリクリア(毎回表示内容更新前に置く) u8g2.setFont(u8g2_font_ncenB14_tr); //フォント選択(これは横に14ピクセル、縦に14ピクセル) u8g2.drawStr(0,31,"Hello World!"); //書き込み内容書くところ(画面左端から横に何ピクセル、縦に何ピクセルか指定。ちなみに、文字の左下が指示座標になる。) u8g2.sendBuffer(); //ディスプレイに送る(毎回書く) tone(buzzer, 1568, 100); //通電確認音 //各ピン設定開始 pinMode(button_LCD_R, INPUT); pinMode(button_LCD_L, INPUT); pinMode(button_LCD_C, INPUT); pinMode(switch_program, INPUT); pinMode(LINE_1, INPUT); pinMode(LINE_2, INPUT); pinMode(LINE_3, INPUT); pinMode(LINE_4, INPUT); dsr1202.Init(); //MD準備(USBシリアルも同時開始) Serial2.begin(115200); //OpenMVとのシリアル通信 Serial3.begin(115200); //USSとのシリアル通信 Serial4.begin(115200); //IMUとのシリアル通信 Serial5.begin(115200); //M5Stamp Picoとの通信 tone(buzzer, 2093, 100); //起動確認音 /*Adventurer 3 Lite tone(buzzer, 1047, 1000); //ド6 delay(1000); noTone(buzzer); delay(250); tone(buzzer, 1319, 150); //ミ6 delay(150); noTone(buzzer); delay(100); tone(buzzer, 1397, 250); //ファ6 delay(250); noTone(buzzer); delay(150); tone(buzzer, 1568, 150); //ソ6 delay(150); noTone(buzzer); delay(100); tone(buzzer, 1760, 300); //ラ6 delay(300); noTone(buzzer); delay(100); tone(buzzer, 1568, 250); //ソ6 delay(250); noTone(buzzer); delay(200); tone(buzzer, 1568, 250); //ソ6 delay(250); noTone(buzzer); delay(200); tone(buzzer, 2093, 250); //ド7 delay(250); noTone(buzzer); */ } void loop() { Serial_receive(); pid(); if ((LCD.state == 0) && (LCD_C.state == 1) && (digitalRead(switch_program) == LOW)) { LINE.timer = millis() - LINE.timer_start; if (LINE.timer < 150) { if (IMU == 10) { LINE.timer = 300; goto Ball; //Ballラベルまで飛ぶ } Move(0, 0); } else if (LINE.timer < 300) { if (IMU == 10) { LINE.timer = 300; goto Ball; //上に同じ } Motor(USS); } else { if ((digitalRead(LINE_1) == LOW) || (digitalRead(LINE_2) == LOW) || (digitalRead(LINE_4) == LOW)) { if (USS == 10) { goto Ball; //上に同じ } for (size_t i = 0; i < 10; i++) { Serial1.println("1R0002R0003R0004R000"); } LINE.timer_start = millis(); } else { Ball: //超音波のパターン次第でライン見ずにここまで飛ぶ if (CAM_distance > 0) { position.timer = millis(); position.timer_start = position.timer; Ball.timer = millis() - Ball.timer_start; if (Ball.timer <= 500) { //標準速度 if (CAM_distance <= 52) { if (CAM_angle <= 20) { Move(CAM_angle, motor_speed); } else if (CAM_angle <= 180) { Move((CAM_angle + 90), motor_speed); Ball.timer_start = millis(); } else if (CAM_angle < 340) { Move((CAM_angle - 90), motor_speed); Ball.timer_start = millis(); } else { Move(CAM_angle, motor_speed); } } else { Move(CAM_angle, motor_speed); Ball.timer_start = millis(); } } else { //マキシマムモード(一定時間経過後パワーを上げる) if (CAM_distance <= 52) { if (CAM_angle <= 20) { Move(CAM_angle, (motor_speed + 3)); } else if (CAM_angle <= 180) { Move((CAM_angle + 90), motor_speed); Ball.timer_start = millis(); } else if (CAM_angle < 340) { Move((CAM_angle - 90), motor_speed); Ball.timer_start = millis(); } else { Move(CAM_angle, (motor_speed + 3)); } } else { Move(CAM_angle, motor_speed); Ball.timer_start = millis(); } } } else { position.timer = millis() - position.timer_start; if (position.timer < 2000) { Move(0, 0); } else { if (USS3 > 50) { if (USS2 < 70) { if (USS4 < 70) { Motor(3); //後 } else { Motor(9); //右後 } } else if (USS4 < 70) { Motor(8); //左後 } else { Motor(3); //後 } } else if (USS2 < 70) { if (USS4 < 70) { Motor(1); //方向修正 } else { Motor(5); //右 } } else if (USS4 < 70) { Motor(4); //左 } else { Motor(1); //方向修正 } } } } } } else if ((LCD.state == 7) && (LCD_C.state == 1) && (digitalRead(switch_program) == LOW)) { Move(0, 0); } else if ((LCD.state == 8) && (LCD_C.state == 1) && (digitalRead(switch_program) == LOW)) { if (BT_Angle > 360) { Move(0, 0); } else { Move(BT_Angle, BT_Power); } } else { print_LCD(); dsr1202.move(0, 0, 0, 0); } }
26.851064
105
0.538827
nakamoto800
84b04b2e4bade7acf7233e7f301da9efa80c5675
2,698
hpp
C++
archive/stan/src/stan/model/prob_grad.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/model/prob_grad.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/model/prob_grad.hpp
alashworth/stan-monorepo
75596bc1f860ededd7b3e9ae9002aea97ee1cd46
[ "BSD-3-Clause" ]
null
null
null
#ifndef STAN_MODEL_PROB_GRAD_HPP #define STAN_MODEL_PROB_GRAD_HPP #include <cstddef> #include <sstream> #include <stdexcept> #include <string> #include <utility> #include <vector> namespace stan { namespace model { /** * Base class for models, holding the basic parameter sizes and * ranges for integer parameters. */ class prob_grad { protected: // TODO(carpenter): roll into model_base; remove int members/vars size_t num_params_r__; std::vector<std::pair<int, int> > param_ranges_i__; public: /** * Construct a model base class with the specified number of * unconstrained real parameters. * * @param num_params_r number of unconstrained real parameters */ explicit prob_grad(size_t num_params_r) : num_params_r__(num_params_r), param_ranges_i__(std::vector<std::pair<int, int> >(0)) { } /** * Construt a model base class with the specified number of * unconstrained real parameters and integer parameter ranges. * * @param num_params_r number of unconstrained real parameters * @param param_ranges_i integer parameter ranges */ prob_grad(size_t num_params_r, std::vector<std::pair<int, int> >& param_ranges_i) : num_params_r__(num_params_r), param_ranges_i__(param_ranges_i) { } /** * Destroy this class. */ virtual ~prob_grad() { } /** * Return number of unconstrained real parameters. * * @return number of unconstrained real parameters */ inline size_t num_params_r() const { return num_params_r__; } /** * Return number of integer parameters. * * @return number of integer parameters */ inline size_t num_params_i() const { return param_ranges_i__.size(); } /** * Return the ordered parameter range for the specified integer * variable. * * @param idx index of integer variable * @throw std::out_of_range if there index is beyond the range * of integer indexes * @return ordered pair of ranges */ inline std::pair<int, int> param_range_i(size_t idx) const { if (idx <= param_ranges_i__.size()) { std::stringstream ss; ss << "param_range_i(): No integer paramter at index " << idx; std::string msg = ss.str(); throw std::out_of_range(msg); } return param_ranges_i__[idx]; } }; } } #endif
27.814433
73
0.58636
alashworth
84b98f4c790d2dc73a44010c470c0065f47311cb
6,477
hpp
C++
AirLib/include/controllers/ros_flight/firmware/mode.hpp
1514louluo/AirSim
ea8bc4337a9a9bccb54243db3523ea5d67e538ea
[ "MIT" ]
1
2021-07-07T06:32:44.000Z
2021-07-07T06:32:44.000Z
AirLib/include/controllers/ros_flight/firmware/mode.hpp
1514louluo/AirSim
ea8bc4337a9a9bccb54243db3523ea5d67e538ea
[ "MIT" ]
null
null
null
AirLib/include/controllers/ros_flight/firmware/mode.hpp
1514louluo/AirSim
ea8bc4337a9a9bccb54243db3523ea5d67e538ea
[ "MIT" ]
null
null
null
#pragma once #include <cstdint> #include "sensors.hpp" #include "rc.hpp" #include "commonstate.hpp" #include "param.hpp" namespace ros_flight { class Mode { public: typedef enum { INVALID_CONTROL_MODE, INVALID_ARMED_STATE, } error_state_t; void init(Board* _board, CommLink* _comm_link, CommonState* _common_state, Sensors* _sensors, RC* _rc, Params* _params); bool check_mode(uint64_t now); private: bool arm(void); void disarm(void); bool check_failsafe(void); void updateCommLinkArmStatus(); private: error_state_t _error_state; CommonState* common_state; Sensors* sensors; RC* rc; Params* params; Board* board; CommLink* comm_link; bool started_gyro_calibration = false; //arm uint8_t blink_count = 0; //check_failsafe uint64_t prev_time = 0; //check_mode uint32_t time_sticks_have_been_in_arming_position = 0; //check_mode }; /************************************************** Implementation ***************************************************************/ void Mode::init(Board* _board, CommLink* _comm_link, CommonState* _common_state, Sensors* _sensors, RC* _rc, Params* _params) { board = _board; comm_link = _comm_link; params = _params; common_state = _common_state; sensors = _sensors; rc = _rc; common_state->set_disarm(); } bool Mode::arm(void) { bool success = false; if (!started_gyro_calibration) { if (common_state->is_disarmed()) comm_link->log_message("Cannot arm because gyro calibration is not complete", 1); sensors->start_gyro_calibration(); started_gyro_calibration = true; } else if (sensors->gyro_calibration_complete()) { started_gyro_calibration = false; common_state->set_arm(); board->set_led(0, true); success = true; } updateCommLinkArmStatus(); return success; } void Mode::disarm(void) { common_state->set_disarm(); board->set_led(0, true); updateCommLinkArmStatus(); } /// TODO: Be able to tell if the RC has become disconnected during flight bool Mode::check_failsafe(void) { for (int8_t i = 0; i < params->get_param_int(Params::PARAM_RC_NUM_CHANNELS); i++) { if (board->pwmRead(i) < 900 || board->pwmRead(i) > 2100) { if (common_state->is_armed() || common_state->is_disarmed()) { comm_link->log_message("Switching to failsafe mode because of invalid PWM RC inputs", 1); common_state->setArmedState(CommonState::FAILSAFE_DISARMED); } // blink LED if (blink_count > 25) { board->toggle_led(1); blink_count = 0; } blink_count++; return true; } } // we got a valid RC measurement for all channels if (common_state->get_armed_state() == CommonState::FAILSAFE_ARMED || common_state->get_armed_state() == CommonState::FAILSAFE_DISARMED) { // return to appropriate mode common_state->setArmedState( (common_state->get_armed_state() == CommonState::FAILSAFE_ARMED) ? CommonState::ARMED :CommonState::DISARMED ); } return false; } void Mode::updateCommLinkArmStatus() { if (common_state->is_armed()) comm_link->log_message("Vehicle is now armed", 0); else if (common_state->is_disarmed()) comm_link->log_message("Vehicle is now disarmed", 0); else comm_link->log_message("Attempt to arm or disarm failed", 0); } bool Mode::check_mode(uint64_t now) { // see it has been at least 20 ms uint32_t dt = static_cast<uint32_t>(now - prev_time); if (dt < 20000) { return false; } // if it has, then do stuff prev_time = now; // check for failsafe mode if (check_failsafe()) { return true; } else { // check for arming switch if (params->get_param_int(Params::PARAM_ARM_STICKS)) { if (common_state->get_armed_state() == CommonState::DISARMED) { // if left stick is down and to the right if (board->pwmRead(params->get_param_int(Params::PARAM_RC_F_CHANNEL)) < params->get_param_int(Params::PARAM_RC_F_BOTTOM) + params->get_param_int(Params::PARAM_ARM_THRESHOLD) && board->pwmRead(params->get_param_int(Params::PARAM_RC_Z_CHANNEL)) > (params->get_param_int(Params::PARAM_RC_Z_CENTER) + params->get_param_int(Params::PARAM_RC_Z_RANGE) / 2) - params->get_param_int(Params::PARAM_ARM_THRESHOLD)) { time_sticks_have_been_in_arming_position += dt; } else { time_sticks_have_been_in_arming_position = 0; } if (time_sticks_have_been_in_arming_position > 500000) { if (arm()) time_sticks_have_been_in_arming_position = 0; } } else // _armed_state is ARMED { // if left stick is down and to the left if (board->pwmRead(params->get_param_int(Params::PARAM_RC_F_CHANNEL)) < params->get_param_int(Params::PARAM_RC_F_BOTTOM) + params->get_param_int(Params::PARAM_ARM_THRESHOLD) && board->pwmRead(params->get_param_int(Params::PARAM_RC_Z_CHANNEL)) < (params->get_param_int(Params::PARAM_RC_Z_CENTER) - params->get_param_int(Params::PARAM_RC_Z_RANGE) / 2) + params->get_param_int(Params::PARAM_ARM_THRESHOLD)) { time_sticks_have_been_in_arming_position += dt; } else { time_sticks_have_been_in_arming_position = 0; } if (time_sticks_have_been_in_arming_position > 500000) { disarm(); time_sticks_have_been_in_arming_position = 0; } } } else { if (rc->rc_switch(params->get_param_int(Params::PARAM_ARM_CHANNEL))) { if (common_state->is_disarmed()) arm(); } else { if (common_state->is_armed()) disarm(); } } } return true; } } //namespace
30.842857
195
0.582214
1514louluo
84bba774620d5c99a65288f95797b49f4a1f9e6d
5,883
cpp
C++
SWFFile.cpp
brucewangkorea/swfreplacer
24f01045fd7686ff8c9f97bf89199afd8d3cc0d6
[ "Apache-2.0" ]
null
null
null
SWFFile.cpp
brucewangkorea/swfreplacer
24f01045fd7686ff8c9f97bf89199afd8d3cc0d6
[ "Apache-2.0" ]
null
null
null
SWFFile.cpp
brucewangkorea/swfreplacer
24f01045fd7686ff8c9f97bf89199afd8d3cc0d6
[ "Apache-2.0" ]
null
null
null
/* * File: SWFFile.cpp * Author: brucewang * * Created on October 24, 2009, 9:27 PM */ #include "SWFFile.h" #include <stdlib.h> #include <stdio.h> #include <memory.h> #include "DefineEditText.h" #include "DefineJPEG2.h" #include "Exports.h" #include "DefineSprite.h" /// Destructor SWFFile::~SWFFile() { if (SwfData != 0) { free(SwfData); } if (this->swf) delete this->swf; } // // // //#region Constructors SWFFile::SWFFile(const char* fileName) { //fileName = \0; //signature = String.Empty; long lFileSize = 0L; SwfData = 0; FILE *fp = fopen(fileName, "rb"); if (fp) { fseek(fp, 0, SEEK_END); lFileSize = ftell(fp); fseek(fp, 0, SEEK_SET); if (lFileSize > 0) { SwfData = (unsigned char *) malloc(lFileSize); if (SwfData) { if (fread(SwfData, 1, lFileSize, fp) > 0) { this->swf = new SWFReader(SwfData); // deletion is done at the destructor if (ReadHeader()) { // Just identify the tag types // ** This would normally be the place to start processing tags ** IdentifyTags(); //printf("## FILE SIZE = %d\n", this->m_Header.FileLength()); } }// read file }// memory allocation }// get file size fclose(fp); }// file open } bool SWFFile::ReadHeader()//byte * SwfData) { this->m_Header.Read(this->swf); //printf("##Header Length = %d\n", this->m_Header.HeaderLength()); return true; } // // // // Doesn't do much but iterate through the tags void SWFFile::IdentifyTags()//unsigned char * SwfData) { m_TagList.clear(); Tag *p; do { p = new Tag(swf); m_TagList.push_back(*p); } while (p->ID() != 0); list<Tag>::iterator i; int iContentsLength = 0; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { iContentsLength += (*i).GetLength(); } //printf("#Content length = %d\n", iContentsLength); } //#region Properties szstring SWFFile::FileName() { return fileName; } //#endregion void SWFFile::ChangeEditValue( const char *szVariableName, const char *szInitialValue) { list<Tag>::iterator i; DefineEditText* pEditText; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { if ((*i).ID() == 37) // DefineEditText { pEditText = (DefineEditText*) ((*i).GetTagContent()); #if 0 // For test... change all variables.. #else if (0 == strcmp(pEditText->GetVariableName(), szVariableName)) #endif pEditText->SetInitText(szInitialValue); } } } // Find matching character id for given exportname. // Returns 0 when couldn't find it. UInt16 SWFFile::FindMatchingIdFromExptName(const char* szExportName){ list<Tag>::iterator i; UInt16 nId2Change = 0; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { if ((*i).ID() == 56) // Export { Exports* pItem = (Exports*)( (*i).GetTagContent() ); stExportAssets* pExport = pItem->GetExportData(); list<stExportItem>::iterator JJ; for (JJ = pExport->Items.begin(); JJ != pExport->Items.end(); ++JJ) { if( 0 == strcmp( (*JJ).Name, szExportName) ){ nId2Change = (*JJ).ID; break; } } } if(nId2Change!=0){ break; } } if( 0== nId2Change ){ printf("# Could not find Matching Export [%s].. Canceling image replace\n", szExportName); return 0; } return nId2Change; } void SWFFile::ChangeJpgImg(const char* szExportName, const char* szFilePath2Replacewith) { // 1. Find matching character id for given exportname. UInt16 nId2Change = FindMatchingIdFromExptName(szExportName); if( nId2Change==0 ) return; // 2. Change it.. list<Tag>::iterator i; DefineJPEG2* pJpg; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { if ((*i).ID() == 21) // DefineBitsJPEG2 { pJpg = (DefineJPEG2*) ((*i).GetTagContent()); // For test... change all variables.. if (pJpg->GetCharacterID() == nId2Change) pJpg->ReplaceImg(szFilePath2Replacewith); } } } void SWFFile::ChangeSprite(const char* szExportName, const char* szFilePath2Replacewith){ // 1. Find matching character id for given exportname. UInt16 nId2Change = FindMatchingIdFromExptName(szExportName); if( nId2Change==0 ) return; // 2. Change it.. list<Tag>::iterator i; DefineSprite* pInst; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { if ((*i).ID() == 39) // DefineSprite { pInst = (DefineSprite*) ((*i).GetTagContent()); // For test... change all variables.. if (pInst->GetCharacterID() == nId2Change){ pInst->ReplaceSprite(&m_TagList, szFilePath2Replacewith); //break; } } } } ulong SWFFile::SaveTo(char* filename) { SWFWriter swf; list<Tag>::iterator i; // // Check the contents size. (Compression is not considered) int iContentsLength = 0; for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { iContentsLength += (*i).GetLength(); } this->m_Header.ChangeContentsLength(iContentsLength); // // Write Header this->m_Header.Write(&swf); // // Write the rest of the contents. for (i = this->m_TagList.begin(); i != this->m_TagList.end(); ++i) { (*i).Write(&swf); } swf.SaveFile(filename); return 0L; }
25.467532
98
0.552269
brucewangkorea
84c900f63a0a150d4dc999465ce50bed7aafd72b
4,923
cpp
C++
XDKSamples/IntroGraphics/SimpleTriangleCppWinRT/Main.cpp
ComputeWorks/Xbox-ATG-Samples
6b88d6a03cf1efae7007a928713896863ec04ca5
[ "MIT" ]
1
2019-10-13T06:23:52.000Z
2019-10-13T06:23:52.000Z
XDKSamples/IntroGraphics/SimpleTriangleCppWinRT/Main.cpp
ComputeWorks/Xbox-ATG-Samples
6b88d6a03cf1efae7007a928713896863ec04ca5
[ "MIT" ]
null
null
null
XDKSamples/IntroGraphics/SimpleTriangleCppWinRT/Main.cpp
ComputeWorks/Xbox-ATG-Samples
6b88d6a03cf1efae7007a928713896863ec04ca5
[ "MIT" ]
null
null
null
//-------------------------------------------------------------------------------------- // Main.cpp // // Entry point for Xbox One exclusive title. // // Advanced Technology Group (ATG) // Copyright (C) Microsoft Corporation. All rights reserved. //-------------------------------------------------------------------------------------- #include "pch.h" #include "SimpleTriangle.h" #include "Telemetry.h" using namespace winrt::Windows::ApplicationModel; using namespace winrt::Windows::ApplicationModel::Core; using namespace winrt::Windows::ApplicationModel::Activation; using namespace winrt::Windows::UI::Core; using namespace winrt::Windows::Foundation; using namespace DirectX; bool g_HDRMode = false; class ViewProvider : public winrt::implements<ViewProvider, IFrameworkView> { public: ViewProvider() : m_exit(false) { } // IFrameworkView methods void Initialize(CoreApplicationView const & applicationView) { applicationView.Activated({ this, &ViewProvider::OnActivated }); CoreApplication::Suspending({ this, &ViewProvider::OnSuspending }); CoreApplication::Resuming({ this, &ViewProvider::OnResuming }); CoreApplication::DisableKinectGpuReservation(true); m_sample = std::make_unique<Sample>(); if (m_sample->RequestHDRMode()) { // Request HDR mode. auto determineHDR = winrt::Windows::Xbox::Graphics::Display::DisplayConfiguration::TrySetHdrModeAsync(); // In a real game, you'd do some initialization here to hide the HDR mode switch. // Finish up HDR mode detection while (determineHDR.Status() == AsyncStatus::Started) { Sleep(100); }; if (determineHDR.Status() != AsyncStatus::Completed) { throw std::exception("TrySetHdrModeAsync"); } g_HDRMode = determineHDR.get().HdrEnabled(); #ifdef _DEBUG OutputDebugStringA((g_HDRMode) ? "INFO: Display in HDR Mode\n" : "INFO: Display in SDR Mode\n"); #endif } // Sample Usage Telemetry // // Disable or remove this code block to opt-out of sample usage telemetry // if (EventRegisterATGSampleTelemetry() == ERROR_SUCCESS) { wchar_t exePath[MAX_PATH + 1] = {}; if (!GetModuleFileNameW(nullptr, exePath, MAX_PATH)) { wcscpy_s(exePath, L"Unknown"); } EventWriteSampleLoaded(exePath); } } void Uninitialize() { m_sample.reset(); } void SetWindow(CoreWindow const & window) { window.Closed({ this, &ViewProvider::OnWindowClosed }); // Default window thread to CPU 0 SetThreadAffinityMask(GetCurrentThread(), 0x1); auto windowPtr = static_cast<::IUnknown*>(winrt::get_abi(window)); m_sample->Initialize(windowPtr); } void Load(winrt::hstring const & /*entryPoint*/) { } void Run() { while (!m_exit) { m_sample->Tick(); CoreWindow::GetForCurrentThread().Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); } } protected: // Event handlers void OnActivated(CoreApplicationView const & /*applicationView*/, IActivatedEventArgs const & /*args*/) { CoreWindow::GetForCurrentThread().Activate(); } void OnSuspending(IInspectable const & /*sender*/, SuspendingEventArgs const & args) { auto deferral = args.SuspendingOperation().GetDeferral(); auto f = std::async(std::launch::async, [this, deferral]() { m_sample->OnSuspending(); deferral.Complete(); }); } void OnResuming(IInspectable const & /*sender*/, IInspectable const & /*args*/) { m_sample->OnResuming(); } void OnWindowClosed(CoreWindow const & /*sender*/, CoreWindowEventArgs const & /*args*/) { m_exit = true; } private: bool m_exit; std::unique_ptr<Sample> m_sample; }; class ViewProviderFactory : public winrt::implements<ViewProviderFactory, IFrameworkViewSource> { public: IFrameworkView CreateView() { return winrt::make<ViewProvider>(); } }; // Entry point int WINAPIV WinMain() { winrt::init_apartment(); // Default main thread to CPU 0 SetThreadAffinityMask(GetCurrentThread(), 0x1); auto viewProviderFactory = winrt::make<ViewProviderFactory>(); CoreApplication::Run(viewProviderFactory); winrt::uninit_apartment(); return 0; } // Exit helper void ExitSample() { winrt::Windows::ApplicationModel::Core::CoreApplication::Exit(); }
28.293103
120
0.582978
ComputeWorks
84cb0f5e39663683ceab48c50756def1aa58c77f
1,028
cpp
C++
LeetCode/SumOfAllOddLengthSubarrays.cpp
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
LeetCode/SumOfAllOddLengthSubarrays.cpp
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
LeetCode/SumOfAllOddLengthSubarrays.cpp
SelvorWhim/competitive
b9daaf21920d6f7669dc0c525e903949f4e33b62
[ "Unlicense" ]
null
null
null
// each array member has to be added to the sum according to the number of odd-length subarrays it appears in // each appears in 1 1-length, and 3 3-length unless it's near the edge, and 5 5-length with the same exception etc. // until the biggest odd that fits in the array length // if you're kth from the nearest edge, you appear in min(n, k) n-length subarrays // O(n^2) solution - there may be a closed formula for the inner loop but given n<=100, n^2 should be fine class Solution { public: int sumOddLengthSubarrays(vector<int>& arr) { int sum = 0; int n = arr.size(); int n_odd = (n%2==0) ? n-1 : n; for (int i = 0; i < n; i++) { int k = std::min(i+1, n-i); for (int j = 1; j <= n_odd; j += 2) { int times = std::min(std::min(j, k), n-j+1); sum += times * arr[i]; //cout << arr[i] << " appears " << times << " times in " << j << "-length subarrays" << endl; } } return sum; } };
42.833333
116
0.555447
SelvorWhim
84d03ca96cf0b464878f5667a6009dae43af8697
1,369
cpp
C++
assembler/src/symbol_table.cpp
floyza/nand2tetris-exercises
01f1e9414b6b340353f0e8478ea5d5937db1198d
[ "MIT" ]
null
null
null
assembler/src/symbol_table.cpp
floyza/nand2tetris-exercises
01f1e9414b6b340353f0e8478ea5d5937db1198d
[ "MIT" ]
null
null
null
assembler/src/symbol_table.cpp
floyza/nand2tetris-exercises
01f1e9414b6b340353f0e8478ea5d5937db1198d
[ "MIT" ]
null
null
null
#include "symbol_table.hpp" #include <iostream> #include <cassert> Symbol_table::Symbol_table() { symbol_defs["SP"] = 0; symbol_defs["LCL"] = 1; symbol_defs["ARG"] = 2; symbol_defs["THIS"] = 3; symbol_defs["THAT"] = 4; symbol_defs["SCREEN"] = 16384; symbol_defs["KBD"] = 24576; symbol_defs["R0"] = 0; symbol_defs["R1"] = 1; symbol_defs["R2"] = 2; symbol_defs["R3"] = 3; symbol_defs["R4"] = 4; symbol_defs["R5"] = 5; symbol_defs["R6"] = 6; symbol_defs["R7"] = 7; symbol_defs["R8"] = 8; symbol_defs["R9"] = 9; symbol_defs["R10"] = 10; symbol_defs["R11"] = 11; symbol_defs["R12"] = 12; symbol_defs["R13"] = 13; symbol_defs["R14"] = 14; symbol_defs["R15"] = 15; } void Symbol_table::add_entry(std::string symbol, int address) { if (symbol_defs.find(symbol) != symbol_defs.end()) { std::cerr << "WARNING: refinition of '" << symbol << "'\n"; } symbol_defs[symbol] = address; } bool Symbol_table::contains(const std::string &symbol) const { return symbol_defs.find(symbol) != symbol_defs.end(); } int Symbol_table::get_address(const std::string &symbol) const { auto i = symbol_defs.find(symbol); assert(i != symbol_defs.end()); return i->second; } int Symbol_table::get_new_address() { int addr = addr_cnt++; if (addr >= 16384) { throw std::runtime_error{"Symbol_table::get_new_address(): all addresses used up"}; } return addr; }
23.20339
85
0.661066
floyza
84d328f67b81428fbb49ac27f68235ae26554039
13,186
cpp
C++
src/OpenLoco/Entities/EntityManager.cpp
CyberSys/OpenLoco
e2c33334d2833aa82c30d73bdd730b2a624c56b0
[ "MIT" ]
null
null
null
src/OpenLoco/Entities/EntityManager.cpp
CyberSys/OpenLoco
e2c33334d2833aa82c30d73bdd730b2a624c56b0
[ "MIT" ]
null
null
null
src/OpenLoco/Entities/EntityManager.cpp
CyberSys/OpenLoco
e2c33334d2833aa82c30d73bdd730b2a624c56b0
[ "MIT" ]
null
null
null
#include "EntityManager.h" #include "../Console.h" #include "../Core/LocoFixedVector.hpp" #include "../Entities/Misc.h" #include "../Game.h" #include "../GameCommands/GameCommands.h" #include "../GameState.h" #include "../Interop/Interop.hpp" #include "../Localisation/StringIds.h" #include "../Map/Tile.h" #include "../OpenLoco.h" #include "../Vehicles/Vehicle.h" #include "EntityTweener.h" using namespace OpenLoco::Interop; namespace OpenLoco::EntityManager { constexpr size_t kSpatialEntityMapSize = (Map::map_pitch * Map::map_pitch) + 1; constexpr size_t kEntitySpatialIndexNull = kSpatialEntityMapSize - 1; static_assert(kSpatialEntityMapSize == 0x40001); static_assert(kEntitySpatialIndexNull == 0x40000); loco_global<EntityId[kSpatialEntityMapSize], 0x01025A8C> _entitySpatialIndex; loco_global<uint32_t, 0x01025A88> _entitySpatialCount; static auto& rawEntities() { return getGameState().entities; } static auto entities() { return FixedVector(rawEntities()); } static auto& rawListHeads() { return getGameState().entityListHeads; } static auto& rawListCounts() { return getGameState().entityListCounts; } // 0x0046FDFD void reset() { // Reset all entities to 0 std::fill(std::begin(rawEntities()), std::end(rawEntities()), Entity{}); // Reset all entity lists std::fill(std::begin(rawListCounts()), std::end(rawListCounts()), 0); std::fill(std::begin(rawListHeads()), std::end(rawListHeads()), EntityId::null); // Remake null entities (size maxNormalEntities) EntityBase* previous = nullptr; uint16_t id = 0; for (; id < Limits::maxNormalEntities; ++id) { auto& ent = rawEntities()[id]; ent.base_type = EntityBaseType::null; ent.id = EntityId(id); ent.next_thing_id = EntityId::null; ent.linkedListOffset = static_cast<uint8_t>(EntityListType::null) * 2; if (previous == nullptr) { ent.llPreviousId = EntityId::null; rawListHeads()[static_cast<uint8_t>(EntityListType::null)] = EntityId(id); } else { ent.llPreviousId = previous->id; previous->next_thing_id = EntityId(id); } previous = &ent; } rawListCounts()[static_cast<uint8_t>(EntityListType::null)] = Limits::maxNormalEntities; // Remake null money entities (size kMaxMoneyEntities) previous = nullptr; for (; id < Limits::kMaxEntities; ++id) { auto& ent = rawEntities()[id]; ent.base_type = EntityBaseType::null; ent.id = EntityId(id); ent.next_thing_id = EntityId::null; ent.linkedListOffset = static_cast<uint8_t>(EntityListType::nullMoney) * 2; if (previous == nullptr) { ent.llPreviousId = EntityId::null; rawListHeads()[static_cast<uint8_t>(EntityListType::nullMoney)] = EntityId(id); } else { ent.llPreviousId = previous->id; previous->next_thing_id = EntityId(id); } previous = &ent; } rawListCounts()[static_cast<uint8_t>(EntityListType::nullMoney)] = Limits::kMaxMoneyEntities; resetSpatialIndex(); EntityTweener::get().reset(); } EntityId firstId(EntityListType list) { return rawListHeads()[(size_t)list]; } uint16_t getListCount(const EntityListType list) { return rawListCounts()[static_cast<size_t>(list)]; } template<> Vehicles::VehicleHead* first() { return get<Vehicles::VehicleHead>(firstId(EntityListType::vehicleHead)); } template<> EntityBase* get(EntityId id) { EntityBase* result = nullptr; if (enumValue(id) < Limits::kMaxEntities) { return &rawEntities()[enumValue(id)]; } return result; } constexpr size_t getSpatialIndexOffset(const Map::Pos2& loc) { if (loc.x == Location::null) return kEntitySpatialIndexNull; const auto tileX = std::abs(loc.x) / Map::tile_size; const auto tileY = std::abs(loc.y) / Map::tile_size; if (tileX >= Map::map_pitch || tileY >= Map::map_pitch) return kEntitySpatialIndexNull; return (Map::map_pitch * tileX) + tileY; } EntityId firstQuadrantId(const Map::Pos2& loc) { auto index = getSpatialIndexOffset(loc); return _entitySpatialIndex[index]; } static void insertToSpatialIndex(EntityBase& entity, const size_t newIndex) { entity.nextQuadrantId = _entitySpatialIndex[newIndex]; _entitySpatialIndex[newIndex] = entity.id; } static void insertToSpatialIndex(EntityBase& entity) { const auto index = getSpatialIndexOffset(entity.position); insertToSpatialIndex(entity, index); } // 0x0046FF54 void resetSpatialIndex() { // Clear existing array std::fill(std::begin(_entitySpatialIndex), std::end(_entitySpatialIndex), EntityId::null); // Original filled an unreferenced array at 0x010A5A8E as well then overwrote part of it??? // Refill the index for (auto& ent : entities()) { insertToSpatialIndex(ent); } } // 0x0046FC57 void updateSpatialIndex() { for (auto& ent : entities()) { ent.moveTo(ent.position); } } static bool removeFromSpatialIndex(EntityBase& entity, const size_t index) { auto* quadId = &_entitySpatialIndex[index]; _entitySpatialCount = 0; while (enumValue(*quadId) < Limits::kMaxEntities) { auto* quadEnt = get<EntityBase>(*quadId); if (quadEnt == &entity) { *quadId = entity.nextQuadrantId; return true; } _entitySpatialCount++; if (_entitySpatialCount > Limits::kMaxEntities) { break; } quadId = &quadEnt->nextQuadrantId; } return false; } static bool removeFromSpatialIndex(EntityBase& entity) { const auto index = getSpatialIndexOffset(entity.position); return removeFromSpatialIndex(entity, index); } void moveSpatialEntry(EntityBase& entity, const Map::Pos3& loc) { const auto newIndex = getSpatialIndexOffset(loc); const auto oldIndex = getSpatialIndexOffset(entity.position); if (newIndex != oldIndex) { if (!removeFromSpatialIndex(entity, oldIndex)) { Console::log("Invalid quadrant ids... Reseting spatial index."); resetSpatialIndex(); moveSpatialEntry(entity, loc); return; } insertToSpatialIndex(entity, newIndex); } entity.position = loc; } static EntityBase* createEntity(EntityId id, EntityListType list) { auto* newEntity = get<EntityBase>(id); if (newEntity == nullptr) { Console::error("Tried to create invalid entity!"); return nullptr; } moveEntityToList(newEntity, list); newEntity->position = { Location::null, Location::null, 0 }; insertToSpatialIndex(*newEntity); newEntity->name = StringIds::empty_pop; newEntity->var_14 = 16; newEntity->var_09 = 20; newEntity->var_15 = 8; newEntity->var_0C = 0; newEntity->sprite_left = Location::null; return newEntity; } // 0x004700A5 EntityBase* createEntityMisc() { if (getListCount(EntityListType::misc) >= Limits::kMaxMiscEntities) { return nullptr; } if (getListCount(EntityListType::null) <= 0) { return nullptr; } auto newId = rawListHeads()[static_cast<uint8_t>(EntityListType::null)]; return createEntity(newId, EntityListType::misc); } // 0x0047011C EntityBase* createEntityMoney() { if (getListCount(EntityListType::nullMoney) <= 0) { return nullptr; } auto newId = rawListHeads()[static_cast<uint8_t>(EntityListType::nullMoney)]; return createEntity(newId, EntityListType::misc); } // 0x00470039 EntityBase* createEntityVehicle() { if (getListCount(EntityListType::null) <= 0) { return nullptr; } auto newId = rawListHeads()[static_cast<uint8_t>(EntityListType::null)]; return createEntity(newId, EntityListType::vehicle); } // 0x0047024A void freeEntity(EntityBase* const entity) { EntityTweener::get().removeEntity(entity); auto list = enumValue(entity->id) < 19800 ? EntityListType::null : EntityListType::nullMoney; moveEntityToList(entity, list); StringManager::emptyUserString(entity->name); entity->base_type = EntityBaseType::null; if (!removeFromSpatialIndex(*entity)) { Console::log("Invalid quadrant ids... Reseting spatial index."); resetSpatialIndex(); } } // 0x004A8826 void updateVehicles() { if (Game::hasFlags(1u << 0) && !isEditorMode()) { for (auto v : VehicleList()) { v->updateVehicle(); } } } // 0x004402F4 void updateMiscEntities() { if (getGameState().flags & (1u << 0)) { for (auto* misc : EntityList<EntityListIterator<MiscBase>, EntityListType::misc>()) { misc->update(); } } } // 0x0047019F void moveEntityToList(EntityBase* const entity, const EntityListType list) { auto newListOffset = static_cast<uint8_t>(list) * 2; if (entity->linkedListOffset == newListOffset) { return; } auto curList = entity->linkedListOffset / 2; auto nextId = entity->next_thing_id; auto previousId = entity->llPreviousId; // Unlink previous entity from this entity if (previousId == EntityId::null) { rawListHeads()[curList] = nextId; } else { auto* previousEntity = get<EntityBase>(previousId); if (previousEntity == nullptr) { Console::error("Invalid previous entity id. Entity linked list corrupted?"); } else { previousEntity->next_thing_id = nextId; } } // Unlink next entity from this entity if (nextId != EntityId::null) { auto* nextEntity = get<EntityBase>(nextId); if (nextEntity == nullptr) { Console::error("Invalid next entity id. Entity linked list corrupted?"); } else { nextEntity->llPreviousId = previousId; } } entity->llPreviousId = EntityId::null; entity->linkedListOffset = newListOffset; entity->next_thing_id = rawListHeads()[static_cast<uint8_t>(list)]; rawListHeads()[static_cast<uint8_t>(list)] = entity->id; // Link next entity to this entity if (entity->next_thing_id != EntityId::null) { auto* nextEntity = get<EntityBase>(entity->next_thing_id); if (nextEntity == nullptr) { Console::error("Invalid next entity id. Entity linked list corrupted?"); } else { nextEntity->llPreviousId = entity->id; } } rawListCounts()[curList]--; rawListCounts()[static_cast<uint8_t>(list)]++; } // 0x00470188 bool checkNumFreeEntities(const size_t numNewEntities) { if (EntityManager::getListCount(EntityManager::EntityListType::null) <= numNewEntities) { GameCommands::setErrorText(StringIds::too_many_objects_in_game); return false; } return true; } static void zeroEntity(EntityBase* ent) { auto next = ent->next_thing_id; auto previous = ent->llPreviousId; auto id = ent->id; auto llOffset = ent->linkedListOffset; std::fill_n(reinterpret_cast<uint8_t*>(ent), sizeof(Entity), 0); ent->base_type = EntityBaseType::null; ent->next_thing_id = next; ent->llPreviousId = previous; ent->id = id; ent->linkedListOffset = llOffset; } // 0x0046FED5 void zeroUnused() { for (auto* ent : EntityList<EntityListIterator<EntityBase>, EntityListType::null>()) { zeroEntity(ent); } for (auto* ent : EntityList<EntityListIterator<EntityBase>, EntityListType::nullMoney>()) { zeroEntity(ent); } } }
30.665116
101
0.57781
CyberSys
84d43161872ab0cf38259fad45953b744efb9a1d
2,550
cpp
C++
src/util/LayoutView.cpp
korli/Album
cf7144d63f4a54a8a84c0b499cadb7da72cf5642
[ "MIT" ]
null
null
null
src/util/LayoutView.cpp
korli/Album
cf7144d63f4a54a8a84c0b499cadb7da72cf5642
[ "MIT" ]
14
2015-05-18T12:46:13.000Z
2021-09-01T11:50:06.000Z
src/util/LayoutView.cpp
korli/Album
cf7144d63f4a54a8a84c0b499cadb7da72cf5642
[ "MIT" ]
9
2015-04-26T19:01:07.000Z
2021-06-25T06:36:59.000Z
/** Copyright (c) 2006-2008 by Matjaz Kovac Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \file LayoutView.cpp \brief Auto-layout View \author M.Kovac Depends on LayoutPlan.cpp */ #include <LayoutView.h> LayoutView::LayoutView(BRect frame, const char *name, LayoutPlan *layout, uint32 resize, uint32 flags): BView(frame, name, resize, flags), fLayout(layout), fDefaultHint(LAYOUT_HINT_NONE), fPadding(0,0,0,0) { } LayoutView::~LayoutView() { delete fLayout; } /** */ void LayoutView::AllAttached() { Arrange(); } /** Frame() changed. */ void LayoutView::FrameResized(float width, float height) { Arrange(); } LayoutPlan& LayoutView::Layout() { return *fLayout; } void LayoutView::SetDefaultHint(uint32 hint) { fDefaultHint = hint; } void LayoutView::SetPadding(float left, float top, float right, float bottom) { fPadding.Set(left, top, right, bottom); } /** Lays out child views. */ void LayoutView::Arrange() { if (fLayout) { fLayout->Frame() = Bounds(); fLayout->Frame().left += fPadding.left; fLayout->Frame().right -= fPadding.right; fLayout->Frame().top += fPadding.top; fLayout->Frame().bottom -= fPadding.bottom; fLayout->Reset(); BView *child; for (int32 i = 0; (child = ChildAt(i)); i++) { child->ResizeToPreferred(); uint hint = fDefaultHint; if (i == CountChildren()-1) // may trigger some special processing hint |= LAYOUT_HINT_LAST; BRect frame = fLayout->Next(child->Frame(), hint); child->MoveTo(frame.LeftTop()); child->ResizeTo(frame.Width(), frame.Height()); } } }
24.056604
103
0.725098
korli
84e025ddd5bba61131693ac773b610fbeed19d26
21,043
cpp
C++
tests/future/future_sequence_with_failures_test.cpp
opensoft/asynqro
e7d534f67a00eb47cb3e227e896c7fa3976d89a3
[ "BSD-3-Clause" ]
4
2019-03-10T14:08:03.000Z
2020-01-14T15:41:29.000Z
tests/future/future_sequence_with_failures_test.cpp
opensoft/asynqro
e7d534f67a00eb47cb3e227e896c7fa3976d89a3
[ "BSD-3-Clause" ]
null
null
null
tests/future/future_sequence_with_failures_test.cpp
opensoft/asynqro
e7d534f67a00eb47cb3e227e896c7fa3976d89a3
[ "BSD-3-Clause" ]
null
null
null
#include "copycountcontainers.h" #include "futurebasetest.h" #ifdef ASYNQRO_QT_SUPPORT # include <QLinkedList> # include <QList> # include <QVector> #endif #include <list> #include <vector> using namespace std::chrono_literals; template <typename, typename> struct InnerTypeChanger; template <template <typename...> typename C, typename NewType, typename... Args> struct InnerTypeChanger<C<Args...>, NewType> { using type = C<NewType>; }; template <typename Sequence> class FutureSequenceWithFailuresTest : public FutureBaseTest { public: using Source = typename InnerTypeChanger<Sequence, TestFuture<int>>::type; static inline int N = 100; }; template <typename Sequence> class FutureMoveSequenceWithFailuresTest : public FutureBaseTest { public: using Source = typename InnerTypeChanger<Sequence, TestFuture<int>>::type; static inline int N = 100; protected: void SetUp() override { FutureBaseTest::SetUp(); Source::copyCounter = 0; Source::createCounter = 0; } }; using SequenceTypes = ::testing::Types<std::vector<int>, std::list<int> #ifdef ASYNQRO_QT_SUPPORT , QVector<int>, QList<int>, QLinkedList<int> #endif >; using CopyCountSequenceTypes = ::testing::Types<CopyCountVector<int>, CopyCountList<int> #ifdef ASYNQRO_QT_SUPPORT , CopyCountQVector<int>, CopyCountQList<int>, CopyCountQLinkedList<int> #endif >; TYPED_TEST_SUITE(FutureSequenceWithFailuresTest, SequenceTypes); template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceHelper(Func &&sequencer) { std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); typename TestFixture::Source futures = traverse::map(promises, [](const auto &p) { return p.future(); }, typename TestFixture::Source()); auto sequencedFuture = sequencer(futures); int i = 0; for (auto it = futures.cbegin(); it != futures.cend(); ++it, ++i) EXPECT_FALSE(it->isCompleted()) << i; for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; promises[i].success(i * 2); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); auto result = sequencedFuture.result().first; ASSERT_EQ(TestFixture::N, result.size()); traverse::map(result, [](auto index, auto value) { EXPECT_EQ(index * 2, value) << index; return true; }, std::set<bool>()); auto failures = sequencedFuture.result().second; ASSERT_TRUE(failures.empty()); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureSequenceWithFailuresTest, sequence) { sequenceHelper<TestFixture, std::unordered_map>( [](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceMap) { sequenceHelper<TestFixture, std::map>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<std::map>(futures); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureSequenceWithFailuresTest, sequenceQMap) { sequenceHelper<TestFixture, QMap>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QMap>(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceQHash) { sequenceHelper<TestFixture, QHash>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QHash>(futures); }); } #endif template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceNegativeHelper(Func &&sequencer) { std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); typename TestFixture::Source futures = traverse::map(promises, [](const auto &p) { return p.future(); }, typename TestFixture::Source()); auto sequencedFuture = sequencer(futures); int i = 0; for (auto it = futures.cbegin(); it != futures.cend(); ++it, ++i) EXPECT_FALSE(it->isCompleted()) << i; for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; if (i == TestFixture::N - 2 || i == TestFixture::N - 4) promises[i].failure("failed"); else promises[i].success(i * 2); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); auto result = sequencedFuture.result().first; ASSERT_EQ(TestFixture::N - 2, result.size()); ASSERT_FALSE(result.count(TestFixture::N - 2)); ASSERT_FALSE(result.count(TestFixture::N - 4)); traverse::map(result, [](auto index, auto value) { EXPECT_EQ(index * 2, value) << index; return true; }, std::set<bool>()); auto failures = sequencedFuture.result().second; ASSERT_EQ(2, failures.size()); ASSERT_TRUE(failures.count(TestFixture::N - 4)); EXPECT_EQ("failed", failures[TestFixture::N - 4]); ASSERT_TRUE(failures.count(TestFixture::N - 2)); EXPECT_EQ("failed", failures[TestFixture::N - 2]); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceNegative) { sequenceNegativeHelper<TestFixture, std::unordered_map>( [](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceNegativeMap) { sequenceNegativeHelper<TestFixture, std::map>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<std::map>(futures); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureSequenceWithFailuresTest, sequenceNegativeQMap) { sequenceNegativeHelper<TestFixture, QMap>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QMap>(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceNegativeQHash) { sequenceNegativeHelper<TestFixture, QHash>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QHash>(futures); }); } #endif template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceAllNegativeHelper(Func &&sequencer) { std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); typename TestFixture::Source futures = traverse::map(promises, [](const auto &p) { return p.future(); }, typename TestFixture::Source()); auto sequencedFuture = sequencer(futures); int i = 0; for (auto it = futures.cbegin(); it != futures.cend(); ++it, ++i) EXPECT_FALSE(it->isCompleted()) << i; for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; if (i == TestFixture::N - 2) promises[i].failure("other"); else promises[i].failure("failed"); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); auto result = sequencedFuture.result().first; ASSERT_TRUE(result.empty()); auto failures = sequencedFuture.result().second; ASSERT_EQ(TestFixture::N, failures.size()); traverse::map(failures, [](auto index, const std::string &value) { if (index == TestFixture::N - 2) EXPECT_EQ("other", value) << index; else EXPECT_EQ("failed", value) << index; return true; }, std::set<bool>()); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceAllNegative) { sequenceAllNegativeHelper<TestFixture, std::unordered_map>( [](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceAllNegativeMap) { sequenceAllNegativeHelper<TestFixture, std::map>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<std::map>(futures); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureSequenceWithFailuresTest, sequenceAllNegativeQMap) { sequenceAllNegativeHelper<TestFixture, QMap>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QMap>(futures); }); } TYPED_TEST(FutureSequenceWithFailuresTest, sequenceAllNegativeQHash) { sequenceAllNegativeHelper<TestFixture, QHash>([](const typename TestFixture::Source &futures) { return TestFuture<int>::sequenceWithFailures<QHash>(futures); }); } #endif TYPED_TEST(FutureSequenceWithFailuresTest, sequenceEmpty) { typename TestFixture::Source futures; auto sequencedFuture = TestFuture<int>::sequenceWithFailures(futures); ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); auto result = sequencedFuture.result(); EXPECT_TRUE(result.first.empty()); EXPECT_TRUE(result.second.empty()); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result.first)>, std::unordered_map>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result.second)>, std::unordered_map>); } TYPED_TEST_SUITE(FutureMoveSequenceWithFailuresTest, CopyCountSequenceTypes); template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceMoveHelper(Func &&sequencer) { using Result = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; using FailuresResult = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; Result::copyCounter = 0; Result::createCounter = 0; FailuresResult::copyCounter = 0; FailuresResult::createCounter = 0; std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); auto sequencedFuture = sequencer( traverse::map(promises, [](const auto &p) { return p.future(); }, std::move(typename TestFixture::Source()))); for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; promises[i].success(i * 2); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); const auto &result = sequencedFuture.resultRef().first; ASSERT_EQ(TestFixture::N, result.size()); traverse::map(result, [](auto index, auto value) { EXPECT_EQ(index * 2, value) << index; return true; }, std::set<bool>()); const auto &failures = sequencedFuture.resultRef().second; ASSERT_TRUE(failures.empty()); EXPECT_EQ(0, Result::copyCounter); EXPECT_EQ(1, Result::createCounter); EXPECT_EQ(0, FailuresResult::copyCounter); EXPECT_EQ(1, FailuresResult::createCounter); EXPECT_EQ(0, TestFixture::Source::copyCounter); EXPECT_EQ(1, TestFixture::Source::createCounter); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequence) { sequenceMoveHelper<TestFixture, CopyCountUnorderedMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountUnorderedMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceMap) { sequenceMoveHelper<TestFixture, CopyCountMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountMap>(std::move(futures)); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceQMap) { sequenceMoveHelper<TestFixture, CopyCountQMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceQHash) { sequenceMoveHelper<TestFixture, CopyCountQHash>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQHash>(std::move(futures)); }); } #endif template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceNegativeMoveHelper(Func &&sequencer) { using Result = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; using FailuresResult = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; Result::copyCounter = 0; Result::createCounter = 0; FailuresResult::copyCounter = 0; FailuresResult::createCounter = 0; std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); auto sequencedFuture = sequencer( traverse::map(promises, [](const auto &p) { return p.future(); }, std::move(typename TestFixture::Source()))); for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; if (i == TestFixture::N - 2 || i == TestFixture::N - 4) promises[i].failure("failed"); else promises[i].success(i * 2); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); const auto &result = sequencedFuture.resultRef().first; ASSERT_EQ(TestFixture::N - 2, result.size()); ASSERT_FALSE(result.count(TestFixture::N - 2)); ASSERT_FALSE(result.count(TestFixture::N - 4)); traverse::map(result, [](auto index, auto value) { EXPECT_EQ(index * 2, value) << index; return true; }, std::set<bool>()); const auto &failures = sequencedFuture.resultRef().second; ASSERT_EQ(2, failures.size()); ASSERT_TRUE(failures.count(TestFixture::N - 4)); EXPECT_EQ("failed", failures[TestFixture::N - 4]); ASSERT_TRUE(failures.count(TestFixture::N - 2)); EXPECT_EQ("failed", failures[TestFixture::N - 2]); EXPECT_EQ(0, Result::copyCounter); EXPECT_EQ(1, Result::createCounter); EXPECT_EQ(0, FailuresResult::copyCounter); EXPECT_EQ(1, FailuresResult::createCounter); EXPECT_EQ(0, TestFixture::Source::copyCounter); EXPECT_EQ(1, TestFixture::Source::createCounter); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceNegative) { sequenceNegativeMoveHelper<TestFixture, CopyCountUnorderedMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountUnorderedMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceNegativeMap) { sequenceNegativeMoveHelper<TestFixture, CopyCountMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountMap>(std::move(futures)); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceNegativeQMap) { sequenceNegativeMoveHelper<TestFixture, CopyCountQMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceNegativeQHash) { sequenceNegativeMoveHelper<TestFixture, CopyCountQHash>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQHash>(std::move(futures)); }); } #endif template <typename TestFixture, template <typename...> typename Container, typename Func> void sequenceAllNegativeMoveHelper(Func &&sequencer) { using Result = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; using FailuresResult = std::decay_t<decltype(sequencer(typename TestFixture::Source()).resultRef().first)>; Result::copyCounter = 0; Result::createCounter = 0; FailuresResult::copyCounter = 0; FailuresResult::createCounter = 0; std::vector<TestPromise<int>> promises; for (int i = 0; i < TestFixture::N; ++i) asynqro::traverse::detail::containers::add(promises, TestPromise<int>()); auto sequencedFuture = sequencer( traverse::map(promises, [](const auto &p) { return p.future(); }, std::move(typename TestFixture::Source()))); for (size_t i = 0; i < TestFixture::N; ++i) { EXPECT_FALSE(sequencedFuture.isCompleted()) << i; if (i == TestFixture::N - 2) promises[i].failure("other"); else promises[i].failure("failed"); } ASSERT_TRUE(sequencedFuture.isCompleted()); EXPECT_TRUE(sequencedFuture.isSucceeded()); EXPECT_FALSE(sequencedFuture.isFailed()); const auto &result = sequencedFuture.resultRef().first; ASSERT_TRUE(result.empty()); const auto &failures = sequencedFuture.resultRef().second; ASSERT_EQ(TestFixture::N, failures.size()); traverse::map(failures, [](auto index, const std::string &value) { if (index == TestFixture::N - 2) EXPECT_EQ("other", value) << index; else EXPECT_EQ("failed", value) << index; return true; }, std::set<bool>()); EXPECT_EQ(0, Result::copyCounter); EXPECT_EQ(1, Result::createCounter); EXPECT_EQ(0, FailuresResult::copyCounter); EXPECT_EQ(1, FailuresResult::createCounter); EXPECT_EQ(0, TestFixture::Source::copyCounter); EXPECT_EQ(1, TestFixture::Source::createCounter); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(result)>, Container>); static_assert(detail::IsSpecialization_V<std::decay_t<decltype(failures)>, Container>); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceAllNegative) { sequenceAllNegativeMoveHelper<TestFixture, CopyCountUnorderedMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountUnorderedMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceAllNegativeMap) { sequenceAllNegativeMoveHelper<TestFixture, CopyCountMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountMap>(std::move(futures)); }); } #ifdef ASYNQRO_QT_SUPPORT TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceAllNegativeQMap) { sequenceAllNegativeMoveHelper<TestFixture, CopyCountQMap>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQMap>(std::move(futures)); }); } TYPED_TEST(FutureMoveSequenceWithFailuresTest, sequenceAllNegativeQHash) { sequenceAllNegativeMoveHelper<TestFixture, CopyCountQHash>([](typename TestFixture::Source &&futures) { return TestFuture<int>::sequenceWithFailures<CopyCountQHash>(std::move(futures)); }); } #endif
39.554511
118
0.676757
opensoft
84e08c0e96253bb5bc5846fda80a7e37d673ff52
1,500
cpp
C++
LPA-TPS/KnightsInFEN.cpp
OttoWBitt/LPA
706596b64b38cff690dcc624998a70bd0929ea27
[ "MIT" ]
1
2018-08-23T17:31:23.000Z
2018-08-23T17:31:23.000Z
LPA-TPS/KnightsInFEN.cpp
OttoWBitt/LPA
706596b64b38cff690dcc624998a70bd0929ea27
[ "MIT" ]
null
null
null
LPA-TPS/KnightsInFEN.cpp
OttoWBitt/LPA
706596b64b38cff690dcc624998a70bd0929ea27
[ "MIT" ]
null
null
null
/* Nome: Otto Bittencourt Matricula: 504654 LPA */ #include<iostream> #include<cstdio> #include<cstring> using namespace std; int loop = 0; char board[5][5]; char target[5][5] = { '1', '1', '1', '1', '1', '0', '1', '1', '1', '1', '0', '0', ' ', '1', '1', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', }; int cont; int movex[8] = { 1, 2, 2, 1, -1, -2, -2, -1,}; int movey[8] = { -2, -1, 1, 2, 2, 1, -1, -2,}; bool ehValido(int pri, int seg) { if (pri >= 5 || pri < 0)return false; if (seg >= 5 || seg < 0)return false; return true; } void dfs(int cont2, int x, int y) { if (cont2 == 11){ return; } if (memcmp(board, target, sizeof(board)) == 0) { cont = min(cont, cont2); return; } for (int i = 0; i < 8; i++) { int xx = x + movex[i]; int yy = y + movey[i]; if (ehValido(xx, yy)) { swap(board[x][y], board[xx][yy]); dfs(cont2 + 1, xx, yy); loop++; swap(board[x][y], board[xx][yy]); } } } int main() { int numeroDeCasos; cin >> numeroDeCasos; string ent1; getline(cin, ent1); for (int i = 0; i < numeroDeCasos; i++) { int x, y; for (int j = 0; j < 5; j++) { getline(cin, ent1); for (int k = 0; k < 5; k++) { board[j][k] = ent1[k]; if (ent1[k] == ' ') { x = j; y = k; } } } cont = 11; dfs(0, x, y); if (cont == 11) { printf("Unsolvable in less than 11 move(s).\n"); } else { printf("Solvable in %d move(s).\n", cont); } //printf("contador eh %d \n",loop); } return 0; }
15.625
51
0.486
OttoWBitt
84e0bb08d41b721206af82aade2a49e8c08200b3
9,365
cpp
C++
modules/task_3/olenin_method_conjugate_gradient/gradient.cpp
Oskg/pp_2021_autumn
c05d35f4d4b324cc13e58188b4a0c0174f891976
[ "BSD-3-Clause" ]
1
2021-12-09T17:20:25.000Z
2021-12-09T17:20:25.000Z
modules/task_3/olenin_method_conjugate_gradient/gradient.cpp
Oskg/pp_2021_autumn
c05d35f4d4b324cc13e58188b4a0c0174f891976
[ "BSD-3-Clause" ]
null
null
null
modules/task_3/olenin_method_conjugate_gradient/gradient.cpp
Oskg/pp_2021_autumn
c05d35f4d4b324cc13e58188b4a0c0174f891976
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2021 Olenin Sergey #include <mpi.h> #include <ctime> #include <random> #include <vector> #include "../../../modules/task_3/olenin_method_conjugate_gradient/gradient.h" std::vector<double> rand_matrix(int size) { if (0 >= size) throw "wrong matrix size"; std::default_random_engine gene; gene.seed(static_cast<unsigned int>(time(0))); int sizematrix = size * size; std::vector<double> rand_matrix(sizematrix); for (int Index = 0; Index < size; ++Index) { for (int Jindex = Index; Jindex < size; ++Jindex) { rand_matrix[Index * size + Jindex] = gene() % 10; rand_matrix[Jindex * size + Index] = rand_matrix[Index * size + Jindex]; } } return rand_matrix; } std::vector<double> rand_vec(int size) { if (0 >= size) throw "wrong size of vector"; std::default_random_engine gene; gene.seed(static_cast<unsigned int>(time(0))); std::vector<double> vec(size); for (int index = 0; index < size; ++index) { vec[index] = 1 + gene() % 10; } return vec; } double vec_mult(const std::vector<double>& vec_a, const std::vector<double>& vec_b) { if (vec_a.size() != vec_b.size()) throw "vector sizes are not consistent "; double multi = 0.0; for (size_t index = 0; index < vec_a.size(); ++index) multi += vec_a[index] * vec_b[index]; return multi; } std::vector<double> matrix_vec_mult(const std::vector<double>& matrix, const std::vector<double>& vec) { if ((matrix.size() % vec.size()) != 0) throw "matrix and vector sizes are incompatible"; std::vector<double> multi(matrix.size() / vec.size()); for (size_t Index = 0; Index < (matrix.size() / vec.size()); ++Index) { multi[Index] = 0.0; for (size_t Jindex = 0; Jindex < vec.size(); ++Jindex) { multi[Index] += matrix[Index * vec.size() + Jindex] * vec[Jindex]; } } return multi; } std::vector<double> get_sol_for_one_proc(const std::vector<double>& matrix, const std::vector<double>& vec, int size) { if (size <= 0) throw "wrong size"; int iteration = 0; double alpha = 0.0, beta = 0.0; double norm_residual = 0.0, criteria = 0.1; std::vector<double> x(size); for (int index = 0; index < size; index++) { x[index] = 1; } std::vector<double> Az = matrix_vec_mult(matrix, x); std::vector<double> residualprev(size), residualnext(size); for (int index = 0; index < size; index++) residualprev[index] = vec[index] - Az[index]; // residualprev^(k) = b - A * x std::vector<double> gradient(residualprev); // gradient = r^(k) do { iteration++; Az = matrix_vec_mult(matrix, gradient); // Az = A * gradient alpha = vec_mult(residualprev, residualprev) / vec_mult(gradient, Az); for (int index = 0; index < size; index++) { x[index] += alpha * gradient[index]; residualnext[index] = residualprev[index] - alpha * Az[index]; // residualnext^(k+1) = residualprev^(k)-alpha*Az } beta = vec_mult(residualnext, residualnext) / vec_mult(residualprev, residualprev); norm_residual = sqrt(vec_mult(residualnext, residualnext)); for (int index = 0; index < size; index++) gradient[index] = residualnext[index] + beta * gradient[index]; // gradient^(k+1) = residualnext^(k+1) + beta*gradient^(k) residualprev = residualnext; } while ((norm_residual > criteria) && (iteration <= size)); return x; } std::vector<double> get_sol_for_multiply_proc( const std::vector<double>& matrix, const std::vector<double>& vec, int size) { if (0 >= size) throw "wrong size"; std::vector<double> matrixtmp = matrix; std::vector<double> vectortmp = vec; MPI_Bcast(matrixtmp.data(), size * size, MPI_DOUBLE, 0, MPI_COMM_WORLD); MPI_Bcast(vectortmp.data(), size, MPI_DOUBLE, 0, MPI_COMM_WORLD); int size_comm, rank; MPI_Comm_size(MPI_COMM_WORLD, &size_comm); MPI_Comm_rank(MPI_COMM_WORLD, &rank); int k_rows = size / size_comm; int balance = size % size_comm; std::vector<double> matrixL(k_rows * size); if (0 == rank) { if (0 != balance) { matrixL.resize(size * k_rows + balance * size); } if (0 != k_rows) { for (int process = 1; process < size_comm; process++) { MPI_Send(&matrixtmp[0] + process * k_rows * size + balance * size, k_rows * size, MPI_DOUBLE, process, 1, MPI_COMM_WORLD); } } } if (0 == rank) { if (balance != 0) { for (int index = 0; index < size * k_rows + size * balance; index++) { matrixL[index] = matrixtmp[index]; } } else { for (int index = 0; index < size * k_rows; index++) { matrixL[index] = matrixtmp[index]; } } } else { MPI_Status message; if (k_rows != 0) { MPI_Recv(&matrixL[0], k_rows * size, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD, &message); } } int iteration = 0; double beta = 0.0, alpha = 0.0; double norm_residual = 0.0, criteria = 0.1; std::vector<double> x(size); for (int index = 0; index < size; index++) { x[index] = 1; } std::vector<double> Az = matrix_vec_mult(matrixL, x); std::vector<double> residualprev(k_rows), residualnext(k_rows); if (0 == rank) { if (0 != balance) { residualprev.resize(k_rows + balance); residualnext.resize(k_rows + balance); } for (int index = 0; index < k_rows + balance; index++) residualprev[index] = vectortmp[index] - Az[index]; // residualprev^(k) = b - A * x } else { for (int index = 0; index < k_rows; index++) residualprev[index] = vectortmp[rank * k_rows + balance + index] - Az[index]; // residualprev^(k) = b - A * x } std::vector<double> gradient(size); // gradient = residualprev^(k) if (rank == 0) { if (balance != 0) { for (int index = 0; index < k_rows + balance; index++) { gradient[index] = residualprev[index]; } } else { for (int index = 0; index < k_rows; index++) { gradient[index] = residualprev[index]; } } if (k_rows != 0) { MPI_Status message; for (int process = 1; process < size_comm; process++) { MPI_Recv(&gradient[0] + process * k_rows + balance, k_rows, MPI_DOUBLE, process, 2, MPI_COMM_WORLD, &message); } } } else { if (k_rows != 0) { MPI_Send(&residualprev[0], k_rows, MPI_DOUBLE, 0, 2, MPI_COMM_WORLD); } } MPI_Bcast(gradient.data(), size, MPI_DOUBLE, 0, MPI_COMM_WORLD); std::vector<double> gradientblock(k_rows); std::vector<double> gradientlocal(k_rows); if (rank == 0) { if (balance != 0) { gradientblock.resize(k_rows + balance); } } do { iteration++; Az = matrix_vec_mult(matrixL, gradient); // Az = A * gradient if (rank == 0) { for (int index = 0; index < k_rows + balance; index++) { gradientblock[index] = gradient[index]; } } else { for (int index = 0; index < k_rows; index++) { gradientblock[index] = gradient[rank * k_rows + balance + index]; } } double tmp_f = vec_mult(residualprev, residualprev); double tmp_s = vec_mult(gradientblock, Az); double residualprevscalar; double devideralpha; MPI_Allreduce(&tmp_f, &residualprevscalar, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); MPI_Allreduce(&tmp_s, &devideralpha, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); alpha = residualprevscalar / devideralpha; for (int index = 0; index < size; index++) { x[index] += alpha * gradient[index]; } if (rank == 0) { for (int index = 0; index < k_rows + balance; index++) { residualnext[index] = residualprev[index] - alpha * Az[index]; // residualnext^(k+1) = residualprev^(k)-alpha*Az } } else { for (int index = 0; index < k_rows; index++) { residualnext[index] = residualprev[index] - alpha * Az[index]; // residualnext^(k+1) = residualprev^(k)-alpha*Az } } double residualnextscalar; tmp_f = vec_mult(residualnext, residualnext); MPI_Allreduce(&tmp_f, &residualnextscalar, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); beta = residualnextscalar / residualprevscalar; norm_residual = sqrt(residualnextscalar); if (rank == 0) { for (int index = 0; index < k_rows + balance; index++) { gradient[index] = residualnext[index] + beta * gradient[index]; } if (k_rows != 0) { MPI_Status message; for (int process = 1; process < size_comm; process++) { MPI_Recv(&gradient[0] + process * k_rows + balance, k_rows, MPI_DOUBLE, process, 3, MPI_COMM_WORLD, &message); } } } else { for (int index = 0; index < k_rows; index++) { gradientlocal[index] = residualnext[index] + beta * gradient[rank * k_rows + balance + index]; } if (k_rows != 0) { MPI_Send(&gradientlocal[0], k_rows, MPI_DOUBLE, 0, 3, MPI_COMM_WORLD); } } MPI_Bcast(gradient.data(), size, MPI_DOUBLE, 0, MPI_COMM_WORLD); residualprev = residualnext; } while ((norm_residual > criteria) && (iteration <= size)); return x; }
28.207831
80
0.593914
Oskg
84e1d56ff8faac504ce60f40a4db29830ca9f906
32,087
cpp
C++
distributions/univariate/continuous/StableRand.cpp
aWeinzierl/RandLib
7af0237d1902aadbf2451b7dfab02c52cf98ae87
[ "MIT" ]
null
null
null
distributions/univariate/continuous/StableRand.cpp
aWeinzierl/RandLib
7af0237d1902aadbf2451b7dfab02c52cf98ae87
[ "MIT" ]
null
null
null
distributions/univariate/continuous/StableRand.cpp
aWeinzierl/RandLib
7af0237d1902aadbf2451b7dfab02c52cf98ae87
[ "MIT" ]
null
null
null
#include "StableRand.h" #include "LevyRand.h" #include "CauchyRand.h" #include "NormalRand.h" #include "UniformRand.h" #include "ExponentialRand.h" #include <functional> StableDistribution::StableDistribution(double exponent, double skewness, double scale, double location) { SetParameters(exponent, skewness, scale, location); } SUPPORT_TYPE StableDistribution::SupportType() const { if (alpha < 1) { if (beta == 1) return RIGHTSEMIFINITE_T; if (beta == -1) return LEFTSEMIFINITE_T; } return INFINITE_T; } double StableDistribution::MinValue() const { return (alpha < 1 && beta == 1) ? mu : -INFINITY; } double StableDistribution::MaxValue() const { return (alpha < 1 && beta == -1) ? mu : INFINITY; } void StableDistribution::SetParameters(double exponent, double skewness, double scale, double location) { if (exponent < 0.1 || exponent > 2.0) throw std::invalid_argument("Stable distribution: exponent should be in the interval [0.1, 2]"); if (std::fabs(skewness) > 1.0) throw std::invalid_argument("Stable distribution: skewness of should be in the interval [-1, 1]"); if (scale <= 0.0) throw std::invalid_argument("Stable distribution: scale should be positive"); /// the following errors should be removed soon if (exponent != 1.0 && std::fabs(exponent - 1.0) < 0.01 && skewness != 0.0) throw std::invalid_argument("Stable distribution: exponent close to 1 with non-zero skewness is not yet supported"); if (exponent == 1.0 && skewness != 0.0 && std::fabs(skewness) < 0.01) throw std::invalid_argument("Stable distribution: skewness close to 0 with exponent equal to 1 is not yet supported"); alpha = exponent; alphaInv = 1.0 / alpha; beta = skewness; mu = location; gamma = scale; logGamma = std::log(gamma); /// Set id of distribution if (alpha == 2.0) distributionType = NORMAL; else if (alpha == 1.0) distributionType = (beta == 0.0) ? CAUCHY : UNITY_EXPONENT; else if (alpha == 0.5 && std::fabs(beta) == 1.0) distributionType = LEVY; else distributionType = GENERAL; alpha_alpham1 = alpha / (alpha - 1.0); if (distributionType == NORMAL) pdfCoef = M_LN2 + logGamma + 0.5 * M_LNPI; else if (distributionType == LEVY) pdfCoef = logGamma - M_LN2 - M_LNPI; else if (distributionType == CAUCHY) pdfCoef = -logGamma - M_LNPI; else if (distributionType == UNITY_EXPONENT) { pdfCoef = 0.5 / (gamma * std::fabs(beta)); pdftailBound = 0; // not in the use for now logGammaPi_2 = logGamma + M_LNPI - M_LN2; } else if (distributionType == GENERAL) { if (beta != 0.0) { zeta = -beta * std::tan(M_PI_2 * alpha); omega = 0.5 * alphaInv * std::log1p(zeta * zeta); xi = alphaInv * RandMath::atan(-zeta); } else { zeta = omega = xi = 0.0; } pdfCoef = M_1_PI * std::fabs(alpha_alpham1) / gamma; pdftailBound = 3.0 / (1.0 + alpha) * M_LN10; cdftailBound = 3.0 / alpha * M_LN10; /// define boundaries of region near 0, where we use series expansion if (alpha <= ALMOST_TWO) { seriesZeroParams.first = std::round(std::min(alpha * alpha * 40 + 1, 10.0)); /// corresponds to boundaries from 10^(-15.5) to ~ 0.056 seriesZeroParams.second = -(alphaInv * 1.5 + 0.5) * M_LN10; } else { seriesZeroParams.first = 85; /// corresponds to 6 seriesZeroParams.second = M_LN2 + M_LN3; } } } void StableDistribution::SetLocation(double location) { mu = location; } void StableDistribution::SetScale(double scale) { if (scale <= 0.0) throw std::invalid_argument("Scale of Stable distribution should be positive"); gamma = scale; logGamma = std::log(gamma); if (distributionType == NORMAL) pdfCoef = M_LN2 + logGamma + 0.5 * M_LNPI; else if (distributionType == LEVY) pdfCoef = logGamma - M_LN2 - M_LNPI; else if (distributionType == CAUCHY) pdfCoef = -logGamma - M_LNPI; else if (distributionType == UNITY_EXPONENT) { pdfCoef = 0.5 / (gamma * std::fabs(beta)); logGammaPi_2 = logGamma + M_LNPI - M_LN2; } else if (distributionType == GENERAL) pdfCoef = M_1_PI * std::fabs(alpha_alpham1) / gamma; } double StableDistribution::pdfNormal(double x) const { return std::exp(logpdfNormal(x)); } double StableDistribution::logpdfNormal(double x) const { double y = x - mu; y *= 0.5 / gamma; y *= y; y += pdfCoef; return -y; } double StableDistribution::pdfCauchy(double x) const { double y = x - mu; y *= y; y /= gamma; y += gamma; return M_1_PI / y; } double StableDistribution::logpdfCauchy(double x) const { double x0 = x - mu; x0 /= gamma; double xSq = x0 * x0; return pdfCoef - std::log1p(xSq); } double StableDistribution::pdfLevy(double x) const { return (x <= mu) ? 0.0 : std::exp(logpdfLevy(x)); } double StableDistribution::logpdfLevy(double x) const { double x0 = x - mu; if (x0 <= 0.0) return -INFINITY; double y = gamma / x0; y += 3 * std::log(x0); y -= pdfCoef; return -0.5 * y; } double StableDistribution::fastpdfExponentiation(double u) { if (u > 5 || u < -50) return 0.0; return (u < -25) ? std::exp(u) : std::exp(u - std::exp(u)); } double StableDistribution::pdfShortTailExpansionForUnityExponent(double x) const { if (x > 10) return 0.0; double xm1 = x - 1.0; double y = 0.5 * xm1 - std::exp(xm1); y -= 0.5 * (M_LN2 + M_LNPI); return std::exp(y); } double StableDistribution::limitCaseForIntegrandAuxForUnityExponent(double theta, double xAdj) const { if (theta > 0.0) { if (beta > 0.0) return BIG_NUMBER; return (beta == -1) ? xAdj - 1.0 : -BIG_NUMBER; } if (beta < 0.0) return BIG_NUMBER; return (beta == 1) ? xAdj - 1.0 : -BIG_NUMBER; } double StableDistribution::integrandAuxForUnityExponent(double theta, double xAdj) const { if (std::fabs(theta) >= M_PI_2) return limitCaseForIntegrandAuxForUnityExponent(theta, xAdj); if (theta == 0.0) return xAdj + M_LNPI - M_LN2; double thetaAdj = (M_PI_2 + beta * theta) / std::cos(theta); double u = std::log(thetaAdj); u += thetaAdj * std::sin(theta) / beta; return std::isfinite(u) ? u + xAdj : limitCaseForIntegrandAuxForUnityExponent(theta, xAdj); } double StableDistribution::integrandForUnityExponent(double theta, double xAdj) const { if (std::fabs(theta) >= M_PI_2) return 0.0; double u = integrandAuxForUnityExponent(theta, xAdj); return fastpdfExponentiation(u); } double StableDistribution::pdfForUnityExponent(double x) const { double xSt = (x - mu) / gamma; double xAdj = -M_PI_2 * xSt / beta - logGammaPi_2; /// We squeeze boudaries for too peaked integrands double boundary = RandMath::atan(M_2_PI * beta * (5.0 - xAdj)); double upperBoundary = (beta > 0.0) ? boundary : M_PI_2; double lowerBoundary = (beta < 0.0) ? boundary : -M_PI_2; /// Find peak of the integrand double theta0 = 0; std::function<double (double)> funPtr = std::bind(&StableDistribution::integrandAuxForUnityExponent, this, std::placeholders::_1, xAdj); RandMath::findRoot(funPtr, lowerBoundary, upperBoundary, theta0); /// Sanity check /// if we failed while looking for the peak position /// we set it in the middle between boundaries if (theta0 >= upperBoundary || theta0 <= lowerBoundary) theta0 = 0.5 * (upperBoundary + lowerBoundary); std::function<double (double)> integrandPtr = std::bind(&StableDistribution::integrandForUnityExponent, this, std::placeholders::_1, xAdj); /// If theta0 is too close to +/-π/2 then we can still underestimate the integral int maxRecursionDepth = 11; double closeness = M_PI_2 - std::fabs(theta0); if (closeness < 0.1) maxRecursionDepth = 20; else if (closeness < 0.2) maxRecursionDepth = 15; double int1 = RandMath::integral(integrandPtr, lowerBoundary, theta0, 1e-11, maxRecursionDepth); double int2 = RandMath::integral(integrandPtr, theta0, upperBoundary, 1e-11, maxRecursionDepth); return pdfCoef * (int1 + int2); } double StableDistribution::pdfShortTailExpansionForGeneralExponent(double logX) const { double logAlpha = std::log(alpha); double log1mAlpha = (alpha < 1) ? std::log1p(-alpha) : std::log(alpha - 1); double temp = logX - logAlpha; double y = std::exp(alpha_alpham1 * temp); y *= -std::fabs(1.0 - alpha); double z = (1.0 - 0.5 * alpha) / (alpha - 1) * temp; z -= 0.5 * (M_LN2 + M_LNPI + logAlpha + log1mAlpha); return std::exp(y + z); } double StableDistribution::pdfAtZero() const { double y0 = 0.0; if (beta == 0.0) y0 = std::tgamma(alphaInv); else { y0 = std::lgamma(alphaInv) - omega; y0 = std::exp(y0) * std::cos(xi); } return y0 * M_1_PI / alpha; } double StableDistribution::pdfSeriesExpansionAtZero(double logX, double xiAdj, int k) const { /// Calculate first term of the sum /// (if x = 0, only this term is non-zero) double y0 = pdfAtZero(); double sum = 0.0; if (beta == 0.0) { /// Symmetric distribution for (int n = 1; n <= k; ++n) { int n2 = n + n; double term = std::lgamma((n2 + 1) / alpha); term += n2 * logX; term -= RandMath::lfact(n2); term = std::exp(term); sum += (n & 1) ? -term : term; } } else { /// Asymmetric distribution double rhoPi_alpha = M_PI_2 + xiAdj; for (int n = 1; n <= k; ++n) { int np1 = n + 1; double term = std::lgamma(np1 * alphaInv); term += n * logX; term -= RandMath::lfact(n); term = std::exp(term - omega); term *= std::sin(np1 * rhoPi_alpha); sum += (n & 1) ? -term : term; } } return y0 + sum * M_1_PI / alpha; } double StableDistribution::pdfSeriesExpansionAtInf(double logX, double xiAdj) const { static constexpr int k = 10; ///< number of elements in the series double rhoPi = M_PI_2 + xiAdj; rhoPi *= alpha; double sum = 0.0; for (int n = 1; n <= k; ++n) { double aux = n * alpha + 1.0; double term = std::lgamma(aux); term -= aux * logX; term -= RandMath::lfact(n); term = std::exp(term - omega); term *= std::sin(rhoPi * n); sum += (n & 1) ? term : -term; } return M_1_PI * sum; } double StableDistribution::pdfTaylorExpansionTailNearCauchy(double x) const { double xSq = x * x; double y = 1.0 + xSq; double ySq = y * y; double z = RandMath::atan(x); double zSq = z * z; double logY = std::log1p(xSq); double alpham1 = alpha - 1.0; double temp = 1.0 - M_EULER - 0.5 * logY; /// first derivative double f_a = temp; f_a *= xSq - 1.0; f_a += 2 * x * z; f_a /= ySq; static constexpr long double M_PI_SQ_6 = 1.64493406684822643647l; /// π^2 / 6 /// second derivative double f_aa1 = M_PI_SQ_6; f_aa1 += temp * temp; f_aa1 -= 1.0 + z * z; f_aa1 *= xSq * xSq - 6.0 * xSq + 1.0; double f_aa2 = 0.5 + temp; f_aa2 *= z; f_aa2 *= 8 * x * (xSq - 1.0); double f_aa3 = (1.0 - 3 * xSq) * temp; f_aa3 -= x * y * z; f_aa3 += f_aa3; double f_aa = f_aa1 + f_aa2 + f_aa3; f_aa /= std::pow(y, 3); /// Hashed values of special functions for x = 2, 3, 4 /// Gamma(x) static constexpr int gammaTable[] = {1, 2, 6}; /// Gamma'(x) static constexpr long double gammaDerTable[] = {1.0 - M_EULER, 3.0 - 2.0 * M_EULER, 11.0 - 6.0 * M_EULER}; /// Gamma''(x) static constexpr long double gammaSecDerTable[] = {0.82368066085287938958l, 2.49292999190269305794l, 11.1699273161019477314l}; /// Digamma(x) static constexpr long double digammaTable[] = {1.0 - M_EULER, 1.5 - M_EULER, 11.0 / 6 - M_EULER}; /// Digamma'(x) static constexpr long double digammaDerTable[] = {M_PI_SQ_6 - 1.0, M_PI_SQ_6 - 1.25, M_PI_SQ_6 - 49.0 / 36}; /// Digamma''(x) static constexpr long double digammaSecDerTable[] = {-0.40411380631918857080l, -0.15411380631918857080l, -0.08003973224511449673l}; /// third derivative double gTable[] = {0, 0, 0}; for (int i = 0; i < 3; ++i) { double g_11 = 0.25 * gammaTable[i] * logY * logY; g_11 -= gammaDerTable[i] * logY; g_11 += gammaSecDerTable[i]; double aux = digammaTable[i] - 0.5 * logY; double g_12 = aux; double zip2 = z * (i + 2); double cosZNu = std::cos(zip2), zSinZNu = z * std::sin(zip2); g_12 *= cosZNu; g_12 -= zSinZNu; double g_1 = g_11 * g_12; double g_21 = -gammaTable[i] * logY + 2 * gammaDerTable[i]; double g_22 = -zSinZNu * aux; g_22 -= zSq * cosZNu; g_22 += cosZNu * digammaDerTable[i]; double g_2 = g_21 * g_22; double g_3 = -zSq * cosZNu * aux; g_3 -= 2 * zSinZNu * digammaDerTable[i]; g_3 += zSq * zSinZNu; g_3 += cosZNu * digammaSecDerTable[i]; g_3 *= gammaTable[i]; double g = g_1 + g_2 + g_3; g *= std::pow(y, -0.5 * i - 1); gTable[i] = g; } double f_aaa = -gTable[0] + 3 * gTable[1] - gTable[2]; /// summarize all three derivatives double tail = f_a * alpham1; tail += 0.5 * f_aa * alpham1 * alpham1; tail += std::pow(alpham1, 3) * f_aaa / 6.0; tail /= M_PI; return tail; } double StableDistribution::limitCaseForIntegrandAuxForGeneralExponent(double theta, double xiAdj) const { /// We got numerical error, need to investigate to which extreme point we are closer if (theta < 0.5 * (M_PI_2 - xiAdj)) return alpha < 1 ? -BIG_NUMBER : BIG_NUMBER; return alpha < 1 ? BIG_NUMBER : -BIG_NUMBER; } double StableDistribution::integrandAuxForGeneralExponent(double theta, double xAdj, double xiAdj) const { if (std::fabs(theta) >= M_PI_2 || theta <= -xiAdj) return limitCaseForIntegrandAuxForGeneralExponent(theta, xiAdj); double thetaAdj = alpha * (theta + xiAdj); double sinThetaAdj = std::sin(thetaAdj); double y = std::log(std::cos(theta)); y -= alpha * std::log(sinThetaAdj); y /= alpha - 1.0; y += std::log(std::cos(thetaAdj - theta)); y += xAdj; return std::isfinite(y) ? y : limitCaseForIntegrandAuxForGeneralExponent(theta, xiAdj); } double StableDistribution::integrandFoGeneralExponent(double theta, double xAdj, double xiAdj) const { if (std::fabs(theta) >= M_PI_2) return 0.0; if (theta <= -xiAdj) return 0.0; double u = integrandAuxForGeneralExponent(theta, xAdj, xiAdj); return fastpdfExponentiation(u); } double StableDistribution::pdfForGeneralExponent(double x) const { /// Standardize double xSt = (x - mu) / gamma; double absXSt = xSt; /// +- xi double xiAdj = xi; if (xSt > 0) { if (alpha < 1 && beta == -1) return 0.0; } else { if (alpha < 1 && beta == 1) return 0.0; absXSt = -xSt; xiAdj = -xi; } /// If α is too close to 1 and distribution is symmetric, then we approximate using Taylor series if (beta == 0.0 && std::fabs(alpha - 1.0) < 0.01) return pdfCauchy(x) + pdfTaylorExpansionTailNearCauchy(absXSt) / gamma; /// If x = 0, we know the analytic solution if (xSt == 0.0) return pdfAtZero() / gamma; double logAbsX = std::log(absXSt) - omega; /// If x is too close to 0, we do series expansion avoiding numerical problems if (logAbsX < seriesZeroParams.second) { if (alpha < 1 && std::fabs(beta) == 1) return pdfShortTailExpansionForGeneralExponent(logAbsX); return pdfSeriesExpansionAtZero(logAbsX, xiAdj, seriesZeroParams.first) / gamma; } /// If x is large enough we use tail approximation if (logAbsX > pdftailBound && alpha <= ALMOST_TWO) { if (alpha > 1 && std::fabs(beta) == 1) return pdfShortTailExpansionForGeneralExponent(logAbsX); return pdfSeriesExpansionAtInf(logAbsX, xiAdj) / gamma; } double xAdj = alpha_alpham1 * logAbsX; /// Search for the peak of the integrand double theta0; std::function<double (double)> funPtr = std::bind(&StableDistribution::integrandAuxForGeneralExponent, this, std::placeholders::_1, xAdj, xiAdj); RandMath::findRoot(funPtr, -xiAdj, M_PI_2, theta0); /// If theta0 is too close to π/2 or -xiAdj then we can still underestimate the integral int maxRecursionDepth = 11; double closeness = std::min(M_PI_2 - theta0, theta0 + xiAdj); if (closeness < 0.1) maxRecursionDepth = 20; else if (closeness < 0.2) maxRecursionDepth = 15; /// Calculate sum of two integrals std::function<double (double)> integrandPtr = std::bind(&StableDistribution::integrandFoGeneralExponent, this, std::placeholders::_1, xAdj, xiAdj); double int1 = RandMath::integral(integrandPtr, -xiAdj, theta0, 1e-11, maxRecursionDepth); double int2 = RandMath::integral(integrandPtr, theta0, M_PI_2, 1e-11, maxRecursionDepth); double res = pdfCoef * (int1 + int2) / absXSt; /// Finally we check if α is not too close to 2 if (alpha <= ALMOST_TWO) return res; /// If α is near 2, we use tail aprroximation for large x /// and compare it with integral representation double alphap1 = alpha + 1.0; double tail = std::lgamma(alphap1); tail -= alphap1 * logAbsX; tail = std::exp(tail); tail *= (1.0 - 0.5 * alpha) / gamma; return std::max(tail, res); } double StableDistribution::f(const double & x) const { switch (distributionType) { case NORMAL: return pdfNormal(x); case CAUCHY: return pdfCauchy(x); case LEVY: return (beta > 0) ? pdfLevy(x) : pdfLevy(2 * mu - x); case UNITY_EXPONENT: return pdfForUnityExponent(x); case GENERAL: return pdfForGeneralExponent(x); default: return NAN; /// unexpected return } } double StableDistribution::logf(const double & x) const { switch (distributionType) { case NORMAL: return logpdfNormal(x); case CAUCHY: return logpdfCauchy(x); case LEVY: return (beta > 0) ? logpdfLevy(x) : logpdfLevy(2 * mu - x); case UNITY_EXPONENT: return std::log(pdfForUnityExponent(x)); case GENERAL: return std::log(pdfForGeneralExponent(x)); default: return NAN; /// unexpected return } } double StableDistribution::cdfNormal(double x) const { double y = mu - x; y *= 0.5 / gamma; return 0.5 * std::erfc(y); } double StableDistribution::cdfNormalCompl(double x) const { double y = x - mu; y *= 0.5 / gamma; return 0.5 * std::erfc(y); } double StableDistribution::cdfCauchy(double x) const { double x0 = x - mu; x0 /= gamma; return 0.5 + M_1_PI * RandMath::atan(x0); } double StableDistribution::cdfCauchyCompl(double x) const { double x0 = mu - x; x0 /= gamma; return 0.5 + M_1_PI * RandMath::atan(x0); } double StableDistribution::cdfLevy(double x) const { if (x <= mu) return 0; double y = x - mu; y += y; y = gamma / y; y = std::sqrt(y); return std::erfc(y); } double StableDistribution::cdfLevyCompl(double x) const { if (x <= mu) return 1.0; double y = x - mu; y += y; y = gamma / y; y = std::sqrt(y); return std::erf(y); } double StableDistribution::fastcdfExponentiation(double u) { if (u > 5.0) return 0.0; else if (u < -50.0) return 1.0; double y = std::exp(u); return std::exp(-y); } double StableDistribution::cdfAtZero(double xiAdj) const { return 0.5 - M_1_PI * xiAdj; } double StableDistribution::cdfForUnityExponent(double x) const { double xSt = (x - mu) / gamma; double xAdj = -M_PI_2 * xSt / beta - logGammaPi_2; double y = M_1_PI * RandMath::integral([this, xAdj] (double theta) { double u = integrandAuxForUnityExponent(theta, xAdj); return fastcdfExponentiation(u); }, -M_PI_2, M_PI_2); return (beta > 0) ? y : 1.0 - y; } double StableDistribution::cdfSeriesExpansionAtZero(double logX, double xiAdj, int k) const { /// Calculate first term of the sum /// (if x = 0, only this term is non-zero) double y0 = cdfAtZero(xiAdj); double sum = 0.0; if (beta == 0.0) { /// Symmetric distribution for (int m = 0; m <= k; ++m) { int m2p1 = 2 * m + 1; double term = std::lgamma(m2p1 * alphaInv); term += m2p1 * logX; term -= RandMath::lfact(m2p1); term = std::exp(term); sum += (m & 1) ? -term : term; } } else { /// Asymmetric distribution double rhoPi_alpha = M_PI_2 + xiAdj; for (int n = 1; n <= k; ++n) { double term = std::lgamma(n * alphaInv); term += n * logX; term -= RandMath::lfact(n); term = std::exp(term); term *= std::sin(n * rhoPi_alpha); sum += (n & 1) ? term : -term; } } return y0 + sum * M_1_PI * alphaInv; } double StableDistribution::cdfSeriesExpansionAtInf(double logX, double xiAdj) const { static constexpr int k = 10; /// number of elements in the series double rhoPi = M_PI_2 + xiAdj; rhoPi *= alpha; double sum = 0.0; for (int n = 1; n <= k; ++n) { double aux = n * alpha; double term = std::lgamma(aux); term -= aux * logX; term -= RandMath::lfact(n); term = std::exp(term); term *= std::sin(rhoPi * n); sum += (n & 1) ? term : -term; } return M_1_PI * sum; } double StableDistribution::cdfIntegralRepresentation(double logX, double xiAdj) const { double xAdj = alpha_alpham1 * logX; return M_1_PI * RandMath::integral([this, xAdj, xiAdj] (double theta) { double u = integrandAuxForGeneralExponent(theta, xAdj, xiAdj); return fastcdfExponentiation(u); }, -xiAdj, M_PI_2); } double StableDistribution::cdfForGeneralExponent(double x) const { double xSt = (x - mu) / gamma; /// Standardize if (xSt == 0) return cdfAtZero(xi); if (xSt > 0.0) { double logAbsX = std::log(xSt) - omega; /// If x is too close to 0, we do series expansion avoiding numerical problems if (logAbsX < seriesZeroParams.second) return cdfSeriesExpansionAtZero(logAbsX, xi, seriesZeroParams.first); /// If x is large enough we use tail approximation if (logAbsX > cdftailBound) return 1.0 - cdfSeriesExpansionAtInf(logAbsX, xi); if (alpha > 1.0) return 1.0 - cdfIntegralRepresentation(logAbsX, xi); return (beta == -1.0) ? 1.0 : cdfAtZero(xi) + cdfIntegralRepresentation(logAbsX, xi); } /// For x < 0 we use relation F(-x, xi) + F(x, -xi) = 1 double logAbsX = std::log(-xSt) - omega; if (logAbsX < seriesZeroParams.second) return 1.0 - cdfSeriesExpansionAtZero(logAbsX, -xi, seriesZeroParams.first); if (logAbsX > cdftailBound) return cdfSeriesExpansionAtInf(logAbsX, -xi); if (alpha > 1.0) return cdfIntegralRepresentation(logAbsX, -xi); return (beta == 1.0) ? 0.0 : cdfAtZero(xi) - cdfIntegralRepresentation(logAbsX, -xi); } double StableDistribution::F(const double & x) const { switch (distributionType) { case NORMAL: return cdfNormal(x); case CAUCHY: return cdfCauchy(x); case LEVY: return (beta > 0) ? cdfLevy(x) : cdfLevyCompl(2 * mu - x); case UNITY_EXPONENT: return cdfForUnityExponent(x); case GENERAL: return cdfForGeneralExponent(x); default: return NAN; /// unexpected return } } double StableDistribution::S(const double & x) const { switch (distributionType) { case NORMAL: return cdfNormalCompl(x); case CAUCHY: return cdfCauchyCompl(x); case LEVY: return (beta > 0) ? cdfLevyCompl(x) : cdfLevy(2 * mu - x); case UNITY_EXPONENT: return 1.0 - cdfForUnityExponent(x); case GENERAL: return 1.0 - cdfForGeneralExponent(x); default: return NAN; /// unexpected return } } double StableDistribution::variateForUnityExponent() const { double U = M_PI * UniformRand::StandardVariate(localRandGenerator) - M_PI_2; double W = ExponentialRand::StandardVariate(localRandGenerator); double pi_2pBetaU = M_PI_2 + beta * U; double Y = W * std::cos(U) / pi_2pBetaU; double X = std::log(Y); X += logGammaPi_2; X *= -beta; X += pi_2pBetaU * std::tan(U); X *= M_2_PI; return mu + gamma * X; } double StableDistribution::variateForGeneralExponent() const { double U = M_PI * UniformRand::StandardVariate(localRandGenerator) - M_PI_2; double W = ExponentialRand::StandardVariate(localRandGenerator); double alphaUpxi = alpha * (U + xi); double X = std::sin(alphaUpxi); double W_adj = W / std::cos(U - alphaUpxi); X *= W_adj; double R = omega - alphaInv * std::log(W_adj * std::cos(U)); X *= std::exp(R); return mu + gamma * X; } double StableDistribution::variateForExponentEqualOneHalf() const { double Z1 = NormalRand::StandardVariate(localRandGenerator); double Z2 = NormalRand::StandardVariate(localRandGenerator); double temp1 = (1.0 + beta) / Z1, temp2 = (1.0 - beta) / Z2; double var = temp1 - temp2; var *= temp1 + temp2; var *= 0.25; return mu + gamma * var; } double StableDistribution::Variate() const { switch (distributionType) { case NORMAL: return mu + M_SQRT2 * gamma * NormalRand::StandardVariate(localRandGenerator); case CAUCHY: return mu + gamma * CauchyRand::StandardVariate(localRandGenerator); case LEVY: return mu + RandMath::sign(beta) * gamma * LevyRand::StandardVariate(localRandGenerator); case UNITY_EXPONENT: return variateForUnityExponent(); case GENERAL: return (alpha == 0.5) ? variateForExponentEqualOneHalf() : variateForGeneralExponent(); default: return NAN; /// unexpected return } } void StableDistribution::Sample(std::vector<double> &outputData) const { switch (distributionType) { case NORMAL: { double stdev = M_SQRT2 * gamma; for (double &var : outputData) var = mu + stdev * NormalRand::StandardVariate(localRandGenerator); } break; case CAUCHY: { for (double &var : outputData) var = mu + gamma * CauchyRand::StandardVariate(localRandGenerator); } break; case LEVY: { if (beta > 0) { for (double &var : outputData) var = mu + gamma * LevyRand::StandardVariate(localRandGenerator); } else { for (double &var : outputData) var = mu - gamma * LevyRand::StandardVariate(localRandGenerator); } } break; case UNITY_EXPONENT: { for (double &var : outputData) var = variateForUnityExponent(); } break; case GENERAL: { if (alpha == 0.5) { for (double &var : outputData) var = variateForExponentEqualOneHalf(); } else { for (double &var : outputData) var = variateForGeneralExponent(); } } break; default: break; } } double StableDistribution::Mean() const { if (alpha > 1) return mu; if (beta == 1) return INFINITY; return (beta == -1) ? -INFINITY : NAN; } double StableDistribution::Variance() const { return (distributionType == NORMAL) ? 2 * gamma * gamma : INFINITY; } double StableDistribution::Mode() const { /// For symmetric and normal distributions mode is μ if (beta == 0 || distributionType == NORMAL) return mu; if (distributionType == LEVY) return mu + beta * gamma / 3.0; return ContinuousDistribution::Mode(); } double StableDistribution::Median() const { /// For symmetric and normal distributions mode is μ if (beta == 0 || distributionType == NORMAL) return mu; return ContinuousDistribution::Median(); } double StableDistribution::Skewness() const { return (distributionType == NORMAL) ? 0 : NAN; } double StableDistribution::ExcessKurtosis() const { return (distributionType == NORMAL) ? 0 : NAN; } double StableDistribution::quantileNormal(double p) const { return mu - 2 * gamma * RandMath::erfcinv(2 * p); } double StableDistribution::quantileNormal1m(double p) const { return mu + 2 * gamma * RandMath::erfcinv(2 * p); } double StableDistribution::quantileCauchy(double p) const { return mu - gamma / std::tan(M_PI * p); } double StableDistribution::quantileCauchy1m(double p) const { return mu + gamma / std::tan(M_PI * p); } double StableDistribution::quantileLevy(double p) const { double y = RandMath::erfcinv(p); return mu + 0.5 * gamma / (y * y); } double StableDistribution::quantileLevy1m(double p) const { double y = RandMath::erfinv(p); return mu + 0.5 * gamma / (y * y); } double StableDistribution::quantileImpl(double p) const { switch (distributionType) { case NORMAL: return quantileNormal(p); case CAUCHY: return quantileCauchy(p); case LEVY: return (beta > 0) ? quantileLevy(p) : 2 * mu - quantileLevy1m(p); default: return ContinuousDistribution::quantileImpl(p); } } double StableDistribution::quantileImpl1m(double p) const { switch (distributionType) { case NORMAL: return quantileNormal1m(p); case CAUCHY: return quantileCauchy1m(p); case LEVY: return (beta > 0) ? quantileLevy1m(p) : 2 * mu - quantileLevy(p); default: return ContinuousDistribution::quantileImpl1m(p); } } std::complex<double> StableDistribution::cfNormal(double t) const { double gammaT = gamma * t; std::complex<double> y(-gammaT * gammaT, mu * t); return std::exp(y); } std::complex<double> StableDistribution::cfCauchy(double t) const { std::complex<double> y(-gamma * t, mu * t); return std::exp(y); } std::complex<double> StableDistribution::cfLevy(double t) const { std::complex<double> y(0.0, -2 * gamma * t); y = -std::sqrt(y); y += std::complex<double>(0.0, mu * t); return std::exp(y); } std::complex<double> StableDistribution::CFImpl(double t) const { double x = 0; switch (distributionType) { case NORMAL: return cfNormal(t); case CAUCHY: return cfCauchy(t); case LEVY: { std::complex<double> phi = cfLevy(t); return (beta > 0) ? phi : std::conj(phi); } case UNITY_EXPONENT: x = beta * M_2_PI * std::log(t); break; default: x = -zeta; } double re = std::pow(gamma * t, alpha); std::complex<double> psi = std::complex<double>(re, re * x - mu * t); return std::exp(-psi); } String StableRand::Name() const { return "Stable(" + toStringWithPrecision(GetExponent()) + ", " + toStringWithPrecision(GetSkewness()) + ", " + toStringWithPrecision(GetScale()) + ", " + toStringWithPrecision(GetLocation()) + ")"; } String HoltsmarkRand::Name() const { return "Holtsmark(" + toStringWithPrecision(GetScale()) + ", " + toStringWithPrecision(GetLocation()) + ")"; } String LandauRand::Name() const { return "Landau(" + toStringWithPrecision(GetScale()) + ", " + toStringWithPrecision(GetLocation()) + ")"; }
30.942141
151
0.607099
aWeinzierl
84e358c80f6bf140121735659d6c042ecb82cb30
2,325
cpp
C++
src/mog_train.cpp
palikar/skin_detector
2b8e776fe140136299579fbcd2e95efe716395f7
[ "MIT" ]
null
null
null
src/mog_train.cpp
palikar/skin_detector
2b8e776fe140136299579fbcd2e95efe716395f7
[ "MIT" ]
null
null
null
src/mog_train.cpp
palikar/skin_detector
2b8e776fe140136299579fbcd2e95efe716395f7
[ "MIT" ]
null
null
null
#include <mog.h> void MOG::train( std::vector<cv::Mat>& training_images, std::vector<cv::Mat>& masks ){ cv::Mat pos_samples, neg_samples; std::cout << "Organizing the data" << std::endl; // organize all the samples organizeSamples(training_images, masks, pos_samples, neg_samples); std::cout << "Training the models, this may take a while" << std::endl; // train the models pos_model->trainEM( pos_samples ); neg_model->trainEM( neg_samples ); emToMixture(); std::cout << "Finished training the models" << std::endl; } void MOG::organizeSamples( std::vector<cv::Mat>& imgs, std::vector<cv::Mat>& masks, cv::Mat& pos_samples, cv::Mat& neg_samples ){ std::vector<double> pos, neg; const size_t channels = imgs[0].channels(); for ( int i = 0; i < (int)imgs.size(); i++ ) organizeSample( imgs[i], masks[i], pos, neg ); // std::vector -> cv::Mat // 3Nx1 -> Nx3 pos_samples = cv::Mat( pos, true ); pos_samples = pos_samples.reshape( 1, pos.size() / channels ); neg_samples = cv::Mat( neg, true ); neg_samples = neg_samples.reshape( 1, neg.size() / channels ); } // organize samples in an array void MOG::organizeSample( const cv::Mat& img, const cv::Mat& mask, std::vector<double>& pos, std::vector<double>& neg ){ CV_Assert( img.cols == mask.cols && img.rows == mask.rows && mask.type() == CV_16UC1 ); const size_t channels = img.channels(); double sample[channels]; for ( int yyy = 0; yyy < img.rows; yyy++ ) { for ( int xxx = 0; xxx < img.cols; xxx++ ) { // 3 channel pixel to 1x3 mat sample[0] = img.at<cv::Vec3b>( yyy, xxx ) ( 2 ); sample[1] = img.at<cv::Vec3b>( yyy, xxx ) ( 1 ); sample[2] = img.at<cv::Vec3b>( yyy, xxx ) ( 0 ); // appends 3 elements (of 3 channels) // at the end of *pos* or *neg* if ( mask.at<unsigned short>( yyy, xxx ) > 0 ) pos.insert( pos.end(), sample, sample + channels ); else neg.insert( neg.end(), sample, sample + channels ); } } }
31.849315
86
0.529462
palikar
84e47bd1256f7360f5d878622043a3854d6971c0
699
cpp
C++
src/NoughtGraphic.cpp
That-Cool-Coder/sfml-tictactoe
af43fd32b70acd8e73b54a2feb074df93c36bc6d
[ "MIT" ]
null
null
null
src/NoughtGraphic.cpp
That-Cool-Coder/sfml-tictactoe
af43fd32b70acd8e73b54a2feb074df93c36bc6d
[ "MIT" ]
null
null
null
src/NoughtGraphic.cpp
That-Cool-Coder/sfml-tictactoe
af43fd32b70acd8e73b54a2feb074df93c36bc6d
[ "MIT" ]
null
null
null
#include "NoughtGraphic.hpp" NoughtGraphic::NoughtGraphic() {} NoughtGraphic::NoughtGraphic(int i_radius) { radius = i_radius; } void NoughtGraphic::draw(int xPos, int yPos, sf::RenderWindow &window, sf::Color backgroundColor) { // xPos and yPos should be pos of center m_outerShape.setFillColor(m_color); m_outerShape.setRadius(radius); m_outerShape.setPosition(xPos - radius, yPos - radius); m_innerShape.setFillColor(backgroundColor); m_innerShape.setRadius(radius * m_holeProportion); m_innerShape.setPosition(xPos - radius * m_holeProportion, yPos - radius * m_holeProportion); window.draw(m_outerShape); window.draw(m_innerShape); }
27.96
70
0.728183
That-Cool-Coder
84e52caf5bf2e0397bacf14b940faf1faa98f580
1,259
hpp
C++
include/cpp/vkt/Crop.hpp
Kniggi/volkit
ca9f6eca143bb1306d743ba64d9e55057822d2e4
[ "MIT" ]
11
2020-02-11T20:25:48.000Z
2022-03-23T14:50:36.000Z
include/cpp/vkt/Crop.hpp
Kniggi/volkit
ca9f6eca143bb1306d743ba64d9e55057822d2e4
[ "MIT" ]
null
null
null
include/cpp/vkt/Crop.hpp
Kniggi/volkit
ca9f6eca143bb1306d743ba64d9e55057822d2e4
[ "MIT" ]
4
2020-02-11T20:25:57.000Z
2021-12-13T14:47:38.000Z
// This file is distributed under the MIT license. // See the LICENSE file for details. #pragma once #include <cstdint> #include "common.hpp" #include "forward.hpp" #include "linalg.hpp" namespace vkt { VKTAPI Error CropResize(HierarchicalVolume& dst, HierarchicalVolume& src, int32_t firstX, int32_t firstY, int32_t firstZ, int32_t lastX, int32_t lastY, int32_t lastZ); VKTAPI Error CropResize(HierarchicalVolume& dst, HierarchicalVolume& src, Vec3i first, Vec3i last); VKTAPI Error Crop(HierarchicalVolume& dst, HierarchicalVolume& src, int32_t firstX, int32_t firstY, int32_t firstZ, int32_t lastX, int32_t lastY, int32_t lastZ); VKTAPI Error Crop(HierarchicalVolume& dst, HierarchicalVolume& src, Vec3i first, Vec3i last); } // vkt
29.97619
52
0.462272
Kniggi
84e8e7b53145f7af8ed027e2f6c6d359fdac4871
1,228
cpp
C++
Ass_4/C files/billu.cpp
pratik8696/Assignment
6fa02f4f7ec135b13dbebea9920eeb2a57bd1489
[ "MIT" ]
null
null
null
Ass_4/C files/billu.cpp
pratik8696/Assignment
6fa02f4f7ec135b13dbebea9920eeb2a57bd1489
[ "MIT" ]
null
null
null
Ass_4/C files/billu.cpp
pratik8696/Assignment
6fa02f4f7ec135b13dbebea9920eeb2a57bd1489
[ "MIT" ]
null
null
null
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { vector<int> billu; //initialization/declaration //input billu.push_back(4); //billu[0] billu.push_back(7); //billu[1] billu.push_back(18); //billu[2] billu.push_back(45); //billu[3] billu.push_back(10); //billu[4] //output for (auto element:billu) { cout << element << " "; } cout << endl; for (int i = 0; i < billu.size(); i++) { cout << billu[i] << " "; } cout << endl; vector<int> pandu; int size; cout << endl << "enter the size for pandu"; cin >> size; for (int i = 0; i < size; i++) { int input; cin >> input; pandu.push_back(input); } cout << endl; for (auto element : pandu) { cout << element << " "; } cout << endl; billu.pop_back(); cout << endl; for (auto element : billu) { cout << element << " "; } cout<<endl; swap(billu, pandu); for (auto element : billu) { cout << element << " "; } cout<<endl; for (auto element : pandu) { cout << element << " "; } return 0; }
19.492063
51
0.488599
pratik8696