blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
603e18094366de7d74531c600cb5b1c7bd2a6df1
2f78e134c5b55c816fa8ee939f54bde4918696a5
/code/3rdparty/hk410/include/physics/hkinternal/collide/mopp/builder/splitter/hkMoppSplitter.h
076ca31884647c9f3da5d0fc6939b42004dd0a6b
[]
no_license
narayanr7/HeavenlySword
b53afa6a7a6c344e9a139279fbbd74bfbe70350c
a255b26020933e2336f024558fefcdddb48038b2
refs/heads/master
2022-08-23T01:32:46.029376
2020-05-26T04:45:56
2020-05-26T04:45:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,986
h
/* * * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's * prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok. * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2006 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ // hkMoppDefaultSplitter definition #ifndef HK_COLLIDE2_MOPP_SPLITTER_H #define HK_COLLIDE2_MOPP_SPLITTER_H // // Havok Memory Optimised Partial Polytope Tree // // forward definition class hkMoppSplitParams; class hkMoppNodeMgr : public hkReferencedObject { public: virtual void releaseNode( class hkMoppTreeNode *nodeToRelease ) = 0; virtual int getFreeNodes() = 0; }; class hkMoppSplitter: public hkMoppNodeMgr { public: // // some public classes // struct hkMoppScratchArea { hkMoppCompilerPrimitive* m_primitives; hkMoppTreeInternalNode* m_nodes; hkMoppTreeTerminal* m_terminals; }; public: // // some public classes // /// parameters to the Mopp compile call struct hkMoppSplitParams { // set the essential parameters and initialize the rest with reasonable default values hkMoppSplitParams( hkMoppMeshType meshType = HK_MOPP_MT_LANDSCAPE ); // the maximum error we allow the system to operate hkReal m_tolerance; int m_maxPrimitiveSplits; // maximum number of split primitives in tree int m_maxPrimitiveSplitsPerNode; // maximum number of split primitives per node int m_minRangeMaxListCheck; // minimum number of elements which is checked in the max list int m_checkAllEveryN; // all elements in the max list will be checked every N iterations // Flag that indicates whether 'interleaved building' is enabled or disabled. // For more information on 'interleaved building' see the respective parameter in hkMoppFitToleranceRequirements. hkBool m_interleavedBuildingEnabled; }; public: hkMoppSplitter() {} virtual ~hkMoppSplitter() {} virtual hkMoppTreeNode* buildTree(hkMoppMediator*, hkMoppCostFunction*, class hkMoppAssembler*, const hkMoppSplitParams&, hkMoppScratchArea&) = 0; // recursively build the tree }; #endif // HK_COLLIDE2_MOPP_SPLITTER_H /* * Havok SDK - CLIENT RELEASE, BUILD(#20060902) * * Confidential Information of Havok. (C) Copyright 1999-2006 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok * Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership * rights, and intellectual property rights in the Havok software remain in * Havok and/or its suppliers. * * Use of this software for evaluation purposes is subject to and indicates * acceptance of the End User licence Agreement for this product. A copy of * the license is included with this software and is also available from salesteam@havok.com. * */
[ "hopefullyidontgetbanned735@gmail.com" ]
hopefullyidontgetbanned735@gmail.com
46956978c2d014faa1d176a773579184738c5d2d
5b1134aa5050e5a1616c6915631bb8776197dba7
/series5/rsa.cpp
5e739121355c410a4cbcc87675adb0639760f47b
[]
no_license
TKSpectro/krypto-exercise
017e7e5bb965833710ce9c523d02f3a9276c5f7a
81dfaf6b39035c25d86160314d59bdf4b572250f
refs/heads/master
2023-06-11T20:46:37.326375
2021-06-30T12:49:27
2021-06-30T12:49:27
357,568,325
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,824
cpp
#include "rsa.h" #include <bitset> int ggT(int a, int b) { int rest = b; while(rest != 0) { rest = a % b; a = b; b = rest; } return a; } int extendedEuclideanAlgorithm(int a0, int a1) { int xOld = 1; int xCurrent = 0; int xNew; int yOld = 0; int yCurrent = 1; int yNew; int aOld = a0; int aCurrent = a1; int aNew; int q; while(aCurrent != 0) { q = floor(aOld / aCurrent); aNew = aOld - q * aCurrent; xNew = xOld - q * xCurrent; yNew = yOld - q * yCurrent; aOld = aCurrent; xOld = xCurrent; yOld = yCurrent; aCurrent = aNew; xCurrent = xNew; yCurrent = yNew; } return xOld; } int squareMultiply(int base, int exponent, int mod) { int result; std::bitset<256> expBits(exponent); bool firstOneAlreadyHit = false; for(int i = 255; i >= 0; i--) { if(firstOneAlreadyHit == true) { if(expBits[i] == 1) { result = (result * result * base) % mod; printf(""); } else { result = (result * result) % mod; printf(""); } } if(firstOneAlreadyHit == false && expBits[i] == 1) { firstOneAlreadyHit = true; result = (1 * 1 * base) % mod; } } return result; } rsaReturn rsaEncode(int p, int q, int M) { rsaReturn result; result.n = p * q; result.phi = (p - 1) * (q - 1); bool worked = false; int counter = 3; while(!worked) { if(ggT(counter, result.phi) == 1) { worked = true; result.e = counter; } counter++; } result.d = extendedEuclideanAlgorithm(result.e, result.phi); result.C = squareMultiply(M, result.e, result.n); return result; } int main() { //Vorlesungs Beispiel rsaReturn encodedMessage1 = rsaEncode(13, 23, 212); // Übungs Beispiel 1 rsaReturn encodedMessage3 = rsaEncode(11, 13, 15); // Übungs Beispiel 2 rsaReturn encodedMessage2 = rsaEncode(23, 67, 15); return 0; }
[ "45234980+TKSpectro@users.noreply.github.com" ]
45234980+TKSpectro@users.noreply.github.com
696e4e55a6e3c09b091d6cd4cef376eb97518cf5
fec81bfe0453c5646e00c5d69874a71c579a103d
/blazetest/src/mathtest/operations/smatdmatadd/MZbLDa.cpp
f9990d97fe11a98a7bf6af431fa0f1b9aa014821
[ "BSD-3-Clause" ]
permissive
parsa/blaze
801b0f619a53f8c07454b80d0a665ac0a3cf561d
6ce2d5d8951e9b367aad87cc55ac835b054b5964
refs/heads/master
2022-09-19T15:46:44.108364
2022-07-30T04:47:03
2022-07-30T04:47:03
105,918,096
52
7
null
null
null
null
UTF-8
C++
false
false
4,103
cpp
//================================================================================================= /*! // \file src/mathtest/operations/smatdmatadd/MZbLDa.cpp // \brief Source file for the MZbLDa sparse matrix/dense matrix addition math test // // Copyright (C) 2012-2020 Klaus Iglberger - All Rights Reserved // // This file is part of the Blaze library. You can redistribute it and/or modify it under // the terms of the New (Revised) BSD License. Redistribution and use in source and binary // forms, with or without modification, are permitted provided that the following conditions // are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // 3. Neither the names of the Blaze development group nor the names of its contributors // may be used to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR // BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. */ //================================================================================================= //************************************************************************************************* // Includes //************************************************************************************************* #include <cstdlib> #include <iostream> #include <blaze/math/DynamicMatrix.h> #include <blaze/math/LowerMatrix.h> #include <blaze/math/ZeroMatrix.h> #include <blazetest/mathtest/Creator.h> #include <blazetest/mathtest/operations/smatdmatadd/OperationTest.h> #include <blazetest/system/MathTest.h> #ifdef BLAZE_USE_HPX_THREADS # include <hpx/hpx_main.hpp> #endif //================================================================================================= // // MAIN FUNCTION // //================================================================================================= //************************************************************************************************* int main() { std::cout << " Running 'MZbLDa'..." << std::endl; using blazetest::mathtest::TypeA; using blazetest::mathtest::TypeB; try { // Matrix type definitions using MZb = blaze::ZeroMatrix<TypeB>; using LDa = blaze::LowerMatrix< blaze::DynamicMatrix<TypeA> >; // Creator type definitions using CMZb = blazetest::Creator<MZb>; using CLDa = blazetest::Creator<LDa>; // Running tests with small matrices for( size_t i=0UL; i<=6UL; ++i ) { RUN_SMATDMATADD_OPERATION_TEST( CMZb( i, i ), CLDa( i ) ); } // Running tests with large matrices RUN_SMATDMATADD_OPERATION_TEST( CMZb( 67UL, 67UL ), CLDa( 67UL ) ); RUN_SMATDMATADD_OPERATION_TEST( CMZb( 128UL, 128UL ), CLDa( 128UL ) ); } catch( std::exception& ex ) { std::cerr << "\n\n ERROR DETECTED during sparse matrix/dense matrix addition:\n" << ex.what() << "\n"; return EXIT_FAILURE; } return EXIT_SUCCESS; } //*************************************************************************************************
[ "klaus.iglberger@gmail.com" ]
klaus.iglberger@gmail.com
9c757b62e5a31b9a8860d49963d7aecda7cff872
9f4a21b020c5ad96a20b8e75947013d6c553b8a8
/Renderer/Interface/Renderer.cpp
7119675c35fe125249ccf1561dfc22c985dbddc3
[]
no_license
Hamsterarsch/Rendering
99452091aac36a1fd628cef4a6d9c3aed999c68b
e9e301920edbfa5369edd21348c574bc01666201
refs/heads/master
2022-11-25T12:23:04.814619
2019-10-17T16:56:22
2019-10-17T16:56:22
215,843,230
0
0
null
null
null
null
UTF-8
C++
false
false
1,442
cpp
#include "Renderer.hpp" #include "DX12/Facade.hpp" namespace Renderer { Renderer::Renderer(HWND outputWindow) : inflightFramesAmount{ 1 }, shouldUpdateRendering{ false } { resources = RHA::DX12::Facade::MakeDeviceResources(D3D_FEATURE_LEVEL_12_0, true); commonQueue = RHA::DX12::Facade::MakeQueue(resources.get(), D3D12_COMMAND_LIST_TYPE_DIRECT); outputSurface = RHA::DX12::Facade::MakeWindowSurface(resources.get(), commonQueue.get(), outputWindow); commonAllocator = RHA::DX12::Facade::MakeCmdAllocator(resources.get(), D3D12_COMMAND_LIST_TYPE_DIRECT); updaterHandle = std::async( std::launch::async, &Renderer::UpdateRendering, this); { std::lock_guard<std::mutex> lock{ updaterMutex }; shouldUpdateRendering = true; } updaterCondition.notify_all(); } int Renderer::UpdateRendering() { std::unique_lock<std::mutex> lock{ updaterMutex }; updaterCondition.wait(lock, [&shouldUpdateRendering = shouldUpdateRendering] { return shouldUpdateRendering; }); while(shouldUpdateRendering) { outputSurface->ScheduleBackbufferClear(commonQueue.get()); //other commands outputSurface->SchedulePresentation(commonQueue.get()); } return 0; } Renderer::~Renderer() { { std::lock_guard<std::mutex> lock{ updaterMutex }; shouldUpdateRendering = false; updaterHandle.wait(); } } void Renderer::SubmitFrameInfo() { } }
[ "rl-bellin@web.de" ]
rl-bellin@web.de
0a3d3144c9f9ad80b2a13a7910bfe571cd551760
4d8f03b00266b2809e50073a236771cd66e0706d
/moves/ori_move.h
a43ac0c48fe81d5ea18c15f5dd1a2d80447b5bff
[]
no_license
Shadowslice62642/Old-Sharcs
483531ba35c7f50fa8fb42b78da2414affa38940
4f28453502adb05aac2daf564c5fd1b7d93f5c6a
refs/heads/master
2023-08-12T00:01:59.574744
2021-10-04T10:41:50
2021-10-04T10:41:50
413,346,769
0
0
null
null
null
null
UTF-8
C++
false
false
923
h
#pragma once #include <array> //maybe change it to take uint64_t and bitshift so not so many arguments template<char length, char ori> class ori_move { public: char len = length; ori_move() : _pos1(0), _pos2(3), _pos3(2), _pos4(1), _ori1(0), _ori2(0), _ori3(0), _ori4(0) {} //defaults to U corner ori_move(char pos1, char pos2, char pos3, char pos4, char ori1, char ori2, char ori3, char ori4) : _pos1(pos1), _pos2(pos2), _pos3(pos3), _pos4(pos4), _ori1(ori1), _ori2(ori2), _ori3(ori3), _ori4(ori4) {} void operator()(std::array<char, length>& ori_array) { char x; x = ori_array[_pos1]; ori_array[_pos1] = (ori_array[_pos2] + _ori2) % ori; ori_array[_pos2] = (ori_array[_pos3] + _ori3) % ori; ori_array[_pos3] = (ori_array[_pos4] + _ori4) % ori; ori_array[_pos4] = (x + _ori1) % ori; } private: char _pos1; char _pos2; char _pos3; char _pos4; char _ori1; char _ori2; char _ori3; char _ori4; };
[ "joseph.briggs@live.co.uk" ]
joseph.briggs@live.co.uk
1027b8c2186c31002aa38796a5438715550adb61
24e6b47ae367c95b51e86642155e3d62456430c8
/DuiLib/Control/UIButton.h
d9d5961435929693f8236b8a6396c1ec6b629f22
[ "MIT", "BSD-2-Clause" ]
permissive
ezhangle/BalloonDuilib
b8c8e958bc3df5aaf0af3061e508fc09fef39452
3fd8700d3b10075e2a9f62931c56bb394e893876
refs/heads/master
2020-05-22T18:09:42.901993
2017-05-25T10:59:03
2017-05-25T10:59:03
null
0
0
null
null
null
null
GB18030
C++
false
false
2,552
h
#ifndef __UIBUTTON_H__ #define __UIBUTTON_H__ #pragma once namespace DuiLib { //对应<Button>标签 class DUILIB_API CButtonUI : public CLabelUI { public: CButtonUI(); LPCTSTR GetClass() const; LPVOID GetInterface(LPCTSTR pstrName); UINT GetControlFlags() const; bool Activate(); void SetEnabled(bool bEnable = true); void DoEvent(TEventUI& event); LPCTSTR GetNormalImage(); void SetNormalImage(LPCTSTR pStrImage); LPCTSTR GetHotImage(); void SetHotImage(LPCTSTR pStrImage); LPCTSTR GetPushedImage(); void SetPushedImage(LPCTSTR pStrImage); LPCTSTR GetFocusedImage(); void SetFocusedImage(LPCTSTR pStrImage); LPCTSTR GetDisabledImage(); void SetDisabledImage(LPCTSTR pStrImage); LPCTSTR GetForeImage(); void SetForeImage(LPCTSTR pStrImage); LPCTSTR GetHotForeImage(); void SetHotForeImage(LPCTSTR pStrImage); // 对应按钮的5个状态图 void SetFiveStatusImage(LPCTSTR pStrImage); void SetFadeAlphaDelta(BYTE uDelta); BYTE GetFadeAlphaDelta(); void SetHotBkColor(DWORD dwColor); DWORD GetHotBkColor() const; void SetHotTextColor(DWORD dwColor); DWORD GetHotTextColor() const; void SetPushedTextColor(DWORD dwColor); DWORD GetPushedTextColor() const; void SetFocusedTextColor(DWORD dwColor); DWORD GetFocusedTextColor() const; SIZE EstimateSize(SIZE szAvailable); /** 支持的属性 * normalimage string * hotimage string * pushedimage string * focusedimage string * disabledimage string * foreimage string 前景图片 * hotforeimage string * fivestatusimage string ?? * fadedelta int * hotbkcolor int 十六进制 0xAARRGGBB/#AARRGGBB * hottextcolor int 十六进制 0xAARRGGBB/#AARRGGBB * pushedtextcolor int 十六进制 0xAARRGGBB/#AARRGGBB * focusedtextcolor int 十六进制 0xAARRGGBB/#AARRGGBB **/ void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue); void PaintText(HDC hDC); void PaintStatusImage(HDC hDC); protected: enum { FADE_TIMERID = 11, FADE_ELLAPSE = 30, }; UINT m_uButtonState; DWORD m_dwHotBkColor; DWORD m_dwHotTextColor; DWORD m_dwPushedTextColor; DWORD m_dwFocusedTextColor; BYTE m_uFadeAlpha; BYTE m_uFadeAlphaDelta; TDrawInfo m_diNormal; TDrawInfo m_diHot; TDrawInfo m_diHotFore; TDrawInfo m_diPushed; TDrawInfo m_diPushedFore; TDrawInfo m_diFocused; TDrawInfo m_diDisabled; }; } // namespace DuiLib #endif // __UIBUTTON_H__
[ "yuanlong.zhang@baidao.com" ]
yuanlong.zhang@baidao.com
082737ebc924a8a3f041c15174c98822d9ce523d
1723ea35099fb5f60c1f0f9f8f8b86641de10c9a
/src/MarkerDB.cpp
0e10cfb122d3b8a9429485edb37819aa6cf79684
[]
no_license
emojilearning/NaiveAR
c847c8c6b421d545312740899f0093b784e99698
35490291e4e215b241b9c46898be1483ef9b575c
refs/heads/master
2021-01-23T22:31:19.905777
2017-09-09T09:03:52
2017-09-09T09:03:52
102,941,302
1
0
null
null
null
null
UTF-8
C++
false
false
1,216
cpp
#include <MarkerDB.h> #include <memory> using namespace DBoW3; using namespace std; using namespace cv; //methods of MarkerDB namespace nar { void nar::MarkerDB::load(string filename) { dict = make_shared<Vocabulary>(); dict->load(filename); db = make_shared<Database>(*dict); } void MarkerDB::build(std::vector<cv::Mat>& voc_imgs,int n_orb_kpt) { Vocabulary voc(10, 6, DBoW3::TF_IDF, DBoW3::L1_NORM); auto orbDetector = ORB::create(n_orb_kpt); vector<Mat> all_desp; for (auto& img : voc_imgs) { vector<KeyPoint> kpts; Mat desp; orbDetector->detectAndCompute(img, noArray(), kpts, desp); all_desp.push_back(desp); } voc.create(all_desp); voc.save("ambd.voc"); } void MarkerDB::addMarker(Mat marker) { auto temp = make_shared<Frame>(marker); m_ptrs.push_back(temp); temp->init(2000,dict); auto id = db->add(temp->descriptor); } shared_ptr<MarkerDB> MarkerDB::getInstance() { static shared_ptr<MarkerDB> db = make_shared<MarkerDB>(); return db; } int MarkerDB::queryMarker(Mat imgdes) { if(!imgdes.data) return -1; QueryResults ret; db->query(imgdes, ret); //cout << ret << endl; if (ret.empty()) return -1; return ret.back().Id; } }
[ "chuguanyi@qq.com" ]
chuguanyi@qq.com
40a4800ab36164f00d7937e317a7a9b07d606ec1
f92886e4a175a037a6103eba23ad94ed5051fbcc
/tests/fenv_test.cpp
9fc7d96fc05aa1f25f7c1e56dba47ee994c8ce62
[]
no_license
Havoc-OS/android_bionic
8bcfc2686e10b7420188f12cfbe04f07cf20d0f3
ceda818b63478bf052d514f8aa30fde56c90b612
refs/heads/pie
2022-10-08T05:42:34.653351
2019-07-13T19:15:44
2019-07-13T19:15:44
132,499,154
4
31
null
2018-09-04T16:45:29
2018-05-07T18:15:02
C
UTF-8
C++
false
false
6,864
cpp
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gtest/gtest.h> #include "ScopedSignalHandler.h" #include "utils.h" #include <fenv.h> #include <stdint.h> static void TestRounding(float expectation1, float expectation2) { // volatile to prevent compiler optimizations. volatile float f = 1.968750f; volatile float m = 0x1.0p23f; volatile float x = f + m; ASSERT_FLOAT_EQ(expectation1, x); x -= m; ASSERT_EQ(expectation2, x); } static void DivideByZero() { // volatile to prevent compiler optimizations. volatile float zero = 0.0f; volatile float result __attribute__((unused)) = 123.0f / zero; } TEST(fenv, fesetround_fegetround_FE_TONEAREST) { fesetround(FE_TONEAREST); ASSERT_EQ(FE_TONEAREST, fegetround()); TestRounding(8388610.0f, 2.0f); } TEST(fenv, fesetround_fegetround_FE_TOWARDZERO) { fesetround(FE_TOWARDZERO); ASSERT_EQ(FE_TOWARDZERO, fegetround()); TestRounding(8388609.0f, 1.0f); } TEST(fenv, fesetround_fegetround_FE_UPWARD) { fesetround(FE_UPWARD); ASSERT_EQ(FE_UPWARD, fegetround()); TestRounding(8388610.0f, 2.0f); } TEST(fenv, fesetround_fegetround_FE_DOWNWARD) { fesetround(FE_DOWNWARD); ASSERT_EQ(FE_DOWNWARD, fegetround()); TestRounding(8388609.0f, 1.0f); } TEST(fenv, feclearexcept_fetestexcept) { // Clearing clears. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); // Dividing by zero sets FE_DIVBYZERO. DivideByZero(); int raised = fetestexcept(FE_DIVBYZERO | FE_OVERFLOW); ASSERT_TRUE((raised & FE_OVERFLOW) == 0); ASSERT_TRUE((raised & FE_DIVBYZERO) != 0); // Clearing an unset bit is a no-op. feclearexcept(FE_OVERFLOW); ASSERT_TRUE((raised & FE_OVERFLOW) == 0); ASSERT_TRUE((raised & FE_DIVBYZERO) != 0); // Clearing a set bit works. feclearexcept(FE_DIVBYZERO); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, FE_DFL_ENV_macro) { ASSERT_EQ(0, fesetenv(FE_DFL_ENV)); } TEST(fenv, feraiseexcept) { feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); ASSERT_EQ(0, feraiseexcept(FE_DIVBYZERO | FE_OVERFLOW)); ASSERT_EQ(FE_DIVBYZERO | FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, fegetenv_fesetenv) { // Set FE_OVERFLOW only. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); ASSERT_EQ(0, feraiseexcept(FE_OVERFLOW)); // fegetenv (unlike feholdexcept) leaves the current state untouched... fenv_t state; ASSERT_EQ(0, fegetenv(&state)); ASSERT_EQ(FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT)); // Dividing by zero sets the appropriate flag... DivideByZero(); ASSERT_EQ(FE_DIVBYZERO | FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT)); // And fesetenv (unlike feupdateenv) clobbers that to return to where // we started. ASSERT_EQ(0, fesetenv(&state)); ASSERT_EQ(FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, feholdexcept_feupdateenv) { // Set FE_OVERFLOW only. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); ASSERT_EQ(0, feraiseexcept(FE_OVERFLOW)); // feholdexcept (unlike fegetenv) clears everything... fenv_t state; ASSERT_EQ(0, feholdexcept(&state)); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); // Dividing by zero sets the appropriate flag... DivideByZero(); ASSERT_EQ(FE_DIVBYZERO, fetestexcept(FE_ALL_EXCEPT)); // And feupdateenv (unlike fesetenv) merges what we started with // (FE_OVERFLOW) with what we now have (FE_DIVBYZERO). ASSERT_EQ(0, feupdateenv(&state)); ASSERT_EQ(FE_DIVBYZERO | FE_OVERFLOW, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, fegetexceptflag_fesetexceptflag) { // Set three flags. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, feraiseexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)); ASSERT_EQ(FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW, fetestexcept(FE_ALL_EXCEPT)); fexcept_t all; // FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW fexcept_t two; // FE_OVERFLOW | FE_UNDERFLOW ASSERT_EQ(0, fegetexceptflag(&all, FE_ALL_EXCEPT)); ASSERT_EQ(0, fegetexceptflag(&two, FE_OVERFLOW | FE_UNDERFLOW)); // Check we can restore all. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fesetexceptflag(&all, FE_ALL_EXCEPT)); ASSERT_EQ(FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW, fetestexcept(FE_ALL_EXCEPT)); // Check that `two` only stored a subset. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fesetexceptflag(&two, FE_ALL_EXCEPT)); ASSERT_EQ(FE_OVERFLOW | FE_UNDERFLOW, fetestexcept(FE_ALL_EXCEPT)); // Check that we can restore a single flag. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fesetexceptflag(&all, FE_DIVBYZERO)); ASSERT_EQ(FE_DIVBYZERO, fetestexcept(FE_ALL_EXCEPT)); // Check that we can restore a subset of flags. feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fesetexceptflag(&all, FE_OVERFLOW | FE_UNDERFLOW)); ASSERT_EQ(FE_OVERFLOW | FE_UNDERFLOW, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, fedisableexcept_fegetexcept) { feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); // No SIGFPE please... ASSERT_EQ(0, fedisableexcept(FE_ALL_EXCEPT)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(0, feraiseexcept(FE_INVALID)); ASSERT_EQ(FE_INVALID, fetestexcept(FE_ALL_EXCEPT)); } TEST(fenv, feenableexcept_fegetexcept) { #if defined(__aarch64__) || defined(__arm__) // ARM doesn't support this. They used to if you go back far enough, but it was removed in // the Cortex-A8 between r3p1 and r3p2. ASSERT_EQ(-1, feenableexcept(FE_INVALID)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(-1, feenableexcept(FE_DIVBYZERO)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(-1, feenableexcept(FE_OVERFLOW)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(-1, feenableexcept(FE_UNDERFLOW)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(-1, feenableexcept(FE_INEXACT)); ASSERT_EQ(0, fegetexcept()); ASSERT_EQ(-1, feenableexcept(FE_DENORMAL)); ASSERT_EQ(0, fegetexcept()); #else // We can't recover from SIGFPE, so sacrifice a child... pid_t pid = fork(); ASSERT_NE(-1, pid) << strerror(errno); if (pid == 0) { feclearexcept(FE_ALL_EXCEPT); ASSERT_EQ(0, fetestexcept(FE_ALL_EXCEPT)); ASSERT_EQ(0, feenableexcept(FE_INVALID)); ASSERT_EQ(FE_INVALID, fegetexcept()); ASSERT_EQ(0, feraiseexcept(FE_INVALID)); _exit(123); } AssertChildExited(pid, -SIGFPE); #endif }
[ "enh@google.com" ]
enh@google.com
2e7c7ab91e440c032796ff250f8e1de3350d8c7c
c8ca15462c87e4e4ff8f98637e2d274170ec6e2f
/src/modules/BatteryTestESPNowModule.h
33f5d1f7d733db88cc19ae84a0e5d1a9757fe2dd
[]
no_license
cmmakerclub/legend-jetpack
ad521c721b0f910bff680b6e1a65c9a7b5760cd5
9b98c1b6a845ae3bf73800cc453fef3f79e7c299
refs/heads/master
2020-03-19T07:36:21.734995
2018-08-20T11:28:19
2018-08-20T11:28:19
136,130,326
0
0
null
null
null
null
UTF-8
C++
false
false
873
h
#ifndef CMMC_BatteryTestESPNowModule_MODULE_H #define CMMC_BatteryTestESPNowModule_MODULE_H #define CMMC_USE_ALIAS #include <CMMC_Legend.h> #include <CMMC_Utils.h> #include <CMMC_Module.h> #include <CMMC_ESPNow.h> #include <CMMC_SimplePair.h> #include <CMMC_Sensor.h> #include <CMMC_LED.h> #define BUTTON_PIN 0 class BatteryTestESPNowModule: public CMMC_Module { public: void config(CMMC_System *os, AsyncWebServer* server); void configLoop(); void setup(); void loop(); private: CMMC_SENSOR_DATA_T _userPacket; uint8_t _defaultDeepSleep_m = 30; CMMC_System *os; CMMC_ESPNow espNow; CMMC_SimplePair simplePair; CMMC_LED *led; uint8_t self_mac[6]; uint8_t master_mac[6]; bool sp_flag_done = false; void _init_simple_pair(); void _go_sleep(uint32_t deepSleepM); void _init_espnow(); }; #endif
[ "nat@cmmc.io" ]
nat@cmmc.io
3b3f1ae8d98ba855c203706d5d1558160817e5aa
6b4e73b7de22ad3a6afd58bd3b1c3becb2b9ae98
/cross_compile/src/main.cpp
aae511e031b0714ff16d86f0170588845c555016
[]
no_license
chrisjdavie/cpp_practice
2809665bf07d7e2c666f8272ee653c8f836b7f20
538448a363c1c42165f8698ff25daa104eec1a6c
refs/heads/master
2021-01-10T13:43:59.381945
2015-10-25T13:49:57
2015-10-25T13:49:57
44,911,727
1
0
null
null
null
null
UTF-8
C++
false
false
1,806
cpp
//============================================================================ // Name : main.cpp // Author : Chris Davie // Version : 1.0 // Description : C/C++ practice //============================================================================ #include <stdio.h> #include <vector> #include <iostream> #include "read_file.h" #include "volt_prof.h" #include "analysis.h" using namespace std; int main() { // cin filename string fname; // fname = "data/voltages.txt"; cout << "Please input filename" << endl; getline(cin,fname); cout << endl; // voltages vector<int> VV_0; vector<int> VV_1; // Names of sensor (0 and 1) vector<string> hheaders; // Open file, load in values read_in_data( fname, VV_0, VV_1, hheaders ); // for each jump, analyse data and output results vector< vector <int> > VVV; // voltage data for both jumps VVV.push_back(VV_0); VVV.push_back(VV_1); for (size_t o = 0; o < VVV.size(); o++ ){ vector<int> VV; VV = VVV[o]; // gets the volterature profile for a jump vector< vector<size_t> > nnn_jump; // start and end indices for each jump int V_bg; // ambient volterature get_volt_prof_each_jump( VV, nnn_jump, V_bg ); vector<int> VV_jump_max; vector<int> VV_jump_av; analysis( VV, nnn_jump, VV_jump_max, VV_jump_av ); // from the profiles gets the ambient volt, the peak volt and // the median volt for each jump cout << hheaders[o] << " sensor" << endl; cout << endl; cout << "Ambient voltage: " << V_bg << endl << endl; for ( size_t i = 0; i < VV_jump_max.size(); i++ ){ cout << "jump " << i << endl; cout << "Maximum jump voltage: " << VV_jump_max[i] << endl; cout << "Average jump voltage: " << VV_jump_av[i] << endl; cout << endl; } cout << endl; } return 0; }
[ "chris.d@theasi.co" ]
chris.d@theasi.co
f782c730fc5be872a0d7c4ed3b96586668a3b1b6
0ffdb82091390f31a78b4ff3e14b8e4469416fc9
/robotStuff.ino
a4ddcb13766f72fa8022814cd9214da274a1f0f7
[]
no_license
jamopopper/WalkingRobot
14633a6069dc85b28e9be16ae93248442b007160
5efa6a501e08a388bf492e31d16b1f5e047de1cb
refs/heads/master
2021-05-23T14:19:26.767522
2020-04-08T03:46:29
2020-04-08T03:46:29
253,335,394
1
0
null
null
null
null
UTF-8
C++
false
false
4,820
ino
// Robot controlling program for quad legged robot #include <Wire.h> #include <Servo.h> #include <Adafruit_PWMServoDriver.h> //#include <BLEDevice.h> //#include <BLEUtils.h> //#include <BLEScan.h> //#include <BLEAdvertisedDevice.h> #include "math.h" #define USMIN 350 // This is the rounded 'minimum' microsecond length based on the minimum pulse of 150 #define USMAX 2300 // This is the rounded 'maximum' microsecond length based on the maximum pulse of 600 #define SERVO_FREQ 50 // Analog servos run at ~50 Hz updates #define PI_Value 3.1416 #define Base_Length 113.1 #define Coxa_Length 82.25 #define Femur_Length 82.25 #define Tibia_Length 82.25 Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40, Wire1); //custom math double robotDimensions[] = {113.137, 82.25, 82.25, 82.25}; //{coxa joint to adjacent coxa joint length, coxa length, femur length, tibia length} in mm from joint center to joint center double legLocation[4][3] = {{ -175, 175, 0}, {175, 175, 0}, { -175, -175, 0}, {175, -175, 0}}; //{leg selected, {foot x, foot y, foot z}} in mm from robot center double torsoLocation[] = {0, 0, 0}; //{center x, center y, center z} in mm from center of robot on the plane passing through all joints when perpendicular double torsoOrientation[] = {0, 0, 0}; //{roll, pitch, yaw} in degrees of offset double servoPositions[4][3] = {{90, 90, 90}, {90, 90, 90}, {90, 90, 90}, {90, 90, 90}}; // const double servoScale = double(USMAX - USMIN) / 180; boolean servoState = false; boolean servoToggle = false; int testable; void setup() { pwm.begin(); pwm.setOscillatorFrequency(27000000); // The int.osc. is closer to 27MHz pwm.setPWMFreq(SERVO_FREQ); // Analog servos run at ~50 Hz updates Serial.begin(115200); pinMode(3, OUTPUT); pinMode(10, INPUT); pinMode(LED_BUILTIN, OUTPUT); digitalWrite(3, LOW); digitalWrite(LED_BUILTIN, LOW); } void loop() { servoCalc(); //servoSend(); if (!servoToggle && digitalRead(10)) { servoState = !servoState; } servoToggle = digitalRead(10); digitalWrite(3, servoState); digitalWrite(LED_BUILTIN, servoState); delay(75); } void servoCalc() { float jointOffset[4][2] = {{-1, 1}, {1, 1}, {-1, -1}, {1, -1}}; // implement heading rotation using the coordinate rotation math from calc class for (uint_fast8_t i = 0U; i < 4U; i++) { // variable calulations double legHold[2] = {legLocation[i][0] - torsoLocation[0] - (jointOffset[i][0] * robotDimensions[0] / 2), legLocation[i][1] - torsoLocation[1] - (jointOffset[i][1] * robotDimensions[0] / 2)}; double legLength = sqrt(sq(legLocation[i][2] - torsoLocation[2]) + sq(sqrt(sq(legHold[0]) + sq(legHold[1])) - robotDimensions[1])); double legAngle[3] = {0, 0, acos((sq(robotDimensions[2]) + sq(robotDimensions[3]) - sq(legLength))/(2 * robotDimensions[2] * robotDimensions[3]))}; if (legHold[0] != 0) legAngle[0] = atan(legHold[1]/legHold[0]); //angle from horizontal else legAngle[0] = 90; // warnings for invalid inputs if (legLength > (robotDimensions[2] + robotDimensions[3])) { Serial.print(i); Serial.print(" is over-extended"); Serial.print("\t"); break; } if (legLength < abs(robotDimensions[2] - robotDimensions[3])) { Serial.print(i); Serial.print(" is under-extended"); Serial.print("\t"); break; } if ((i % 3) && (legAngle[0] < 0 || legAngle[0] > HALF_PI)) { Serial.print(i); Serial.print(" coxa servo can't extend that far"); Serial.print("\t"); break; } else if (!(i % 3) && (legAngle[0] > 0 || legAngle[0] < -HALF_PI)) { Serial.print(i); Serial.print(" coxa servo can't extend that far"); Serial.print("\t"); break; } // setting servo angles if (i % 3) servoPositions[i][0] = 45 + (legAngle[0] * (180 / PI)); else servoPositions[i][0] = 135 + (legAngle[0] * (180 / PI)); servoPositions[i][1] = (sqrt(sq(legHold[0]) + sq(legHold[1])) - robotDimensions[1]); servoPositions[i][2] = atan((legLocation[i][2] - torsoLocation[2])/((180/PI) * legAngle[2])); for (uint_fast8_t j = 0U; j < 3U; j++) { Serial.print(servoPositions[i][j]); Serial.print("\t"); } } Serial.println(); } void robotAim(int heading) { //moving leg designation /* use joystick to tell the goal position for moving feet further joystick push = longer strides update location at end of step */ } void servoSend() { for (uint_fast8_t i = 0U; i < 4U; i++) { for (uint_fast8_t j = 0U; j < 3U; j++) { pwm.writeMicroseconds(((i * 3) + j), USMIN + (servoPositions[i][j] * servoScale)); Serial.print((i * 3) + j); Serial.print(" at "); Serial.print(USMIN + (servoPositions[i][j] * servoScale)); Serial.print("\t"); } } Serial.println(); }
[ "noreply@github.com" ]
noreply@github.com
34bcd65c912998af71b2bdce528334526bc386c4
fca5912f14ac8c346c7f45b3df5976297a5a1121
/Source/Testing/Public/PickUps.h
7f8b41746dde8b65c8b02e58711a1d465e9e9e91
[]
no_license
felluffy/UERandomThings
c08ee460aa6b3cae1aaa677889fadced359540ce
05907d178d40427576c7eb195c69f36bff49bf50
refs/heads/master
2023-02-10T03:07:27.781654
2021-01-08T20:12:39
2021-01-08T20:12:39
321,848,624
0
0
null
null
null
null
UTF-8
C++
false
false
5,129
h
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "TInteractable.h" #include "GameFramework/Character.h" #include "PickUps.generated.h" USTRUCT(BlueprintType) struct FInventoryAttributes { GENERATED_BODY() UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Inventory) float Weight; UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Inventory) int TopLeftBox; UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Inventory) int RightOccupancy; UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Inventory) int BottomOccupancy; UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Inventory) class UTexture2D* ItemTexture; }; UCLASS() class TESTING_API APickUps : public ATInteractable { GENERATED_BODY() public: // Sets default values for this actor's properties APickUps(); UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) class USphereComponent* OverlapSphere; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) class UParticleSystemComponent* OnPickUpParticle; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) class UParticleSystemComponent* OnSpawnParticle; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) class UParticleSystemComponent* DefaultParticle; //properties protected: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float RespawnTimer; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float MovementXAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float MovementYAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float MovementZAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float RotationXAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float RotationYAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float RotationZAxis; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) bool bOnceUse = false; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) bool bAllowedInInventory = true; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) FInventoryAttributes InventoryAttributes; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float MaxThrowDistance; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = Pickups) float ThrowMultiplier; protected: //void ChangeTransforms(); public: UFUNCTION(BlueprintCallable, Category = Pickups) virtual void OnPickUp(); UFUNCTION(BlueprintCallable, Category = Pickups) virtual void OnDrop(); UFUNCTION(BlueprintCallable, Category = Pickups) virtual void OnEquip(); UFUNCTION(BlueprintCallable, Category = Pickups) virtual void OnUnEquip(); UFUNCTION(BlueprintCallable, Category = Pickups) virtual void ThrowUponDrop(bool ShouldThrow = false, FName SocketAttachmentPoint = ""); UFUNCTION(BlueprintCallable, Category = Pickups) virtual void OnThrowDropAddImpulse(FVector Impulse, FVector Location, FName BoneName); UFUNCTION(BlueprintCallable, Category = Pickups) inline FInventoryAttributes GetInventoryAttributes() const { return InventoryAttributes; } UFUNCTION(BlueprintCallable, Category = PickUps) virtual void ClearOwnerUponDrop(); UFUNCTION(BlueprintCallable, Category = PickUps) virtual void AddOwnerUponPickedUp(class ACharacter* CharacterToAdd); UFUNCTION(BlueprintCallable, Category = Input) virtual void OnPressMainButton() { return; } ; UFUNCTION(BlueprintCallable, Category = Input) virtual void OnPressSecondaryButton() { return; }; UFUNCTION(BlueprintCallable, Category = Input) virtual void OnPressActionButton() { return; }; UFUNCTION(BlueprintCallable, Category = Input) virtual void OnReleaseActionButton() { return; } UFUNCTION(BlueprintCallable, Category = Input) virtual void OnReleaseSecondaryButton() { return; } UFUNCTION(BlueprintCallable, Category = Input) virtual void OnReleaseMainButton() { return; } UFUNCTION(BlueprintCallable, Category = Input) virtual void ResetToDefaultState() { return; } //Zoomout, change firing modes and things UFUNCTION(BlueprintCallable, Category = Input) virtual bool CanBeSwapped() { return true; } //Zoomout, change firing modes and things UFUNCTION( ) virtual void Overlap( UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult ); //UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Pickups) //virtual void OnRespawn(); //virtual bool CanBePickedUp(class AActor* ) const; //UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Pickups) //virtual void RespawnPickup(); protected: // Called when the game starts or when spawned virtual void BeginPlay() override; public: // Called every frame virtual void Tick(float DeltaTime) override; };
[ "nasif.fei@gmail.com" ]
nasif.fei@gmail.com
dfe728a1a488e5b9d6377c4df99c6f6cd480a6f3
7f2255fd0fce35a14556dda32ff06113c83b2e88
/洛谷/P1387.cpp
ce2a106a106a33bf3ae988afd6f2455334cfeb4d
[]
no_license
cordercorder/ProgrammingCompetionCareer
c54e2c35c64a1a5fd45fc1e86ddfe5b72ab0cb01
acc27440d3a9643d06bfbfc130958b1a38970f0a
refs/heads/master
2023-08-16T18:21:27.520885
2023-08-13T15:13:44
2023-08-13T15:13:44
225,124,408
3
0
null
null
null
null
UTF-8
C++
false
false
1,468
cpp
#include<bits/stdc++.h> using namespace std; #define FC ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define deb(args...) std::cerr<<"DEBUG------"<<'\n';std::cerr<<#args<<"------>";err(args) void err(){ std::cerr<<'\n'<<"END OF DEBUG"<<'\n'<<'\n'; } template<typename T,typename... Args> void err(T a,Args... args){ std::cerr<<a<<", "; err(args...); } template<template<typename...> class T,typename t,typename... Args> void err(T<t> a, Args... args){ for(auto x: a){ std::cerr<<x<<", "; } err(args...); } const long double PI=acos(-1.0); const long double eps=1e-6; using ll=long long; using ull=unsigned long long; using pii=pair<int,int>; /*head------[@cordercorder]*/ const int maxn=110; int n,m; int a[maxn][maxn],sum[maxn][maxn]; void solve(){ for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+a[i][j]; } int ans=0; int lim=min(n,m); for(int len=1;len<=lim;len++){ for(int i=1;i+len-1<=n;i++){ for(int j=1;j+len-1<=m;j++){ if(sum[i+len-1][j+len-1]-sum[i-1][j+len-1]-sum[i+len-1][j-1]+sum[i-1][j-1]==(len*len)){ ans=max(ans,len); } } } } printf("%d\n",ans); } int main(void){ scanf("%d %d",&n,&m); for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) scanf("%d",&a[i][j]); } solve(); return 0; }
[ "2205722269@qq.com" ]
2205722269@qq.com
d1227a720ab0447d986de73f2eb1309c5ccdf67d
a777431d0f8db92e56045eb4e8cf9dabd0c53767
/TE1/src/Graph.cpp
70b7093ba1dfb4765ab5b32c2fdce5c1ae87120c
[]
no_license
yen31b/TE1-DatosII
b8096af9d3516fc07c5bdb51d3906a9fcd94b570
a39ce480391e78335604a42cb895a76cb9557b6b
refs/heads/master
2021-02-07T20:55:03.686611
2020-03-03T04:55:09
2020-03-03T04:55:09
244,076,043
0
0
null
null
null
null
UTF-8
C++
false
false
4,372
cpp
#include "Graph.h" #include <algorithm> CGraph::CGraph() : m_iRows{ 0 }, m_iCols{ 0 }, m_pBegin{ nullptr }, m_pEnd{ nullptr }, m_pConnections{ nullptr } { } CGraph::CGraph( const CGraph & graph ) { *this = graph; } CGraph& CGraph::operator=( const CGraph & graph ) { m_iRows = graph.m_iRows; m_iCols = graph.m_iRows; m_nodes.reserve( graph.m_nodes.size() ); for ( auto& pNode : graph.m_nodes ) { auto pNewNode = std::make_unique<CGraphNode>( *pNode ); pNewNode->SetGraph( this ); m_nodes.push_back( std::move(pNewNode) ); } m_heuristicFunc = graph.m_heuristicFunc; if ( graph.m_pBegin ) SetBegin( graph.m_pBegin->GetID() ); else m_pBegin = nullptr; if ( graph.m_pEnd ) SetBegin( graph.m_pEnd->GetID() ); else m_pEnd = nullptr; m_pConnections = &const_cast<CGraph&>(graph).m_connections; return *this; } CGraph::~CGraph() { } CGraphNode* CGraph::GetNode( id_type id ) { return ((int)id >= 0 && (int)id < (m_iRows * m_iCols)) ? m_nodes[id].get() : nullptr; } CGraphNode* CGraph::GetBeginNode() { return m_pBegin; } CGraphNode* CGraph::GetEndNode() { return m_pEnd; } CGraph::ConnectionsMap CGraph::GetConnections() { return m_pConnections ? *m_pConnections : m_connections; } std::vector<CGraphNode*> CGraph::GetNodeConnections( CGraphNode * pNode ) { auto nodeConnections = m_pConnections ? m_pConnections->find(pNode->GetID()) : m_connections.find( pNode->GetID() ); std::vector<CGraphNode*> connections; auto connEnd = m_pConnections ? m_pConnections->end() : m_connections.end(); if ( nodeConnections != connEnd ) { for ( auto& connection_id : nodeConnections->second ) { connections.emplace_back( GetNode( connection_id ) ); } } return std::move( connections ); } std::vector<CGraphNode*> CGraph::GetNodes() { std::vector<CGraphNode*> out; out.reserve( m_nodes.size() ); for ( auto& pNode : m_nodes ) out.emplace_back( pNode.get() ); return std::move( out ); } void CGraph::Create( int iCols, int iRows, float fNodeWidth, float fNodeHeight, Connections::Type connType ) { Clean(); m_iRows = iRows; m_iCols = iCols; m_nodes.reserve( iCols * iRows ); for ( int i = 0; i < (iCols * iRows); ++i ) { auto pNode = std::make_unique<CGraphNode>( i, this ); pNode->SetPosition( { i % iCols * fNodeWidth, i / iCols * fNodeHeight, 0.f, 1.f } ); m_nodes.push_back( std::move( pNode ) ); } for ( int i = 0; i < (iCols * iRows); ++i ) { const int x = i % iCols; const int y = i / iCols; const int iLeft = std::max( x - 1, 0 ); const int iRight = std::min( x + 1, iCols - 1 ); const int iTop = std::max( y - 1, 0 ); const int iDown = std::min( y + 1, iRows - 1 ); AddConnection( iLeft + y * iCols, i, true ); AddConnection( iRight + y * iCols, i, true ); AddConnection( iTop * iCols + x, i, true ); AddConnection( iDown * iCols + x, i, true ); if ( connType == Connections::EIGHT_DIRECTIONS ) { AddConnection( iLeft + iTop * iCols, i, true ); AddConnection( iRight + iDown * iCols, i, true ); AddConnection( iTop * iCols + iRight, i, true ); AddConnection( iDown * iCols + iLeft, i, true ); } } } void CGraph::SetHeuristicFunction( HeuristeicFuncType func ) { m_heuristicFunc = func; } void CGraph::SetBegin( id_type id ) { m_pBegin = GetNode( id ); } void CGraph::SetEnd( id_type id ) { m_pEnd = GetNode( id ); } void CGraph::Clean() { m_iRows = 0; m_iCols = 0; m_nodes.clear(); m_connections.clear(); m_pConnections = nullptr; m_pBegin = nullptr; m_pEnd = nullptr; } float CGraph::GetNodeHeuristic( CGraphNode* node ) { return m_heuristicFunc( node, this ); } void CGraph::AddConnection( id_type id_from, id_type id_to, bool bBidirectional ) { auto pFrom = GetNode( id_from ); auto pTo = GetNode( id_to ); if ( pFrom && pTo && pFrom != pTo ) { m_connections[id_from].insert( id_to ); if ( bBidirectional ) m_connections[id_to].insert( id_from ); } }
[ "yen.badilla@gmail.com" ]
yen.badilla@gmail.com
900cf242b986675ffcfda4924ffb48e652245b36
47ebdec93b6b7d434c08227d601dfdc09de1a6e7
/HolaOGRE/RobotMan.h
c842726175d70e6b0381f4875844edb9adab7074
[]
no_license
JoseInside/IG-OGRE
3614ec64c3613ba1524b6ac0c2c7d99bf176c7d0
273a68a11731edc99a0f9cc7fa44e3b5fec0fca0
refs/heads/master
2021-09-04T12:26:26.656968
2018-01-18T16:19:37
2018-01-18T16:19:37
112,468,418
0
0
null
null
null
null
UTF-8
C++
false
false
160
h
#ifndef __RobotMan_H__ #define __RobotMan_H__ #include "ObjectMan.h" class RobotMan : public ObjectMan { public: RobotMan(); virtual ~RobotMan(); }; #endif
[ "josemonr@ucm.es" ]
josemonr@ucm.es
1b6cf7b870412c12ee82a69b7ccf66d2326253c6
325fbad62094be52eaf74a6d9cf05bcc32ae8ec7
/WinSockFAQ/AsyncClient/AddrPortDlg.h
c20440a20518d01085fab65b5f619e48ee44c42c
[ "MIT" ]
permissive
bjnix/pedogogy
b40b002f5e022d59e8ac971cdc8ee11df60e6c09
bdcedd3565c0596a92094182492f135aa8ecdf09
refs/heads/master
2021-03-12T19:38:27.738759
2014-03-29T18:56:55
2014-03-29T18:56:55
16,443,152
0
1
null
null
null
null
UTF-8
C++
false
false
795
h
// AddrPortDlg.h - Defines the address/port input dialog #if !defined(AFX_ADDRPORTDLG_H__1D8777C2_5075_11D4_86BD_00600895D2A4__INCLUDED_) #define AFX_ADDRPORTDLG_H__1D8777C2_5075_11D4_86BD_00600895D2A4__INCLUDED_ #pragma once #include "resource.h" class CAddrPortDlg : public CDialog { public: //// Public interface // Ctor CAddrPortDlg(CWnd* pParent = 0); //// Dialog Data //{{AFX_DATA(CAddrPortDlg) enum { IDD = IDD_ADDR_PORT }; CString sAddress_; CString sPort_; //}}AFX_DATA protected: //// Overrides //{{AFX_VIRTUAL(CAddrPortDlg) virtual void DoDataExchange(CDataExchange* pDX); //}}AFX_VIRTUAL //// Message map //{{AFX_MSG(CAddrPortDlg) //}}AFX_MSG DECLARE_MESSAGE_MAP(); }; #endif // !defined(AFX_ADDRPORTDLG_H__1D8777C2_5075_11D4_86BD_00600895D2A4__INCLUDED_)
[ "drums5150@gmail.com" ]
drums5150@gmail.com
c29c380f715728d74a2e80b3bd399b55c3301ac9
027ba1e389d45e253dce892220555d6f9826f0cd
/packages/ipnoise-pipe/pipe-rc/src/apiItemInfo.hpp
b93529aecb4ee4daf67b01b9ddcd83d89e660ac3
[]
no_license
m0r1k/IPNoise
1f371ed6a7cd6ba5637edbbe8718190d7f514827
dbab828d48aa1ab626fd528e71b1c28e3702be09
refs/heads/master
2021-01-02T23:09:51.193762
2018-02-04T11:23:27
2018-02-04T11:23:27
99,478,087
1
4
null
null
null
null
UTF-8
C++
false
false
708
hpp
#ifndef API_ITEM_INFO #define API_ITEM_INFO #include <QtCore/QObject> #include <QtCore/QString> class ApiItemInfo : public QObject { Q_OBJECT signals: void changed(ApiItemInfo *); public: ApiItemInfo( const QString &a_huid ); virtual ~ApiItemInfo(); QString getHuid(); void setNickName(const QString &); QString getNickName() const; void setOnline(bool); bool isOnline() const; ApiItemInfo & operator=( const ApiItemInfo &a_right); private: QString m_huid; QString m_nickname; bool m_is_online; }; #endif
[ "interferation@gmail.com" ]
interferation@gmail.com
ccb2ee0d8edbce80c52024a95ae9f6d7a379f38e
a9a0935050d17e9d6158d2a7890b8ca8bfb84adb
/mpca_project/hcprint.ino/hcprint.ino.ino
0d34a6f3d4fb162280321383d3b14e2f39fe7f47
[]
no_license
Ritabhash/MPCA
e0268d133b7254d1e99bdc17e079e1f43d54a635
0e291ed86c4af57a810668d29251a5800eb14adc
refs/heads/master
2020-04-30T21:00:30.388558
2019-03-22T06:33:28
2019-03-22T06:33:28
177,083,882
0
0
null
null
null
null
UTF-8
C++
false
false
709
ino
#include <SoftwareSerial.h> SoftwareSerial BTserial(10, 11); // RX | TX //int sensorPin = A0; //int sensorValue = 0; void setup() { BTserial.begin(9600); } void loop() { //sensorValue = analogRead(sensorPin); //IMPORTANT: The complete String has to be of the Form: 1234,1234,1234,1234; //(every Value has to be seperated through a comma (',') and the message has to //end with a semikolon (';')) BTserial.print("1234"); BTserial.print(","); BTserial.print("1234.0"); BTserial.print(","); BTserial.print("1234 hPa"); BTserial.print(","); BTserial.print("500 ml/s"); BTserial.print(","); //BTserial.print(sensorValue); BTserial.print(";"); //message to the receiving device delay(20); }
[ "noreply@github.com" ]
noreply@github.com
f6493c18f99daddf90943832641487a8903e9e78
e6044c05fed51820a5eb39de797b3a630fa7ffbe
/examples/cgsolve/parallel/cgsolve.cpp
7b4dbfe12889c6cb5fc15fe43c5047eb1ceebb26
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
zeta1999/kokkos-remote-spaces
12150aa9580db4ea1a9ebd2d19e8aa9fe6f79664
5ecedc6e648ede78a9ce15e3bce99072f9a2ffc8
refs/heads/main
2022-12-17T18:27:32.960243
2020-08-21T16:31:45
2020-08-21T16:31:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,586
cpp
// @HEADER // *********************************************************************** // // Tpetra: Templated Linear Algebra Services Package // Copyright (2008) Sandia Corporation // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // 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 Corporation nor the names of the // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "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 SANDIA CORPORATION OR THE // 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. // // Questions? Contact Michael A. Heroux (maherou@sandia.gov) // // ************************************************************************ // @HEADER /* Adapted from the Mantevo Miniapp Suite. https://mantevo.github.io/pdfs/MantevoOverview.pdf */ #include <Kokkos_RemoteSpaces.hpp> #include <generate_matrix.hpp> #include <mpi.h> typedef Kokkos::Experimental::DefaultRemoteMemorySpace RemoteMemSpace_t; typedef Kokkos::View<double **, RemoteMemSpace_t> RemoteView_t; template <class YType, class AType, class XType> void spmv(YType y, AType A, XType x) { #ifdef KOKKOS_ENABLE_CUDA int rows_per_team = 16; int team_size = 16; #else int rows_per_team = 512; int team_size = 1; #endif int vector_length = 8; int64_t nrows = y.extent(0); auto policy = require(Kokkos::TeamPolicy<>((nrows + rows_per_team - 1) / rows_per_team, team_size, vector_length), Kokkos::Experimental::WorkItemProperty::HintHeavyWeight); Kokkos::parallel_for( "spmv", policy, KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type &team) { const int64_t first_row = team.league_rank() * rows_per_team; const int64_t last_row = first_row + rows_per_team < nrows ? first_row + rows_per_team : nrows; Kokkos::parallel_for( Kokkos::TeamThreadRange(team, first_row, last_row), [&](const int64_t row) { const int64_t row_start = A.row_ptr(row); const int64_t row_length = A.row_ptr(row + 1) - row_start; double y_row = 0.0; Kokkos::parallel_reduce( Kokkos::ThreadVectorRange(team, row_length), [=](const int64_t i, double &sum) { int64_t idx = A.col_idx(i + row_start); int64_t pid = idx / MASK; int64_t offset = idx % MASK; sum += A.values(i + row_start) * x(pid, offset); }, y_row); y(row) = y_row; }); }); RemoteMemSpace_t().fence(); } template <class YType, class XType> double dot(YType y, XType x) { double result = 0.0; Kokkos::parallel_reduce( "DOT", y.extent(0), KOKKOS_LAMBDA(const int64_t &i, double &lsum) { lsum += y(i) * x(i); }, result); return result; } template <class ZType, class YType, class XType> void axpby(ZType z, double alpha, XType x, double beta, YType y) { int64_t n = z.extent(0); Kokkos::parallel_for( "AXPBY", n, KOKKOS_LAMBDA(const int &i) { z(i) = alpha * x(i) + beta * y(i); }); } template <class VType> void print_vector(int label, VType v) { std::cout << "\n\nPRINT " << v.label() << std::endl << std::endl; int myRank = 0; Kokkos::parallel_for( v.extent(0), KOKKOS_LAMBDA(const int i) { printf("%i %i %i %lf\n", label, myRank, i, v(i)); }); Kokkos::fence(); std::cout << "\n\nPRINT DONE " << v.label() << std::endl << std::endl; } template <class VType, class AType, class PType> int cg_solve(VType y, AType A, VType b, PType p_global, int max_iter, double tolerance) { int myproc = 0; MPI_Comm_rank(MPI_COMM_WORLD, &myproc); int num_iters = 0; double normr = 0; double rtrans = 0; double oldrtrans = 0; int64_t print_freq = max_iter / 10; if (print_freq > 50) print_freq = 50; if (print_freq < 1) print_freq = 1; VType x("x", b.extent(0)); VType r("r", x.extent(0)); VType p(p_global.data(), x.extent(0)); // Globally accessible data VType Ap("Ap", x.extent(0)); double one = 1.0; double zero = 0.0; axpby(p, one, x, zero, x); spmv(Ap, A, p_global); axpby(r, one, b, -one, Ap); rtrans = dot(r, r); MPI_Allreduce(MPI_IN_PLACE, &rtrans, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); normr = std::sqrt(rtrans); if (false) { if (myproc == 0) { std::cout << "Initial Residual = " << normr << std::endl; } } double brkdown_tol = std::numeric_limits<double>::epsilon(); for (int64_t k = 1; k <= max_iter && normr > tolerance; ++k) { if (k == 1) { axpby(p, one, r, zero, r); } else { oldrtrans = rtrans; rtrans = dot(r, r); MPI_Allreduce(MPI_IN_PLACE, &rtrans, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); double beta = rtrans / oldrtrans; axpby(p, one, r, beta, p); } normr = std::sqrt(rtrans); if (false) { if (myproc == 0 && (k % print_freq == 0 || k == max_iter)) { std::cout << "Iteration = " << k << " Residual = " << normr << std::endl; } } double alpha = 0; double p_ap_dot = 0; spmv(Ap, A, p_global); p_ap_dot = dot(Ap, p); MPI_Allreduce(MPI_IN_PLACE, &p_ap_dot, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); if (p_ap_dot < brkdown_tol) { if (p_ap_dot < 0) { std::cerr << "miniFE::cg_solve ERROR, numerical breakdown!" << std::endl; return num_iters; } else brkdown_tol = 0.1 * p_ap_dot; } alpha = rtrans / p_ap_dot; axpby(x, one, x, alpha, p); axpby(r, one, r, -alpha, Ap); num_iters = k; } return num_iters; } int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); int myRank, numRanks; MPI_Comm_rank(MPI_COMM_WORLD, &myRank); MPI_Comm_size(MPI_COMM_WORLD, &numRanks); #ifdef KOKKOS_ENABLE_SHMEMSPACE shmem_init(); #endif #ifdef KOKKOS_ENABLE_NVSHMEMSPACE MPI_Comm mpi_comm; nvshmemx_init_attr_t attr; mpi_comm = MPI_COMM_WORLD; attr.mpi_comm = &mpi_comm; nvshmemx_init_attr(NVSHMEMX_INIT_WITH_MPI_COMM, &attr); #endif Kokkos::initialize(argc, argv); { int N = argc > 1 ? atoi(argv[1]) : 100; int max_iter = argc > 2 ? atoi(argv[2]) : 200; double tolerance = argc > 3 ? atoi(argv[3]) : 1e-7; CrsMatrix<Kokkos::HostSpace> h_A = Impl::generate_miniFE_matrix(N); Kokkos::View<double *, Kokkos::HostSpace> h_x = Impl::generate_miniFE_vector(N); Kokkos::View<int64_t *> row_ptr("row_ptr", h_A.row_ptr.extent(0)); Kokkos::View<int64_t *> col_idx("col_idx", h_A.col_idx.extent(0)); Kokkos::View<double *> values("values", h_A.values.extent(0)); CrsMatrix<Kokkos::DefaultExecutionSpace::memory_space> A( row_ptr, col_idx, values, h_A.num_cols()); Kokkos::View<double *> x("X", h_x.extent(0)); Kokkos::View<double *> y("Y", A.num_rows()); Kokkos::deep_copy(x, h_x); Kokkos::deep_copy(A.row_ptr, h_A.row_ptr); Kokkos::deep_copy(A.col_idx, h_A.col_idx); Kokkos::deep_copy(A.values, h_A.values); // Remote View RemoteView_t p = Kokkos::Experimental::allocate_symmetric_remote_view<RemoteView_t>( "MyView", numRanks, (h_x.extent(0) + numRanks - 1) / numRanks); int64_t start_row = myRank * p.extent(1); int64_t end_row = (myRank + 1) * p.extent(1); if (end_row > h_x.extent(0)) end_row = h_x.extent(0); // CG Kokkos::pair<int64_t, int64_t> bounds(start_row, end_row); Kokkos::View<double *> x_sub = Kokkos::subview(x, bounds); Kokkos::Timer timer; int num_iters = cg_solve(y, A, x_sub, p, max_iter, tolerance); double time = timer.seconds(); // Compute Bytes and Flops double spmv_bytes = A.num_rows() * sizeof(int64_t) + A.nnz() * sizeof(int64_t) + A.nnz() * sizeof(double) + A.nnz() * sizeof(double) + A.num_rows() * sizeof(double); double dot_bytes = A.num_rows() * sizeof(double) * 2; double axpby_bytes = A.num_rows() * sizeof(double) * 3; double spmv_flops = A.nnz() * 2; double dot_flops = x.extent(0) * 2; double axpby_flops = x.extent(0) * 3; int spmv_calls = 1 + num_iters; int dot_calls = num_iters; int axpby_calls = 2 + num_iters * 3; double total_flops = spmv_flops * spmv_calls + dot_flops * dot_calls + axpby_flops * axpby_calls; double GFlops = 1e-9 * (total_flops) / time; double GBs = (1.0 / 1024 / 1024 / 1024) * (spmv_bytes * spmv_calls + dot_bytes * dot_calls + axpby_bytes * axpby_calls) / time; MPI_Allreduce(MPI_IN_PLACE, &GFlops, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); MPI_Allreduce(MPI_IN_PLACE, &GBs, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); if (myRank == 0) { printf("%i, %i, %0.1f, %lf\n", N, num_iters, total_flops, time, GFlops, GBs); } } Kokkos::finalize(); #ifdef KOKKOS_ENABLE_SHMEMSPACE shmem_finalize(); #endif #ifdef KOKKOS_ENABLE_NVSHMEMSPACE nvshmem_finalize(); #endif MPI_Finalize(); return 0; }
[ "jan.ciesko@gmail.com" ]
jan.ciesko@gmail.com
6ccb0b6c01eed9a5c9a339e786f12f85b6ce1731
80e5393d228cbc80a79346224666ca1ef1ad3a1a
/xml.h
4b67ae35487c741a527005205ee7e8f3030bf89e
[]
no_license
kjgrahn/weather
7eccbcd9ef9bab7da7f7a7ede2deb5247880f847
317850e1b78ddc1adfafe820208ce4907eb2604a
refs/heads/master
2022-12-04T16:07:24.810982
2022-11-27T18:39:31
2022-11-28T21:38:57
159,066,013
0
0
null
null
null
null
ISO-8859-1
C++
false
false
2,514
h
/* -*- c++ -*- * * Copyright (c) 2016 Jörgen Grahn * All rights reserved. * */ #ifndef XML_STREAM_H #define XML_STREAM_H #include <iosfwd> #include <string> #include <sstream> #include <stack> namespace xml { /** * An element tag, e.g. the foo in <foo>. Used to open an element. */ struct elem { template <class T> explicit elem(const T& val) : val(val) {} std::string val; }; /** * A key='value' attribute. You don't have to (should not) quote * the value. */ struct attr { template <class Name, class Val> attr(const Name& name, const Val& val) : name(name), val(val) {} std::string name; std::string val; }; /** * The closing of an element. All elements opened must eventually * be closed, if you want to create valid XML. */ struct elem_end {}; constexpr elem_end end; /** * Stream-like object for generating XML and feeding it into a * std::ostream. Only handles the boring parts: * * - The XML declaration. * - Closing the elements with a </foo> or a <foo/>. * - Escaping & to &amp; and so on. * - Indenting for readability. * - Ending the document with a newline. * * Otherwise it provides a flattened view of the document. * To render an element, you feed it, in this order, with: * - an elem(name) * - zero or more attr(name, val) * - a mix of more elem()s and text (anything streamable) * - an end() * * The text can be fed as any object which can be put on a * std::ostream. * * Everything is assumed to be utf-8 encoded. There's no * transcoding going on, and the resulting XML is by default * marked as utf-8. It's up to the user to keep the document * well-formed in this respect. */ class ostream { public: ostream(std::ostream& os, unsigned indent = 2); ostream(std::ostream& os, const std::string& declaration, unsigned indent = 2); ostream& operator<< (const elem& e); ostream& operator<< (const elem_end& e); ostream& operator<< (const attr& attr); template <class T> ostream& operator<< (const T& val); private: ostream& text(); void nl_indent() const; void flush_indent(); std::stack<elem> stack; std::ostringstream ss; std::ostream& os; const unsigned indent; char prev; }; template <class T> ostream& ostream::operator<< (const T& val) { ss << val; if(prev=='t') return *this; return text(); } } #endif
[ "grahn+src@snipabacken.se" ]
grahn+src@snipabacken.se
1e357554c961252e5bac1bfebd8f9796516de55e
37fbf79b5d6f49d867c675a39855de1e7b167224
/libautoscoper/src/gpu/opencl/SharpenFilter.cpp
63c8fd12e083aaff4c66247c38573cf0bd5a19ef
[]
no_license
foltzmh/AutoScoper
0f719924fb5b9d162d7cc58efd86bb11a935a8bf
b814bb0f702e3ad3172bccab8b1a2a915281035d
refs/heads/master
2020-04-01T15:31:38.497960
2018-06-19T14:35:48
2018-06-19T14:35:48
153,340,634
0
0
null
null
null
null
UTF-8
C++
false
false
4,815
cpp
// ---------------------------------- // Copyright (c) 2011, Brown University // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provideId 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 Brown University 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 BROWN UNIVERSITY “AS IS” WITH NO // WARRANTIES OR REPRESENTATIONS OF ANY KIND WHATSOEVER EITHER EXPRESS OR // IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTY OF DESIGN OR // MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, EACH OF WHICH ARE // SPECIFICALLY DISCLAIMED, NOR ANY WARRANTY OR REPRESENTATIONS THAT THE // SOFTWARE IS ERROR FREE OR THAT THE SOFTWARE WILL NOT INFRINGE ANY // PATENT, COPYRIGHT, TRADEMARK, OR OTHER THIRD PARTY PROPRIETARY RIGHTS. // IN NO EVENT SHALL BROWN UNIVERSITY 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 OR CAUSE OF ACTION, WHETHER IN CONTRACT, // STRICT LIABILITY, TORT, NEGLIGENCE OR OTHERWISE, ARISING IN ANY WAY // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. ANY RECIPIENT OR USER OF THIS SOFTWARE ACKNOWLEDGES THE // FOREGOING, AND ACCEPTS ALL RISKS AND LIABILITIES THAT MAY ARISE FROM // THEIR USE OF THE SOFTWARE. // --------------------------------- /// \file SharpenFilter.cpp /// \author Emily Fu #include <sstream> #include <cmath> #include "SharpenFilter.hpp" #define BX 16 #define BY 16 using namespace std; namespace xromm { namespace gpu { #include "gpu/opencl/kernel/SharpenFilter.cl.h" static Program sharpen_program_; static int num_sharpen_filters = 0; SharpenFilter::SharpenFilter() : Filter(XROMM_GPU_SHARPEN_FILTER,""), radius_(1), contrast_(1), sharpen_(NULL) { stringstream name_stream; name_stream << "SharpenFilter" << (++num_sharpen_filters); name_ = name_stream.str(); /* default values--threshold = 0 so all pixels are sharpened */ set_radius(1); set_contrast(1); set_threshold(0); } SharpenFilter::~SharpenFilter() { if (sharpen_ != NULL) delete sharpen_; } void SharpenFilter::set_radius(float radius) { if (radius < 0) radius = 0; radius_ = radius; makeFilter(); } void SharpenFilter::set_contrast(float contrast) { if(contrast<1) contrast = 1; contrast_ = contrast; } void SharpenFilter::set_threshold(float threshold) { threshold_ = threshold; } /* makes a Gaussian blur filter (filterSize*filterSize) with stdev radius_ */ void SharpenFilter::makeFilter() { int filterRadius= 3*radius_; filterSize_ = 2*filterRadius + 1; if(filterSize_ == 1) return; size_t nBytes = sizeof(float) * filterSize_ * filterSize_; float* sharpen = new float[nBytes]; float sum = 0.0f; for(int i = 0; i < filterSize_; ++i){ for(int j = 0; j < filterSize_ ; ++j){ sharpen[i*filterSize_+j] = exp(( (i-filterRadius)*(i-filterRadius)+ (j-filterRadius)*(j-filterRadius)) / (-2.0*radius_)); sum = sum + sharpen[i*filterSize_ +j]; } } float temp = 0.0f; /* normalize the filter */ for(int i = 0 ; i < filterSize_; ++i){ for(int j = 0 ; j < filterSize_; ++j) { temp = sharpen[i*filterSize_ +j]; sharpen[i*filterSize_ + j] = temp / sum; } } /* copy the filter to GPU */ if (sharpen_ != NULL) delete sharpen_; sharpen_ = new Buffer(nBytes, CL_MEM_READ_ONLY); sharpen_->read((void*)sharpen); delete sharpen; } void SharpenFilter::apply( const Buffer* input, Buffer* output, int width, int height) { if (filterSize_ == 1 ) { /* if filterSize_ = 1, filter does not change image */ input->copy(output); } else { Kernel* kernel = sharpen_program_.compile( SharpenFilter_cl, "sharpen_filter_kernel"); kernel->block2d(BX, BY); kernel->grid2d((width-1)/BX+1, (height-1)/BY+1); kernel->addBufferArg(input); kernel->addBufferArg(output); kernel->addArg(width); kernel->addArg(height); kernel->addBufferArg(sharpen_); kernel->addArg(filterSize_); kernel->addArg(contrast_); kernel->addArg(threshold_); kernel->launch(); delete kernel; } } } } // namespace xromm::cuda
[ "Benjamin_Knorlein@brown.edu" ]
Benjamin_Knorlein@brown.edu
6ee3582782a06b9f3cb0e642775fc9b0b38a7d9d
d3fbbe2fb3fe0cfddfc590349e673d43f54fac2c
/Koulupeliprojekti/src/VM/Core/VMFrame.cpp
78bc4e18e5128f61b6a7bf70bb7bf7708eb6097d
[ "LicenseRef-scancode-unknown-license-reference", "BSL-1.0" ]
permissive
Valtis/Peliprojekti-2013
da485791418987b9d90ee4c419f300c002ed1b19
56483e669e040e0180ea244077cbee578c034016
refs/heads/master
2016-09-16T02:25:29.630030
2015-05-16T15:06:12
2015-05-16T15:06:12
13,344,932
0
0
null
null
null
null
UTF-8
C++
false
false
1,088
cpp
#include "VM/Core/VMFrame.h" VMFrame::VMFrame() : VMFrame(nullptr) { } VMFrame::VMFrame(const VMFunction *function) : m_function(function), m_current_instruction(0) { m_localVariables.resize(function->GetLocalCount()); } ByteCode VMFrame::GetNextInstruction() { return m_function->GetByteCode(m_current_instruction++); } ByteCode VMFrame::GetPreviousInstruction() const { return m_function->GetByteCode(m_current_instruction - 1); } void VMFrame::SetNextInstruction(uint32_t instruction) { m_current_instruction = instruction; } std::string VMFrame::GetFunctionName() const { return m_function->GetName(); } uint32_t VMFrame::GetProgramCounter() const { return m_current_instruction; } void VMFrame::SetLocalVariable(size_t index, VMValue value) { m_localVariables.at(index) = value; } VMValue VMFrame::GetLocalVariable(size_t index) const { return m_localVariables.at(index); } VMValue &VMFrame::GetLocalVariableReference(size_t index) { return m_localVariables.at(index); } size_t VMFrame::GetLocalVariableCount() const { return m_localVariables.size(); }
[ "erkka.kaaria@helsinki.fi" ]
erkka.kaaria@helsinki.fi
23c705e42d515be5cf6f083f5b5f9618274de25f
195517d70b296b1c25045a91054269d0198571a6
/service_apis/youtube/google/youtube_api/video_localization.h
365f2a242b52fd46abb223beb8475bca831c8f97
[ "Apache-2.0" ]
permissive
dreamer-dead/google-api-cpp-client
167f6163b36523c8123465d76b8551113f839441
2fd5619a4ca6c6d39e7b4c29d387451d1aab3a0d
refs/heads/master
2021-01-14T12:47:19.456156
2015-06-23T15:03:49
2015-06-23T15:03:49
35,201,587
1
0
null
2015-05-07T05:57:54
2015-05-07T05:57:53
null
UTF-8
C++
false
false
4,450
h
// Copyright 2010 Google 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. // This code was generated by google-apis-code-generator 1.5.1 // Build date: 2015-03-26 20:30:19 UTC // on: 2015-06-02, 17:00:10 UTC // C++ generator version: 0.1.3 // ---------------------------------------------------------------------------- // NOTE: This file is generated from Google APIs Discovery Service. // Service: // YouTube Data API (youtube/v3) // Generated from: // Version: v3 // Revision: 139 // Generated by: // Tool: google-apis-code-generator 1.5.1 // C++: 0.1.3 #ifndef GOOGLE_YOUTUBE_API_VIDEO_LOCALIZATION_H_ #define GOOGLE_YOUTUBE_API_VIDEO_LOCALIZATION_H_ #include <string> #include "googleapis/base/macros.h" #include "googleapis/client/data/jsoncpp_data.h" #include "googleapis/strings/stringpiece.h" namespace Json { class Value; } // namespace Json namespace google_youtube_api { using namespace googleapis; /** * Localized versions of certain video properties (e.g. title). * * @ingroup DataObject */ class VideoLocalization : public client::JsonCppData { public: /** * Creates a new default instance. * * @return Ownership is passed back to the caller. */ static VideoLocalization* New(); /** * Standard constructor for an immutable data object instance. * * @param[in] storage The underlying data storage for this instance. */ explicit VideoLocalization(const Json::Value& storage); /** * Standard constructor for a mutable data object instance. * * @param[in] storage The underlying data storage for this instance. */ explicit VideoLocalization(Json::Value* storage); /** * Standard destructor. */ virtual ~VideoLocalization(); /** * Returns a string denoting the type of this data object. * * @return <code>google_youtube_api::VideoLocalization</code> */ const StringPiece GetTypeName() const { return StringPiece("google_youtube_api::VideoLocalization"); } /** * Determine if the '<code>description</code>' attribute was set. * * @return true if the '<code>description</code>' attribute was set. */ bool has_description() const { return Storage().isMember("description"); } /** * Clears the '<code>description</code>' attribute. */ void clear_description() { MutableStorage()->removeMember("description"); } /** * Get the value of the '<code>description</code>' attribute. */ const StringPiece get_description() const { const Json::Value& v = Storage("description"); if (v == Json::Value::null) return StringPiece(""); return StringPiece(v.asCString()); } /** * Change the '<code>description</code>' attribute. * * Localized version of the video's description. * * @param[in] value The new value. */ void set_description(const StringPiece& value) { *MutableStorage("description") = value.data(); } /** * Determine if the '<code>title</code>' attribute was set. * * @return true if the '<code>title</code>' attribute was set. */ bool has_title() const { return Storage().isMember("title"); } /** * Clears the '<code>title</code>' attribute. */ void clear_title() { MutableStorage()->removeMember("title"); } /** * Get the value of the '<code>title</code>' attribute. */ const StringPiece get_title() const { const Json::Value& v = Storage("title"); if (v == Json::Value::null) return StringPiece(""); return StringPiece(v.asCString()); } /** * Change the '<code>title</code>' attribute. * * Localized version of the video's title. * * @param[in] value The new value. */ void set_title(const StringPiece& value) { *MutableStorage("title") = value.data(); } private: void operator=(const VideoLocalization&); }; // VideoLocalization } // namespace google_youtube_api #endif // GOOGLE_YOUTUBE_API_VIDEO_LOCALIZATION_H_
[ "aiuto@google.com" ]
aiuto@google.com
035352c0230fe357f43e85a1324e76347e097b17
c2283e833bdb0eeb985d95fc5a1db8facb027f05
/Project/Intermediate/Build/Win64/UE4/Inc/GCAA/MovingNpc.gen.cpp
957a26841638cce3ffeed6b288c0fa00d0bf922d
[]
no_license
Bibool/Lost-Souls
ce44653b7672cb3703ba79795e0cee94051e38ff
67e58de79c8bf26a6f45273595cb765b729cb69b
refs/heads/main
2022-07-29T17:20:53.648402
2021-05-26T17:16:32
2021-05-26T17:16:32
368,998,934
0
1
null
null
null
null
UTF-8
C++
false
false
13,772
cpp
// Copyright Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "GCAA/NPC/MovingNpc.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodeMovingNpc() {} // Cross Module References GCAA_API UClass* Z_Construct_UClass_AMovingNpc_NoRegister(); GCAA_API UClass* Z_Construct_UClass_AMovingNpc(); GCAA_API UClass* Z_Construct_UClass_ABaseNpc(); UPackage* Z_Construct_UPackage__Script_GCAA(); COREUOBJECT_API UClass* Z_Construct_UClass_UClass(); GCAA_API UClass* Z_Construct_UClass_ANPCRangedSpell_NoRegister(); GCAA_API UClass* Z_Construct_UClass_APatrolPath_NoRegister(); // End Cross Module References void AMovingNpc::StaticRegisterNativesAMovingNpc() { } UClass* Z_Construct_UClass_AMovingNpc_NoRegister() { return AMovingNpc::StaticClass(); } struct Z_Construct_UClass_AMovingNpc_Statics { static UObject* (*const DependentSingletons[])(); #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_BulletBP_MetaData[]; #endif static const UE4CodeGen_Private::FClassPropertyParams NewProp_BulletBP; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_walkSpeed_MetaData[]; #endif static const UE4CodeGen_Private::FFloatPropertyParams NewProp_walkSpeed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_runSpeed_MetaData[]; #endif static const UE4CodeGen_Private::FFloatPropertyParams NewProp_runSpeed; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_patrollingNpc_MetaData[]; #endif static void NewProp_patrollingNpc_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_patrollingNpc; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_PatrolPath_MetaData[]; #endif static const UE4CodeGen_Private::FObjectPropertyParams NewProp_PatrolPath; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_spawnRandomPath_MetaData[]; #endif static void NewProp_spawnRandomPath_SetBit(void* Obj); static const UE4CodeGen_Private::FBoolPropertyParams NewProp_spawnRandomPath; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_PatrolPathClass_MetaData[]; #endif static const UE4CodeGen_Private::FClassPropertyParams NewProp_PatrolPathClass; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_numOfPatrolPoints_MetaData[]; #endif static const UE4CodeGen_Private::FUnsizedIntPropertyParams NewProp_numOfPatrolPoints; #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam NewProp_pathSpawnRadius_MetaData[]; #endif static const UE4CodeGen_Private::FFloatPropertyParams NewProp_pathSpawnRadius; static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[]; static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_AMovingNpc_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_ABaseNpc, (UObject* (*)())Z_Construct_UPackage__Script_GCAA, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::Class_MetaDataParams[] = { { "Comment", "/**\n * \n */" }, { "HideCategories", "Navigation" }, { "IncludePath", "NPC/MovingNpc.h" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_BulletBP_MetaData[] = { { "Category", "AI | Shooting" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FClassPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_BulletBP = { "BulletBP", nullptr, (EPropertyFlags)0x0044000000000001, UE4CodeGen_Private::EPropertyGenFlags::Class, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, BulletBP), Z_Construct_UClass_ANPCRangedSpell_NoRegister, Z_Construct_UClass_UClass, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_BulletBP_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_BulletBP_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_walkSpeed_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Stats" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_walkSpeed = { "walkSpeed", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, walkSpeed), METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_walkSpeed_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_walkSpeed_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_runSpeed_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Stats" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_runSpeed = { "runSpeed", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, runSpeed), METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_runSpeed_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_runSpeed_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif void Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc_SetBit(void* Obj) { ((AMovingNpc*)Obj)->patrollingNpc = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc = { "patrollingNpc", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(AMovingNpc), &Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc_SetBit, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPath_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FObjectPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPath = { "PatrolPath", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Object, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, PatrolPath), Z_Construct_UClass_APatrolPath_NoRegister, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPath_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPath_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif void Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath_SetBit(void* Obj) { ((AMovingNpc*)Obj)->spawnRandomPath = 1; } const UE4CodeGen_Private::FBoolPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath = { "spawnRandomPath", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Bool | UE4CodeGen_Private::EPropertyGenFlags::NativeBool, RF_Public|RF_Transient|RF_MarkAsNative, 1, sizeof(bool), sizeof(AMovingNpc), &Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath_SetBit, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPathClass_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FClassPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPathClass = { "PatrolPathClass", nullptr, (EPropertyFlags)0x0044000000000005, UE4CodeGen_Private::EPropertyGenFlags::Class, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, PatrolPathClass), Z_Construct_UClass_APatrolPath_NoRegister, Z_Construct_UClass_UClass, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPathClass_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPathClass_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_numOfPatrolPoints_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FUnsizedIntPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_numOfPatrolPoints = { "numOfPatrolPoints", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Int, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, numOfPatrolPoints), METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_numOfPatrolPoints_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_numOfPatrolPoints_MetaData)) }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AMovingNpc_Statics::NewProp_pathSpawnRadius_MetaData[] = { { "AllowPrivateAccess", "true" }, { "Category", "AI | Path" }, { "ModuleRelativePath", "NPC/MovingNpc.h" }, }; #endif const UE4CodeGen_Private::FFloatPropertyParams Z_Construct_UClass_AMovingNpc_Statics::NewProp_pathSpawnRadius = { "pathSpawnRadius", nullptr, (EPropertyFlags)0x0040000000000005, UE4CodeGen_Private::EPropertyGenFlags::Float, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AMovingNpc, pathSpawnRadius), METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::NewProp_pathSpawnRadius_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::NewProp_pathSpawnRadius_MetaData)) }; const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_AMovingNpc_Statics::PropPointers[] = { (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_BulletBP, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_walkSpeed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_runSpeed, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_patrollingNpc, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPath, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_spawnRandomPath, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_PatrolPathClass, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_numOfPatrolPoints, (const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AMovingNpc_Statics::NewProp_pathSpawnRadius, }; const FCppClassTypeInfoStatic Z_Construct_UClass_AMovingNpc_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<AMovingNpc>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_AMovingNpc_Statics::ClassParams = { &AMovingNpc::StaticClass, "Game", &StaticCppClassTypeInfo, DependentSingletons, nullptr, Z_Construct_UClass_AMovingNpc_Statics::PropPointers, nullptr, UE_ARRAY_COUNT(DependentSingletons), 0, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::PropPointers), 0, 0x009000A4u, METADATA_PARAMS(Z_Construct_UClass_AMovingNpc_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_AMovingNpc_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_AMovingNpc() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_AMovingNpc_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(AMovingNpc, 1074272352); template<> GCAA_API UClass* StaticClass<AMovingNpc>() { return AMovingNpc::StaticClass(); } static FCompiledInDefer Z_CompiledInDefer_UClass_AMovingNpc(Z_Construct_UClass_AMovingNpc, &AMovingNpc::StaticClass, TEXT("/Script/GCAA"), TEXT("AMovingNpc"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(AMovingNpc); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
[ "52705025+Bibool@users.noreply.github.com" ]
52705025+Bibool@users.noreply.github.com
1a29e57e914a346803a404eaeae99c1632614966
6f1a8bae3b7916b94bf0409288a3a80692d8e4d3
/CS251/Projects/program1_rgenov2/test-suite/t10_join_plus_maxE_timed.cpp
d5a5ec5b7d65139c70ef50e1e0c754cfc19a1aea
[]
no_license
Rg3n0v4/schoolProjects
8acf490abf9a5c0ecc840b41c4b55747765d81e8
c959b7e31d8dd5b7ea8138dd66447e42907de85d
refs/heads/master
2023-02-15T03:10:50.156762
2021-01-11T18:29:47
2021-01-11T18:29:47
286,540,842
0
0
null
2020-08-19T15:16:32
2020-08-10T17:40:13
null
UTF-8
C++
false
false
1,224
cpp
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include "TravelOptions.h" // #include <string> #include "_test.h" #include "_to_util.h" bool t_join_pm_alternating(int n) { std::vector<std::pair<double,double>> A; std::vector<std::pair<double,double>> B; std::vector<std::pair<double,double>> correct; std::vector<std::pair<double,double>> *result; psline(A, n, 1, 2*n+1, 1.0, -2.0); psline(B, n, 1, 2*n, 1.0, -2.0); psline(correct, 2*n-1, 2, 2*n+1, 1.0, -1.0); TravelOptions *a = TravelOptions::from_vec(A); TravelOptions *b = TravelOptions::from_vec(B); TravelOptions *join; join = a->join_plus_max(*b); result = join->to_vec(); bool passed = cmp_vec(correct, *result, false); delete a; delete join; delete result; return passed; } int main(int argc, char *argv[]) { int n = ___N; int ntrials=1; if(argc > 1) n = atoi(argv[1]); if(argc > 2){ ntrials = atoi(argv[2]); set_ntrials(ntrials); } START("[join_plus_max]: test E (timed)] "); printf(" N = %i\n\n ", n); TIME_RATIO(t_join_pm_alternating(n),t_join_pm_alternating (2*n), "timed test: critical side (time) alternates", 1, 2.9, 4.0); report(); END; }
[ "rgenov2@uic.edu" ]
rgenov2@uic.edu
78abcdc197262b2587859d7ba74fb16aa4629168
37a43b741fc298e98fb0eb2503ffe257646e6f7c
/Algorithmic Toolbox/WK5Assignments/knapsack/hashlist.cpp
b0e165d00542c47d905d91f90e2c415945872848
[]
no_license
bunnybryna/Coursera_UCSD_Data_Structures
90b7e0fb8d078bbb57d9ef76ac627c505444c1ee
41294ed5627f151097a4265bd927918878236026
refs/heads/master
2021-01-19T10:48:21.974875
2018-03-21T08:58:01
2018-03-21T08:58:01
82,206,207
0
0
null
null
null
null
UTF-8
C++
false
false
4,550
cpp
/* * C++ Program to Implement Hash Tables chaining * with Singly Linked Lists */ #include<iostream> #include<cstdlib> #include<string> #include<cstdio> using namespace std; const int TABLE_SIZE = 128; /* * HashNode Class Declaration */ class HashNode { public: int key; int value; HashNode* next; HashNode(int key, int value) { this->key = key; this->value = value; this->next = NULL; } }; /* * HashMap Class Declaration */ class HashMap { private: HashNode** htable; public: HashMap() { htable = new HashNode*[TABLE_SIZE]; for (int i = 0; i < TABLE_SIZE; i++) htable[i] = NULL; } ~HashMap() { for (int i = 0; i < TABLE_SIZE; ++i) { HashNode* entry = htable[i]; while (entry != NULL) { HashNode* prev = entry; entry = entry->next; delete prev; } } delete[] htable; } /* * Hash Function */ int HashFunc(int key) { return key % TABLE_SIZE; } /* * Insert Element at a key */ void Insert(int key, int value) { int hash_val = HashFunc(key); HashNode* prev = NULL; HashNode* entry = htable[hash_val]; while (entry != NULL) { prev = entry; entry = entry->next; } if (entry == NULL) { entry = new HashNode(key, value); if (prev == NULL) { htable[hash_val] = entry; } else { prev->next = entry; } } else { entry->value = value; } } /* * Remove Element at a key */ void Remove(int key) { int hash_val = HashFunc(key); HashNode* entry = htable[hash_val]; HashNode* prev = NULL; if (entry == NULL || entry->key != key) { cout<<"No Element found at key "<<key<<endl; return; } while (entry->next != NULL) { prev = entry; entry = entry->next; } if (prev != NULL) { prev->next = entry->next; } delete entry; cout<<"Element Deleted"<<endl; } /* * Search Element at a key */ int Search(int key) { bool flag = false; int hash_val = HashFunc(key); HashNode* entry = htable[hash_val]; while (entry != NULL) { if (entry->key == key) { cout<<entry->value<<" "; flag = true; } entry = entry->next; } if (!flag) return -1; } }; /* * Main Contains Menu */ int main() { HashMap hash; int key, value; int choice; while (1) { cout<<"\n----------------------"<<endl; cout<<"Operations on Hash Table"<<endl; cout<<"\n----------------------"<<endl; cout<<"1.Insert element into the table"<<endl; cout<<"2.Search element from the key"<<endl; cout<<"3.Delete element at a key"<<endl; cout<<"4.Exit"<<endl; cout<<"Enter your choice: "; cin>>choice; switch(choice) { case 1: cout<<"Enter element to be inserted: "; cin>>value; cout<<"Enter key at which element to be inserted: "; cin>>key; hash.Insert(key, value); break; case 2: cout<<"Enter key of the element to be searched: "; cin>>key; cout<<"Element at key "<<key<<" : "; if (hash.Search(key) == -1) { cout<<"No element found at key "<<key<<endl; continue; } break; case 3: cout<<"Enter key of the element to be deleted: "; cin>>key; hash.Remove(key); break; case 4: exit(1); default: cout<<"\nEnter correct option\n"; } } return 0; }
[ "brynazhao@gmail.com" ]
brynazhao@gmail.com
e1d753713976ecfa9cad6e6119e36ee4b56a544c
0b79f0a0ddadee7ef45755e8d74693e2cc609c52
/main/include/jumpnrun/MoverUtilities.h
dff3a51efeda9d1f1950b59478c990e669054fdf
[ "MIT" ]
permissive
wonderhorn/mkfj
ec98fdf82766d376d99f55659b413ad423608a90
18d2dd290811662d87abefe2fe2e338ba9caf8a5
refs/heads/master
2022-11-24T18:34:23.665540
2020-07-26T10:58:31
2020-07-26T10:58:31
276,013,519
5
0
null
null
null
null
UTF-8
C++
false
false
855
h
#pragma once #include"framework/Object.h" #include"jumpnrun/mover/character/Character.h" #include"utils/OwnerHandle.h" #include"jumpnrun/stage/Stage.h" namespace jnr { class EnemySearcher { public: EnemySearcher(); void initialize(jnr::Mover* me); std::vector<gfw::Object::Pipe> search(double range); private: OWNERHANDLE owner; gfw::Tasklist* tl; //jnr::Character* me; jnr::Mover* me; }; class Router { public: Router(); gmtr::Vector2D grid2point(int x, int y, const gmtr::Vector2D& p_ori, const gmtr::Vector2D& p_ter); std::pair<int, int> point2grid(const gmtr::Vector2D& p, const gmtr::Vector2D& p_ori, const gmtr::Vector2D& p_ter); int route(Stage& stage, const gmtr::Vector2D& p_ori, int myw, int myh, const gmtr::Vector2D& p_ter); int w, h, grid_size, margin; int ter_x, ter_y; std::vector<double> grids; }; };
[ "https://twitter.com/Wonder_Horn" ]
https://twitter.com/Wonder_Horn
6160ef132d51b2e226bc603eede87f716bf63076
7c8a2ad5689be6095415610e2272a395a4c3ffc8
/frameworks/runtime-src/Classes/network/NetworkService.h
a444681734c3cdb30a8c2ea16b3ecc39b1feeb56
[]
no_license
Crasader/Lua2Cxx-Network-Test
c97422c76eb59be288f96db698614aa59e412cbc
c63ea138c2b8acdcfc8d98b27bb256618ef0fc7b
refs/heads/master
2020-11-29T11:32:20.736276
2014-08-13T15:45:20
2014-08-13T15:45:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,414
h
// // NetworkService.h // SocketClient // // Created by 王 欢 on 14-4-12. // Copyright (c) 2014年 王 欢. All rights reserved. // #ifndef __SocketClient_v2__NetworkService__ #define __SocketClient_v2__NetworkService__ extern "C" { #include "syslib.h" } #include "base/CCDirector.h" #include "base/CCScheduler.h" namespace net{ //extern const int MESSAGE_INDICATOR_LENTH; const int SEND_BUFFER_SIZE = 1024; const int RECV_BUFFER_SIZE = 1024; class MessageManager; class NetworkService:public cocos2d::Ref{ public: NetworkService(): sockSendBufferFull(false){} void connect(); void disconnect(); void run(); void update(float d); private: int getMessageLen(int connfd); int noblockConnect(int, const SA*, socklen_t, int); ssize_t writen(int fd, const void *vptr, size_t n); ssize_t readn(int fd, void *vptr, size_t n); size_t send(); size_t recv(); bool isSockSendBufferFull(); void setSockSendBufferFull(bool); bool isSockRecvBufferFull(); void setSockRecvBufferFull(bool); private: char recvBuffer[RECV_BUFFER_SIZE]; char sendBuffer[SEND_BUFFER_SIZE]; int sockfd; bool sockSendBufferFull; bool sockRecvBufferFull; }; } #endif /* defined(__SocketClient__NetworkService__) */
[ "78098718@qq.com" ]
78098718@qq.com
b6f9649e13777a8a00fab35f68c101959b9251d0
518bf342bc4138982af3e2724e75f1d9ca3ba56c
/solutions/1548. The Most Similar Path in a Graph/1548.cpp
6d92dc00e7fd8ec185ec193fd94bf5be355f31a0
[ "MIT" ]
permissive
walkccc/LeetCode
dae85af7cc689882a84ee5011f0a13a19ad97f18
a27be41c174565d365cbfe785f0633f634a01b2a
refs/heads/main
2023-08-28T01:32:43.384999
2023-08-20T19:00:45
2023-08-20T19:00:45
172,231,974
692
302
MIT
2023-08-13T14:48:42
2019-02-23T15:46:23
C++
UTF-8
C++
false
false
1,715
cpp
class Solution { public: vector<int> mostSimilar(int n, vector<vector<int>>& roads, vector<string>& names, vector<string>& targetPath) { this->names = names; this->targetPath = targetPath; // cost[i][j] := min cost to start from names[i] in path[j] this->cost.resize(names.size(), vector<int>(targetPath.size(), -1)); // next[i][j] := best next of names[i] in path[j this->next.resize(names.size(), vector<int>(targetPath.size())); this->graph.resize(n); for (const vector<int>& road : roads) { graph[road[0]].push_back(road[1]); graph[road[1]].push_back(road[0]); } int minDist = INT_MAX; int start = 0; for (int i = 0; i < n; ++i) { const int dist = dfs(i, 0); if (dist < minDist) { minDist = dist; start = i; } } vector<int> ans; while (ans.size() < targetPath.size()) { ans.push_back(start); start = next[start][ans.size() - 1]; } return ans; } private: vector<string> names; vector<string> targetPath; vector<vector<int>> cost; vector<vector<int>> next; vector<vector<int>> graph; int dfs(int nameIndex, int pathIndex) { if (cost[nameIndex][pathIndex] != -1) return cost[nameIndex][pathIndex]; const int editDist = names[nameIndex] != targetPath[pathIndex]; if (pathIndex == targetPath.size() - 1) return editDist; int minDist = INT_MAX; for (const int v : graph[nameIndex]) { const int dist = dfs(v, pathIndex + 1); if (dist < minDist) { minDist = dist; next[nameIndex][pathIndex] = v; } } return cost[nameIndex][pathIndex] = editDist + minDist; } };
[ "me@pengyuc.com" ]
me@pengyuc.com
7e39729d496d9c3a0c2563e64ca4d99ffb7db4f1
2be6646d0034bfdb0c6381c5efe668c86634f42f
/Week5/bai9.cpp
df88d119a7a431ce53aac1fe0367a2d0e1b4b271
[]
no_license
hanh-nd/Programming_Technique
b0e38ee21a70464096b8bcec9a46e1da760f16ad
697a89bc5ecadc2c2bd4f3331c2d884e2065834f
refs/heads/main
2023-05-05T18:14:35.969295
2021-06-01T14:18:27
2021-06-01T14:18:27
364,442,512
1
0
null
null
null
null
UTF-8
C++
false
false
1,150
cpp
#include <bits/stdc++.h> using namespace std; typedef struct { int x, y, z; } block; int n; block a[100]; int maxh[100]; void input(){ cin >> n; if (n == 0) exit(0); int x, y, z; for (int i = 1; i <= n; i++){ cin >> x >> y >> z; a[3 * i - 2].x = x; a[3 * i - 2].y = y; a[3 * i - 2].z = z; a[3 * i - 1].x = y; a[3 * i - 1].y = z; a[3 * i - 1].z = x; a[3 * i].x = z; a[3 * i].y = x; a[3 * i].z = y; } for(int i=0; i<100; i++) maxh[i] = 0; } int dp(int i){//Tim chieu cao cua toa thap voi dinh la vien i if (maxh[i] != 0) return maxh[i]; maxh[i] = a[i].z; for(int j = 1; j <= 3*n; j++){ if (a[i].x < a[j].x && a[i].y < a[j].y || a[i].x < a[j].y && a[i].y < a[j].x){ maxh[i] = max (maxh[i], a[i].z + dp(j)); } } return maxh[i]; } int main(){ int cnt = 1; while(1){ int res = 0; input(); for(int i = 1; i <= 3 * n; i++){ res = max(res, dp(i)); } printf("Case %d: maximum height = %d\n", cnt++, res); } return 0; }
[ "hanhnd156@gmail.com" ]
hanhnd156@gmail.com
f4966cd409aa2cede3047a9c52cd4efba5208d28
4855d40bdc73131c09cf544aed76bb2761d86e47
/src/core/pathtracer.h
8ebc8d4975601b2bbefad80524e7443150155712
[]
no_license
cedricKode/Rayone
a511fe3516c604684c41b5593788fde98d18827a
505a91018782c213c07f17d641016314b49efe48
refs/heads/master
2023-05-28T02:40:25.521765
2016-09-19T20:51:11
2016-09-19T20:51:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,011
h
// core/pathtracer.h #ifndef PT_CORE_PATHTRACER_H #define PT_CORE_PATHTRACER_H // Global include files #include <math.h> #include <stdlib.h> #include <stdio.h> #include <vector> #include "geometry.h" #include "shape.h" #include "renderer.h" #include "montecarlo.h" // Global constants #define RR_DEPTH 5 // Number of bounce before Russian Roulette #define MAX_DEPTH 10 // Maximum number a ray can bounce #define EPS 1e-4 // Small nonzero value for ray intersection // Global forward declarations class Vec; class Ray; class Shape; struct Intersection; class Renderer; // Restrict x value to [0,1] interval inline double Clamp(double x) { return x < 0 ? 0 : x > 1 ? 1 : x; } // Gamma correction (y = 2.2) and RGB conversion inline int ToDisplayValue(double x) { return int(pow(Clamp(x), 1./2.2) * 255 + .5); } // Thread-safe uniformly distributed pseudo-random number // See http://linux.die.net/man/3/erand48 for more info inline double RandomGen(unsigned short *seed) { return erand48(seed); } // Antialiasing tent filter (approximate sinc filter) inline void TentFilter(double &dx, double &dy, unsigned short *Xi) { double a = 2 * RandomGen(Xi); dx = a < 1 ? sqrt(a) - 1 : 1 - sqrt(2 - a); double b = 2 * RandomGen(Xi); dy = b < 1 ? sqrt(b) - 1 : 1 - sqrt(2 - b); } // Construct orthonormal frame from vector w inline void BuildOrthonormalFrame(Vec &u, Vec &v, Vec &w) { u = (fabs(w.x) > .1 ? Vec(0,1,0) : Vec(1,0,0)).Cross(w).Norm(); v = w.Cross(u); } // Write image as PPM Portable Bitmap Format // See http://netpbm.sourceforge.net/doc/ppm.html for more info inline void SaveImage(char const *fileName, Vec *pixCol, int w, int h) { FILE *f = fopen(fileName, "w"); fprintf(f, "P3\n%d %d\n%d\n", w, h, 255); for (int p = 0; p < w * h; p++) { fprintf(f, "%d %d %d ", ToDisplayValue(pixCol[p].x), ToDisplayValue(pixCol[p].y), ToDisplayValue(pixCol[p].z)); } fclose(f); } #endif // PT_CORE_PATHTRACER_H
[ "joey.litalien@gmail.com" ]
joey.litalien@gmail.com
b38d1661adc711a17bccccb13dc4c43aedf82cc1
6c0fef7815d965343bde8fa56e2bbb71c956e3ec
/src/item.cpp
f1dd1242fc98511c0799fbe588fa76e5105290c6
[]
no_license
am0d/LearnGameProgramming
1ca6fd357adf008f8286ad33e59f318451231f1e
8d99c35af4efd30a545f094dbdc53fcc3ff98bf2
refs/heads/master
2016-09-06T12:29:51.731922
2011-10-18T17:07:54
2011-10-18T17:07:54
2,528,795
1
0
null
null
null
null
UTF-8
C++
false
false
1,158
cpp
/* Copyright (c) 2011 by Damien Schoof * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ #include "item.hpp" Item::Item () : Entity () { width = 11; height = 11; _clip = sf::IntRect (586, 1, width, height); } Item::~Item () { } void Item::HandleCollision (Entity*) { isDead = true; }
[ "damien.schoof@gmail.com" ]
damien.schoof@gmail.com
6d72ea61a9cfd5bd234af2c055ad9cd923098ddb
176474ddb79b251e51aa005f7a30b68526ce7808
/4.Interview-Bit/Tree/Identical_Binary_Tree.cpp
ceb010d1a5a068fc6db2b1f6551d67c732a31c23
[]
no_license
ashish1500616/Programming
0f0b3c40be819ad71b77064ef4e2e31765588c53
bdfe9cdf3aeee2875ff78231b04296dc5ba97383
refs/heads/master
2021-03-16T05:17:50.302515
2020-03-10T05:51:44
2020-03-10T05:51:44
121,101,900
4
0
null
null
null
null
UTF-8
C++
false
false
774
cpp
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ void LevelOrderTraversal(TreeNode *A, vector<int> &order) { if (A == nullptr) return; queue<TreeNode *> q; q.push(A); while (!q.empty()) { TreeNode *temp = q.front(); q.pop(); order.push_back(temp->val); if (temp->left) q.push(temp->left); if (temp->right) q.push(temp->right); } } int Solution::isSameTree(TreeNode *A, TreeNode *B) { vector<int> Ao, Bo; LevelOrderTraversal(A, Ao); LevelOrderTraversal(B, Bo); if (Ao == Bo) return 1; else return 0; }
[ "ashish1500616@gmail.com" ]
ashish1500616@gmail.com
9fbab94f01568c31fd045fecff33dbb065b112e9
b0582ef4dae0585edab60044336906116dfcc8a7
/Server/Server.cpp
c1448a10c21af1a90cc1259a82dee29f50ee10ae
[]
no_license
tsijercic1/EducationalPistache
7c037cad265844a88adce5dd3ae8e0e0432173c4
c661475b6249e513a4c0c4e5b934894239dbf006
refs/heads/master
2022-10-15T16:53:40.831524
2020-06-11T21:43:50
2020-06-11T21:43:50
271,653,037
1
0
null
null
null
null
UTF-8
C++
false
false
3,663
cpp
#include "Server.h" namespace Generic { void handleReady(const Rest::Request&, Http::ResponseWriter response) { response.send(Http::Code::Ok, R"({"message":"This is the generic response. Hi!"})"); } } Server::Server(Address address): description("Server", "0.1"), httpEndpoint(std::make_shared<Http::Endpoint>(address)) {} void Server::init(size_t threadNumber = 2) { auto opts = Http::Endpoint::options() .threads(static_cast<int>(threadNumber)); httpEndpoint->init(opts); createDescription(); } void Server::start() { router.initFromDescription(description); httpEndpoint->setHandler(router.handler()); httpEndpoint->serve(); } void Server::createDescription() { description .info() .license("Apache", "http://www.apache.org/licenses/LICENSE-2.0"); auto backendErrorResponse = description.response(Http::Code::Internal_Server_Error, "An error occured with the backend"); description .schemes(Rest::Scheme::Http) .basePath("/v1") .produces(MIME(Application, Json)) .consumes(MIME(Application, Json)); description .route(description.get("/ready")) .bind(&Generic::handleReady) .response(Http::Code::Ok, "Response to the /ready call") .hide(); auto versionPath = description.path("/v1"); auto logsPath = versionPath.path("/logs"); logsPath .route(description.get("/all")) .bind(&Server::retrieveAllLogs, this) .produces(MIME(Application, Json), MIME(Application, Xml)) .response(Http::Code::Ok, "The list of all account"); // logsPath // .route(description.get("/:name"), "Retrieve an account") // .bind(&Server::retrieveAccount, this) // .produces(MIME(Application, Json)) // .parameter<Rest::Type::String>("name", "The name of the account to retrieve") // .response(Http::Code::Ok, "The requested account") // .response(backendErrorResponse); // // logsPath // .route(description.post("/:name"), "Create an account") // .bind(&Server::createAccount, this) // .produces(MIME(Application, Json)) // .consumes(MIME(Application, Json)) // .parameter<Rest::Type::String>("name", "The name of the account to create") // .response(Http::Code::Ok, "The initial state of the account") // .response(backendErrorResponse); // // auto accountPath = logsPath.path("/:name"); // accountPath.parameter<Rest::Type::String>("name", "The name of the account to operate on"); // // accountPath // .route(description.post("/budget"), "Add budget to the account") // .bind(&Server::creditAccount, this) // .produces(MIME(Application, Json)) // .response(Http::Code::Ok, "Budget has been added to the account") // .response(backendErrorResponse); } void Server::retrieveAllLogs(const Rest::Request &, Http::ResponseWriter response) { response.send(Http::Code::Ok, R"({"name":"MyAccount"})"); } void Server::retrieveAccount(const Rest::Request&, Http::ResponseWriter response) { response.send(Http::Code::Ok, "The bank is closed, come back later"); } void Server::createAccount(const Rest::Request&, Http::ResponseWriter response) { response.send(Http::Code::Ok, "The bank is closed, come back later"); } void Server::creditAccount(const Rest::Request&, Http::ResponseWriter response) { response.send(Http::Code::Ok, "The bank is closed, come back later"); }
[ "tsijercic1@etf.unsa.ba" ]
tsijercic1@etf.unsa.ba
dd2831d1cba1d17ab6e25d2bbc8d731f4e1bfafc
320a98c766f78f0b964f92cf4fb9cc16a9e9a715
/MonsterForest/Include/Chatting.h
9b2d7fe245a92f6465a39b910940ec81d0ff3531
[]
no_license
LipCoding/ProjectGOD
058b217ba7705da3b1d38c2cf40ae67fcf462aaa
c63462d800cbbcb36d7fc0a11d909f77f287c980
refs/heads/master
2022-03-12T21:04:53.374351
2019-10-16T02:53:07
2019-10-16T02:53:07
166,417,935
0
0
null
null
null
null
UTF-8
C++
false
false
1,117
h
#pragma once #include "Scene/SceneScript.h" #include "GameObject/GameObject.h" #include "Component/Font.h" #include "Component/UIButton.h" PG_USING class Chatting { #pragma region ChattingEditor CFont* pUIChatText; wstring chatString; CGameObject* pUIChat; vector<WORD> pChatCont; #pragma endregion #pragma region ChattingLog CFont* pUIChatLogText; CGameObject* pUIChatLog; #pragma endregion bool chat_write = false; vector<wstring> UserChatLog; public: Chatting(); ~Chatting(); public: bool initialize(); void update(float deltaTime); public: vector<wstring>& getUserChatLogCont() { return this->UserChatLog; } CFont* getUIChatLogText() { return this->pUIChatLogText; } public: CFont* getUIChatText() { return this->pUIChatText; } wstring& getChatString() { return this->chatString; } CGameObject* getUIChat() { return this->pUIChat; } vector<WORD>& getChatCont() { return this->pChatCont; } public: bool isChatWrite() { return this->chat_write; } void setChatString(wstring& chatString) { this->chatString = chatString; } void enableChatWrite(bool write) { this->chat_write = write; } };
[ "astralshift@daum.net" ]
astralshift@daum.net
206edd8f7234c21636553f080aecd6ab4639484f
65972786d7900a48247df3ea604a2ae82be53fca
/fileDissect/plugins/cbff/plugins/summInfo/summInfo.h
cdeb05464ed80ddcc935710390825f2b7a9ac081
[ "BSD-3-Clause" ]
permissive
jduck/file-dissect
ec765e35be768b41cd09bf55b521e2c5b4435c12
4debec52697f0c10b8c8f024954eb41a5b20a51a
refs/heads/master
2016-09-09T20:09:35.067598
2012-02-05T21:16:59
2012-02-05T21:16:59
1,706,815
11
0
null
null
null
null
UTF-8
C++
false
false
2,100
h
/* * Windows Compound Binary File Format implementation * Joshua J. Drake <jdrake idefense.com> * * summinfo.h: * class declaration for summinfo cbffStreamPlugin class */ #ifndef __summInfo_h_ #define __summInfo_h_ #include "cbffStreamPlugin.h" #include "cbff_defs.h" class summInfo : public cbffStreamPlugin { public: summInfo(wxLog *plog, fileDissectTreeCtrl *tree); // plugin interface methods void MarkDesiredStreams(void); void Dissect(void); // we don't store anything extra, this isn't needed (use default) // void CloseFile(void); private: void DissectStream(cbffStream *pStream); wxChar *HumanReadablePropId(ULONG id); wxChar *HumanReadablePropType(ULONG type); }; struct SummaryInformationHeader { USHORT uByteOrder; USHORT uReserved; USHORT uOSVersion; USHORT uPlatform; CLSID clsid; ULONG ulSectionCount; }; struct SummaryInformationSectionDeclaration { CLSID clsid; ULONG ulOffset; }; struct SummaryInformationSectionHeader { ULONG ulLength; ULONG ulPropertyCount; }; struct SummaryInformationPropertyDeclaration { ULONG ulPropertyId; ULONG ulOffset; }; struct SummaryInformationProperty { ULONG ulType; union { ULONG ulDword1; USHORT uWord1; SHORT sWord1; LONG lDword1; } u; }; #define SVT_SHORT 0x02 #define SVT_LONG 0x03 #define SVT_ULONG 0x13 #define SVT_STRING 0x1e #define SVT_FILETIME 0x40 #define SVT_BLOB 0x41 #define SVT_CLIPBOARD 0x47 #define SPT_CODEPAGE 0x00000001 #define SPT_TITLE 0x00000002 #define SPT_SUBJECT 0x00000003 #define SPT_AUTHOR 0x00000004 #define SPT_KEYWORDS 0x00000005 #define SPT_COMMENTS 0x00000006 #define SPT_TEMPLATE 0x00000007 #define SPT_LASTAUTHOR 0x00000008 #define SPT_REVNUMBER 0x00000009 #define SPT_EDITTIME 0x0000000A #define SPT_LASTPRINTED 0x0000000B #define SPT_CREATE_DTM 0x0000000C #define SPT_LASTSAVE_DTM 0x0000000D #define SPT_PAGECOUNT 0x0000000E #define SPT_WORDCOUNT 0x0000000F #define SPT_CHARCOUNT 0x00000010 #define SPT_THUMBNAIL 0x00000011 #define SPT_APPNAME 0x00000012 #define SPT_SECURITY 0x00000013 #define SPT_LOCALEID 0x80000000 #endif
[ "github.jdrake@qoop.org" ]
github.jdrake@qoop.org
08f014a1741d4f5f4d94874ab9f3666962a402ad
cc1701cadaa3b0e138e30740f98d48264e2010bd
/components/password_manager/core/browser/password_manager_metrics_recorder.cc
c8f492e88dc5a284d0f456afb107a35280296fe6
[ "BSD-3-Clause" ]
permissive
dbuskariol-org/chromium
35d3d7a441009c6f8961227f1f7f7d4823a4207e
e91a999f13a0bda0aff594961762668196c4d22a
refs/heads/master
2023-05-03T10:50:11.717004
2020-06-26T03:33:12
2020-06-26T03:33:12
275,070,037
1
3
BSD-3-Clause
2020-06-26T04:04:30
2020-06-26T04:04:29
null
UTF-8
C++
false
false
4,217
cc
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/password_manager/core/browser/password_manager_metrics_recorder.h" #include <memory> #include "base/metrics/histogram_macros.h" #include "components/autofill/core/common/save_password_progress_logger.h" #include "components/password_manager/core/browser/browser_save_password_progress_logger.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "url/gurl.h" // Shorten the name to spare line breaks. The code provides enough context // already. typedef autofill::SavePasswordProgressLogger Logger; namespace password_manager { PasswordManagerMetricsRecorder::PasswordManagerMetricsRecorder( ukm::SourceId source_id, std::unique_ptr<NavigationMetricRecorderDelegate> navigation_metric_recorder) : ukm_entry_builder_( std::make_unique<ukm::builders::PageWithPassword>(source_id)), navigation_metric_recorder_(std::move(navigation_metric_recorder)) {} PasswordManagerMetricsRecorder::PasswordManagerMetricsRecorder( PasswordManagerMetricsRecorder&& that) noexcept = default; PasswordManagerMetricsRecorder::~PasswordManagerMetricsRecorder() { if (user_modified_password_field_) ukm_entry_builder_->SetUserModifiedPasswordField(1); if (form_manager_availability_ != FormManagerAvailable::kNotSet) ukm_entry_builder_->SetFormManagerAvailable( static_cast<int64_t>(form_manager_availability_)); ukm_entry_builder_->Record(ukm::UkmRecorder::Get()); } PasswordManagerMetricsRecorder& PasswordManagerMetricsRecorder::operator=( PasswordManagerMetricsRecorder&& that) = default; void PasswordManagerMetricsRecorder::RecordUserModifiedPasswordField() { if (!user_modified_password_field_ && navigation_metric_recorder_) { navigation_metric_recorder_->OnUserModifiedPasswordFieldFirstTime(); } user_modified_password_field_ = true; } void PasswordManagerMetricsRecorder::RecordUserFocusedPasswordField() { if (!user_focused_password_field_ && navigation_metric_recorder_) { navigation_metric_recorder_->OnUserFocusedPasswordFieldFirstTime(); } user_focused_password_field_ = true; } void PasswordManagerMetricsRecorder::RecordProvisionalSaveFailure( ProvisionalSaveFailure failure, const GURL& main_frame_url, const GURL& form_origin, BrowserSavePasswordProgressLogger* logger) { UMA_HISTOGRAM_ENUMERATION("PasswordManager.ProvisionalSaveFailure", failure, MAX_FAILURE_VALUE); ukm_entry_builder_->SetProvisionalSaveFailure(static_cast<int64_t>(failure)); if (logger) { switch (failure) { case SAVING_DISABLED: logger->LogMessage(Logger::STRING_SAVING_DISABLED); break; case EMPTY_PASSWORD: logger->LogMessage(Logger::STRING_EMPTY_PASSWORD); break; case MATCHING_NOT_COMPLETE: logger->LogMessage(Logger::STRING_MATCHING_NOT_COMPLETE); break; case NO_MATCHING_FORM: logger->LogMessage(Logger::STRING_NO_MATCHING_FORM); break; case FORM_BLACKLISTED: logger->LogMessage(Logger::STRING_FORM_BLACKLISTED); break; case INVALID_FORM: logger->LogMessage(Logger::STRING_INVALID_FORM); break; case SYNC_CREDENTIAL: logger->LogMessage(Logger::STRING_SYNC_CREDENTIAL); break; case SAVING_ON_HTTP_AFTER_HTTPS: logger->LogSuccessiveOrigins( Logger::STRING_BLOCK_PASSWORD_SAME_ORIGIN_INSECURE_SCHEME, main_frame_url.GetOrigin(), form_origin.GetOrigin()); break; case MAX_FAILURE_VALUE: NOTREACHED(); return; } logger->LogMessage(Logger::STRING_DECISION_DROP); } } void PasswordManagerMetricsRecorder::RecordFormManagerAvailable( FormManagerAvailable availability) { form_manager_availability_ = availability; } void PasswordManagerMetricsRecorder::RecordPageLevelUserAction( PasswordManagerMetricsRecorder::PageLevelUserAction action) { ukm_entry_builder_->SetPageLevelUserAction(static_cast<int64_t>(action)); } } // namespace password_manager
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
d5665131a237184475ffb30edd81d83b945a7f7e
a4423b2f32dd5eb48cbb43404cf291064437934e
/include/mpool.h
2526cf868f67ec01c33f35fc807910300639c185
[ "MIT" ]
permissive
felipecolares22/GREMLINS
25250675a99e142e2dab4ae7d79dd960d9e3b2db
cd28c56f930ab8f75194530cc10455285d9cf864
refs/heads/master
2020-06-01T01:25:26.836128
2019-06-27T02:05:31
2019-06-27T02:05:31
190,576,034
0
0
null
null
null
null
UTF-8
C++
false
false
4,415
h
#ifndef MPOOL_H #define MPOOL_H #include <iostream> #include <cmath> #include <stdexcept> #include <random> #include <algorithm> #include <string> #include <sstream> #include <string.h> #include <iomanip> namespace mp { class StoragePool { public: virtual ~StoragePool() {}; virtual void* Allocate( size_t ) = 0; virtual void Free( void * ) = 0; }; // StoragePool class struct Tag { mp::StoragePool * pool; }; // Tag struct template < size_t BLK_SIZE=16 > class SLPool : public StoragePool { public: static constexpr size_t BLK_SZ = sizeof( mp::SLPool<BLK_SIZE>::Block ); //!< The block size in bytes. static constexpr size_t TAG_SZ = sizeof( mp::Tag ); //!< The Tag size in bytes (each reserved area has a tag). static constexpr size_t HEADER_SZ = sizeof( mp::SLPool<BLK_SIZE>::Header ); struct Header { size_t m_length; Header() : m_length(0u) { }; }; struct Block: public Header { union { Block *m_next; char m_raw[ BLK_SIZE - sizeof(Header) ]; }; Block() : Header(), m_next( nullptr ) { }; }; private: unsigned int m_n_blocks; Block *m_pool; Block &m_sentinel; bool isFull = false; public: /// Constructor explicit SLPool( size_t num_blk ) : m_n_blocks{ (unsigned int) std::ceil( static_cast<float>(num_blk) / BLK_SIZE ) + 1u }, m_pool{ new Block[m_n_blocks] }, m_sentinel{ m_pool[m_n_blocks - 1] } { this->m_pool[0].m_length = (m_n_blocks - 1); this->m_pool[0].m_next = nullptr; this->m_sentinel.m_next = this->m_pool; this->m_sentinel.m_length = 0; } // Destructor ~SLPool() { delete [] m_pool; } void * Allocate( size_t tot_size ) { Block *fast = this->m_sentinel.m_next; Block *slow = &this->m_sentinel; size_t num_blocks = std::ceil( (tot_size + sizeof( Header ))/BLK_SIZE ); while( fast != nullptr ) { if(fast->m_length == num_blocks) { slow->m_next = fast->m_next; fast->m_length = num_blocks; isFull = true; return reinterpret_cast< void* >(reinterpret_cast< Header* > (fast) + (1U)); } else if(fast->m_length > num_blocks) { slow->m_next = fast + num_blocks; slow->m_next->m_next = fast->m_next; slow->m_next->m_length = fast->m_length - num_blocks; fast->m_length = num_blocks; return reinterpret_cast< void* >(reinterpret_cast< Header* > (fast) + (1U)); } else { slow = fast; fast = fast->m_next; } } throw std::bad_alloc(); } void Free( void * ptr ) { ptr = reinterpret_cast<Block *> (reinterpret_cast <Header *> (ptr) - (1U)); Block * current = (Block *) ptr; Block * fast = this->m_sentinel.m_next; Block * slow = &this->m_sentinel; while(fast != nullptr) { if( (current - fast) < (current - slow) and (current - fast) > 0 ) { slow = fast; fast = fast->m_next; } else break; } Block * pre = fast; Block * pos = nullptr; if(pre != nullptr) pos = fast->m_next; if(isFull) { m_sentinel.m_next = current; m_sentinel.m_next->m_next = nullptr; isFull = false; return; } if( (current - pre) == (long int)pre->m_length and (pos - current) == (long int)current->m_length ) { pre->m_next = pos->m_next; pre->m_length = pre->m_length + current->m_length + pos->m_length; } else if( (current - pre) == (long int)pre->m_length ) { pre->m_next = pos; pre->m_length = pre->m_length + current->m_length; } else if( (pos - current) == (long int)current->m_length ) { pre->m_next = current; current->m_next = pos->m_next; current->m_length = current->m_length + pos->m_length; } else { current->m_next = pre->m_next; pre->m_next = current; } } friend std::ostream& operator<< (std::ostream& stream, const SLPool& obj) { stream << " operator << of SLPool Class is a WIP " << std::endl; // Block * fast = obj.m_sentinel.m_next; // Block * first = (Block *)&obj.m_pool[0]; // while(fast != nullptr) // { // int dif = fast - first; // stream << difstd::setw(dif) << std::setfill('#') << ""; // stream << std::setw(fast->m_length) << std::setfill('_') << ""; // first += dif + fast->m_length; // fast = fast->m_next; // } // stream << setw(&m_pool[]-first) << setfill('#') << ""; return stream; } }; // SLPool class } //namespace mp #endif
[ "matheus.mas132@hotmail.com" ]
matheus.mas132@hotmail.com
80e820c61bb79b50bed948fc4372d618632e251b
2ba94892764a44d9c07f0f549f79f9f9dc272151
/Engine/Source/Runtime/Slate/Public/Widgets/Notifications/SErrorHint.h
566c26d994f1c334b2bbc808aa8520532195ba11
[ "BSD-2-Clause", "LicenseRef-scancode-proprietary-license" ]
permissive
PopCap/GameIdea
934769eeb91f9637f5bf205d88b13ff1fc9ae8fd
201e1df50b2bc99afc079ce326aa0a44b178a391
refs/heads/master
2021-01-25T00:11:38.709772
2018-09-11T03:38:56
2018-09-11T03:38:56
37,818,708
0
0
BSD-2-Clause
2018-09-11T03:39:05
2015-06-21T17:36:44
null
UTF-8
C++
false
false
832
h
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once class SLATE_API SErrorHint : public SCompoundWidget , public IErrorReportingWidget { public: SLATE_BEGIN_ARGS( SErrorHint ) : _ErrorText() {} SLATE_TEXT_ARGUMENT(ErrorText) SLATE_END_ARGS() void Construct(const FArguments& InArgs); public: // IErrorReportingWidget interface virtual void SetError( const FText& InErrorText ) override; virtual void SetError( const FString& InErrorText ) override; virtual bool HasError() const override; virtual TSharedRef<SWidget> AsWidget() override; private: TAttribute<EVisibility> CustomVisibility; EVisibility MyVisibility() const; FVector2D GetDesiredSizeScale() const; FCurveSequence ExpandAnimation; TSharedPtr<SWidget> ImageWidget; FText ErrorText; FText GetErrorText() const; };
[ "dkroell@acm.org" ]
dkroell@acm.org
2d51a2026e2d6180509449d661016350a1878d6c
fa6a6fb34fb61c71bc55daea50e799164711126e
/CryGame/STLPORT/test/regression/nextprm2.cpp
ab955814c1e922dfb85223598a1c1a0f941593a8
[ "LicenseRef-scancode-stlport-4.5", "LicenseRef-scancode-unknown-license-reference" ]
permissive
HackCarver/FunCry
3e683309b418b66d4b0baf267ace899b166e48f8
e03d420a825a70821e5d964556f3f87a9388d282
refs/heads/main
2023-08-24T06:43:19.121027
2021-10-15T23:42:59
2021-10-15T23:42:59
377,707,614
2
0
null
null
null
null
UTF-8
C++
false
false
774
cpp
// STLport regression testsuite component. // To compile as a separate example, please #define MAIN. #include <iterator> #include <vector> #include <algorithm> #include <numeric> #include <iterator> #include <iostream> #ifdef MAIN #define nextprm2_test main #endif #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES) using namespace std; #endif int nextprm2_test(int, char**) { cout<<"Results of nextprm2_test:"<<endl; vector <char> v1(3); iota(v1.begin(), v1.end(), 'A'); ostream_iterator<char> iter(cout); copy(v1.begin(), v1.end(), iter); cout << endl; for(int i = 0; i < 9; i++) { next_permutation(v1.begin(), v1.end(), less<char>()); copy(v1.begin(), v1.end(), iter); cout << endl; } return 0; }
[ "valnjackattack@gmail.com" ]
valnjackattack@gmail.com
3374e8ecf852599fb7f773a616e9dc470a60aacf
01f22d91379b56790f4abb3495f50bd2584ac852
/eel/Models/RenderModel.h
a946096bfad6807a70068d372f4d0739b0d66545
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mjbogusz/eel
d5011c80c685720442ae195e76c1ff9624648b24
4963771c6a000c7c6416dd85fb2b377f74a43759
refs/heads/master
2021-08-23T23:04:43.115423
2016-02-12T20:26:43
2016-02-12T20:26:43
51,613,137
0
0
null
null
null
null
UTF-8
C++
false
false
1,935
h
#ifndef _MODELS_RENDERMODEL_H #define _MODELS_RENDERMODEL_H #include "../Interfaces/RenderObject.h" #include "../Structures/ModelMaterial.h" #include "../Libs/glm/gtc/type_ptr.hpp" #include "../Libs/glm/gtc/matrix_transform.hpp" #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif // !M_PI #define MAX_MATERIALS 4 class RenderModel : public RenderObject { protected: GLuint vao; std::vector<GLuint> vbos; ModelMaterial* baseMaterial; std::vector<ModelMaterial*> materials; GLuint normalMap; glm::vec3 worldPosition; glm::vec3 rotation; glm::vec3 rotationSpeed; bool animated; virtual void setAttribPointers() const; virtual void rotate(float deltaTime); virtual void setPositionUniforms(const GLuint program) const; virtual void setMaterialUniforms(const GLuint program) const; public: RenderModel(); virtual ~RenderModel(); virtual void draw() override; virtual void draw(const GLuint program) override; virtual void update(const float totalTimePassed = 0.0f, const float deltaTime = 0.0f, const bool force = false) override; virtual void destroy() override; virtual void setPosition(const glm::vec3& newPosition); virtual void setRotation(const glm::vec3& newRotation); virtual void setRotationSpeed(const glm::vec3& newRotationSpeed); virtual void toggleAnimation(const float totalTimePassed); virtual void setBaseMaterial(float ambient, float diffusive, float specular, float shininess); virtual void addMaterial(unsigned int index, const std::string& textureFileName, float ambient, float diffusive, float specular, float shininess, TextureLoader* textureLoader); virtual void clearMaterial(unsigned int index); virtual void addNormalMap(const std::string& textureFileName, TextureLoader* textureLoader); virtual void clearNormalMap(); virtual GLuint getVao() const override; virtual const std::vector<GLuint>& getVbos() const override; }; #endif // !_MODELS_RENDERMODEL_H
[ "mjbogusz+github@gmail.com" ]
mjbogusz+github@gmail.com
d7ead8e926d89ccb0a90c32597f3efa7dfcac763
f5e3af211d0c51af4a91f4d8b41e510b41c17aa8
/EnemyHead.cpp
877513e62a2fffc6a160bb07a83f2f123fda4676
[]
no_license
LordGoodrick/Portfolio
c1779292014766275601b98a97a6e3beb690844b
1045f5b432c6e5b2b21882f24eed12e02b124ad9
refs/heads/master
2021-04-28T06:34:37.204618
2018-02-20T14:36:39
2018-02-20T14:36:39
122,204,164
0
0
null
null
null
null
UTF-8
C++
false
false
6,418
cpp
#include "pch.h" #include "EnemyHead.h" #include "Utilities.h" #include <WICTextureLoader.h> using namespace Microsoft::WRL; using namespace DirectX; using namespace Windows::Foundation; using namespace DirectX::SimpleMath; using namespace std; EnemyHead::EnemyHead(void) : texture ( nullptr ) , position ( 0.0f, 0.0f ) , tint ( 1.0f, 1.0f, 1.0f, 1.0f ) , boundingBox (0.0f, 0.0f, 56.0f, 50.0f ) , visible ( false ) , sourceRect ( nullptr ) , spriteEffect ( SpriteEffects_None ) , accelerationDueToGravity ( 0.0f, 0.6f ) , jumping ( false ) , jumpDistance ( 30 ) , acceleration ( 0.0f, 0.0f ) , velocity ( 0.0f, 0.0f ) , justSpawned ( false ) , scaleX ( 1.0 ) , scaleY ( 1.0 ) { } EnemyHead::~EnemyHead(void) { } void EnemyHead::Initialize(wstring filePathName , ComPtr<ID3D11Device1> d3dDevice , ComPtr<ID3D11DeviceContext1> d3dDeviceContext, float scaleX, float scaleY) { ThrowIfFailed( CreateWICTextureFromFile(d3dDevice.Get(), d3dDeviceContext.Get(), filePathName.c_str(), 0, &this->texture) ); this->spriteBatch = std::unique_ptr<SpriteBatch>(new SpriteBatch(d3dDeviceContext.Get())); this->commonStates = std::unique_ptr<CommonStates>(new CommonStates(d3dDevice.Get())); this->scaleX = scaleX; this->scaleY = scaleY; this->sourceRect = std::unique_ptr<RECT>(new RECT); this->sourceRect->left = 107.0f; this->sourceRect->top = 65.0f; this->sourceRect->right = 163.0f; this->sourceRect->bottom = 173.0f; /*this->velocity.y = -5.0f; this->jumping = true; this->acceleration = this->accelerationDueToGravity; Vector2 distanceTravelled = tickDelta * this->velocity; this->position = this->position + distanceTravelled;*/ } void EnemyHead::Draw() { XMMATRIX cameraMatrix = Matrix::CreateTranslation(0, 0, 0); cameraMatrix *= Matrix::CreateTranslation(0,0,0) * Matrix::CreateScale(this->scaleX, this->scaleY, 1.0); this->spriteBatch->Begin(SpriteSortMode_Deferred, this->commonStates->NonPremultiplied(), nullptr, nullptr, nullptr, nullptr, cameraMatrix); this->spriteBatch->Draw(this->texture.Get(), this->position, this->sourceRect.get(), this->tint, 0.0f, SimpleMath::Vector2(0.0f, 0.0f), 0.7f, this->spriteEffect, 0.0f); this->spriteBatch->End(); } void EnemyHead::Reset(DirectX::SimpleMath::Vector2 startPosition) { this->position = startPosition; this->justSpawned = true; } bool EnemyHead::IntersectsWith(Windows::Foundation::Rect rectangle) { return this->boundingBox.IntersectsWith(rectangle); } void EnemyHead::SetBoundingBox(Windows::Foundation::Rect rectangle) { this->boundingBox = rectangle; } void EnemyHead::Update(int tickTotal, int tickDelta, float timeDelta, Rect windowBounds, PlatformLoader& platform1, PlatformLoader& platform2, PlatformLoader& platform3, PlatformLoader& platform4, PlatformLoader& platform5, PlatformLoader& platform6, PlatformLoader& ladder, PressurePlate& plate1, PressurePlate& plate2, PressurePlate& plate3) { //Calculate the current position //this->position = this->position + (timeDelta * this->velocity); if( this->justSpawned == true ) { // //this->jumping = true; this->velocity.y = -10.0f; this->velocity.x = -10.0f; this->justSpawned = false; } this->acceleration = this->accelerationDueToGravity; Vector2 distanceTravelled = tickDelta * this->velocity; this->position = this->position + distanceTravelled; //} //Code for making the hero jump //if (this->jumping) //{ // //First calculate the current velocity of the sprite // Vector2 initialVelocity = this->velocity; // this->velocity = initialVelocity + (tickDelta * this->acceleration); // //Second calculate the distance moved // Vector2 distanceTravelled = 0.5f * (initialVelocity + this->velocity) * tickDelta; // //Third, calculate the new position of the sprite // this->position = this->position + distanceTravelled; // // if( this->justSpawned == true && jumping == true ) // { // //Jump // this->velocity.y = -10.0f; // this->jumping = true; // this->acceleration = this->accelerationDueToGravity; // Vector2 distanceTravelled = tickDelta * this->velocity; // this->position = this->position + distanceTravelled; // } //} //else if( this->justSpawned == true ) //{ // //Jump // this->velocity.y = -10.0f; // this->jumping = true; // this->acceleration = this->accelerationDueToGravity; //} //Level Platform Collision if ( platform1.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if ( platform2.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if ( platform3.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if ( platform4.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if ( platform5.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if ( platform6.IntersectsWith(this->boundingBox) && this->velocity.y > 0.0f) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } //************************************************************************* Brandon if(plate1.IntersectsWith(this->boundingBox)) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if(plate2.IntersectsWith(this->boundingBox)) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } if(plate3.IntersectsWith(this->boundingBox)) { this->velocity.y = 0.0f; this->velocity.x = 0.0f; this->jumping = false; } //************************************************************************ //Vector2 translation = tickDelta * velocity; //this->position = this->position + translation; } void EnemyHead::SetJustSpawned(bool justSpawned) { this->justSpawned = justSpawned; //this->jumping = true; }
[ "noreply@github.com" ]
noreply@github.com
b3ca55a25d3ac7056501ddab96251e90d2d3b79a
7163af166893b2bdd710bf652771c09f99106e26
/OpenSim/Simulation/Wrap/WrapEllipsoid.cpp
8072ea75530238e5527bc2485b58dfbd7a264515
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
tgeijten/opensim3-scone
6b73125c7ca438b26b80b04f55f061e0e7f314cb
ffa32e4e098ef364948781444e4ea7f3bab2e845
refs/heads/master
2021-06-20T02:41:28.315713
2021-01-28T13:19:08
2021-01-28T13:19:08
180,564,353
1
2
NOASSERTION
2021-01-14T16:17:41
2019-04-10T11:09:17
C++
UTF-8
C++
false
false
37,435
cpp
/* -------------------------------------------------------------------------- * * OpenSim: WrapEllipsoid.cpp * * -------------------------------------------------------------------------- * * The OpenSim API is a toolkit for musculoskeletal modeling and simulation. * * See http://opensim.stanford.edu and the NOTICE file for more information. * * OpenSim is developed at Stanford University and supported by the US * * National Institutes of Health (U54 GM072970, R24 HD065690) and by DARPA * * through the Warrior Web program. * * * * Copyright (c) 2005-2012 Stanford University and the Authors * * Author(s): Peter Loan * * * * 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. * * -------------------------------------------------------------------------- */ //============================================================================= // INCLUDES //============================================================================= #include "WrapEllipsoid.h" #include <OpenSim/Simulation/Model/PathPoint.h> #include "PathWrap.h" #include "WrapResult.h" #include <OpenSim/Common/SimmMacros.h> #include <OpenSim/Common/Mtx.h> #include <sstream> //============================================================================= // STATICS //============================================================================= using namespace std; using namespace OpenSim; using SimTK::Vec3; static const char* wrapTypeName = "ellipsoid"; #define ELLIPSOID_TOLERANCE_1 1e-4 // tolerance for pt_to_ellipsoid() special case detection #define ELLIPSOID_TINY 0.00000001 #define MU_BLEND_MIN 0.7073 // 100% fan (must be greater than cos(45)!) #define MU_BLEND_MAX 0.9 // 100% Frans #define NUM_FAN_SAMPLES 300 // IMPORTANT: larger numbers produce less jitter #define NUM_DISPLAY_SAMPLES 30 #define N_STEPS 16 #define SV_BOUNDARY_BLEND 0.3 //============================================================================= // CONSTRUCTOR(S) AND DESTRUCTOR //============================================================================= //_____________________________________________________________________________ /** * Default constructor. */ WrapEllipsoid::WrapEllipsoid() : WrapObject(), _dimensions(_dimensionsProp.getValueDblArray()) { setNull(); setupProperties(); } //_____________________________________________________________________________ /** * Destructor. */ WrapEllipsoid::~WrapEllipsoid() { } //_____________________________________________________________________________ /** * Copy constructor. * * @param aWrapEllipsoid WrapEllipsoid to be copied. */ WrapEllipsoid::WrapEllipsoid(const WrapEllipsoid& aWrapEllipsoid) : WrapObject(aWrapEllipsoid), _dimensions(_dimensionsProp.getValueDblArray()) { setNull(); setupProperties(); copyData(aWrapEllipsoid); } //============================================================================= // CONSTRUCTION METHODS //============================================================================= //_____________________________________________________________________________ /** * Set the data members of this WrapEllipsoid to their null values. */ void WrapEllipsoid::setNull() { } //_____________________________________________________________________________ /** * Connect properties to local pointers. */ void WrapEllipsoid::setupProperties() { // BASE CLASS //WrapObject::setupProperties(); const double defaultDimensions[] = {-1.0, -1.0, -1.0}; _dimensionsProp.setName("dimensions"); _dimensionsProp.setValue(3, defaultDimensions); _propertySet.append(&_dimensionsProp); } //_____________________________________________________________________________ /** * Perform some set up functions that happen after the * object has been deserialized or copied. * * @param aModel */ void WrapEllipsoid::connectToModelAndBody(Model& aModel, OpenSim::Body& aBody) { // Base class WrapObject::connectToModelAndBody(aModel, aBody); // maybe set a parent pointer, _body = aBody; if (_dimensions[0] < 0.0 || _dimensions[1] < 0.0 || _dimensions[2] < 0.0) { string errorMessage = "Error: dimensions for WrapEllipsoid " + getName() + " were either not specified, or are negative."; throw Exception(errorMessage); } _displayer.freeGeometry(); AnalyticEllipsoid* ellipsoid = new AnalyticEllipsoid(); ellipsoid->setEllipsoidParams(_dimensions[0], _dimensions[1], _dimensions[2]); setGeometryQuadrants(ellipsoid); _displayer.addGeometry(ellipsoid); } //_____________________________________________________________________________ /** * Scale the ellipsoid's dimensions. The base class scales the origin * of the ellipsoid in the body's reference frame. * * @param aScaleFactors The XYZ scale factors. */ void WrapEllipsoid::scale(const SimTK::Vec3& aScaleFactors) { // Base class, to scale origin in body frame WrapObject::scale(aScaleFactors); SimTK::Vec3 localScaleVector[3]; // _pose.x() holds the ellipsoid's X axis expressed in the // body's reference frame. The magnitude of this-vector-multiplied- // by-the-XYZ-scale-factors gives the amount that you need to // scale the X dimension of the ellipsoid. Similarly for Y and Z... for (int i=0; i<3; i++) { localScaleVector[0][i] = _pose.x()[i] * aScaleFactors[i]; localScaleVector[1][i] = _pose.y()[i] * aScaleFactors[i]; localScaleVector[2][i] = _pose.z()[i] * aScaleFactors[i]; } for (int i=0; i<3; i++) _dimensions[i] *= localScaleVector[i].norm(); } //_____________________________________________________________________________ /** * Copy data members from one WrapEllipsoid to another. * * @param aWrapEllipsoid WrapEllipsoid to be copied. */ void WrapEllipsoid::copyData(const WrapEllipsoid& aWrapEllipsoid) { // BASE CLASS WrapObject::copyData(aWrapEllipsoid); _dimensions = aWrapEllipsoid._dimensions; } //_____________________________________________________________________________ /** * Get the name of the type of wrap object ("ellipsoid" in this case) * * @return A string representing the type of wrap object */ const char* WrapEllipsoid::getWrapTypeName() const { return wrapTypeName; } //_____________________________________________________________________________ /** * Get a string holding the dimensions definition that SIMM would * use to describe this object. This is a rather ugly convenience * function for outputting SIMM joint files. * * @return A string containing the dimensions of the wrap object */ string WrapEllipsoid::getDimensionsString() const { stringstream dimensions; dimensions << "radius " << _dimensions[0] << " " << _dimensions[1] << " " << _dimensions[2]; return dimensions.str(); } //_____________________________________________________________________________ /** * Get the radii of the ellipsoid. * * @return A Vec3 containing the principle radii along the three axes */ SimTK::Vec3 WrapEllipsoid::getRadii() const { return SimTK::Vec3(_dimensions[0], _dimensions[1], _dimensions[2]); } //============================================================================= // OPERATORS //============================================================================= //_____________________________________________________________________________ /** * Assignment operator. * * @return Reference to this object. */ WrapEllipsoid& WrapEllipsoid::operator=(const WrapEllipsoid& aWrapEllipsoid) { // BASE CLASS WrapObject::operator=(aWrapEllipsoid); return(*this); } //============================================================================= // WRAPPING //============================================================================= //_____________________________________________________________________________ /** * Calculate the wrapping of one line segment over the ellipsoid. * * @param aPoint1 One end of the line segment * @param aPoint2 The other end of the line segment * @param aPathWrap An object holding the parameters for this line/ellipsoid pairing * @param aWrapResult The result of the wrapping (tangent points, etc.) * @param aFlag A flag for indicating errors, etc. * @return The status, as a WrapAction enum */ int WrapEllipsoid::wrapLine(const SimTK::State& s, SimTK::Vec3& aPoint1, SimTK::Vec3& aPoint2, const PathWrap& aPathWrap, WrapResult& aWrapResult, bool& aFlag) const { int i, j, bestMu; SimTK::Vec3 p1, p2, m, a, p1p2, p1m, p2m, f1, f2, p1c1, r1r2, vs, t, mu; double ppm, aa, bb, cc, disc, l1, l2, p1e, p2e, vs4, dist, fanWeight = -SimTK::Infinity; double t_sv[3][3], t_c1[3][3]; bool far_side_wrap = false; static SimTK::Vec3 origin(0,0,0); // In case you need any variables from the previous wrap, copy them from // the PathWrap into the WrapResult, re-normalizing the ones that were // un-normalized at the end of the previous wrap calculation. const WrapResult& previousWrap = aPathWrap.getPreviousWrap(); aWrapResult.factor = previousWrap.factor; for (i = 0; i < 3; i++) { aWrapResult.r1[i] = previousWrap.r1[i] * previousWrap.factor; aWrapResult.r2[i] = previousWrap.r2[i] * previousWrap.factor; aWrapResult.c1[i] = previousWrap.c1[i]; aWrapResult.sv[i] = previousWrap.sv[i]; } aFlag = true; aWrapResult.wrap_pts.setSize(0); // This algorithm works best if the coordinates (aPoint1, aPoint2, // origin, _dimensions) are all somewhat close to 1.0. So use // the ellipsoid dimensions to calculate a multiplication factor that // will be applied to all of the coordinates. You want to use just // the ellipsoid dimensions because they do not change from one call to the // next. You don't want the factor to change because the algorithm uses // some vectors (r1, r2, c1) from the previous call. aWrapResult.factor = 3.0 / (_dimensions[0] + _dimensions[1] + _dimensions[2]); for (i = 0; i < 3; i++) { p1[i] = aPoint1[i] * aWrapResult.factor; p2[i] = aPoint2[i] * aWrapResult.factor; m[i] = origin[i] * aWrapResult.factor; a[i] = _dimensions[i] * aWrapResult.factor; } p1e = -1.0; p2e = -1.0; for (i = 0; i < 3;i++) { p1e += SQR((p1[i] - m[i]) / a[i]); p2e += SQR((p2[i] - m[i]) / a[i]); } // check if p1 and p2 are inside the ellipsoid if (p1e < -0.0001 || p2e < -0.0001) { // p1 or p2 is inside the ellipsoid aFlag = false; aWrapResult.wrap_path_length = 0.0; // transform back to starting coordinate system for (i = 0; i < 3; i++) { aWrapResult.r1[i] /= aWrapResult.factor; aWrapResult.r2[i] /= aWrapResult.factor; } return insideRadius; } MAKE_3DVECTOR21(p1, p2, p1p2); MAKE_3DVECTOR21(p1, m, p1m); Mtx::Normalize(3, p1m, p1m); MAKE_3DVECTOR21(p2, m, p2m); Mtx::Normalize(3, p2m, p2m); ppm = Mtx::DotProduct(3, p1m, p2m) - 1.0; // angle between p1->m and p2->m: -2.0 to 0.0 if (fabs(ppm) < 0.0001) { // vector p1m and p2m are colinear aFlag = false; aWrapResult.wrap_path_length = 0.0; // transform back to starting coordinate system for (i = 0; i < 3; i++) { aWrapResult.r1[i] /= aWrapResult.factor; aWrapResult.r2[i] /= aWrapResult.factor; } return noWrap; } // check if the line through p1 and p2 intersects the ellipsoid for (i = 0; i < 3;i++) { f1[i] = p1p2[i] / a[i]; f2[i] = (p2[i] - m[i]) / a[i]; } aa = Mtx::DotProduct(3, f1, f1); bb = 2.0 * Mtx::DotProduct(3, f1, f2); cc = Mtx::DotProduct(3, f2, f2) - 1.0; disc = SQR(bb) - 4.0 * aa * cc; if (disc < 0.0) { // no intersection aFlag = false; aWrapResult.wrap_path_length = 0.0; // transform back to starting coordinate system for (i = 0; i < 3; i++) { aWrapResult.r1[i] /= aWrapResult.factor; aWrapResult.r2[i] /= aWrapResult.factor; } return noWrap; } l1 = (-bb + sqrt(disc)) / (2.0 * aa); l2 = (-bb - sqrt(disc)) / (2.0 * aa); if ( ! (0.0 < l1 && l1 < 1.0) || ! (0.0 < l2 && l2 < 1.0) ) { // no intersection aFlag = false; aWrapResult.wrap_path_length = 0.0; // transform back to starting coordinate system for (i = 0; i < 3; i++) { aWrapResult.r1[i] /= aWrapResult.factor; aWrapResult.r2[i] /= aWrapResult.factor; } return noWrap; } // r1 & r2: intersection points of p1->p2 with the ellipsoid for (i = 0; i < 3; i++) { aWrapResult.r1[i] = p2[i] + l1 * p1p2[i]; aWrapResult.r2[i] = p2[i] + l2 * p1p2[i]; } // ==== COMPUTE WRAPPING PLANE (begin) ==== MAKE_3DVECTOR21(aWrapResult.r2, aWrapResult.r1, r1r2); // (1) Frans technique: choose the most parallel coordinate axis, then set // 'sv' to the point along the muscle line that crosses the plane where // that major axis equals zero. This takes advantage of the special-case // handling in pt_to_ellipsoid() that reduces the 3d point-to-ellipsoid // problem to a 2d point-to-ellipse problem. The 2d case returns a nice // c1 in situations where the "fan" has a sharp discontinuity. Mtx::Normalize(3, p1p2, mu); for (i = 0; i < 3; i++) { mu[i] = fabs(mu[i]); t[i] = (m[i] - aWrapResult.r1[i]) / r1r2[i]; for (j = 0; j < 3; j++) t_sv[i][j] = aWrapResult.r1[j] + t[i] * r1r2[j]; findClosestPoint(a[0], a[1], a[2], t_sv[i][0], t_sv[i][1], t_sv[i][2], &t_c1[i][0], &t_c1[i][1], &t_c1[i][2], i); } // pick most parallel major axis for (bestMu = 0, i = 1; i < 3; i++) if (mu[i] > mu[bestMu]) bestMu = i; if (aPathWrap.getMethod() == PathWrap::hybrid || aPathWrap.getMethod() == PathWrap::axial) { if (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] > MU_BLEND_MIN) { // If Frans' technique produces an sv that is not within the r1->r2 // line segment, then that means that sv will be outside the ellipsoid. // This can create an sv->c1 vector that points roughly 180-degrees // opposite to the fan solution's sv->c1 vector. This creates problems // when interpolating between the Frans and fan solutions because the // interpolated c1 can become colinear to the muscle line during // interpolation. Therefore we detect Frans-solution sv points near // the ends of r1->r2 here, and fade out the Frans result for them. double s = 1.0; if (t[bestMu] < 0.0 || t[bestMu] > 1.0) s = 0.0; else if (t[bestMu] < SV_BOUNDARY_BLEND) s = t[bestMu] / SV_BOUNDARY_BLEND; else if (t[bestMu] > (1.0 - SV_BOUNDARY_BLEND)) s = (1.0 - t[bestMu]) / SV_BOUNDARY_BLEND; if (s < 1.0) mu[bestMu] = MU_BLEND_MIN + s * (mu[bestMu] - MU_BLEND_MIN); } if (aPathWrap.getMethod() == PathWrap::axial || mu[bestMu] > MU_BLEND_MIN) { // if the Frans solution produced a strong result, copy it into // sv and c1. for (i = 0; i < 3; i++) { aWrapResult.c1[i] = t_c1[bestMu][i]; aWrapResult.sv[i] = t_sv[bestMu][i]; } } if (aPathWrap.getMethod() == PathWrap::hybrid && mu[bestMu] < MU_BLEND_MAX) { // (2) Fan technique: sample the fan at fixed intervals and average the // fan "blade" vectors together to determine c1. This only works when // the fan is smoothly continuous. The sharper the discontinuity, the // more jumpy c1 becomes. SimTK::Vec3 v_sum(0,0,0); for (i = 0; i < 3; i++) t_sv[2][i] = aWrapResult.r1[i] + 0.5 * r1r2[i]; for (i = 1; i < NUM_FAN_SAMPLES - 1; i++) { SimTK::Vec3 v; double tt = (double) i / NUM_FAN_SAMPLES; for (j = 0; j < 3; j++) t_sv[0][j] = aWrapResult.r1[j] + tt * r1r2[j]; findClosestPoint(a[0], a[1], a[2], t_sv[0][0], t_sv[0][1], t_sv[0][2], &t_c1[0][0], &t_c1[0][1], &t_c1[0][2]); MAKE_3DVECTOR21(t_c1[0], t_sv[0], v); Mtx::Normalize(3, v, v); // add sv->c1 "fan blade" vector to the running total for (j = 0; j < 3; j++) v_sum[j] += v[j]; } // use vector sum to determine c1 Mtx::Normalize(3, v_sum, v_sum); for (i = 0; i < 3; i++) t_c1[0][i] = t_sv[2][i] + v_sum[i]; if (mu[bestMu] <= MU_BLEND_MIN) { findClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]); for (i = 0; i < 3; i++) aWrapResult.sv[i] = t_sv[2][i]; fanWeight = 1.0; } else { double tt = (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN); double oneMinusT = 1.0 - tt; findClosestPoint(a[0], a[1], a[2], t_c1[0][0], t_c1[0][1], t_c1[0][2], &t_c1[1][0], &t_c1[1][1], &t_c1[1][2]); for (i = 0; i < 3; i++) { t_c1[2][i] = tt * aWrapResult.c1[i] + oneMinusT * t_c1[1][i]; aWrapResult.sv[i] = tt * aWrapResult.sv[i] + oneMinusT * t_sv[2][i]; } findClosestPoint(a[0], a[1], a[2], t_c1[2][0], t_c1[2][1], t_c1[2][2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]); fanWeight = oneMinusT; } } } else // method == midpoint { for (i = 0; i < 3; i++) aWrapResult.sv[i] = aWrapResult.r1[i] + 0.5 * (aWrapResult.r2[i] - aWrapResult.r1[i]); findClosestPoint(a[0], a[1], a[2], aWrapResult.sv[0], aWrapResult.sv[1], aWrapResult.sv[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]); } // ==== COMPUTE WRAPPING PLANE (end) ==== // The old way of initializing r1 used the intersection point // of p1p2 and the ellipsoid. This caused the muscle path to // "jump" to the other side of the ellipsoid as sv[] came near // a plane of the ellipsoid. It jumped to the other side while // c1[] was still on the first side. The new way of initializing // r1 sets it to c1 so that it will stay on c1's side of the // ellipsoid. { bool use_c1_to_find_tangent_pts = true; if (aPathWrap.getMethod() == PathWrap::axial) use_c1_to_find_tangent_pts = (bool) (t[bestMu] > 0.0 && t[bestMu] < 1.0); if (use_c1_to_find_tangent_pts) for (i = 0; i < 3; i++) aWrapResult.r1[i] = aWrapResult.r2[i] = aWrapResult.c1[i]; } // if wrapping is constrained to one half of the ellipsoid, // check to see if we need to flip c1 to the active side of // the ellipsoid. if (_wrapSign != 0) { dist = aWrapResult.c1[_wrapAxis] - m[_wrapAxis]; if (DSIGN(dist) != _wrapSign) { SimTK::Vec3 orig_c1=aWrapResult.c1; aWrapResult.c1[_wrapAxis] = - aWrapResult.c1[_wrapAxis]; aWrapResult.r1 = aWrapResult.r2 = aWrapResult.c1; if (EQUAL_WITHIN_ERROR(fanWeight, -SimTK::Infinity)) fanWeight = 1.0 - (mu[bestMu] - MU_BLEND_MIN) / (MU_BLEND_MAX - MU_BLEND_MIN); if (fanWeight > 1.0) fanWeight = 1.0; if (fanWeight > 0.0) { SimTK::Vec3 tc1; double bisection = (orig_c1[_wrapAxis] + aWrapResult.c1[_wrapAxis]) / 2.0; aWrapResult.c1[_wrapAxis] = aWrapResult.c1[_wrapAxis] + fanWeight * (bisection - aWrapResult.c1[_wrapAxis]); tc1 = aWrapResult.c1; findClosestPoint(a[0], a[1], a[2], tc1[0], tc1[1], tc1[2], &aWrapResult.c1[0], &aWrapResult.c1[1], &aWrapResult.c1[2]); } } } // use p1, p2, and c1 to create parameters for the wrapping plane MAKE_3DVECTOR21(p1, aWrapResult.c1, p1c1); Mtx::CrossProduct(p1p2, p1c1, vs); Mtx::Normalize(3, vs, vs); vs4 = - Mtx::DotProduct(3, vs, aWrapResult.c1); // find r1 & r2 by starting at c1 moving toward p1 & p2 calcTangentPoint(p1e, aWrapResult.r1, p1, m, a, vs, vs4); calcTangentPoint(p2e, aWrapResult.r2, p2, m, a, vs, vs4); // create a series of line segments connecting r1 & r2 along the // surface of the ellipsoid. calc_wrap_path: CalcDistanceOnEllipsoid(aWrapResult.r1, aWrapResult.r2, m, a, vs, vs4, far_side_wrap, aWrapResult); if (_wrapSign != 0 && aWrapResult.wrap_pts.getSize() > 2 && ! far_side_wrap) { SimTK::Vec3 r1p1, r2p2, r1w1, r2w2; SimTK::Vec3& w1 = aWrapResult.wrap_pts.updElt(1); SimTK::Vec3& w2 = aWrapResult.wrap_pts.updElt(aWrapResult.wrap_pts.getSize() - 2); // check for wrong-way wrap by testing angle of first and last // wrap path segments: MAKE_3DVECTOR(aWrapResult.r1, p1, r1p1); MAKE_3DVECTOR(aWrapResult.r1, w1, r1w1); MAKE_3DVECTOR(aWrapResult.r2, p2, r2p2); MAKE_3DVECTOR(aWrapResult.r2, w2, r2w2); Mtx::Normalize(3, r1p1, r1p1); Mtx::Normalize(3, r1w1, r1w1); Mtx::Normalize(3, r2p2, r2p2); Mtx::Normalize(3, r2w2, r2w2); if (Mtx::DotProduct(3, r1p1, r1w1) > 0.0 || Mtx::DotProduct(3, r2p2, r2w2) > 0.0) { // NOTE: I added the ability to call CalcDistanceOnEllipsoid() a 2nd time in this // situation to force a far-side wrap instead of aborting the // wrap. -- KMS 9/3/99 far_side_wrap = true; goto calc_wrap_path; } } // unfactor the output coordinates aWrapResult.wrap_path_length /= aWrapResult.factor; for (i = 0; i < aWrapResult.wrap_pts.getSize(); i++) aWrapResult.wrap_pts[i] *= (1.0 / aWrapResult.factor); // transform back to starting coordinate system // Note: c1 and sv do not get transformed for (i = 0; i < 3; i++) { aWrapResult.r1[i] /= aWrapResult.factor; aWrapResult.r2[i] /= aWrapResult.factor; } return mandatoryWrap; } //_____________________________________________________________________________ /** * Adjust a point (r1) such that the point remains in * a specified plane (vs, vs4), and creates a tangent line segment connecting * it to a specified point (p1) outside of the ellipsoid. All quantities * are normalized. * * @param p1e Ellipsoid parameter for 'p1'? * @param r1 Point to be adjusted to satisfy tangency-within-a-plane constraint * @param p1 Point outside of ellipsoid * @param m Ellipsoid origin * @param a Ellipsoid axis * @param vs Plane vector * @param vs4 Plane coefficient * @return '1' if the point was adjusted, '0' otherwise */ int WrapEllipsoid::calcTangentPoint(double p1e, SimTK::Vec3& r1, SimTK::Vec3& p1, SimTK::Vec3& m, SimTK::Vec3& a, SimTK::Vec3& vs, double vs4) const { int i, j, k, nit, nit2, maxit=50, maxit2=1000; Vec3 nr1, p1r1, p1m; double d1, v[4], ee[4], ssqo, ssq, pcos, dedth[4][4]; double fakt, alpha=0.01, dedth2[4][4], diag[4], ddinv2[4][4], vt[4], dd; if (fabs(p1e) < 0.0001) { for (i = 0; i < 3; i++) r1[i] = p1[i]; } else { for (i = 0; i < 3; i++) nr1[i] = 2.0 * (r1[i] - m[i])/(SQR(a[i])); d1 = -Mtx::DotProduct(3, nr1, r1); ee[0] = Mtx::DotProduct(3, vs, r1) + vs4; ee[1] = -1.0; for (i = 0; i < 3; i++) ee[1] += SQR((r1[i] - m[i]) / a[i]); ee[2] = Mtx::DotProduct(3, nr1, r1) + d1; ee[3] = Mtx::DotProduct(3, nr1, p1) + d1; ssqo = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]); ssq = ssqo; nit = 0; while ((ssq > ELLIPSOID_TINY) && (nit < maxit)) { nit++; for (i = 0; i < 3; i++) { dedth[i][0] = vs[i]; dedth[i][1] = 2.0 * (r1[i] - m[i]) / SQR(a[i]); dedth[i][2] = 2.0 * (2.0 * r1[i] - m[i]) / SQR(a[i]); dedth[i][3] = 2.0 * p1[i] / SQR(a[i]); } dedth[3][0] = 0.0; dedth[3][1] = 0.0; dedth[3][2] = 1.0; dedth[3][3] = 1.0; MAKE_3DVECTOR21(p1, r1, p1r1); Mtx::Normalize(3, p1r1, p1r1); MAKE_3DVECTOR21(p1, m, p1m); Mtx::Normalize(3, p1m, p1m); pcos = Mtx::DotProduct(3, p1r1, p1m); if (pcos > 0.1) dd = 1.0 - pow(pcos, 100); else dd = 1.0; for (i = 0; i < 4; i++) { v[i] = 0.0; for (j = 0; j < 4; j++) v[i] -= dedth[i][j] * ee[j]; } for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { dedth2[i][j] = 0.0; for (k = 0; k < 4; k++) dedth2[i][j] += dedth[i][k] * dedth[j][k]; } } for (i = 0; i < 4; i++) diag[i] = dedth2[i][i]; nit2 = 0; while ((ssq >= ssqo) && (nit2 < maxit2)) { for (i = 0; i < 4; i++) dedth2[i][i] = diag[i] * (1.0 + alpha); Mtx::Invert(4, &dedth2[0][0], &ddinv2[0][0]); for (i = 0; i < 4; i++) { vt[i] = 0.0; for (j = 0; j < 4; j++) vt[i] += dd * ddinv2[i][j] * v[j] / 16.0; } for (i = 0; i < 3; i++) r1[i] += vt[i]; d1 += vt[3]; for (i = 0; i < 3; i++) nr1[i] = 2.0 * (r1[i] - m[i])/SQR(a[i]); ee[0] = Mtx::DotProduct(3, vs, r1) + vs4; ee[1] = -1.0; for (i = 0; i < 3; i++) ee[1] += SQR((r1[i] - m[i])/a[i]); ee[2] = Mtx::DotProduct(3, nr1, r1) + d1; ee[3] = Mtx::DotProduct(3, nr1, p1) + d1; ssqo = ssq; ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]); alpha *= 4.0; nit2++; } alpha /= 8.0; fakt = 0.5; nit2 = 0; while ((ssq <= ssqo) && (nit2 < maxit2)) { fakt *= 2.0; for (i = 0; i < 3; i++) r1[i] += vt[i] * fakt; d1 += vt[3] * fakt; for (i = 0; i < 3; i++) nr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]); ee[0] = Mtx::DotProduct(3, vs, r1) + vs4; ee[1] = -1.0; for (i=0; i<3; i++) ee[1] += SQR((r1[i] - m[i]) / a[i]); ee[2] = Mtx::DotProduct(3, nr1, r1) + d1; ee[3] = Mtx::DotProduct(3, nr1, p1) + d1; ssqo = ssq; ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]); nit2++; } for (i = 0; i < 3; i++) r1[i] -= vt[i] * fakt; d1 -= vt[3] * fakt; for (i=0; i<3; i++) nr1[i] = 2.0 * (r1[i] - m[i]) / SQR(a[i]); ee[0] = Mtx::DotProduct(3, vs, r1) + vs4; ee[1] = -1.0; for (i = 0; i < 3; i++) ee[1] += SQR((r1[i] - m[i]) / a[i]); ee[2] = Mtx::DotProduct(3, nr1, r1) + d1; ee[3] = Mtx::DotProduct(3, nr1, p1) + d1; ssq = SQR(ee[0]) + SQR(ee[1]) + SQR(ee[2]) + SQR(ee[3]); ssqo = ssq; } } return 1; } //_____________________________________________________________________________ /** * Calculate the distance over the surface between two points on an ellipsoid. * All quantities are normalized. * * @param r1 The first point on the surface * @param r2 The second point on the surface * @param m Center of the ellipsoid * @param a Axes of the ellipsoid * @param vs Orientation plane vector * @param vs4 Orientation plane coefficient * @param far_side_wrap Whether or not the wrapping is the long way around * @param aWrapResult The wrapping results (tangent points, etc.) */ void WrapEllipsoid::CalcDistanceOnEllipsoid(SimTK::Vec3& r1, SimTK::Vec3& r2, SimTK::Vec3& m, SimTK::Vec3& a, SimTK::Vec3& vs, double vs4, bool far_side_wrap, WrapResult& aWrapResult) const { int i, j, k, l, imax, numPathSegments; SimTK::Vec3 u, ux, a0, ar1, ar2, vsy, vsz, t, r, f1, f2, dr, dv; double phi, dphi, phi0, len, mu, aa, bb, cc, mu3, s[500][3], r0[3][3], rphi[3][3], desiredSegLength = 0.001; MAKE_3DVECTOR21(r1, r2, dr); len = Mtx::Magnitude(3, dr) / aWrapResult.factor; if (len < desiredSegLength) { // If the distance between r1 and r2 is very small, then don't bother // calculating wrap points along the surface of the ellipsoid. // Just use r1 and r2 as the surface points and return the distance // between them as the distance along the ellipsoid. aWrapResult.wrap_pts.setSize(0); //SimmPoint p1(r1); aWrapResult.wrap_pts.append(r1); //SimmPoint p2(r2); aWrapResult.wrap_pts.append(r2); aWrapResult.wrap_path_length = len * aWrapResult.factor; // the length is unnormalized later return; } else { // You don't know the wrap length until you divide it // into N pieces and add up the lengths of each one. // So calculate N based on the distance between r1 and r2. // desiredSegLength should really depend on the units of // the model, but for now assume it's in meters and use 0.001. numPathSegments = (int) (len / desiredSegLength); if (numPathSegments <= 0) { aWrapResult.wrap_path_length = len; return; } else if (numPathSegments > 499) numPathSegments = 499; } int numPathPts = numPathSegments + 1; int numInteriorPts = numPathPts - 2; ux[0] = 1.0; ux[1] = 0.0; ux[2] = 0.0; imax = 0; for (i = 1; i < 3; i++) if (fabs(vs[i]) > fabs(vs[imax])) imax = i; u[0] = u[1] = u[2] = 0.0; u[imax] = 1.0; mu = (-Mtx::DotProduct(3, vs, m) - vs4) / Mtx::DotProduct(3, vs, u); for (i=0;i<3;i++) a0[i] = m[i] + mu * u[i]; MAKE_3DVECTOR21(r1, a0, ar1); Mtx::Normalize(3, ar1, ar1); MAKE_3DVECTOR21(r2, a0, ar2); Mtx::Normalize(3, ar2, ar2); phi0 = acos(Mtx::DotProduct(3, ar1, ar2)); if (far_side_wrap) dphi = - (2 * SimTK_PI - phi0) / (double) numPathSegments; else dphi = phi0 / (double) numPathSegments; Mtx::CrossProduct(ar1, ar2, vsz); Mtx::Normalize(3, vsz, vsz); Mtx::CrossProduct(vsz, ar1, vsy); for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { rphi[i][j] = 0.0; r0[i][j] = 0.0; } } for (i = 0; i < 3; i++) { r0[i][0] = ar1[i]; r0[i][1] = vsy[i]; r0[i][2] = vsz[i]; } rphi[2][2] = 1; for (i = 0; i < numInteriorPts; i++) { phi = (i + 1) * dphi; rphi[0][0] = cos(phi); rphi[0][1] = -sin(phi); rphi[1][0] = sin(phi); rphi[1][1] = cos(phi); for (j = 0; j < 3; j++) { r[j] = 0.0; for (k = 0; k < 3; k++) { t[k] = 0.0; for (l = 0; l < 3; l++) t[k] += rphi[k][l] * ux[l]; r[j] += r0[j][k] * t[k]; } } for (j = 0; j < 3; j++) { f1[j] = r[j]/a[j]; f2[j] = (a0[j] - m[j])/a[j]; } aa = Mtx::DotProduct(3, f1, f1); bb = 2.0 * (Mtx::DotProduct(3, f1, f2)); cc = Mtx::DotProduct(3, f2, f2) - 1.0; mu3 = (-bb + sqrt(SQR(bb) - 4.0 * aa * cc)) / (2.0 * aa); for (j = 0; j < 3; j++) s[i][j] = a0[j] + mu3 * r[j]; } aWrapResult.wrap_pts.setSize(0); //SimmPoint p1(r1); aWrapResult.wrap_pts.append(r1); for (i = 0; i < numInteriorPts; i++) { Vec3 spt(Vec3::getAs(&s[i][0])); aWrapResult.wrap_pts.append(spt); } //SimmPoint p2(r2); aWrapResult.wrap_pts.append(r2); aWrapResult.wrap_path_length = 0.0; for (i = 0; i < numPathSegments; i++) { Vec3 p = aWrapResult.wrap_pts.get(i); Vec3 q = aWrapResult.wrap_pts.get(i+1); MAKE_3DVECTOR21(q, p, dv); aWrapResult.wrap_path_length += dv.norm(); //Mtx::Magnitude(3, dv); } } //_____________________________________________________________________________ /** * Calculate the point on an ellipsoid that is closest to a point in 3D space. * This function is courtesy of Dave Eberly, Graphics Gems IV. * * Input: Ellipsoid (x/a)^2+(y/b)^2+(z/c)^2 = 1, point (u,v,w). * * Output: Closest point (x,y,z) on ellipsoid to (u,v,w), function returns * the distance sqrt((x-u)^2+(y-v)^2+(z-w)^2). * * @param a X dimension of the ellipsoid * @param b Y dimension of the ellipsoid * @param c Z dimension of the ellipsoid * @param u X coordinate of the point in space * @param v Y coordinate of the point in space * @param w Z coordinate of the point in space * @param x X coordinate of the closest point * @param y Y coordinate of the closest point * @param z Z coordinate of the closest point * @param specialCaseAxis For dealing with uvw points near a major axis * @return The distance between the ellipsoid and the point in space */ double WrapEllipsoid::findClosestPoint(double a, double b, double c, double u, double v, double w, double* x, double* y, double* z, int specialCaseAxis) const { // Graphics Gems IV algorithm for computing distance from point to // ellipsoid (x/a)^2 + (y/b)^2 +(z/c)^2 = 1. The algorithm as stated // is not stable for points near the coordinate planes. The first part // of this code handles those points separately. int i,j; // handle points near the coordinate planes by reducing the problem // to a 2-dimensional pt-to-ellipse. // // if uvw is close to more than one coordinate plane, pick the 2d // elliptical cross-section with the narrowest radius. if (specialCaseAxis < 0) { double uvw[3], minEllipseRadiiSum = SimTK::Infinity; uvw[0] = u; uvw[1] = v; uvw[2] = w; for (i = 0; i < 3; i++) { if (EQUAL_WITHIN_ERROR(0.0,uvw[i])) { double ellipseRadiiSum = 0; for (j = 0; j < 3; j++) if (j != i) ellipseRadiiSum += _dimensions[j]; if (minEllipseRadiiSum > ellipseRadiiSum) { specialCaseAxis = i; minEllipseRadiiSum = ellipseRadiiSum; } } } } if (specialCaseAxis == 0) // use elliptical cross-section in yz plane { *x = u; return closestPointToEllipse(b, c, v, w, y, z); } if (specialCaseAxis == 1) // use elliptical cross-section in xz plane { *y = v; return closestPointToEllipse(c, a, w, u, z, x); } if (specialCaseAxis == 2) // use elliptical cross-section in xy plane { *z = w; return closestPointToEllipse(a, b, u, v, x, y); } // if we get to here, then the point is not close to any of the major planes, // so we can solve the general case. { double a2 = a*a, b2 = b*b, c2 = c*c; double u2 = u*u, v2 = v*v, w2 = w*w; double a2u2 = a2*u2, b2v2 = b2*v2, c2w2 = c2*w2; double dx, dy, dz, t, f; // initial guess if ( (u/a)*(u/a) + (v/b)*(v/b) + (w/c)*(w/c) < 1.0 ) { t = 0.0; } else { double max = a; if ( b > max ) max = b; if ( c > max ) max = c; t = max*sqrt(u*u+v*v+w*w); } for (i = 0; i < 64; i++) { double P = t+a2, P2 = P*P; double Q = t+b2, Q2 = Q*Q; double R = t+c2, _R2 = R*R; double PQ, PR, QR, PQR, fp; f = P2*Q2*_R2 - a2u2*Q2*_R2 - b2v2*P2*_R2 - c2w2*P2*Q2; if ( fabs(f) < 1e-09 ) { *x = a2 * u / P; *y = b2 * v / Q; *z = c2 * w / R; dx = *x - u; dy = *y - v; dz = *z - w; return sqrt(dx*dx+dy*dy+dz*dz); } PQ = P*Q; PR = P*R; QR = Q*R; PQR = P*Q*R; fp = 2.0*(PQR*(QR+PR+PQ)-a2u2*QR*(Q+R)-b2v2*PR*(P+R)-c2w2*PQ*(P+Q)); t -= f/fp; } } return -1.0; } //_____________________________________________________________________________ /** * Calculate the point on an ellipse that is closest to a point in 2D space. * This function is courtesy of Dave Eberly, Graphics Gems IV. * * Input: Ellipse (x/a)^2+(y/b)^2 = 1, point (u,v). * * Output: Closest point (x,y) on ellipse to (u,v), function returns * the distance sqrt((x-u)^2+(y-v)^2). * * @param a X dimension of the ellipse * @param b Y dimension of the ellipse * @param u X coordinate of point on ellipse * @param v Y coordinate of point on ellipse * @param x X coordinate of closest point * @param y Y coordinate of closest point * @return Distance between uv point and ellipse */ double WrapEllipsoid::closestPointToEllipse(double a, double b, double u, double v, double* x, double* y) const { // Graphics Gems IV algorithm for computing distance from point to // ellipse (x/a)^2 + (y/b)^2 = 1. The algorithm as stated is not stable // for points near the coordinate axes. The first part of this code // handles those points separately. double a2 = a*a, b2 = b*b; double u2 = u*u, v2 = v*v; double a2u2 = a2*u2, b2v2 = b2*v2; double dx, dy, xda, ydb; int i, which; double t, P, Q, P2, Q2, f, fp; bool nearXOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,u); bool nearYOrigin = (bool) EQUAL_WITHIN_ERROR(0.0,v); // handle points near the coordinate axes if (nearXOrigin && nearYOrigin) { if (a < b) { *x = (u < 0.0 ? -a : a); *y = v; return a; } else { *x = u; *y = (v < 0.0 ? -b : b); return b; } } if (nearXOrigin) // u == 0 { if ( a >= b || fabs(v) >= b - a2/b ) { *x = u; *y = ( v >= 0 ? b : -b ); dy = *y - v; return fabs(dy); } else { *y = b2 * v / (b2-a2); dy = *y - v; ydb = *y / b; *x = a * sqrt(fabs(1 - ydb*ydb)); return sqrt(*x * *x + dy*dy); } } if (nearYOrigin) // v == 0 { if ( b >= a || fabs(u) >= a - b2/a ) { *x = ( u >= 0 ? a : -a ); dx = *x - u; *y = v; return fabs(*x - u); } else { *x = a2 * u / (a2-b2); dx = *x - u; xda = *x / a; *y = b * sqrt(fabs(1 - xda*xda)); return sqrt(dx*dx + *y * *y); } } // initial guess if ( (u/a)*(u/a) + (v/b)*(v/b) < 1.0 ) { which = 0; t = 0.0; } else { double max = a; which = 1; if ( b > max ) max = b; t = max * sqrt(u*u + v*v); } for (i = 0; i < 64; i++) { P = t+a2; P2 = P*P; Q = t+b2; Q2 = Q*Q; f = P2*Q2 - a2u2*Q2 - b2v2*P2; if ( fabs(f) < 1e-09 ) break; fp = 2.0 * (P*Q*(P+Q) - a2u2*Q - b2v2*P); t -= f / fp; } *x = a2 * u / P; *y = b2 * v / Q; dx = *x - u; dy = *y - v; return sqrt(dx*dx + dy*dy); }
[ "tgeijten@gmail.com" ]
tgeijten@gmail.com
7e0d7222e0414e19c45728c7e67955b28b2eb761
16e130599e881b7c1782ae822f3c52d88eac5892
/leetcode/binaryTreeLongestConsecutiveSequence/mySol2.cpp
074e8aeac8d4b6ec704d8c19a66bb54e989a35ed
[]
no_license
knightzf/review
9b40221a908d8197a3288ba3774651aa31aef338
8c716b13b5bfba7eafc218f29e4f240700ae3707
refs/heads/master
2023-04-27T04:43:36.840289
2023-04-22T22:15:26
2023-04-22T22:15:26
10,069,788
0
0
null
null
null
null
UTF-8
C++
false
false
575
cpp
#include "header.h" class Solution { public: int longestConsecutive(TreeNode* root) { int res = 0; function<void(TreeNode*, TreeNode*, int)> dfs = [&](TreeNode* node, TreeNode* parent, int len) { if(!node) return; if(parent && node->val == parent->val + 1) ++len; else len = 1; res = max(res, len); dfs(node->left, node, len); dfs(node->right, node, len); }; dfs(root, nullptr, 1); return res; } }; int main() { //Solution s; }
[ "knightzf@gmail.com" ]
knightzf@gmail.com
8b1ab037d965b87d282d0e5d114e9eee986265a3
69dd4bd4268e1c361d8b8d95f56b5b3f5264cc96
/GPU Zen1/04_Screen Space/03_Practical Gather-based Bokeh Depth of Field/include/math/types.h
fbb0085133055aa6cedafbed5026d1740e777d66
[ "MIT" ]
permissive
AnabaenaQing/Source-Code_ShaderX_GPU-Pro_GPU-Zen
65c16710d1abb9207fd7e1116290336a64ddfc86
f442622273c6c18da36b61906ec9acff3366a790
refs/heads/master
2022-12-15T00:40:42.931271
2020-09-07T16:48:25
2020-09-07T16:48:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
487
h
#pragma once namespace NMath { struct Vector2 { float x, y; }; struct Vector3 { float x, y, z; }; struct Vector4 { float x, y, z, w; }; struct Quaternion { float x, y, z, w; }; struct Plane { float a, b, c, d; }; struct Matrix { union { float m[4][4]; struct { Vector4 x, y, z, w; }; }; }; struct Spherical { float theta, phi; // theta in [0..Pi], phi in [0..2*Pi] }; enum class ZRange { ZeroToOne, MinusOneToPlusOne }; }
[ "IRONKAGE@gmail.com" ]
IRONKAGE@gmail.com
d5aba366ee97e029b9608452c582e8c98029e477
1b60384e6e4399fa5e24e5d2ddfc5e0ff08c591a
/452.cpp
1f4f21ef47d9e02de1d9933ffc482479d14727d6
[]
no_license
brightnesss/exercise-of-code
2cda6309b2e91474f360b0c1009e63212385bf91
d3bad9f313269d95016e173b83c38c80dca47ac4
refs/heads/master
2021-01-23T06:01:54.464044
2018-01-08T06:17:24
2018-01-08T06:17:24
86,332,497
0
0
null
null
null
null
UTF-8
C++
false
false
2,526
cpp
//leetcode No.452 Minimum Number of Arrows to Burst Balloons /* * There are a number of spherical balloons spread in two-dimensional space. * For each balloon, provided input is the start and end coordinates of the horizontal diameter. * Since it's horizontal, y-coordinates don't matter and hence the x-coordinates of start and end of the diameter suffice. * Start is always smaller than end. There will be at most 104 balloons. * An arrow can be shot up exactly vertically from different points along the x-axis. * A balloon with xstart and xend bursts by an arrow shot at x if xstart ≤ x ≤ xend. There is no limit to the number of arrows that can be shot. * An arrow once shot keeps travelling up infinitely. The problem is to find the minimum number of arrows that must be shot to burst all balloons. * Example: * Input: * [[10,16], [2,8], [1,6], [7,12]] * Output: * 2 * Explanation: * One way is to shoot one arrow for example at x = 6 (bursting the balloons [2,8] and [1,6]) and another arrow at x = 11 (bursting the other two balloons). */ int findMinArrowShots(vector<pair<int, int>>& points) { //如果两个气球有重叠,则可以一起扎破 //如果有重叠,计算它们的重叠区域,并保存,之后用这个重叠区域与其他气球再比较 sort(points.begin(), points.end()); vector<pair<int, int>> bin; for (int i = 0;i != points.size();++i) { if (i == 0) bin.push_back(points[i]); else { bool isfind(false); for (int j = 0;j != bin.size();++j) { if (points[i].first > bin[j].second || bin[j].first > points[i].second) continue; else { bin[j].first = max(bin[j].first, points[i].first); bin[j].second = min(bin[j].second, points[i].second); isfind = true; } } if (!isfind) bin.push_back(points[i]); } } return bin.size(); } //同样的思路,用贪心法 //只记录一个重叠区域的末尾 //若points[i]与之前的末尾有交集,则可以一起扎破,再更新末尾 //若没有交集,则定义新的末尾为points[i]的末尾 int findMinArrowShots(vector<pair<int, int>>& points) { if (points.empty()) return 0; sort(points.begin(), points.end()); int ans(1); //最少需要一针扎破 int end = points[0].second; //初始的末尾为points[0].second for (int i = 1;i != points.size();++i) { if (points[i].first > end) { //若没有交集 ++ans; end = points[i].second; //定义新的末尾 } else end = min(end, points[i].second); //否则更新末尾 } return ans; }
[ "brightness_j@hotmail.com" ]
brightness_j@hotmail.com
43c4bcd20147a3001f3e2f24838a07f5ce2404ad
814d5d3d79dbb4468d82a0e57277f57b09a62c17
/darwin/Linux/project/taurabots_vision/src/FeaturePointFinder.cpp
3a56cd74a88db52d6c5843ef4482c3d7ce6107fa
[]
no_license
rsmrafael/DarwinWalking-Repository
a64ce41d8a9f80e528fae8296222fa810f292e26
b08d1fd10d36abb62fa01536de7298e83e69fd58
refs/heads/master
2021-01-10T04:30:29.684386
2015-10-08T01:06:57
2015-10-08T01:06:57
43,387,421
4
0
null
null
null
null
UTF-8
C++
false
false
15,714
cpp
#include "FeaturePointFinder.h" #include <cmath> #include <cstdio> #include <cstdlib> #define SQR(x) ((x)*(x)) using namespace Robot; using namespace std; FeaturePointFinder::FeaturePointFinder() { double angleStep = 2*M_PI / (double)TOTAL_ANGLES; double radiusStep = (double)(MAX_RADIUS - MIN_RADIUS) / (double)TOTAL_RADIUS; double angle = 0.0; // Initialize radial offsets to save runtime performance for (int angle_i = 0 ; angle_i < TOTAL_ANGLES ; angle_i++) { double radius = (double)MIN_RADIUS; mAngle[angle_i] = angle; for (int radius_i = 0 ; radius_i < TOTAL_RADIUS ; radius_i++) { if (angle_i == 0) mRadius[radius_i] = radius; dx[angle_i][radius_i] = radius*sin(angle); dy[angle_i][radius_i] = radius*cos(angle); radius += radiusStep; } angle += angleStep; } mThreshold = THRESHOLD; } void FeaturePointFinder::DrawFeaturePoints(Image *image) { for (std::list<FeaturePoint>::iterator i = mPoint.begin() ; i != mPoint.end() ; i++) { switch(i->mType) { case TYPE_UNKNOWN: break; case TYPE_POINT: VisionUtil::GetInstance()->DrawPixel( i->X, i->Y, 0, 255, 255, image); break; case TYPE_POINT_ON_LINE: VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[0], 255, 0, 0, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[1], 255, 0, 0, image); break; case TYPE_POINT_ON_L: VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[0], 0, 255, 0, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[1], 0, 255, 0, image); break; case TYPE_POINT_ON_T: VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[0], 0, 0, 255, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[1], 0, 0, 255, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[2], 0, 0, 255, image); break; case TYPE_POINT_ON_X: VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[0], 255, 0, 255, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[1], 255, 0, 255, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[2], 255, 0, 255, image); VisionUtil::GetInstance()->DrawAngle( i->X, i->Y, i->mAngle[3], 255, 0, 255, image); break; case TOTAL_TYPES: break; } } } void FeaturePointFinder::FindFeaturePoints(Image *image) { mPoint.clear(); for (int i = 0 ; i < TOTAL_TYPES ; i++) mTotals[i] = 0; for (int i = MARGIN ; i < image->m_Height-MARGIN ; i+=STEP) { for (int j = MARGIN ; j < image->m_Width-MARGIN ; j+=STEP) { // nw, n, ne // w, x, e // sw, s, se //printf("8-neighbours\n"); bool nw = VisionUtil::GetInstance()->GetBinaryPixel( i-CONTRAST_DIST,j-CONTRAST_DIST, image, mThreshold); bool n = VisionUtil::GetInstance()->GetBinaryPixel( i, j-CONTRAST_DIST, image, mThreshold); bool ne = VisionUtil::GetInstance()->GetBinaryPixel( i+CONTRAST_DIST,j-CONTRAST_DIST, image, mThreshold); bool w = VisionUtil::GetInstance()->GetBinaryPixel( i-CONTRAST_DIST,j , image, mThreshold); bool x = VisionUtil::GetInstance()->GetBinaryPixel( i ,j , image, mThreshold); bool e = VisionUtil::GetInstance()->GetBinaryPixel( i+CONTRAST_DIST,j , image, mThreshold); bool sw = VisionUtil::GetInstance()->GetBinaryPixel( i-CONTRAST_DIST,j+CONTRAST_DIST, image, mThreshold); bool s = VisionUtil::GetInstance()->GetBinaryPixel( i, j+CONTRAST_DIST, image, mThreshold); bool se = VisionUtil::GetInstance()->GetBinaryPixel( i+CONTRAST_DIST,j+CONTRAST_DIST, image, mThreshold); if (x && ((!nw && !se) || // '\' (!w && !e) || // '-' (!sw && !ne) || // '/' (!n && !s))) // '|' { // add point at i,j as candidate point double angles[4]; //printf("GetFeturePointType\n"); FeaturePointType type = GetFeaturePointType(i, j, image, angles); mTotals[type]++; mPoint.push_back(FeaturePoint(i,j,type,angles)); } } } } FeaturePointType FeaturePointFinder::GetFeaturePointType(int x0, int y0, Image *image, double *angles) { bool radials[TOTAL_ANGLES]; int lastFalseRadial = -1; int firstTrueRadial = -1; for (int angle_i = 0 ; angle_i < TOTAL_ANGLES ; angle_i++) { radials[angle_i] = true; for (int radius_i = 0 ; radius_i < TOTAL_RADIUS ; radius_i++) { int x = x0 + dx[angle_i][radius_i]; int y = y0 + dy[angle_i][radius_i]; //if (!VisionUtil::GetInstance()->GetBinaryPixel( // x ,y ,image, mThreshold)) if (!(VisionUtil::GetInstance()->GetBinaryPixel( x ,y ,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x-1,y ,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x ,y-1,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x+1,y ,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x ,y+1,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x+1,y+1,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x+1,y-1,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x-1,y+1,image, mThreshold) || VisionUtil::GetInstance()->GetBinaryPixel( x-1,y-1,image, mThreshold))) { radials[angle_i] = false; break; } } if (radials[angle_i] && firstTrueRadial == -1) { firstTrueRadial = angle_i; } else if (!radials[angle_i]) { lastFalseRadial = angle_i; } } // No radial, then type is unknown if (firstTrueRadial == -1) return TYPE_POINT; // All radials, then type is point if (lastFalseRadial == -1) return TYPE_UNKNOWN; // Wrap around to find the true first radial if (lastFalseRadial < TOTAL_ANGLES-1) { firstTrueRadial = lastFalseRadial+1; } // Mark the first radial angle double startAngle = mAngle[firstTrueRadial]; double finishAngle; int count = 0; // Set up a search for the remaining radials (if any) int angle_i_before = firstTrueRadial; int angle_i = (angle_i_before + 1) % TOTAL_ANGLES; do { if (radials[angle_i_before] == true && radials[angle_i] == false) { finishAngle = mAngle[angle_i]; angles[count] = VisionUtil::GetInstance()->AngleWrap( startAngle + VisionUtil::GetInstance()->AngleDifference( finishAngle, startAngle) / 2.0); count++; if (count == 5) break; } if (radials[angle_i_before] == false && radials[angle_i] == true) { startAngle = mAngle[angle_i]; } angle_i_before = angle_i; angle_i = (angle_i + 1) % TOTAL_ANGLES; } while (angle_i != firstTrueRadial); // If found two radials, then type is either // point on line or point on L depending on // the angle difference if (count == 2) { double angle_dif = VisionUtil::GetInstance()->GetInstance()->AngleDifference(angles[0], angles[1]); if (fabs(fabs(angle_dif) - M_PI) < MAX_ANGLE_FOR_LINE) { return TYPE_POINT_ON_LINE; } else { return TYPE_POINT_ON_L; } // If found three radials then is a T } else if (count == 3) { return TYPE_POINT_ON_T; // If found three radials then is an X } else if (count == 4) { return TYPE_POINT_ON_X; } // If none of the above, then unknown return TYPE_UNKNOWN; } void FeaturePointFinder::ProcessFrame(Image *image) { //printf("FindFeaturePoints\n"); FindFeaturePoints(image); int count = 0; while (count < 5) { count++; //printf("FindClusters\n"); FindClusters(image); } } void FeaturePointFinder::FindClusters(Image *image) { double total_X[MAX_CLUSTERS]; double total_Y[MAX_CLUSTERS]; double total_angles[MAX_CLUSTERS][4]; int total[MAX_CLUSTERS]; int angle_max = 2; for (int type = 1 ; type < TOTAL_TYPES ; type++) { if (type == TYPE_POINT_ON_T) angle_max = 3; else if (type == TYPE_POINT_ON_X) angle_max = 4; mTotalClusters[type] = MAX_CLUSTERS; for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { FeaturePoint p(rand() % image->m_Height, rand() % image->m_Width, (FeaturePointType)type); mClusters[type][k] = p; } bool not_finished = true; int count = 0; while (not_finished && count < 15) { not_finished = false; //printf("type:%d, clusters:%d, count %d\n", type, mTotalClusters[type], count); for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { total_X[k] = 0.0; total_Y[k] = 0.0; total[k] = 0; for (int angle_i = 0 ; angle_i < angle_max ; angle_i++) total_angles[k][angle_i] = 0.0; } for (std::list<FeaturePoint>::iterator i = mPoint.begin() ; i != mPoint.end() ; i++) { if (i->mType == (FeaturePointType)type) { bool firstRun = true; float minDist = 0.0; int min_k = 0; for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { float dist = i->DistanceTo(mClusters[type][k]); if (dist < minDist || firstRun) { firstRun = false; minDist = dist; min_k = k; } } total[min_k]++; total_X[min_k] += i->X; total_Y[min_k] += i->Y; for (int angle_i = 0 ; angle_i < angle_max ; angle_i++) { total_angles[min_k][angle_i] += i->mAngle[angle_i]; } } } for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { if (total[k] > 0) { total_X[k] /= (double)total[k]; total_Y[k] /= (double)total[k]; for (int angle_i = 0 ; angle_i < angle_max ; angle_i++) { total_angles[k][angle_i] /= (double)total[k]; } } else { total_X[k] = -1; } if (mClusters[type][k].X != total_X[k] || mClusters[type][k].Y != total_Y[k]) { not_finished = true; mClusters[type][k].X = total_X[k]; mClusters[type][k].Y = total_Y[k]; for (int angle_i = 0 ; angle_i < 4 ; angle_i++) { mClusters[type][k].mAngle[angle_i] = total_angles[k][angle_i]; } mClusters[type][k].mType = (FeaturePointType)type; mClusters[type][k].mCluster++; } } count++; } } for (int type = 1 ; type < TOTAL_TYPES ; type++) { for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { if (mClusters[type][k].X != -1) { bool firstRun = true; float minDist = 0.0; FeaturePoint min_p; for (std::list<FeaturePoint>::iterator i = mPoint.begin() ; i != mPoint.end() ; i++) { if (i->mType == (FeaturePointType)type) { float dist = i->DistanceTo(mClusters[type][k]); if (dist < minDist || firstRun) { firstRun = false; minDist = dist; min_p = *i; } } } if (!firstRun) { min_p.mCluster = mClusters[type][k].mCluster; mClusters[type][k] = min_p; } } } } mPoint.clear(); for (int type = 1 ; type < TOTAL_TYPES ; type++) { for (unsigned int k = 0 ; k < mTotalClusters[type] ; k++) { if (mClusters[type][k].X != -1) { mPoint.push_back(mClusters[type][k]); //printf("Adding point %f, %f type %d\n", // mClusters[type][k].X, mClusters[type][k].Y, type); } } } if (mPoint.size() > 0) { for (std::list<FeaturePoint>::iterator i = mPoint.begin() ; i != mPoint.end() ; i++) { for (std::list<FeaturePoint>::iterator j = i ; j != mPoint.end() ; j++) { float d = i->DistanceTo(*j); if (d < MIN_CLUSTER_DIST && j != i) { if (i->mCluster > j->mCluster) { j->mCluster = 0; } else if (i->mCluster < j->mCluster) { i->mCluster = 0; } else if ((int)i->mType > (int)j->mType) { j->mCluster = 0; } else { i->mCluster = 0; } } } } for (std::list<FeaturePoint>::iterator i = mPoint.begin() ; i != mPoint.end() ; i++) { if (i->mCluster == 0) { i = mPoint.erase(i); } } } }
[ "rafael.sebatiaomiranda@mail.utoronto.ca" ]
rafael.sebatiaomiranda@mail.utoronto.ca
5b69027afc730fb4e84e92f0ff0cc1be7731f994
2487c6a41e8f00b24e7f97b4251263c607f57e5a
/C&C++/2020-05-08-중간고사대리시험/2020-05-08-중간고사-3/main.cpp
359d2312d5a70b12ccae6ee4a7bed6f782eed86d
[]
no_license
0x000613/Outsourcing
1dacf34431a70950153f699f99780d59ee42e2fa
d2d9cb7111c3b12e16fe42e73150b2f6e4f7e7bc
refs/heads/master
2023-03-09T11:49:41.648198
2021-02-21T09:49:14
2021-02-21T09:49:14
329,673,001
0
0
null
null
null
null
UHC
C++
false
false
1,724
cpp
// num을 20으로 고정선언 #define num 20 #include <stdio.h> #include <math.h> int main() { /*--------------------------------------------------------------------------------------- * 파일 : main.cpp * 기능 : 중간고사 * 개발자 : 박수하 * 개발시작 : 2020-05-08 * 개발종료 : 2020-05-08 (Pass) ---------------------------------------------------------------------------------------*/ printf("*** Sorting ****\n"); // 길이가 20인 배열 생성 int number[num]{ 42, 68, 35, 1, 70, 25, 79, 59, 63, 65, 6, 46, 82, 28, 62, 92, 96, 43, 28, 37 }; // 정렬하기 전의 배열을 출력 printf("** Given Data **\n "); for (int i = 0; i < 20; i++) { // 배열의 아이템을 10개 기준으로 개행해주기 위한 조건문 if (i == 10) { printf("\n "); } printf("%d ", number[i]); } // 스왑을 하기위한 변수 선언 int temp; // 버블 정렬 알고리즘을 이용한 오름차순 정렬 for (int i = 0; i < num; i++) { for (int j = 0; j < num - i - 1; j++) { if (number[j] > number[j + 1]) { temp = number[j]; number[j] = number[j + 1]; number[j + 1] = temp; } } } printf("\n* Sorted Data**\n "); // 버블 정렬 알고리즘을 이용해 정렬된 배열을 출력 for (int i = 0; i < 20; i++) { // 정렬된 배열의 아이템을 10개 기준으로 개행해주기 위한 조건문 if (i == 10) { printf("\n "); } printf("%d ", number[i]); } // 최소값 중간값 최대값 평균 출력 float ave; float sum = 0; for (int i = 0; i < 20; i++) { sum += number[i]; ave = sum / 20; } printf("Min = %d, Max = %d, Med = %.2f, Ave = %.2f", number[0], number[19], ((float)number[9] + (float)number[10])/2, ave); }
[ "xeros.log@gmail.com" ]
xeros.log@gmail.com
2efda44c9bb9d804a6e3b92033338a387bd16606
4c9dc4a0e97f6c173ce48de7095719a1f490478d
/rush01/srcs/display/ncurses/Curses.cpp
bb8efff544424c7fe258687049a89e6022ad9bcb
[]
no_license
jt-taylor/42-cpp-piscine
e21fe2e0a2f86450e0dca65aedadb9cea77c7d6f
d6c1a2fbc2ae8c58a313136de342b9e94c2bde8d
refs/heads/master
2020-08-26T20:05:20.115475
2019-11-06T23:52:47
2019-11-06T23:52:47
217,131,397
1
0
null
null
null
null
UTF-8
C++
false
false
1,062
cpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* curses.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: viclucas <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/03 10:22:09 by viclucas #+# #+# */ /* Updated: 2019/11/03 10:49:31 by viclucas ### ########.fr */ /* */ /* ************************************************************************** */ Curses:: Curses(void) { } Curses:: ~Curses(void) { } Curses:: Curses(Curses const &name) { *this = name; } Curses:: &operator=(Curses const &name) { return *this; }
[ "jtttaylorjackson@gmail.com" ]
jtttaylorjackson@gmail.com
eff8e64016d8db690e3790df97ecb7ecaeec76f3
bf316bf6b2f6d9bc75991b7bb9015bab37835236
/divided.cpp
14e07de5b041a269fc61d226f1d1a5ce7b1c397d
[]
no_license
Alexdong8/-
c6fadeed93f98560dca713f2cccbd412f275bdec
ed0a231832a1b35e14efad6a38976098aad62607
refs/heads/master
2020-05-20T05:38:45.247562
2019-05-07T13:54:05
2019-05-07T13:54:05
185,411,949
1
0
null
null
null
null
UTF-8
C++
false
false
7,684
cpp
#include <iostream> #include<set> #include<algorithm> #include<vector> #include<ctime> using namespace std; const int maxn = 10005; const double PI = acos(-1.0); const int point_max_loc = 1000; typedef struct point { int x; int y; } point; point p[maxn],ans[maxn],que[maxn]; set<pair<int, int> > s; int n; int top; int visit[maxn], mark[maxn]; vector<int> stack(maxn,-1); vector<int> stackfenzhi; int judge(point p1, point p2, point p3) { int flag = p1.x * p2.y + p3.x * p1.y + p2.x * p3.y - p3.x * p2.y - p2.x * p1.y - p1.x * p3.y; if (flag > 0) return 1; else if (flag == 0) return 2; else return 0; } int Djudge(point a1, point a2, point a3) { int calculate = a1.x*a2.y + a3.x*a1.y + a2.x*a3.y - a3.x*a2.y - a2.x*a1.y - a1.x*a3.y; return calculate; } bool cmpxy(const point a, const point b) //按x轴排序,如果x相同,按y轴排序 { if (a.x != b.x) return a.x < b.x; else return a.y < b.y; } void DealLeft(int first, int last) { int max = 0, index = -1; int i = first; if (first < last) { for (i = first + 1; i < last; i++) //注意两端,对于first和last,没必要再进行计算 { int calcu = Djudge(p[first], p[i], p[last]); if (calcu == 0) { visit[i] = 1; } // if (calcu > max) { max = calcu; index = i; } } } else { for (i = first + 1; i >last; i--) //如果first>last,重复上述过程,注意这里下界不是0. { int calcu = Djudge(p[first], p[i], p[last]); if (calcu == 0) { visit[i] = 1; } // if (calcu > max) { max = calcu; index = i; } } } if (index != -1) { visit[index] = 1; //对取到的点进行标注   stackfenzhi.push_back(index); DealLeft(first, index); DealLeft(index, last);//分治的部分 } } void swap(point p[], int i, int j) { point tmp; tmp = p[i]; p[i] = p[j]; p[j] = tmp; } double multi(point p1, point p2, point p0) //极角的比较 { return ((p1.x - p0.x)*(p2.y - p0.y) - (p1.y - p0.y)*(p2.x - p0.x)); } double distence(point p1, point p2) //p1,p2的距离 { return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y)); } int cmp(const void *a, const void *b) { point *c = (point *)a; point *d = (point *)b; double k = multi(*c, *d, p[0]); if (k<0) return 1; else if (k == 0 && distence(*c, p[0]) > distence(*d, p[0])) return 1; //极角相同,比距离 else return -1; } void grahamscan(int n) { int i, u; u = 0; for (i = 1; i <= n - 1; i++) //找到最左下的点p0 if ((p[i].y < p[u].y) || (p[i].y == p[u].y&&p[i].x < p[u].x)) u = i; swap(p, 0, u); qsort(p + 1, n - 1, sizeof(p[0]), cmp); //按极角排序 // for (int i = 0; i < n; i++) { // cout << "(" << p[i].x << " , " << p[i].y << ") "; // } //sort(p, p + n-1, cmp); for (i = 0; i <= 2; i++) stack[i]=i; //p0,p1,p2入栈 top = 2; for (i = 3; i <= n - 1; i++) //最终凸包的各顶点的编号依次存在stack[]中。 { while (top >= 1&&multi(p[stack[top]],p[i], p[stack[top - 1]]) < 0) //弹出非左转的点 { //if (top == 1)break; top--; //if (top == 0)break; } top++; stack[top] = i; } } double polygonArea(int n, point p[]) { double area; int i; area = 0; for (i = 1; i <= n; i++) { area += (p[stack[i - 1]].x * p[stack[i % n]].y - p[stack[i % n]].x * p[stack[i - 1]].y); } return fabs(area) / 2; } void rand100(point p[],int pointnum) { int num = 100; int x, y; point temp[4]; temp[0].x = 0; temp[0].y = 0; temp[1].x = 100; temp[1].y = 0; temp[2].x = 0; temp[2].y = 100; temp[3].x = 100; temp[3].y = 100; for (int i = 0; i < pointnum; i++) { x = rand() % num; y = rand() % num; p[i].x = x; p[i].y = y; } for (int i = 0; i < 4; i++) { x = rand() % pointnum; //y = rand() % num; p[x].x = temp[i].x; p[x].y = temp[i].y; //swap(p, x, y); } } void rand_suiji(point p[],int num) { int x, y; for (int i = 0; i < num ; i++) { x = rand() % point_max_loc; y = rand() % point_max_loc; p[i].x = x; p[i].y = y; } } void rand_suiji_num(point p[], int num) { int x, y; for (int i = 0; i < num ; i++) { x = rand() % num; y = rand() % num; p[i].x = x; p[i].y = y; } } int main() { cout << "请输入坐标点的个数 "; cout << endl; cin >> n; //int num = 100; rand_suiji(p, n); //rand100(p, n); //rand_suiji_num(p, n); cout << endl; //for (int i = 0; i < n; i++) { // cout << "("<<p[i].x << " , " << p[i].y <<") "; //} //cout << endl<<endl; cout << "请输入一个数,1表示蛮力法,2表示分治法,3表示Graham Scan法" << endl; int i; cin >> i; while (i > 0 && i < 4) { switch (i) { case 1: { //cout << "请输入各点的坐标 " << endl; //for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y; s.clear(); clock_t starttime = clock(); for (int i = 0; i < n; i++) { int t = 0; for (int j = 0; j < n; j++) { int flag = -1; if (i == j) continue; for (int k = 0; k < n; k++) { if (k == i || k == j) continue; if (flag == -1) flag = judge(p[i], p[j], p[k]); else { int temp = judge(p[i], p[j], p[k]); if (flag == temp || temp == 2) t = 1; else { t = 0; break; } } } if (t) s.insert(make_pair(p[j].x, p[j].y)); } if (t) s.insert(make_pair(p[i].x, p[i].y)); } cout << "蛮力法运行时间为: " << double(clock() - starttime) << " ms" << endl; set<pair<int, int> >::iterator it = s.begin(); /* cout << "结果集合中点的坐标为:" << endl<<endl; while (it != s.end()) { printf("(%d , %d) ", it->first, it->second); it++; } */ cout << endl; break; } case 2: { for (int i = 0; i < n; i++) { //cin >> p[i].x >> p[i].y; visit[i] = 0; } visit[0] = 1; visit[n - 1] = 1; sort(p, p + n, cmpxy); stackfenzhi.push_back(0); stackfenzhi.push_back(n-1); clock_t starttime = clock(); DealLeft(0, n - 1); //上边 DealLeft(n - 1, 0); //下包 cout << "分治法运行时间为: " << double(clock() - starttime) << " ms" << endl; int t = 0; /* cout << "结果集合中点的坐标为:" << endl<<endl; /* for (int i = 0; i < n; i++) { if (visit[i] == 1) { cout << "(" << p[i].x << " , " << p[i].y << ") " ; } } for (int i = 0; i < stackfenzhi.size(); i++) { cout << "(" << p[stackfenzhi[i]].x << " , " << p[stackfenzhi[i]].y << ") "; } */ cout << endl; break; } case 3: { //int a; /* cout << "请输入各点的坐标 " << endl; int i; for (i = 0; i < n; i++) cin >> p[i].x >> p[i].y; */ clock_t starttime = clock(); grahamscan(n); cout << "Graham Scan法运行时间为: " << double(clock() - starttime) << " ms" << endl; // printf("%lf\n", polygonArea(n, p)); vector<int>::iterator it = stack.begin(); //cout << stack.size(); /* cout << "结果集合中点的坐标为:" << endl<<endl; //cout << stack.size() << endl; while (*it != -1) { printf("(%d , %d) ", p[*it].x, p[*it].y); it++; } */ cout << endl; break; } default: //cout << "byebye" << endl; break; } //cout << endl; cout << "请输入一个数,1表示蛮力法,2表示分治法,3表示Graham Scan法" << endl; cin >> i; } return 0; }
[ "noreply@github.com" ]
noreply@github.com
19374537c078dfc88be9d1f7aea0400323aa214a
5d83739af703fb400857cecc69aadaf02e07f8d1
/Archive2/0b/57b1a9b1972901/main.cpp
b3a4a2a44adda2bbb546cb94cd8f5a4082505142
[]
no_license
WhiZTiM/coliru
3a6c4c0bdac566d1aa1c21818118ba70479b0f40
2c72c048846c082f943e6c7f9fa8d94aee76979f
refs/heads/master
2021-01-01T05:10:33.812560
2015-08-24T19:09:22
2015-08-24T19:09:22
56,789,706
3
0
null
null
null
null
UTF-8
C++
false
false
3,233
cpp
// Ensure two vector<int>s are equivalent sizes first, then add them together. // Author: LLD!5DeRpYLOvE // Respin of: http://coliru.stacked-crooked.com/a/34542cba6c40b27b #include <iostream> #include <vector> using namespace std; // All C++ programs begin execution here at main()!! int main () { int sizediff{0}; // Always good developer form to immediately initialize a variable. //*** EDIT *** // What if it was the FIRST vector v1 that was shorter, and v2 was // longer instead? (Plz try that inside your original code linked above.) // >OH NOES!! :O vector<int> v1{20, 30, 90, 2, 42}; // First vector v1 is smaller in length (5). vector<int> v2{1, 2, -3, 4, 5, 6, 7, 0}; // Second vector v2 is larger in length (8). const size_t s1{v1.size()}; const size_t s2{v2.size()}; cout << "Original sizes:\n V1 equals " << s1 << "\n V2 Equals " << s2 << endl; // First case: v1 is bigger. if(s1 > s2) { //This test statement says that if the length of v1 is greater than the length of v2 sizediff = s1 - s2; //sizediff will now be the difference between the first and second vector sizes //This loop states that it will add a new value onto the smallest vector for as many times //as there are more elements inside the largest vector. for(int idk = 0; idk < sizediff; idk++) //*** EDIT *** // Let's push_back() on v2 which would be shorter in this case. v2.push_back(0); } //*** EDIT *** // What if the vectors are equal in length? // So, let's make this code block into a second if() test instance here instead. // Second case: v2 is bigger. else if(s2 > s1) { // This test statement checks if the size of vector 2 is greater than the size of vector 1. //*** EDIT *** // Let's swap the subtraction around, so we don't wind up getting a negative number. sizediff = s2 - s1; //sizediff will now be the difference between the second and first vector sizes //This loop states that it will add a new value onto the smallest vector for as many times //as there are more elements inside the largest vector. for(int idk = 0; idk < sizediff; idk++) //*** EDIT *** // Let's push_back() on v1 which would be shorter in this case. v1.push_back(0); } //*** EDIT *** // For this third case, the vectors are equivalent in length. // Third case: equivalent sizes. else sizediff = 0; cout << "New sizes:\n V1 equals " << v1.size() << "\n V2 Equals " << v2.size() << "\n sizediff equals " << sizediff << endl; //This is just to print the new sizes for v1 and v2, and to tell you what was the size difference const size_t sz{v1.size()}; //This shall make the variable sz based on the size of v1 or v1 //It doesn't matter what you pick since they are now the same length. vector<int> datsumdoe(sz); for(size_t idy = 0; idy < sz; ++idy){ //This is to add all the vectors together accordingly datsumdoe[idy] = v1[idy] + v2[idy]; //making sure every value is accounted for. cout << datsumdoe[idy] << endl;} } //Tada!~
[ "francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df" ]
francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df
a626c4bbcfc0d877116eee98b3d322599bad9af6
72963f3181e08adea8a7e5991885b2d47a90d30d
/JumpToDisasm/main.cpp
537bdc1a7f533dc70a915946098186435e6e1f18
[]
no_license
IDAPlugins/JumpToDisasm
8f663d1e90bc4b8e03ad4c880427cb27d0439590
68840811e274ee2f1b1b7f1861186c10209ddb31
refs/heads/master
2022-11-18T08:31:34.428759
2020-07-16T13:27:28
2020-07-16T13:27:28
280,038,865
2
0
null
null
null
null
UTF-8
C++
false
false
3,440
cpp
#include <windows.h> #include <tchar.h> #include <hexrays.hpp> #include <functional> extern plugin_t PLUGIN; // Hex-Rays API pointer hexdsp_t *hexdsp = NULL; namespace { static bool inited = false; // Hotkey for the new command static const char hotkey_gd[] = "J"; } // show disassembly line for ctree->item bool idaapi decompiled_line_to_disasm_cb(void *ud) { vdui_t &vu = *(vdui_t *)ud; vu.ctree_to_disasm(); vu.get_current_item(USE_KEYBOARD); citem_t *highlight = vu.item.is_citem() ? vu.item.e : NULL; return true; } //-------------------------------------------------------------------------- // This callback handles various hexrays events. static ssize_t idaapi callback(void *ud, hexrays_event_t event, va_list va) { switch (event) { case hxe_populating_popup: { TWidget *widget = va_arg(va, TWidget *); TPopupMenu *popup = va_arg(va, TPopupMenu *); vdui_t &vu = *va_arg(va, vdui_t *); // add new command to the popup menu attach_action_to_popup(vu.ct, popup, "codexplorer::jump_to_disasm"); } break; default: break; } return 0; } namespace { class MenuActionHandler : public action_handler_t { public: typedef std::function<bool(void *)> handler_t; MenuActionHandler(handler_t handler) : handler_(handler) { } virtual int idaapi activate(action_activation_ctx_t *ctx) { auto vdui = get_widget_vdui(ctx->widget); return handler_(vdui) ? TRUE : FALSE; } virtual action_state_t idaapi update(action_update_ctx_t *ctx) { return ctx->widget_type == BWN_PSEUDOCODE ? AST_ENABLE_FOR_WIDGET : AST_DISABLE_FOR_WIDGET; } private: handler_t handler_; }; static MenuActionHandler kJumpToDisasmHandler{ decompiled_line_to_disasm_cb }; static action_desc_t kActionDescs[] = { ACTION_DESC_LITERAL("codexplorer::jump_to_disasm", "Jump to Disasm", &kJumpToDisasmHandler, hotkey_gd, nullptr, -1), }; } //-------------------------------------------------------------------------- // Initialize the plugin. int idaapi init() { if (!init_hexrays_plugin()) return PLUGIN_SKIP; // no decompiler for (unsigned i = 0; i < _countof(kActionDescs); ++i) register_action(kActionDescs[i]); install_hexrays_callback((hexrays_cb_t *)callback, nullptr); inited = true; return PLUGIN_KEEP; } //-------------------------------------------------------------------------- void idaapi term() { if (inited) { remove_hexrays_callback((hexrays_cb_t *)callback, NULL); term_hexrays_plugin(); } } //-------------------------------------------------------------------------- bool idaapi run(size_t) { // This function won't be called because our plugin is invisible (no menu // item in the Edit, Plugins menu) because of PLUGIN_HIDE return true; } static const char comment[] = "JumpToDisasm plugin"; //-------------------------------------------------------------------------- // // PLUGIN DESCRIPTION BLOCK // //-------------------------------------------------------------------------- plugin_t PLUGIN = { IDP_INTERFACE_VERSION, PLUGIN_HIDE, // plugin flags init, // initialize term, // terminate. this pointer may be NULL. run, // invoke plugin comment, // long comment about the plugin // it could appear in the status line or as a hint "", // multiline help about the plugin "JumpToDisasm", // the preferred short name of the plugin (PLUGIN.wanted_name) "" // the preferred hotkey to run the plugin };
[ "humangamer.dev@hotmail.com" ]
humangamer.dev@hotmail.com
621751b04e493f3853555f3b44c6b25058c97685
88678d6377075eb1589fb53e59c908dbc7f26071
/angel_1_1/Code/VineDraw/GameScreen.cpp
df7b61433abe5fcbbd1c74d91c3452f5e6f9492e
[]
no_license
chrishaukap/GameDev
89d76eacdae34ae96e83496f2c34c61e101d2600
fb364cea6941e9b9074ecdd0d9569578efb0f937
refs/heads/master
2020-05-28T11:23:41.750257
2013-08-08T21:59:30
2013-08-08T21:59:30
2,401,748
1
0
null
null
null
null
UTF-8
C++
false
false
287
cpp
#include "StdAfx.h" #include "GameScreen.h" #include "World.h" void GameScreen::Start() {} void GameScreen::Stop() { std::vector<Renderable*>::iterator it = m_objects.begin(); while(m_objects.end() != it) { theWorld.Remove(*it); delete *it; it++; } m_objects.clear(); }
[ "" ]
ca0c4ab4a49318099d97809b896eb2d7295d91d6
f56f9e9e8b0afd5f00134f328149570c750ab714
/Advanced/NQueen.cpp
413c02638e43d91b29c15d31ec766cf95813b8d6
[ "Apache-2.0" ]
permissive
justgoofingaround/IOSD-UIETKUK-HacktoberFest-Meetup-2019
0eb6719a43cb6686bca82d15e6a9091d4b62d8cc
498995901125a0d7924035e6e2d355bfc8630a13
refs/heads/master
2022-02-23T21:07:08.110820
2019-10-13T07:13:38
2019-10-13T07:13:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,448
cpp
#define N 4 #include <stdbool.h> #include <stdio.h> void printSolution(int board[N][N]) { for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) printf(" %d ", board[i][j]); printf("\n"); } } bool isSafe(int board[N][N], int row, int col) { int i, j; for (i = 0; i < col; i++) if (board[row][i]) return false; for (i = row, j = col; i >= 0 && j >= 0; i--, j--) if (board[i][j]) return false; for (i = row, j = col; j >= 0 && i < N; i++, j--) if (board[i][j]) return false; return true; } bool solveNQUtil(int board[N][N], int col) { if (col >= N) return true; for (int i = 0; i < N; i++) { if (isSafe(board, i, col)) { board[i][col] = 1; if (solveNQUtil(board, col + 1)) return true; board[i][col] = 0; } } return false; } bool solveNQ() { int board[N][N] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; if (solveNQUtil(board, 0) == false) { printf("Solution does not exist"); return false; } printSolution(board); return true; } int main() { solveNQ(); return 0; }
[ "noreply@github.com" ]
noreply@github.com
ff022067d2638232f52569a2a7e9876be3c7a4b8
711e5c8b643dd2a93fbcbada982d7ad489fb0169
/XPSP1/NT/admin/hmonitor/snapin/rule.inl
3c18a178d3eebf52e6f117a81a0849d44a81868e
[]
no_license
aurantst/windows-XP-SP1
629a7763c082fd04d3b881e0d32a1cfbd523b5ce
d521b6360fcff4294ae6c5651c539f1b9a6cbb49
refs/heads/master
2023-03-21T01:08:39.870106
2020-09-28T08:10:11
2020-09-28T08:10:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,704
inl
#ifdef _DEBUG #define new DEBUG_NEW #endif ///////////////////////////////////////////////////////////////////////////// // WMI Operations ///////////////////////////////////////////////////////////////////////////// inline HRESULT CRule::EnumerateChildren() { TRACEX(_T("CRule::EnumerateChildren\n")); return S_OK; } inline CString CRule::GetObjectPath() { TRACEX(_T("CRule::GetObjectPath\n")); CString sPath; sPath.Format(IDS_STRING_MOF_OBJECTPATH,IDS_STRING_MOF_HMR_CONFIG,GetGuid()); return sPath; } inline CString CRule::GetStatusObjectPath() { TRACEX(_T("CRule::GetStatusObjectPath\n")); CString sPath; sPath.Format(IDS_STRING_MOF_OBJECTPATH,IDS_STRING_MOF_HMR_STATUS,GetGuid()); return sPath; } inline CWbemClassObject* CRule::GetParentClassObject() { TRACEX(_T("CRule::GetParentClassObject\n")); CWbemClassObject* pClassObject = new CWbemClassObject; if( ! CHECKHRESULT(pClassObject->Create(GetSystemName())) ) { delete pClassObject; return NULL; } CString sQuery; sQuery.Format(IDS_STRING_R2DE_ASSOC_QUERY,GetGuid()); BSTR bsQuery = sQuery.AllocSysString(); if( ! CHECKHRESULT(pClassObject->ExecQuery(bsQuery)) ) { delete pClassObject; ::SysFreeString(bsQuery); return NULL; } ::SysFreeString(bsQuery); ULONG ulReturned = 0L; if( pClassObject->GetNextObject(ulReturned) != S_OK ) { ASSERT(FALSE); delete pClassObject; return NULL; } ASSERT(ulReturned > 0); return pClassObject; } inline CHMEvent* CRule::GetStatusClassObject() { TRACEX(_T("CRule::GetStatusClassObject\n")); CHMEvent* pClassObject = new CHMRuleStatus; pClassObject->SetMachineName(GetSystemName()); if( ! CHECKHRESULT(pClassObject->GetObject(GetStatusObjectPath())) ) { delete pClassObject; return NULL; } pClassObject->GetAllProperties(); return pClassObject; } inline CString CRule::GetThresholdString() { TRACEX(_T("CRule::GetThresholdString\n")); CWbemClassObject* pThreshold = GetClassObject(); if( ! GfxCheckObjPtr(pThreshold,CWbemClassObject) ) { return _T(""); } CString sExpression; CString sValue; int iCondition = -1; pThreshold->GetProperty(IDS_STRING_MOF_PROPERTYNAME,sValue); if( sValue.IsEmpty() ) { delete pThreshold; return _T(""); } sExpression += sValue + _T(" "); pThreshold->GetProperty(IDS_STRING_MOF_RULECONDITION,iCondition); switch( iCondition ) { case 0: { sValue = _T("<"); } break; case 1: { sValue = _T(">"); } break; case 2: { sValue = _T("="); } break; case 3: { sValue = _T("!="); } break; case 4: { sValue = _T(">="); } break; case 5: { sValue = _T("<="); } break; case 6: { sValue.LoadString(IDS_STRING_CONTAINS); } break; case 7: { sValue.LoadString(IDS_STRING_DOES_NOT_CONTAIN); } break; default: { delete pThreshold; return _T(""); } break; } sExpression += sValue + _T(" "); pThreshold->GetProperty(IDS_STRING_MOF_RULEVALUE,sValue); if( sValue.IsEmpty() ) { delete pThreshold; return _T(""); } sExpression += sValue; delete pThreshold; return sExpression; } /* inline void CRule::DeleteClassObject() { TRACEX(_T("CRule::DeleteClassObject\n")); // get associator path CWbemClassObject Associator; Associator.SetMachineName(GetSystemName()); CString sQuery; sQuery.Format(IDS_STRING_R2DE_REF_QUERY,GetGuid()); BSTR bsQuery = sQuery.AllocSysString(); if( ! CHECKHRESULT(Associator.ExecQuery(bsQuery)) ) { ::SysFreeString(bsQuery); return; } ::SysFreeString(bsQuery); ULONG ulReturned = 0L; if( Associator.GetNextObject(ulReturned) != S_OK ) { ASSERT(FALSE); return; } CString sAssociatorPath; Associator.GetProperty(_T("__path"),sAssociatorPath); Associator.Destroy(); // delete the instance Associator.SetMachineName(GetSystemName()); BSTR bsInstanceName = sAssociatorPath.AllocSysString(); CHECKHRESULT(Associator.DeleteInstance(bsInstanceName)); ::SysFreeString(bsInstanceName); } */ ///////////////////////////////////////////////////////////////////////////// // Clipboard Operations ///////////////////////////////////////////////////////////////////////////// inline bool CRule::Cut() { TRACEX(_T("CRule::Cut\n")); return false; } inline bool CRule::Copy() { TRACEX(_T("CRule::Copy\n")); return false; } inline bool CRule::Paste() { TRACEX(_T("CRule::Paste\n")); return false; } ///////////////////////////////////////////////////////////////////////////// // Operations ///////////////////////////////////////////////////////////////////////////// inline bool CRule::Rename(const CString& sNewName) { TRACEX(_T("CRule::Rename\n")); TRACEARGs(sNewName); CString sName = sNewName; CString sThreshold; sThreshold.LoadString(IDS_STRING_RULE_FMT); sThreshold = sThreshold.Left(sThreshold.GetLength()-3); // do we need to autoname this ? if( sName.Find(sThreshold) == 0 ) { CWbemClassObject* pRuleObject = GetClassObject(); CString sPropertyName; CString sCompareValue; CString sOperator; int iCondition; pRuleObject->GetProperty(IDS_STRING_MOF_PROPERTYNAME,sPropertyName); pRuleObject->GetProperty(IDS_STRING_MOF_COMPAREVALUE,sCompareValue); pRuleObject->GetProperty(IDS_STRING_MOF_RULECONDITION,iCondition); delete pRuleObject; pRuleObject = NULL; switch( iCondition ) { case 0: { sOperator.LoadString(IDS_STRING_LESS_THAN); } break; case 1: { sOperator.LoadString(IDS_STRING_GREATER_THAN); } break; case 2: { sOperator.LoadString(IDS_STRING_EQUALS); } break; case 3: { sOperator.LoadString(IDS_STRING_DOES_NOT_EQUAL); } break; case 4: { sOperator.LoadString(IDS_STRING_GREATER_THAN_EQUAL_TO); } break; case 5: { sOperator.LoadString(IDS_STRING_LESS_THAN_EQUAL_TO); } break; case 6: { sOperator.LoadString(IDS_STRING_CONTAINS); } break; case 7: { sOperator.LoadString(IDS_STRING_DOES_NOT_CONTAIN); } break; case 8: { sOperator.LoadString(IDS_STRING_IS_ALWAYS_TRUE); } break; } if( ! sPropertyName.IsEmpty() && ! sOperator.IsEmpty() && ! sCompareValue.IsEmpty() ) { if( iCondition != 8 ) // Is Always true is a special case { sName.Format(_T("%s %s %s"),sPropertyName,sOperator,sCompareValue); } } else if( ! sOperator.IsEmpty() && iCondition == 8 ) { sName = sOperator; } } return CHMObject::Rename(sName); } inline bool CRule::Refresh() { TRACEX(_T("CRule::Refresh\n")); return false; } inline bool CRule::ResetStatus() { TRACEX(_T("CRule::ResetStatus\n")); return false; } inline CString CRule::GetUITypeName() { TRACEX(_T("CRule::GetUITypeName\n")); CString sTypeName; sTypeName.LoadString(IDS_STRING_RULE); return sTypeName; } ///////////////////////////////////////////////////////////////////////////// // Scope Item Members ///////////////////////////////////////////////////////////////////////////// inline CScopePaneItem* CRule::CreateScopeItem() { TRACEX(_T("CRule::CreateScopeItem\n")); CRuleScopeItem * pNewItem = new CRuleScopeItem; pNewItem->SetObjectPtr(this); return pNewItem; }
[ "112426112@qq.com" ]
112426112@qq.com
c9a312e2830b742630611913f45617641282208d
9280c8473396dacce64c01740b81abb86cc52afe
/firmware/timer.cpp
b958598b6802c42c4a50a6a49fdb423fa06c8119
[]
no_license
plastbotindustries/franklin
b50c1bcaa2754f8888bccae79bd139002bfb220c
4c7650b460917ffd3e46c87e4d3c3a99dbd8734a
refs/heads/master
2021-01-16T22:08:49.709567
2015-11-08T02:31:45
2015-11-08T02:31:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,181
cpp
#include "firmware.h" void handle_motors() { if (step_state == 1) return; last_active = seconds(); cli(); uint8_t state = step_state; uint8_t cf = current_fragment; uint8_t cs = current_sample; sei(); // Check probe. bool probed; if (settings[cf].flags & Settings::PROBING && probe_pin < NUM_DIGITAL_PINS) { if (state == 0) { if (GET(probe_pin) ^ bool(pin_flags & 2)) stopping = active_motors; probed = true; } else probed = false; } else probed = true; // If we didn't need to probe; don't block later on. if (stopping < 0) { // Check sensors. for (uint8_t m = 0; m < active_motors; ++m) { if (!(motor[m].intflags & Motor::ACTIVE)) continue; //debug("check %d", m); // Check sense pins. if (motor[m].sense_pin < NUM_DIGITAL_PINS) { if (GET(motor[m].sense_pin) ^ bool(motor[m].flags & Motor::SENSE_STATE)) { //debug("sense %d %x", m, motor[m].flags); motor[m].flags ^= Motor::SENSE_STATE; motor[m].flags |= (motor[m].flags & Motor::SENSE_STATE ? Motor::SENSE1 : Motor::SENSE0); uint8_t sense_state = motor[m].flags & Motor::SENSE_STATE ? 1 : 0; cli(); for (int mi = 0; mi < active_motors; ++mi) motor[mi].sense_pos[sense_state] = motor[mi].current_pos; sei(); } } // Check limit switches. if (stopping < 0) { int8_t value = buffer[cf][m][cs]; if (value == 0) continue; uint8_t limit_pin = value < 0 ? motor[m].limit_min_pin : motor[m].limit_max_pin; if (limit_pin < NUM_DIGITAL_PINS) { bool inverted = motor[m].flags & (value < 0 ? Motor::INVERT_LIMIT_MIN : Motor::INVERT_LIMIT_MAX); if (GET(limit_pin) ^ inverted) { debug("hit %d pos %d state %d sample %d", m, motor[m].current_pos, state, buffer[cf][m][cs]); stopping = m; motor[m].flags |= Motor::LIMIT; break; } } } } } if (stopping >= 0) { // Hit endstop or probe; disable timer interrupt. step_state = 1; //debug("hit limit %d curpos %ld cf %d ncf %d lf %d cfp %d", m, F(motor[m].current_pos), cf, notified_current_fragment, last_fragment, cs); // Notify host. limit_fragment_pos = cs; arch_set_speed(0); return; } if (homers > 0) { // Homing. if (state == 0) { probed = true; for (uint8_t m = 0; m < active_motors; ++m) { if (!(motor[m].intflags & Motor::ACTIVE)) continue; // Get twe "wrong" limit pin for the given direction. uint8_t limit_pin = (buffer[cf][m][cs] < 0 ? motor[m].limit_max_pin : motor[m].limit_min_pin); bool inverted = motor[m].flags & (buffer[cf][m][cs] < 0 ? Motor::INVERT_LIMIT_MAX : Motor::INVERT_LIMIT_MIN); if (limit_pin >= NUM_DIGITAL_PINS || GET(limit_pin) ^ inverted) { // Limit pin still triggered; continue moving. continue; } // Limit pin no longer triggered. Stop moving and possibly notify host. motor[m].intflags &= ~Motor::ACTIVE; if (!--homers) { arch_set_speed(0); return; } } } else probed = false; } if (state == 0 && probed) { if (homers > 0) current_sample = 0; // Use only the first sample for homing. step_state = homers > 0 || (settings[cf].flags & Settings::PROBING) ? 2 : 3; } }
[ "wijnen@debian.org" ]
wijnen@debian.org
1fc5a8d514a8dbe958470ea83acb84738352eb76
f2e1ef881c5835fce122f8076f484c0475bff9df
/src/LuminoEngine/test/Test_Shader_HlslEffect.cpp
d347b5590df766648e99e57eba96cfea6822fff5
[ "MIT" ]
permissive
lp249839965/Lumino
def5d41f32d4a3f3c87966719fd5ded954b348cc
94b1919f1579610fc6034c371cf96e7e8517c5e9
refs/heads/master
2023-02-13T09:33:22.868358
2020-12-22T15:30:55
2020-12-22T15:30:55
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,509
cpp
#include "Common.hpp" class Test_Graphics_HlslEffect : public ::testing::Test { public: virtual void SetUp() {} virtual void TearDown() {} }; //------------------------------------------------------------------------------ TEST_F(Test_Graphics_HlslEffect, Basic) { struct PosColor { Vector4 pos; Vector4 color; }; PosColor v1[3] = { { { -1, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { 0, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { -1, 0, 0, 1 },{ 0, 0, 1, 1 } }, }; auto vb1 = makeObject<VertexBuffer>(sizeof(v1), v1, GraphicsResourceUsage::Static); auto vd1 = makeObject<VertexLayout>(); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Position, 0); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Color, 0); //* [ ] Basic rendering { auto shader1 = makeObject<Shader>(LN_ASSETFILE("Basic.fx")); shader1->findParameter("g_color")->setVector(Vector4(1, 0, 0, 1)); auto ctx = TestEnv::beginFrame(); auto cbb = TestEnv::mainWindowSwapChain()->currentBackbuffer(); auto crp = TestEnv::renderPass(); crp->setClearValues(ClearFlags::All, Color::White, 1.0f, 0); ctx->beginRenderPass(crp); ctx->setVertexLayout(vd1); ctx->setVertexBuffer(0, vb1); ctx->setShaderPass(shader1->techniques()[0]->passes()[0]); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ctx->endRenderPass(); TestEnv::endFrame(); ASSERT_RENDERTARGET(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-Basic-1.png"), cbb); } //* [ ] Nested struct { auto shader2 = makeObject<Shader>(LN_ASSETFILE("NestedStruct.fx")); shader2->findParameter("g_color")->setVector(Vector4(0, 1, 0, 1)); auto ctx = TestEnv::beginFrame(); auto cbb = TestEnv::mainWindowSwapChain()->currentBackbuffer(); auto crp = TestEnv::renderPass(); crp->setClearValues(ClearFlags::All, Color::White, 1.0f, 0); ctx->beginRenderPass(crp); ctx->setVertexLayout(vd1); ctx->setVertexBuffer(0, vb1); ctx->setShaderPass(shader2->techniques()[0]->passes()[0]); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ctx->endRenderPass(); TestEnv::endFrame(); ASSERT_RENDERTARGET(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-Basic-3.png"), cbb); } } //------------------------------------------------------------------------------ TEST_F(Test_Graphics_HlslEffect, Preprocess) { struct PosColor { Vector4 pos; Vector4 color; }; PosColor v1[3] = { { { -1, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { 0, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { -1, 0, 0, 1 },{ 0, 0, 1, 1 } }, }; auto vb1 = makeObject<VertexBuffer>(sizeof(v1), v1, GraphicsResourceUsage::Static); auto vd1 = makeObject<VertexLayout>(); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Position, 0); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Color, 0); //* [ ] #if { auto props = makeObject<ShaderCompilationProperties>(); props->addDefinition(u"GREEN=1"); auto shader2 = makeObject<Shader>(LN_ASSETFILE("PreprosessorTest2.fx"), props); auto ctx = TestEnv::beginFrame(); auto cbb = TestEnv::mainWindowSwapChain()->currentBackbuffer(); auto crp = TestEnv::renderPass(); crp->setClearValues(ClearFlags::All, Color::White, 1.0f, 0); ctx->beginRenderPass(crp); ctx->setVertexBuffer(0, vb1); ctx->setVertexLayout(vd1); ctx->setShaderPass(shader2->techniques()[0]->passes()[0]); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ctx->endRenderPass(); TestEnv::endFrame(); ASSERT_RENDERTARGET(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-Basic-4.png"), cbb); } //* [ ] #ifdef { auto props = makeObject<ShaderCompilationProperties>(); props->addDefinition(u"BLUE"); auto shader2 = makeObject<Shader>(LN_ASSETFILE("PreprosessorTest2.fx"), props); auto ctx = TestEnv::beginFrame(); auto cbb = TestEnv::mainWindowSwapChain()->currentBackbuffer(); auto crp = TestEnv::renderPass(); crp->setClearValues(ClearFlags::All, Color::White, 1.0f, 0); ctx->beginRenderPass(crp); ctx->setVertexBuffer(0, vb1); ctx->setVertexLayout(vd1); ctx->setShaderPass(shader2->techniques()[0]->passes()[0]); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ctx->endRenderPass(); TestEnv::endFrame(); ASSERT_RENDERTARGET(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-Basic-5.png"), cbb); } //* [ ] #include { auto props = makeObject<ShaderCompilationProperties>(); props->addIncludeDirectory(LN_ASSETFILE("")); auto shader2 = makeObject<Shader>(LN_ASSETFILE("PreprosessorTest.fx"), props); shader2->findParameter("g_color")->setVector(Vector4(1, 0, 0, 1)); auto ctx = TestEnv::beginFrame(); auto cbb = TestEnv::mainWindowSwapChain()->currentBackbuffer(); auto crp = TestEnv::renderPass(); crp->setClearValues(ClearFlags::All, Color::White, 1.0f, 0); ctx->beginRenderPass(crp); ctx->setVertexBuffer(0, vb1); ctx->setVertexLayout(vd1); ctx->setShaderPass(shader2->techniques()[0]->passes()[0]); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ctx->endRenderPass(); TestEnv::endFrame(); ASSERT_RENDERTARGET(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-Basic-1.png"), cbb); // 1 と同じ結果でよい } } //------------------------------------------------------------------------------ TEST_F(Test_Graphics_HlslEffect, ShaderPassRenderState) { auto shader = makeObject<Shader>(LN_ASSETFILE("ShaderPassRenderStateTest1.fx")); // pass0 は何もセットされていない // pass1 はすべてセットされている for (int i = 0; i < 2; i++) { auto pass = shader->techniques()[0]->passes()[i]; auto state = detail::ShaderHelper::getShaderRenderState(pass); bool expect = (i == 0) ? false : true; ASSERT_EQ(expect, state->blendEnable.hasValue()); ASSERT_EQ(expect, state->sourceBlend.hasValue()); ASSERT_EQ(expect, state->destinationBlend.hasValue()); ASSERT_EQ(expect, state->blendOp.hasValue()); ASSERT_EQ(expect, state->sourceBlendAlpha.hasValue()); ASSERT_EQ(expect, state->destinationBlendAlpha.hasValue()); ASSERT_EQ(expect, state->blendOpAlpha.hasValue()); ASSERT_EQ(expect, state->fillMode.hasValue()); ASSERT_EQ(expect, state->cullMode.hasValue()); ASSERT_EQ(expect, state->depthTestFunc.hasValue()); ASSERT_EQ(expect, state->depthWriteEnabled.hasValue()); ASSERT_EQ(expect, state->stencilEnabled.hasValue()); ASSERT_EQ(expect, state->stencilReferenceValue.hasValue()); ASSERT_EQ(expect, state->stencilFailOp.hasValue()); ASSERT_EQ(expect, state->stencilDepthFailOp.hasValue()); ASSERT_EQ(expect, state->stencilPassOp.hasValue()); ASSERT_EQ(expect, state->stencilFunc.hasValue()); } } //------------------------------------------------------------------------------ #if 0 TEST_F(Test_Graphics_HlslEffect, UnifiedShader) { struct PosColor { Vector4 pos; Vector4 color; }; PosColor v1[3] = { { { -1, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { 0, 1, 0, 1 },{ 0, 0, 1, 1 } }, { { -1, 0, 0, 1 },{ 0, 0, 1, 1 } }, }; auto vb1 = makeObject<VertexBuffer>(sizeof(v1), v1, GraphicsResourceUsage::Static); auto vd1 = makeObject<VertexLayout>(); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Position, 0); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Color, 0); auto ctx = TestEnv::graphicsContext(); TestEnv::resetGraphicsContext(ctx); //* [ ] Basic rendering { auto shader = makeObject<Shader>(LN_ASSETFILE("Shader/FxcTest1.v1.lcfx")); shader->findConstantBuffer("ConstBuff")->findParameter("g_color")->setVector(Vector4(0, 1, 0, 1)); ctx->setVertexDeclaration(vd1); ctx->setVertexBuffer(0, vb1); ctx->setShaderPass(shader->techniques()[0]->passes()[0]); ctx->clear(ClearFlags::All, Color::White, 1.0f, 0); ctx->setPrimitiveTopology(PrimitiveTopology::TriangleList); ctx->drawPrimitive(0, 1); ASSERT_SCREEN(LN_ASSETFILE("Shader/Result/Test_Graphics_HlslEffect-UnifiedShader-1.png")); } } #endif //------------------------------------------------------------------------------ TEST_F(Test_Graphics_HlslEffect, Sample) { #if 0 auto shader1 = makeObject<Shader>(LN_ASSETFILE("Atmosphere.fx")); auto shader2 = makeObject<Shader>(LN_ASSETFILE("Cloud.fx")); Vector4 v1[] = { { -1, 1, 1, 1 }, { 1, 1, 1, 1 }, { -1, -1, 1, 1 }, { 1, -1, 1, 1 }, }; auto vb1 = makeObject<VertexBuffer>(sizeof(v1), v1, GraphicsResourceUsage::Static); auto vd1 = makeObject<VertexLayout>(); vd1->addElement(0, VertexElementType::Float4, VertexElementUsage::Position, 0); auto ctx = TestEnv::graphicsContext(); TestEnv::resetGraphicsContext(ctx); ctx->setVertexDeclaration(vd1); ctx->setVertexBuffer(0, vb1); ctx->setIndexBuffer(nullptr); float r = -5; while (Engine::update()) { r += 0.05; //Vector4 lightPos(cos(r), sin(r), 0, 1); //Vector4 lightPos(0, cos(r), sin(r), 1); float lr = 1.6; Vector4 lightPos(0, cos(lr), sin(lr), 1); Vector4 cameraPos(0, r, 0, 1); auto view = Matrix::makeLookAtLH(cameraPos.xyz(), cameraPos.xyz() + Vector3::normalize(-0.2, 0, 1), Vector3::UnitY); auto proj = Matrix::makePerspectiveFovLH(Math::PI / 3, 160.0 / 120.0, 0.1, 1000); ctx->clear(ClearFlags::All, Color::Gray, 1.0f, 0); DepthStencilStateDesc state1; state1.depthTestEnabled = false; state1.depthWriteEnabled = false; ctx->setDepthStencilState(state1); { auto buf = shader1->findConstantBuffer("_Global"); buf->findParameter("_SkyTint")->setVector(Vector4(.5, .5, .5, 1)); buf->findParameter("_AtmosphereThickness")->setFloat(1.0); //buf->findParameter("_WorldSpaceLightPos0")->setVector(Vector4(0.1, 0.5, -0.8, 0)); buf->findParameter("_WorldSpaceLightPos0")->setVector(lightPos);//Vector4(0.8, 0.8, 0.8, 0)); buf->findParameter("_Exposure")->setFloat(1.3); buf->findParameter("_GroundColor")->setVector(Vector4(.369, .349, .341, 1)); buf->findParameter("_SunSize")->setFloat(0.04); buf->findParameter("_LightColor0")->setVector(Vector4(1, 1, 1, 1)); buf->findParameter("_VPInv")->setMatrix(Matrix::makeInverse(view * proj)); ctx->setShaderPass(shader1->techniques()[0]->passes()[0]); ctx->drawPrimitive(PrimitiveType::TriangleStrip, 0, 2); } { auto buf = shader2->findConstantBuffer("_Global"); buf->findParameter("_VolumeUpper")->setFloat(20); buf->findParameter("_VolumeLower")->setFloat(10); buf->findParameter("_CameraPos")->setVector(Vector4(0, 0, 0, 0)); buf->findParameter("_VPInv")->setMatrix(Matrix::makeInverse(view * proj)); BlendStateDesc state1; state1.renderTargets[0].blendEnable = true; state1.renderTargets[0].sourceBlend = BlendFactor::One; state1.renderTargets[0].destinationBlend = BlendFactor::One; state1.renderTargets[0].blendOp = BlendOp::Add; ctx->setBlendState(state1); ctx->setShaderPass(shader2->techniques()[0]->passes()[0]); ctx->drawPrimitive(PrimitiveType::TriangleStrip, 0, 2); } auto vv = Vector4::transform(Vector4(1, 1, 1, 1), Matrix::makeInverse(view * proj)); auto v3 = vv.xyz() / vv.w; auto dd = Vector3::dot(Vector3::normalize(0, 1, 1), Vector3(0, 1, 0)); Engine::mainWindow()->present(); Thread::sleep(32); } //ASSERT_SCREEN_S(LN_ASSETFILE("Result/Shader/Test_Graphics_HlslEffect-Sample-1.png")); #endif }
[ "lriki.net@gmail.com" ]
lriki.net@gmail.com
515157d98113023194d76f85e79ebaa463f80f21
8bc93a465d1e7e9572b8c89aa346e42b8fa89c64
/ParticalSystem/ParticalSystem/Snow.h
d23e2b53506313bbffd01cdcacfe39cc895f5886
[]
no_license
sarii0504/ParticalSystem
460bdfe3b633da97b3e67542a8a26bcc9a8496cf
e098569b3642819f197590dfc77e5f9e3b04af52
refs/heads/master
2021-06-13T11:44:24.650424
2016-02-11T22:19:39
2016-02-11T22:19:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
411
h
#ifndef SNOW_H #define SNOW_H #include"ParticalSystem.h" class Snow : public ParticleSystem { public: Time m_CurrentLifeTime; Snow(unsigned int count, PrimitiveType type, float lifeTime, Vector2f pos); virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const; virtual void resetParticle(std::size_t index); virtual void setup(); virtual void update(sf::Time elapsed); }; #endif
[ "cilazi@qq.com" ]
cilazi@qq.com
e1f9f1f035410f8e4d32aaf623eb39bc8faefbb0
08ecba710d7513be27c7995f3702001201a3d48c
/TRADERS/RHSGREF/TraderCategoriesGREF.hpp
0ea45ef49022c896b861b7942fb7ea077c08cc0a
[]
no_license
tinboye/Trader-Mod
41f159388d1f48315899006a9fa5b647919c10a6
89e6cc7e8e91a723cc4753a3c0a11ed70e4e54bd
refs/heads/master
2021-01-11T18:14:40.196116
2017-03-01T01:01:58
2017-03-01T01:01:58
79,522,669
1
0
null
2017-03-01T00:32:53
2017-01-20T03:44:31
C++
UTF-8
C++
false
false
3,873
hpp
class GREFUniforms { name = "GREF Uniforms"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\uniform_ca.paa"; items[] = { "rhsgref_uniform_alpenflage", "rhsgref_uniform_flecktarn", "rhsgref_uniform_para_ttsko_mountain", "rhsgref_uniform_para_ttsko_oxblood", "rhsgref_uniform_para_ttsko_urban", "rhsgref_uniform_reed", "rhsgref_uniform_specter", "rhsgref_uniform_tigerstripe", "rhsgref_uniform_ttsko_forest", "rhsgref_uniform_ttsko_mountain", "rhsgref_uniform_ttsko_urban", "rhsgref_uniform_vsr", "rhsgref_uniform_woodland", "rhsgref_uniform_woodland_olive" }; }; class GREFVests { name = "GREF Vests"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\vest_ca.paa"; items[] = { "rhsgref_6b23", "rhsgref_6b23_khaki", "rhsgref_6b23_khaki_medic", "rhsgref_6b23_khaki_nco", "rhsgref_6b23_khaki_officer", "rhsgref_6b23_khaki_rifleman", "rhsgref_6b23_khaki_sniper", "rhsgref_6b23_ttsko_digi", "rhsgref_6b23_ttsko_digi_medic", "rhsgref_6b23_ttsko_digi_nco", "rhsgref_6b23_ttsko_digi_officer", "rhsgref_6b23_ttsko_digi_rifleman", "rhsgref_6b23_ttsko_digi_sniper", "rhsgref_6b23_ttsko_forest", "rhsgref_6b23_ttsko_forest_rifleman", "rhsgref_6b23_ttsko_mountain", "rhsgref_6b23_ttsko_mountain_medic", "rhsgref_6b23_ttsko_mountain_nco", "rhsgref_6b23_ttsko_mountain_officer", "rhsgref_6b23_ttsko_mountain_rifleman", "rhsgref_6b23_ttsko_mountain_sniper", "rhsgref_otv_digi", "rhsgref_otv_khaki" }; }; class GREFHeadgear { name = "GREF Headgear"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\headgear_ca.paa"; items[] = { "rhsgref_6b27m", "rhsgref_6b27m_ttsko_digi", "rhsgref_6b27m_ttsko_forest", "rhsgref_6b27m_ttsko_mountain", "rhsgref_6b27m_ttsko_urban", "rhsgref_Booniehat_alpen", "rhsgref_fieldcap", "rhsgref_fieldcap_ttsko_digi", "rhsgref_fieldcap_ttsko_forest", "rhsgref_fieldcap_ttsko_mountain", "rhsgref_fieldcap_ttsko_urban", "rhsgref_patrolcap_specter", "rhsgref_ssh68", "rhsgref_ssh68_emr", "rhsgref_ssh68_ttsko_digi", "rhsgref_ssh68_ttsko_forest", "rhsgref_ssh68_ttsko_mountain", "rhsgref_ssh68_un" }; }; class GREFAmmunition { name = "GREF Ammunition"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\CargoMag_ca.paa"; items[] = { "rhsgref_5Rnd_792x57_kar98k", "rhsgref_30rnd_556x45_m21", "rhsgref_5Rnd_762x54_m38", "rhsgref_10Rnd_792x57_m76" //"rhs_30Rnd_762x39mm" }; }; class GREFWeapons { name = "GREF Weapons"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\itemacc_ca.paa"; items[] = { "rhs_weap_kar98k", "rhs_weap_m21a", "rhs_weap_m21a_fold", "rhs_weap_m21a_pr", "rhs_weap_m21s", "rhs_weap_m21s_fold", "rhs_weap_m21s_pr", "rhs_weap_m70ab2", "rhs_weap_m70ab2_fold", "rhs_weap_m70b1", "rhs_weap_m76", "rhs_weap_m92", "rhs_weap_m92_fold", "rhs_weap_m38" }; }; class GREFArmed { name = "GREF Armed"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\itemacc_ca.paa"; items[] = { "rhsgref_BRDM2", "rhsgref_BRDM2_ATGM", "rhsgref_BRDM2UM", "rhsgref_un_m1117" }; }; class GREFUnarmed { name = "GREF Unarmed"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\itemacc_ca.paa"; items[]= { "rhsgref_cdf_reg_uaz_ags", "rhsgref_cdf_reg_uaz_dshkm", "rhsgref_cdf_reg_uaz_spg9" }; }; class GREFChoppers { name = "GREF Helicopters"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\itemacc_ca.paa"; items[]= { "rhsgref_mi24g_CAS" }; }; class GREFPlanes { name = "GREF Planes"; icon = "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\itemacc_ca.paa"; items[] = { "RHS_AN2", "rhs_l159_CDF_CAP", "rhs_l159_CDF_CAS", "rhs_l159_CDF_plamen", "rhs_l159_CDF", "rhs_l39_cdf" }; };
[ "ned@blueyonder.co.uk" ]
ned@blueyonder.co.uk
765731b65422d7ec7163f281a337fcb23fcea5c2
056de5ad524f0170f2e295f71eb58e7165b417d0
/Script/Data/ScriptVariable.cpp
5d977b916990f0df62208eb606a9e29d258f4200
[]
no_license
schartz/cScript
b591fd87f1dd0f42091644eadcf77cb51853227b
5b94030c942fb85f83014bd7370712847642b9fe
refs/heads/master
2021-01-10T04:06:20.478711
2018-11-11T08:29:23
2018-11-11T08:29:23
36,060,872
3
0
null
null
null
null
UTF-8
C++
false
false
2,854
cpp
/** * ScriptVariable.cpp * * Created on: Apr 27, 2015 * Author: schartz */ #include "ScriptVariable.h" #define NAN -3231307.6790 string ScriptVariable::getName() { return name; } string ScriptVariable::getStringValue() { if(!isRegistered) return svalue; else{ if(type != REGISTERED_STRING){ ScriptError::msg("ScriptVariable is register is not of type string, symbol -" + name); return "NULL"; }else{ string v = *(static_cast<string*>(address)); return v; } } } double ScriptVariable::getNumberValue() { if(!isRegistered) return dvalue; else{ if(type != REGISTERED_DOUBLE){ ScriptError::msg("ScriptVariable is register is not of type double, symbol -" + name); }else{ double v = *(static_cast<double*>(address)); return v; } } return 0; } ScriptVariable::ScriptVariable(){ svalue = "null"; dvalue = NAN; name = ".invalid.null.initialize."; isRegistered= false; address = NULL; } ScriptVariable::ScriptVariable(string xName, double value) { svalue = "null"; dvalue = value; name = xName; isRegistered =false; address = NULL; } ScriptVariable::ScriptVariable(string xName, string value) { svalue = value; dvalue = NAN; name = xName; isRegistered =false; address = NULL; } ScriptVariable::ScriptVariable(string xName, RegisteredVariable xType, void* xAddress) { svalue = "NULL"; dvalue = NAN; name = xName; isRegistered = true; address = xAddress; type = xType; } ScriptVariable::ScriptVariable(string xName) { svalue = "NULL"; dvalue = NAN; name = xName; isRegistered = false; address = NULL; } bool ScriptVariable::isString() { if(!isRegistered){ if(svalue != "null"){ return true; }else return false; } else{ if(type == REGISTERED_STRING) return true; else return false; } } bool ScriptVariable::isNumber() { if(!isRegistered){ if(dvalue != NAN){ return true; }else return false; }else{ if(type == REGISTERED_DOUBLE) return true; else return false; } } void ScriptVariable::setNumberValue(double xValue) { svalue = "NULL"; if(!isRegistered){ dvalue = xValue; }else{ if(type != REGISTERED_DOUBLE){ ScriptError::msg("script variable is registered but can only accept double value"); }else{ double* v = static_cast<double*>(address); *v = xValue; } } } void ScriptVariable::setStringValue(string xValue) { dvalue = NAN; if(!isRegistered){ svalue = xValue; }else{ if(type != REGISTERED_STRING){ ScriptError::msg("script variable is registered but can only accept double value"); }else{ string* s = static_cast<string*>(address); *s = xValue; } } } void ScriptVariable::setFromStackData(StackData& sd) { if(sd.isNumber()) { this->setNumberValue(sd.getNumber()); } else { this->setStringValue(sd.getString()); } } ScriptVariable::~ScriptVariable() { }
[ "rehan.qt@gmail.com" ]
rehan.qt@gmail.com
37f85d4fd2318bbbcbe701235508a800977c07bc
44ab57520bb1a9b48045cb1ee9baee8816b44a5b
/Assist/Code/Example/Physics/PhysicsExample/Placeholder/Placeholder.h
816e3909f27506f1dcb1ea12d89b13880fb6daed
[ "BSD-3-Clause" ]
permissive
WuyangPeng/Engine
d5d81fd4ec18795679ce99552ab9809f3b205409
738fde5660449e87ccd4f4878f7bf2a443ae9f1f
refs/heads/master
2023-08-17T17:01:41.765963
2023-08-16T07:27:05
2023-08-16T07:27:05
246,266,843
10
0
null
null
null
null
GB18030
C++
false
false
678
h
/// Copyright (c) 2010-2023 /// Threading Core Render Engine /// /// 作者:彭武阳,彭晔恩,彭晔泽 /// 联系作者:94458936@qq.com /// /// 标准:std:c++20 /// 版本:0.9.1.2 (2023/07/31 11:12) #ifndef PHYSICS_EXAMPLE_PLACEHOLDER_H #define PHYSICS_EXAMPLE_PLACEHOLDER_H #include "Example/Physics/PhysicsExample/PhysicsExampleDll.h" #include "CoreTools/Helper/ExportMacro.h" namespace PhysicsExample { class PHYSICS_EXAMPLE_DEFAULT_DECLARE Placeholder { public: using ClassType = Placeholder; public: CLASS_INVARIANT_DECLARE; public: Placeholder() noexcept; }; } #endif // PHYSICS_EXAMPLE_PLACEHOLDER_H
[ "94458936@qq.com" ]
94458936@qq.com
7f882b4483b36a8ad16fef64be028e658f5717b0
a0eb9016e9a705502561323a711b14190f513d77
/BlasterMasterEngine/Assets/Others/CutsceneBackground.cpp
479ae63dcd3533bcae25635ab1e00ed4391cf27c
[]
no_license
Hengle/BlasterMasterEngine
c65d4cf49238951aac229406f568c5ca09c87d60
0e58882799bd0166ace3893f0c4a30a5f9f1322f
refs/heads/main
2023-04-03T21:00:23.931203
2021-03-23T05:47:24
2021-03-23T05:47:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,119
cpp
#include "d3dpch.h" #include "CutsceneBackground.h" CutsceneBackground::CutsceneBackground(float x, float y, CutsceneType cst) : Object2D(x, y), cutsceneType(cst) { name = "Cutscene Background"; tag = Tag::Default; spriteRenderer = GetComponent<SpriteRenderer>(); } void CutsceneBackground::Start() { playTime = 0.0f; randomTime = 0.0f; } void CutsceneBackground::Update() { if (cutsceneType == CutsceneType::None) { if (randomTime >= 2.5f && randomTime <= 4.0f) { color = { 80, 53, 240, 255 }; return; } randomTime += Time::GetDeltaTime(); } if (playTime >= 0.06f) { color = GenerateRandomColor(); playTime = 0.0f; } playTime += Time::GetDeltaTime(); } void CutsceneBackground::CreateResources() { spriteRenderer->sprite = SpriteResources::GetSprite("White_Background"); spriteRenderer->rect = { 0, 0, 700, 500 }; } Color CutsceneBackground::GenerateRandomColor() { Color color; std::random_device rdev{}; std::default_random_engine e{ rdev() }; std::uniform_int_distribution<> dis(0, 255); color.red = dis(e); color.green = dis(e); color.blue = dis(e); return color; }
[ "rekzerskien@gmail.com" ]
rekzerskien@gmail.com
467a015423c6530692ccff30880da0a7ba5be592
6f56c50d174473be3ed14c74a735c4be813717fe
/util.h
557b45fc8ad85a9f70cc6ebb241b6f044910de9f
[]
no_license
Giv3x/OpenGLInitialProject
bb5cac5b64d6f3055b8a9f0bba17d3d3cea98b25
ecbea23227e0650a32c8e01710663983ac34d497
refs/heads/master
2020-06-28T00:19:03.253695
2019-08-30T19:08:48
2019-08-30T19:08:48
200,090,947
0
0
null
null
null
null
UTF-8
C++
false
false
119
h
#pragma once #include <vector> #include <string> std::vector<std::string> split(const std::string& s, const char& d);
[ "arabidzegivi@gmail.com" ]
arabidzegivi@gmail.com
eaebfa8d9aa046a2e2c3e81a348fe99e04b65cec
2f809f7efe20182b68cd917c0a33928761c1a78d
/V2/Objet.cpp
032f9a582dcce8c95f77a1155e7bc23f84892669
[]
no_license
Locoduino/Satellite
3371207fb46e8e94c01579d2f161c10606c6640f
3ffd523c12bdfdc9ff6f444595981442607accca
refs/heads/master
2020-04-07T02:18:05.664427
2019-08-30T14:49:22
2019-08-30T14:49:22
157,971,047
2
1
null
null
null
null
UTF-8
C++
false
false
2,434
cpp
#include <Arduino.h> #include <EEPROM.h> #include "Satellite.h" Objet *Objet::pPremierObjet = NULL; void Objet::AddObjet(Objet *inpObjet, uint8_t inPin, uint8_t inNumber) { if (inpObjet != NULL && inPin != 255) { if (pPremierObjet == NULL) { pPremierObjet = inpObjet; } else { Objet *pLast = GetLast(); pLast->pNextObjet = inpObjet; inpObjet->pNextObjet = NULL; } inpObjet->begin(inPin, inNumber); } } Objet *Objet::GetLast() { Objet *pCurr = pPremierObjet; if (pCurr == NULL) return NULL; while (pCurr != NULL) { if (pCurr->pNextObjet == NULL) return pCurr; pCurr = pCurr->pNextObjet; } return NULL; } Objet *Objet::GetObjet(OBJETTYPE inType, uint8_t inNumber) { Objet *pCurr = pPremierObjet; if (pCurr == NULL) return NULL; while (pCurr != NULL) { if (pCurr->type == inType && pCurr->number == inNumber) return pCurr; pCurr = pCurr->pNextObjet; } return NULL; } uint8_t Objet::NombreDObjets(byte inType) { uint8_t compteur = 0; Objet *pCurr = pPremierObjet; if (pCurr == NULL) return 0; while (pCurr != NULL) { if (inType == 255 || (byte)pCurr->type == inType) compteur++; if (pCurr->pNextObjet == NULL) return compteur; pCurr = pCurr->pNextObjet; } return 0; } #ifdef DEBUG_MODE void Objet::printObjet() { Serial.print(F(" ")); Serial.print(this->number); Serial.print(F(" pin: ")); Serial.print(this->pin); } #endif void Objet::printObjets() { #ifdef DEBUG_MODE Objet *pCurr = pPremierObjet; if (pCurr == NULL) return; while (pCurr != NULL) { pCurr->printObjet(); Serial.println(""); pCurr = pCurr->pNextObjet; } #endif } uint8_t Objet::EEPROM_sauvegarde(int inAddr) { int addr = inAddr; uint8_t valeur8; /* valeur8 = this->type; EEPROMPUT(addr, valeur8, sizeof(uint8_t)); addr += sizeof(uint8_t);*/ valeur8 = this->pin; EEPROMPUT(addr, valeur8, sizeof(uint8_t)); addr += sizeof(uint8_t); valeur8 = this->number; EEPROMPUT(addr, valeur8, sizeof(uint8_t)); addr += sizeof(uint8_t); return addr; } uint8_t Objet::EEPROM_chargement(int inAddr) { int addr = inAddr; uint8_t valeur8; /* EEPROMGET(addr, valeur8, sizeof(uint8_t)); this->type = (OBJETTYPE)valeur8; addr += sizeof(uint8_t);*/ EEPROMGET(addr, valeur8, sizeof(uint8_t)); this->pin = valeur8; addr += sizeof(uint8_t); EEPROMGET(addr, valeur8, sizeof(uint8_t)); this->number = valeur8; addr += sizeof(uint8_t); return addr; }
[ "thierry@lapajaparis.net" ]
thierry@lapajaparis.net
3eed612a416ba3e86a608473eaec0c4bab713dad
f999711a794bd8f28b3365fa9333403df179fd90
/hust C语言学习/第三章/3.1字符的输出和输入/putchar应用(小写输出大写).cpp
9f9a33322db3269cfa1fb39ce024f8935f3db201
[]
no_license
Hanray-Zhong/Computer-Science
2423222addff275e5822a1390b43c44c1b24a252
dfea9d3ee465c36a405e50f53589bdacbd6d2ae2
refs/heads/master
2021-07-04T21:35:43.730153
2020-08-07T09:56:58
2020-08-07T09:56:58
145,799,254
0
1
null
null
null
null
UTF-8
C++
false
false
145
cpp
#include<stdio.h> int main() { char c; putchar(((c=getchar())>='a'&&c<='z')?c-'a'+'A':c); getchar(); getchar(); return 0; }
[ "646374316@qq.com" ]
646374316@qq.com
030e5ee089802e38d6bac9250cfe22fdef3d0dae
5cc640bcef6d7dd935ce73690ee64a64eddb0c29
/mktdata/ChannelReset4.h
31d5ef0e8e64e31c66ef7c4f13904056dddcf2d8
[]
no_license
mattpearson/cme_mdp_decoder
256254a33cc3e65d70ff06ab188b68f401638ada
862fac2c5f67f50649079c0a86c8eaac16bec33c
refs/heads/master
2020-02-26T16:16:52.934189
2016-10-17T03:31:48
2016-10-17T03:31:48
71,092,510
7
4
null
null
null
null
UTF-8
C++
false
false
16,293
h
/* Generated SBE (Simple Binary Encoding) message codec */ #ifndef _MKTDATA_CHANNELRESET4_H_ #define _MKTDATA_CHANNELRESET4_H_ #if defined(SBE_HAVE_CMATH) /* cmath needed for std::numeric_limits<double>::quiet_NaN() */ # include <cmath> # define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN() # define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN() #else /* math.h needed for NAN */ # include <math.h> # define SBE_FLOAT_NAN NAN # define SBE_DOUBLE_NAN NAN #endif #if __cplusplus >= 201103L # include <cstdint> # include <string> # include <cstring> #endif #if __cplusplus >= 201103L # define SBE_CONSTEXPR constexpr #else # define SBE_CONSTEXPR #endif #include <sbe/sbe.h> #include "MDEntryTypeBook.h" #include "OpenCloseSettlFlag.h" #include "MatchEventIndicator.h" #include "MaturityMonthYear.h" #include "FLOAT.h" #include "MDEntryTypeDailyStatistics.h" #include "EventType.h" #include "DecimalQty.h" #include "MDUpdateAction.h" #include "GroupSize8Byte.h" #include "HaltReason.h" #include "MDEntryType.h" #include "PRICENULL.h" #include "SecurityTradingStatus.h" #include "LegSide.h" #include "OrderUpdateAction.h" #include "PRICE.h" #include "PutOrCall.h" #include "SecurityUpdateAction.h" #include "SecurityTradingEvent.h" #include "MDEntryTypeStatistics.h" #include "InstAttribValue.h" #include "AggressorSide.h" #include "GroupSize.h" #include "SettlPriceType.h" using namespace sbe; namespace mktdata { class ChannelReset4 { private: char *m_buffer; std::uint64_t m_bufferLength; std::uint64_t *m_positionPtr; std::uint64_t m_offset; std::uint64_t m_position; std::uint64_t m_actingBlockLength; std::uint64_t m_actingVersion; inline void reset( char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength, const std::uint64_t actingBlockLength, const std::uint64_t actingVersion) { m_buffer = buffer; m_offset = offset; m_bufferLength = bufferLength; m_actingBlockLength = actingBlockLength; m_actingVersion = actingVersion; m_positionPtr = &m_position; position(offset + m_actingBlockLength); } public: ChannelReset4(void) : m_buffer(nullptr), m_bufferLength(0), m_offset(0) {} ChannelReset4(char *buffer, const std::uint64_t bufferLength) { reset(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion()); } ChannelReset4(char *buffer, const std::uint64_t bufferLength, const std::uint64_t actingBlockLength, const std::uint64_t actingVersion) { reset(buffer, 0, bufferLength, actingBlockLength, actingVersion); } ChannelReset4(const ChannelReset4& codec) { reset(codec.m_buffer, codec.m_offset, codec.m_bufferLength, codec.m_actingBlockLength, codec.m_actingVersion); } #if __cplusplus >= 201103L ChannelReset4(ChannelReset4&& codec) { reset(codec.m_buffer, codec.m_offset, codec.m_bufferLength, codec.m_actingBlockLength, codec.m_actingVersion); } ChannelReset4& operator=(ChannelReset4&& codec) { reset(codec.m_buffer, codec.m_offset, codec.m_bufferLength, codec.m_actingBlockLength, codec.m_actingVersion); return *this; } #endif ChannelReset4& operator=(const ChannelReset4& codec) { reset(codec.m_buffer, codec.m_offset, codec.m_bufferLength, codec.m_actingBlockLength, codec.m_actingVersion); return *this; } static SBE_CONSTEXPR const std::uint16_t sbeBlockLength(void) { return (std::uint16_t)9; } static SBE_CONSTEXPR const std::uint16_t sbeTemplateId(void) { return (std::uint16_t)4; } static SBE_CONSTEXPR const std::uint16_t sbeSchemaId(void) { return (std::uint16_t)1; } static SBE_CONSTEXPR const std::uint16_t sbeSchemaVersion(void) { return (std::uint16_t)8; } static SBE_CONSTEXPR const char * sbeSemanticType(void) { return "X"; } std::uint64_t offset(void) const { return m_offset; } ChannelReset4 &wrapForEncode(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength) { reset(buffer, offset, bufferLength, sbeBlockLength(), sbeSchemaVersion()); return *this; } ChannelReset4 &wrapForDecode( char *buffer, const std::uint64_t offset, const std::uint64_t actingBlockLength, const std::uint64_t actingVersion, const std::uint64_t bufferLength) { reset(buffer, offset, bufferLength, actingBlockLength, actingVersion); return *this; } std::uint64_t position(void) const { return m_position; } void position(const std::uint64_t position) { if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false)) { throw std::runtime_error("buffer too short [E100]"); } m_position = position; } std::uint64_t encodedLength(void) const { return position() - m_offset; } char *buffer(void) { return m_buffer; } std::uint64_t actingVersion(void) const { return m_actingVersion; } static SBE_CONSTEXPR const std::uint16_t transactTimeId(void) { return 60; } static SBE_CONSTEXPR const std::uint64_t transactTimeSinceVersion(void) { return 0; } bool transactTimeInActingVersion(void) { return m_actingVersion >= transactTimeSinceVersion(); } static const char *TransactTimeMetaAttribute(const MetaAttribute::Attribute metaAttribute) { switch (metaAttribute) { case MetaAttribute::EPOCH: return "unix"; case MetaAttribute::TIME_UNIT: return "nanosecond"; case MetaAttribute::SEMANTIC_TYPE: return "UTCTimestamp"; } return ""; } static SBE_CONSTEXPR const std::uint64_t transactTimeNullValue() { return SBE_NULLVALUE_UINT64; } static SBE_CONSTEXPR const std::uint64_t transactTimeMinValue() { return 0x0L; } static SBE_CONSTEXPR const std::uint64_t transactTimeMaxValue() { return 0xfffffffffffffffeL; } std::uint64_t transactTime(void) const { return SBE_LITTLE_ENDIAN_ENCODE_64(*((std::uint64_t *)(m_buffer + m_offset + 0))); } ChannelReset4 &transactTime(const std::uint64_t value) { *((std::uint64_t *)(m_buffer + m_offset + 0)) = SBE_LITTLE_ENDIAN_ENCODE_64(value); return *this; } static SBE_CONSTEXPR const std::uint16_t matchEventIndicatorId(void) { return 5799; } static SBE_CONSTEXPR const std::uint64_t matchEventIndicatorSinceVersion(void) { return 0; } bool matchEventIndicatorInActingVersion(void) { return m_actingVersion >= matchEventIndicatorSinceVersion(); } static const char *MatchEventIndicatorMetaAttribute(const MetaAttribute::Attribute metaAttribute) { switch (metaAttribute) { case MetaAttribute::EPOCH: return "unix"; case MetaAttribute::TIME_UNIT: return "nanosecond"; case MetaAttribute::SEMANTIC_TYPE: return "MultipleCharValue"; } return ""; } private: MatchEventIndicator m_matchEventIndicator; public: MatchEventIndicator &matchEventIndicator() { m_matchEventIndicator.wrap(m_buffer, m_offset + 8, m_actingVersion, m_bufferLength); return m_matchEventIndicator; } class NoMDEntries { private: char *m_buffer; std::uint64_t m_bufferLength; std::uint64_t *m_positionPtr; std::uint64_t m_blockLength; std::uint64_t m_count; std::uint64_t m_index; std::uint64_t m_offset; std::uint64_t m_actingVersion; GroupSize m_dimensions; public: inline void wrapForDecode(char *buffer, std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength) { m_buffer = buffer; m_bufferLength = bufferLength; m_dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength); m_blockLength = m_dimensions.blockLength(); m_count = m_dimensions.numInGroup(); m_index = -1; m_actingVersion = actingVersion; m_positionPtr = pos; *m_positionPtr = *m_positionPtr + 3; } inline void wrapForEncode(char *buffer, const std::uint8_t count, std::uint64_t *pos, const std::uint64_t actingVersion, const std::uint64_t bufferLength) { if (count < 0 || count > 254) { throw std::runtime_error("count outside of allowed range [E110]"); } m_buffer = buffer; m_bufferLength = bufferLength; m_dimensions.wrap(m_buffer, *pos, actingVersion, bufferLength); m_dimensions.blockLength((std::uint16_t)2); m_dimensions.numInGroup((std::uint8_t)count); m_index = -1; m_count = count; m_blockLength = 2; m_actingVersion = actingVersion; m_positionPtr = pos; *m_positionPtr = *m_positionPtr + 3; } static SBE_CONSTEXPR const std::uint64_t sbeHeaderSize() { return 3; } static SBE_CONSTEXPR const std::uint64_t sbeBlockLength() { return 2; } std::uint64_t position(void) const { return *m_positionPtr; } void position(const std::uint64_t position) { if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false)) { throw std::runtime_error("buffer too short [E100]"); } *m_positionPtr = position; } inline std::uint64_t count(void) const { return m_count; } inline bool hasNext(void) const { return m_index + 1 < m_count; } inline NoMDEntries &next(void) { m_offset = *m_positionPtr; if (SBE_BOUNDS_CHECK_EXPECT(( (m_offset + m_blockLength) > m_bufferLength ), false)) { throw std::runtime_error("buffer too short to support next group index [E108]"); } *m_positionPtr = m_offset + m_blockLength; ++m_index; return *this; } #if __cplusplus < 201103L template<class Func> inline void forEach(Func& func) { while(hasNext()) { next(); func(*this); } } #else template<class Func> inline void forEach(Func&& func) { while(hasNext()) { next(); func(*this); } } #endif static SBE_CONSTEXPR const std::uint16_t mDUpdateActionId(void) { return 279; } static SBE_CONSTEXPR const std::uint64_t mDUpdateActionSinceVersion(void) { return 2; } bool mDUpdateActionInActingVersion(void) { return m_actingVersion >= mDUpdateActionSinceVersion(); } static const char *MDUpdateActionMetaAttribute(const MetaAttribute::Attribute metaAttribute) { switch (metaAttribute) { case MetaAttribute::EPOCH: return "unix"; case MetaAttribute::TIME_UNIT: return "nanosecond"; case MetaAttribute::SEMANTIC_TYPE: return "int"; } return ""; } static SBE_CONSTEXPR const std::int8_t mDUpdateActionNullValue() { return SBE_NULLVALUE_INT8; } static SBE_CONSTEXPR const std::int8_t mDUpdateActionMinValue() { return (std::int8_t)-127; } static SBE_CONSTEXPR const std::int8_t mDUpdateActionMaxValue() { return (std::int8_t)127; } static SBE_CONSTEXPR const std::int8_t mDUpdateAction(void) { return (std::int8_t)0; } static SBE_CONSTEXPR const std::uint16_t mDEntryTypeId(void) { return 269; } static SBE_CONSTEXPR const std::uint64_t mDEntryTypeSinceVersion(void) { return 0; } bool mDEntryTypeInActingVersion(void) { return m_actingVersion >= mDEntryTypeSinceVersion(); } static const char *MDEntryTypeMetaAttribute(const MetaAttribute::Attribute metaAttribute) { switch (metaAttribute) { case MetaAttribute::EPOCH: return "unix"; case MetaAttribute::TIME_UNIT: return "nanosecond"; case MetaAttribute::SEMANTIC_TYPE: return "char"; } return ""; } static SBE_CONSTEXPR const char mDEntryTypeNullValue() { return (char)0; } static SBE_CONSTEXPR const char mDEntryTypeMinValue() { return (char)32; } static SBE_CONSTEXPR const char mDEntryTypeMaxValue() { return (char)126; } static SBE_CONSTEXPR const std::uint64_t mDEntryTypeLength(void) { return 1; } const char *mDEntryType(void) const { static sbe_uint8_t mDEntryTypeValues[] = {74}; return (const char *)mDEntryTypeValues; } char mDEntryType(const std::uint64_t index) const { static sbe_uint8_t mDEntryTypeValues[] = {74}; return mDEntryTypeValues[index]; } std::uint64_t getMDEntryType(char *dst, const std::uint64_t length) const { static sbe_uint8_t mDEntryTypeValues[] = {74}; std::uint64_t bytesToCopy = (length < sizeof(mDEntryTypeValues)) ? length : sizeof(mDEntryTypeValues); std::memcpy(dst, mDEntryTypeValues, bytesToCopy); return bytesToCopy; } static SBE_CONSTEXPR const std::uint16_t applIDId(void) { return 1180; } static SBE_CONSTEXPR const std::uint64_t applIDSinceVersion(void) { return 3; } bool applIDInActingVersion(void) { return m_actingVersion >= applIDSinceVersion(); } static const char *ApplIDMetaAttribute(const MetaAttribute::Attribute metaAttribute) { switch (metaAttribute) { case MetaAttribute::EPOCH: return "unix"; case MetaAttribute::TIME_UNIT: return "nanosecond"; case MetaAttribute::SEMANTIC_TYPE: return "int"; } return ""; } static SBE_CONSTEXPR const std::int16_t applIDNullValue() { return SBE_NULLVALUE_INT16; } static SBE_CONSTEXPR const std::int16_t applIDMinValue() { return (std::int16_t)-32767; } static SBE_CONSTEXPR const std::int16_t applIDMaxValue() { return (std::int16_t)32767; } std::int16_t applID(void) const { if (m_actingVersion < 3) { return (std::int16_t)-32768; } return SBE_LITTLE_ENDIAN_ENCODE_16(*((std::int16_t *)(m_buffer + m_offset + 0))); } NoMDEntries &applID(const std::int16_t value) { *((std::int16_t *)(m_buffer + m_offset + 0)) = SBE_LITTLE_ENDIAN_ENCODE_16(value); return *this; } }; private: NoMDEntries m_noMDEntries; public: static SBE_CONSTEXPR const std::uint16_t NoMDEntriesId(void) { return 268; } inline NoMDEntries &noMDEntries(void) { m_noMDEntries.wrapForDecode(m_buffer, m_positionPtr, m_actingVersion, m_bufferLength); return m_noMDEntries; } NoMDEntries &noMDEntriesCount(const std::uint8_t count) { m_noMDEntries.wrapForEncode(m_buffer, count, m_positionPtr, m_actingVersion, m_bufferLength); return m_noMDEntries; } }; } #endif
[ "mattpearson@gmail.com" ]
mattpearson@gmail.com
c887a1c191411f4a3543d5c322d2dd2b90d89605
a0604bbb76abbb42cf83e99f673134c80397b92b
/fldserver/base/ced/util/languages/languages.cc
0e00fa85fdfb6d1f8afaa86e52b88021185c8848
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
Hussam-Turjman/FLDServer
816910da39b6780cfd540fa1e79c84a03c57a488
ccc6e98d105cfffbf44bfd0a49ee5dcaf47e9ddb
refs/heads/master
2022-07-29T20:59:28.954301
2022-07-03T12:02:42
2022-07-03T12:02:42
461,034,667
2
0
null
null
null
null
UTF-8
C++
false
false
12,585
cc
// Copyright 2016 Google 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 "fldserver/base/ced/util/languages/languages.h" #include "fldserver/base/ced/util/basictypes.h" #include "fldserver/base/ced/util/string_util.h" Language default_language() { return ENGLISH; } // Language names and codes struct LanguageInfo { const char* language_name_; const char* language_code_639_1_; // the ISO-639-1 code for the language const char* language_code_639_2_; // the ISO-639-2 code for the language const char* language_code_other_; // some nonstandard code for the language }; static const LanguageInfo kLanguageInfoTable[] = { {"ENGLISH", "en", "eng", NULL}, {"DANISH", "da", "dan", NULL}, {"DUTCH", "nl", "dut", NULL}, {"FINNISH", "fi", "fin", NULL}, {"FRENCH", "fr", "fre", NULL}, {"GERMAN", "de", "ger", NULL}, {"HEBREW", "he", "heb", NULL}, {"ITALIAN", "it", "ita", NULL}, {"Japanese", "ja", "jpn", NULL}, {"Korean", "ko", "kor", NULL}, {"NORWEGIAN", "nb", "nor", NULL}, {"POLISH", "pl", "pol", NULL}, {"PORTUGUESE", "pt", "por", NULL}, {"RUSSIAN", "ru", "rus", NULL}, {"SPANISH", "es", "spa", NULL}, {"SWEDISH", "sv", "swe", NULL}, {"Chinese", "zh", "chi", "zh-CN"}, {"CZECH", "cs", "cze", NULL}, {"GREEK", "el", "gre", NULL}, {"ICELANDIC", "is", "ice", NULL}, {"LATVIAN", "lv", "lav", NULL}, {"LITHUANIAN", "lt", "lit", NULL}, {"ROMANIAN", "ro", "rum", NULL}, {"HUNGARIAN", "hu", "hun", NULL}, {"ESTONIAN", "et", "est", NULL}, // TODO: Although Teragram has two output names "TG_UNKNOWN_LANGUAGE" // and "Unknown", they are essentially the same. Need to unify them. // "un" and "ut" are invented by us, not from ISO-639. // {"TG_UNKNOWN_LANGUAGE", NULL, NULL, "ut"}, {"Unknown", NULL, NULL, "un"}, {"BULGARIAN", "bg", "bul", NULL}, {"CROATIAN", "hr", "scr", NULL}, {"SERBIAN", "sr", "scc", NULL}, {"IRISH", "ga", "gle", NULL}, {"GALICIAN", "gl", "glg", NULL}, // Impossible to tell Tagalog from Filipino at the moment. // Use ISO 639-2 code for Filipino here. {"TAGALOG", NULL, "fil", NULL}, {"TURKISH", "tr", "tur", NULL}, {"UKRAINIAN", "uk", "ukr", NULL}, {"HINDI", "hi", "hin", NULL}, {"MACEDONIAN", "mk", "mac", NULL}, {"BENGALI", "bn", "ben", NULL}, {"INDONESIAN", "id", "ind", NULL}, {"LATIN", "la", "lat", NULL}, {"MALAY", "ms", "may", NULL}, {"MALAYALAM", "ml", "mal", NULL}, {"WELSH", "cy", "wel", NULL}, {"NEPALI", "ne", "nep", NULL}, {"TELUGU", "te", "tel", NULL}, {"ALBANIAN", "sq", "alb", NULL}, {"TAMIL", "ta", "tam", NULL}, {"BELARUSIAN", "be", "bel", NULL}, {"JAVANESE", "jw", "jav", NULL}, {"OCCITAN", "oc", "oci", NULL}, {"URDU", "ur", "urd", NULL}, {"BIHARI", "bh", "bih", NULL}, {"GUJARATI", "gu", "guj", NULL}, {"THAI", "th", "tha", NULL}, {"ARABIC", "ar", "ara", NULL}, {"CATALAN", "ca", "cat", NULL}, {"ESPERANTO", "eo", "epo", NULL}, {"BASQUE", "eu", "baq", NULL}, {"INTERLINGUA", "ia", "ina", NULL}, {"KANNADA", "kn", "kan", NULL}, {"PUNJABI", "pa", "pan", NULL}, {"SCOTS_GAELIC", "gd", "gla", NULL}, {"SWAHILI", "sw", "swa", NULL}, {"SLOVENIAN", "sl", "slv", NULL}, {"MARATHI", "mr", "mar", NULL}, {"MALTESE", "mt", "mlt", NULL}, {"VIETNAMESE", "vi", "vie", NULL}, {"FRISIAN", "fy", "fry", NULL}, {"SLOVAK", "sk", "slo", NULL}, {"ChineseT", NULL, NULL, // We intentionally set these 2 fields to NULL to avoid // confusion between CHINESE_T and CHINESE. "zh-TW"}, {"FAROESE", "fo", "fao", NULL}, {"SUNDANESE", "su", "sun", NULL}, {"UZBEK", "uz", "uzb", NULL}, {"AMHARIC", "am", "amh", NULL}, {"AZERBAIJANI", "az", "aze", NULL}, {"GEORGIAN", "ka", "geo", NULL}, {"TIGRINYA", "ti", "tir", NULL}, {"PERSIAN", "fa", "per", NULL}, {"BOSNIAN", "bs", "bos", NULL}, {"SINHALESE", "si", "sin", NULL}, {"NORWEGIAN_N", "nn", "nno", NULL}, {"PORTUGUESE_P", NULL, NULL, "pt-PT"}, {"PORTUGUESE_B", NULL, NULL, "pt-BR"}, {"XHOSA", "xh", "xho", NULL}, {"ZULU", "zu", "zul", NULL}, {"GUARANI", "gn", "grn", NULL}, {"SESOTHO", "st", "sot", NULL}, {"TURKMEN", "tk", "tuk", NULL}, {"KYRGYZ", "ky", "kir", NULL}, {"BRETON", "br", "bre", NULL}, {"TWI", "tw", "twi", NULL}, {"YIDDISH", "yi", "yid", NULL}, {"SERBO_CROATIAN", "sh", NULL, NULL}, {"SOMALI", "so", "som", NULL}, {"UIGHUR", "ug", "uig", NULL}, {"KURDISH", "ku", "kur", NULL}, {"MONGOLIAN", "mn", "mon", NULL}, {"ARMENIAN", "hy", "arm", NULL}, {"LAOTHIAN", "lo", "lao", NULL}, {"SINDHI", "sd", "snd", NULL}, {"RHAETO_ROMANCE", "rm", "roh", NULL}, {"AFRIKAANS", "af", "afr", NULL}, {"LUXEMBOURGISH", "lb", "ltz", NULL}, {"BURMESE", "my", "bur", NULL}, // KHMER is known as Cambodian for Google user interfaces. {"KHMER", "km", "khm", NULL}, {"TIBETAN", "bo", "tib", NULL}, {"DHIVEHI", "dv", "div", NULL}, {"CHEROKEE", NULL, "chr", NULL}, {"SYRIAC", NULL, "syr", NULL}, {"LIMBU", NULL, NULL, "sit-NP"}, {"ORIYA", "or", "ori", NULL}, {"ASSAMESE", "as", "asm", NULL}, {"CORSICAN", "co", "cos", NULL}, {"INTERLINGUE", "ie", "ine", NULL}, {"KAZAKH", "kk", "kaz", NULL}, {"LINGALA", "ln", "lin", NULL}, {"MOLDAVIAN", "mo", "mol", NULL}, {"PASHTO", "ps", "pus", NULL}, {"QUECHUA", "qu", "que", NULL}, {"SHONA", "sn", "sna", NULL}, {"TAJIK", "tg", "tgk", NULL}, {"TATAR", "tt", "tat", NULL}, {"TONGA", "to", "tog", NULL}, {"YORUBA", "yo", "yor", NULL}, {"CREOLES_AND_PIDGINS_ENGLISH_BASED", NULL, "cpe", NULL}, {"CREOLES_AND_PIDGINS_FRENCH_BASED", NULL, "cpf", NULL}, {"CREOLES_AND_PIDGINS_PORTUGUESE_BASED", NULL, "cpp", NULL}, {"CREOLES_AND_PIDGINS_OTHER", NULL, "crp", NULL}, {"MAORI", "mi", "mao", NULL}, {"WOLOF", "wo", "wol", NULL}, {"ABKHAZIAN", "ab", "abk", NULL}, {"AFAR", "aa", "aar", NULL}, {"AYMARA", "ay", "aym", NULL}, {"BASHKIR", "ba", "bak", NULL}, {"BISLAMA", "bi", "bis", NULL}, {"DZONGKHA", "dz", "dzo", NULL}, {"FIJIAN", "fj", "fij", NULL}, {"GREENLANDIC", "kl", "kal", NULL}, {"HAUSA", "ha", "hau", NULL}, {"HAITIAN_CREOLE", "ht", NULL, NULL}, {"INUPIAK", "ik", "ipk", NULL}, {"INUKTITUT", "iu", "iku", NULL}, {"KASHMIRI", "ks", "kas", NULL}, {"KINYARWANDA", "rw", "kin", NULL}, {"MALAGASY", "mg", "mlg", NULL}, {"NAURU", "na", "nau", NULL}, {"OROMO", "om", "orm", NULL}, {"RUNDI", "rn", "run", NULL}, {"SAMOAN", "sm", "smo", NULL}, {"SANGO", "sg", "sag", NULL}, {"SANSKRIT", "sa", "san", NULL}, {"SISWANT", "ss", "ssw", NULL}, {"TSONGA", "ts", "tso", NULL}, {"TSWANA", "tn", "tsn", NULL}, {"VOLAPUK", "vo", "vol", NULL}, {"ZHUANG", "za", "zha", NULL}, {"KHASI", NULL, "kha", NULL}, {"SCOTS", NULL, "sco", NULL}, {"GANDA", "lg", "lug", NULL}, {"MANX", "gv", "glv", NULL}, {"MONTENEGRIN", NULL, NULL, "sr-ME"}, {"XX", NULL, NULL, "XX"}, }; COMPILE_ASSERT(arraysize(kLanguageInfoTable) == NUM_LANGUAGES + 1, kLanguageInfoTable_has_incorrect_length); // LANGUAGE NAMES const char* default_language_name() { return kLanguageInfoTable[ENGLISH].language_name_; } static const char* const kInvalidLanguageName = "invalid_language"; const char* invalid_language_name() { return kInvalidLanguageName; } const char* LanguageName(Language lang) { return IsValidLanguage(lang) ? kLanguageInfoTable[lang].language_name_ : kInvalidLanguageName; } // LANGUAGE CODES // The space before invalid_language_code is intentional. It is used // to prevent it matching any two letter language code. // static const char* const kInvalidLanguageCode = " invalid_language_code"; const char* invalid_language_code() { return kInvalidLanguageCode; } const char* LanguageCode(Language lang) { if (!IsValidLanguage(lang)) return kInvalidLanguageCode; const LanguageInfo& info = kLanguageInfoTable[lang]; if (info.language_code_639_1_) { return info.language_code_639_1_; } else if (info.language_code_639_2_) { return info.language_code_639_2_; } else if (info.language_code_other_) { return info.language_code_other_; } else { return kInvalidLanguageCode; } } const char* default_language_code() { return kLanguageInfoTable[ENGLISH].language_code_639_1_; } const char* LanguageCodeISO639_1(Language lang) { if (!IsValidLanguage(lang)) return kInvalidLanguageCode; if (const char* code = kLanguageInfoTable[lang].language_code_639_1_) return code; return kInvalidLanguageCode; } const char* LanguageCodeISO639_2(Language lang) { if (!IsValidLanguage(lang)) return kInvalidLanguageCode; if (const char* code = kLanguageInfoTable[lang].language_code_639_2_) return code; return kInvalidLanguageCode; } const char* LanguageCodeWithDialects(Language lang) { if (lang == CHINESE) return "zh-CN"; return LanguageCode(lang); } bool LanguageFromCode(const char* lang_code, Language* language) { *language = UNKNOWN_LANGUAGE; if (lang_code == NULL) return false; for (int i = 0; i < kNumLanguages; i++) { const LanguageInfo& info = kLanguageInfoTable[i]; if ((info.language_code_639_1_ && !base::strcasecmp(lang_code, info.language_code_639_1_)) || (info.language_code_639_2_ && !base::strcasecmp(lang_code, info.language_code_639_2_)) || (info.language_code_other_ && !base::strcasecmp(lang_code, info.language_code_other_))) { *language = static_cast<Language>(i); return true; } } // For convenience, this function can also parse the non-standard // five-letter language codes "zh-cn" and "zh-tw" which are used by // front-ends such as GWS to distinguish Simplified from Traditional // Chinese. if (!base::strcasecmp(lang_code, "zh-cn") || !base::strcasecmp(lang_code, "zh_cn")) { *language = CHINESE; return true; } if (!base::strcasecmp(lang_code, "zh-tw") || !base::strcasecmp(lang_code, "zh_tw")) { *language = CHINESE_T; return true; } if (!base::strcasecmp(lang_code, "sr-me") || !base::strcasecmp(lang_code, "sr_me")) { *language = MONTENEGRIN; return true; } // Process language-code synonyms. if (!base::strcasecmp(lang_code, "he")) { *language = HEBREW; // Use "iw". return true; } if (!base::strcasecmp(lang_code, "in")) { *language = INDONESIAN; // Use "id". return true; } if (!base::strcasecmp(lang_code, "ji")) { *language = YIDDISH; // Use "yi". return true; } // Process language-detection synonyms. // These distinct languages cannot be differentiated by our current // language-detection algorithms. if (!base::strcasecmp(lang_code, "fil")) { *language = TAGALOG; return true; } return false; }
[ "hussam.turjman@gmail.com" ]
hussam.turjman@gmail.com
34404ecd967f933a5780ca35d7cbb7edc4ece842
35b67f088a638f459dffefa447ff6949fb6d55f0
/Module02/EX15/IFT3100H17_DrawVectorPrimitive/src/application.h
4cecc6e9ce0a59acdea01f68676aa0aa2a83fa26
[ "MIT" ]
permissive
AlexandreMcCune/IFT3100H17
fc003cc31665ca6694ce955a1f87131c5c72f08b
51dd3a6563c582b45b458c12d2f8d4914cfcc522
refs/heads/master
2021-01-23T03:27:32.369541
2017-03-24T01:58:49
2017-03-24T01:58:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
600
h
// IFT3100H17_DrawVectorPrimitives/application.h // Classe principale de l'application. #pragma once #include "ofMain.h" #include "renderer.h" class Application : public ofBaseApp { public: Renderer * renderer; bool isVerbose; Application(); void setup(); void draw(); void mouseMoved(int x, int y); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void mouseEntered(int x, int y); void mouseExited(int x, int y); void keyReleased(int key); void exit(); ~Application(); };
[ "philvoyer@gmail.com" ]
philvoyer@gmail.com
aab5032c79b91559f1e443a2260303120c4f1b4b
7535c99a052d0cf40cd8d3d2170caea429dac685
/salary/DelEmployeeTrans.h
8a943f7a6f879f54690ea198bcb9e628f72beef2
[]
no_license
cly1231989/salary
1c9371e2d1568a6dd7c7f0d8be961d93f4993159
37dc5c0248f9fd2e6fafef63b717396fd8179e80
refs/heads/master
2021-05-09T13:20:35.553291
2018-02-11T03:10:33
2018-02-11T03:10:33
119,031,344
0
0
null
null
null
null
UTF-8
C++
false
false
255
h
#pragma once #include "Transaction.h" class DelEmployeeTrans : public Transaction { public: DelEmployeeTrans(int employeeID); virtual ~DelEmployeeTrans(); // Inherited via Transaction virtual void excute() override; private: int m_employeeID; };
[ "349930507@qq.com" ]
349930507@qq.com
f99aed9b1d40d10e8350fd8e437d9a2d36ea372c
689487b86039dbd9400c3878043bf1813765260d
/src/intermediate/MethodCall.cpp
cd2ce18f0aa84ef6ca28925eda7a51603195836a
[ "MIT" ]
permissive
robocon2011/VC4C
604ff5272c20e5fd3210716abaca62ccfea45155
d044a399f83f9a4e297db405ece179cd85d85944
refs/heads/master
2020-04-07T11:24:42.174962
2018-03-06T19:48:42
2018-03-06T19:48:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,622
cpp
/* * Author: doe300 * * See the file "LICENSE" for the full license governing this code. */ #include "IntermediateInstruction.h" using namespace vc4c; using namespace vc4c::intermediate; MethodCall::MethodCall(const std::string& methodName, const std::vector<Value>& args) : IntermediateInstruction(NO_VALUE), methodName(methodName) { for(std::size_t i = 0; i < args.size(); ++i) setArgument(i, args[i]); } MethodCall::MethodCall(const Value& dest, const std::string& methodName, const std::vector<Value>& args) : IntermediateInstruction(dest), methodName(methodName) { for(std::size_t i = 0; i < args.size(); ++i) setArgument(i, args[i]); } std::string MethodCall::to_string() const { std::string signature = (getReturnType() == TYPE_VOID ? "" : getOutput()->to_string(true) + " = ") + (getReturnType().to_string() + " ") + methodName + "("; if(!getArguments().empty()) { for (const Value& arg : getArguments()) { signature.append(arg.to_string()).append(", "); } signature = signature.substr(0, signature.length() - 2); } signature.append(")"); return signature + createAdditionalInfoString(); } IntermediateInstruction* MethodCall::copyFor(Method& method, const std::string& localPrefix) const { std::vector<Value> newArgs; newArgs.reserve(getArguments().size()); for (const Value& arg : getArguments()) { newArgs.push_back(renameValue(method, arg, localPrefix)); } if(getOutput()) return (new MethodCall(renameValue(method, getOutput().value(), localPrefix), methodName, newArgs))->copyExtrasFrom(this); else return (new MethodCall(methodName, newArgs))->copyExtrasFrom(this); } qpu_asm::Instruction* MethodCall::convertToAsm(const FastMap<const Local*, Register>& registerMapping, const FastMap<const Local*, std::size_t>& labelMapping, const std::size_t instructionIndex) const { throw CompilationError(CompilationStep::OPTIMIZER, "There should be no more function-calls", to_string()); } const DataType MethodCall::getReturnType() const { if(!getOutput()) return TYPE_VOID; return getOutput()->type; } bool MethodCall::matchesSignature(const Method& method) const { if(methodName.compare(method.name) != 0) { return false; } if(getArguments().size() != method.parameters.size()) { return false; } if(!getReturnType().containsType(method.returnType)) { return false; } for(std::size_t i = 0; i < method.parameters.size(); ++i) { if(!(method.parameters.at(i).type.containsType(getArgument(i)->type))) { return false; } } return true; } Return::Return(const Value& val) : IntermediateInstruction(NO_VALUE) { setArgument(0, val); } Return::Return() : IntermediateInstruction(NO_VALUE) { } std::string Return::to_string() const { return std::string("return ") + (getReturnValue() ? getReturnValue().to_string() : "") + createAdditionalInfoString(); } IntermediateInstruction* Return::copyFor(Method& method, const std::string& localPrefix) const { throw CompilationError(CompilationStep::OPTIMIZER, "Return should never be inlined in calling method", to_string()); } qpu_asm::Instruction* Return::convertToAsm(const FastMap<const Local*, Register>& registerMapping, const FastMap<const Local*, std::size_t>& labelMapping, const std::size_t instructionIndex) const { throw CompilationError(CompilationStep::LABEL_REGISTER_MAPPING, "There should be no more returns at this point", to_string()); } bool Return::mapsToASMInstruction() const { return false; } Optional<Value> Return::getReturnValue() const { return getArgument(0); }
[ "stadeldani@web.de" ]
stadeldani@web.de
7b37ea0a773206a68b45f5a0f6804654dbb7a3f4
e7d7377b40fc431ef2cf8dfa259a611f6acc2c67
/SampleDump/Cpp/SDK/BP_Zweihander_SecureHandle_functions.cpp
749804f33750610d54685cab39dd4de4e1246635
[]
no_license
liner0211/uSDK_Generator
ac90211e005c5f744e4f718cd5c8118aab3f8a18
9ef122944349d2bad7c0abe5b183534f5b189bd7
refs/heads/main
2023-09-02T16:37:22.932365
2021-10-31T17:38:03
2021-10-31T17:38:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,574
cpp
// Name: Mordhau, Version: Patch23 #include "../pch.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function: // Offset -> 0x014F36A0 // Name -> Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveBeginPlay // Flags -> (BlueprintCallable, BlueprintEvent) void UBP_Zweihander_SecureHandle_C::ReceiveBeginPlay() { static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveBeginPlay"); UBP_Zweihander_SecureHandle_C_ReceiveBeginPlay_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x014F36A0 // Name -> Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveActorBeginOverlap // Flags -> (BlueprintCallable, BlueprintEvent) // Parameters: // class AActor* OtherActor (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBP_Zweihander_SecureHandle_C::ReceiveActorBeginOverlap(class AActor* OtherActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveActorBeginOverlap"); UBP_Zweihander_SecureHandle_C_ReceiveActorBeginOverlap_Params params; params.OtherActor = OtherActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x014F36A0 // Name -> Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveTick // Flags -> (BlueprintCallable, BlueprintEvent) // Parameters: // float DeltaSeconds (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBP_Zweihander_SecureHandle_C::ReceiveTick(float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ReceiveTick"); UBP_Zweihander_SecureHandle_C_ReceiveTick_Params params; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x014F36A0 // Name -> Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ExecuteUbergraph_BP_Zweihander_SecureHandle // Flags -> (Final) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBP_Zweihander_SecureHandle_C::ExecuteUbergraph_BP_Zweihander_SecureHandle(int EntryPoint) { static UFunction* fn = UObject::FindObject<UFunction>("Function BP_Zweihander_SecureHandle.BP_Zweihander_SecureHandle_C.ExecuteUbergraph_BP_Zweihander_SecureHandle"); UBP_Zweihander_SecureHandle_C_ExecuteUbergraph_BP_Zweihander_SecureHandle_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "talon_hq@outlook.com" ]
talon_hq@outlook.com
d9291f3b3447b4754c0aadee5cfb2980ff6e9877
c980e7bbebd6178671cd12741e889b3cd492516b
/1338_Hidden_Secret!.cpp
d0e714a8214c35eb0e25a807dcccd47b693a9ac8
[]
no_license
mdminhazulhaque/lightoj
deef4395205b5bfa40161b65476c8724469b4059
fe49b8df6e2904c95138dd38e649780e23e89b4d
refs/heads/master
2021-05-28T20:12:49.525735
2015-03-11T13:12:11
2015-03-11T13:12:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,448
cpp
/** 1338 - Hidden Secret! */ #include <iostream> #include <fstream> #include <sstream> #include <cstring> #include <algorithm> #define eol "\n" #define space ' ' #define sqr(x) ((x)*(x)) #define len(var) var.size() using namespace std; int main() { ios::sync_with_stdio(false); //ifstream in("/home/minhaz/1338"); //cin.rdbuf(in.rdbuf()); int caseno = 0, cases = 1; string line; getline(cin, line); stringstream(line) >> cases; while(cases--) { cout << "Case " << ++caseno << ": "; string line1, line2; getline(cin, line1); getline(cin, line2); // Remove space and covert to lowercase for(int i=0; i<len(line1); i++) { if(line1[i]==' ') line1=line1.erase(i,1); line1[i] = tolower(line1[i]); } for(int i=0; i<len(line2); i++) { if(line2[i]==' ') line2.erase(i,1); line2[i] = tolower(line2[i]); } // Sort to make it clear if the string matches sort(line1.begin(), line1.end()); sort(line2.begin(), line2.end()); // Swap if line2 is bigger if(len(line1) < len(line2)) swap(line1, line2); // Find line2 in line 1 if(line1.find(line2) != string::npos) cout << "Yes"; else cout << "No"; cout << eol; } return 0; }
[ "mdminhazulhaque@gmail.com" ]
mdminhazulhaque@gmail.com
0d5fcafc4e97891501b070f1d0911768bb5c7cef
b9337dc53ba89d28d31d0de3586d4fdce786fbd9
/bahaeddine lakhzouri/gymtouch1/publicite.cpp
cfcf403ab7f4fbbf4b0454db7cab9ae0a32963c2
[]
no_license
soumaya-nheri/Smart-Club-2A28
aceff9295ef4352d7ad3b4f3d5df6221670f7d9f
5e113bdf2bc2fa6039fe19b7aace2c1599c0f76f
refs/heads/main
2023-04-22T18:25:42.309456
2021-05-05T22:51:45
2021-05-05T22:51:45
345,393,746
0
0
null
null
null
null
UTF-8
C++
false
false
2,239
cpp
#include "publicite.h" #include "connection.h" #include<QSqlQuery> #include<QtDebug> #include<QSqlQueryModel> #include <QObject> publicite::publicite() { id=0; cout=0;type_pub=""; } publicite::publicite(int id,QString type_pub, int cout) {this->id=id; this->cout=cout; this->type_pub=type_pub;} int publicite::getid(){return id;} int publicite::getcout(){return cout;} QString publicite::gettype_pub(){return type_pub;} void publicite::setid(int id){this->id=id;} void publicite::setcout(int cout){this->cout=cout;} void publicite::settype_pub(QString type_pub){this->type_pub=type_pub;} bool publicite::ajouter() {bool test=false; QString id_string= QString::number(id); QString cout_string= QString::number(cout); QSqlQuery query; query.prepare("INSERT INTO pub(ID,TYPE_PUB,COUT) " "VALUES (:id, :type_pub, :cout)"); query.bindValue(":id", id_string); query.bindValue(":type_pub", type_pub); query.bindValue(":cout", cout_string); return query.exec(); return test; } QSqlQueryModel* publicite::afficher() { QSqlQueryModel* model=new QSqlQueryModel(); model->setQuery("SELECT* FROM pub"); model->setHeaderData(0, Qt::Horizontal, QObject::tr("id")); model->setHeaderData(1, Qt::Horizontal, QObject::tr("type_pub")); model->setHeaderData(2, Qt::Horizontal, QObject::tr("cout")); return model; } bool publicite::supprimer(int id) { QSqlQuery query; query.prepare(" Delete from pub where id=:id"); query.bindValue(":id", id); return query.exec(); } bool publicite::modifier(){ QSqlQuery query ; query.prepare("update pub set ID=:id, TYPE_PUB=:type_pub,COUT=:cout where ID=:id"); query.bindValue(":id", id); query.bindValue(":type_pub", type_pub); query.bindValue(":cout", cout); return query.exec(); }
[ "noreply@github.com" ]
noreply@github.com
980bf14dc04ee3e5548ce9b3b4f43c71ecb9e626
3b9b4049a8e7d38b49e07bb752780b2f1d792851
/src/components/certificate_transparency/single_tree_tracker.cc
7946208ca753303a7589260e7a60fd34a58bb5e0
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
webosce/chromium53
f8e745e91363586aee9620c609aacf15b3261540
9171447efcf0bb393d41d1dc877c7c13c46d8e38
refs/heads/webosce
2020-03-26T23:08:14.416858
2018-08-23T08:35:17
2018-09-20T14:25:18
145,513,343
0
2
Apache-2.0
2019-08-21T22:44:55
2018-08-21T05:52:31
null
UTF-8
C++
false
false
3,733
cc
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/certificate_transparency/single_tree_tracker.h" #include <utility> #include "net/cert/ct_log_verifier.h" #include "net/cert/signed_certificate_timestamp.h" #include "net/cert/x509_certificate.h" using net::ct::SignedTreeHead; namespace certificate_transparency { SingleTreeTracker::SingleTreeTracker( scoped_refptr<const net::CTLogVerifier> ct_log) : ct_log_(std::move(ct_log)) {} SingleTreeTracker::~SingleTreeTracker() {} void SingleTreeTracker::OnSCTVerified( net::X509Certificate* cert, const net::ct::SignedCertificateTimestamp* sct) { DCHECK_EQ(ct_log_->key_id(), sct->log_id); // SCT was previously observed, so its status should not be changed. if (entries_status_.find(sct->timestamp) != entries_status_.end()) return; // If there isn't a valid STH or the STH is not fresh enough to check // inclusion against, store the SCT for future checking and return. if (verified_sth_.timestamp.is_null() || (verified_sth_.timestamp < (sct->timestamp + base::TimeDelta::FromHours(24)))) { // TODO(eranm): UMA - how often SCTs have to wait for a newer STH for // inclusion check. entries_status_.insert( std::make_pair(sct->timestamp, SCT_PENDING_NEWER_STH)); return; } // TODO(eranm): Check inclusion here. // TODO(eranm): UMA - how often inclusion can be checked immediately. entries_status_.insert( std::make_pair(sct->timestamp, SCT_PENDING_INCLUSION_CHECK)); } void SingleTreeTracker::NewSTHObserved(const SignedTreeHead& sth) { DCHECK_EQ(ct_log_->key_id(), sth.log_id); if (!ct_log_->VerifySignedTreeHead(sth)) { // Sanity check the STH; the caller should have done this // already, but being paranoid here. // NOTE(eranm): Right now there's no way to get rid of this check here // as this is the first object in the chain that has an instance of // a CTLogVerifier to verify the STH. return; } // In order to avoid updating |verified_sth_| to an older STH in case // an older STH is observed, check that either the observed STH is for // a larger tree size or that it is for the same tree size but has // a newer timestamp. const bool sths_for_same_tree = verified_sth_.tree_size == sth.tree_size; const bool received_sth_is_for_larger_tree = (verified_sth_.tree_size > sth.tree_size); const bool received_sth_is_newer = (sth.timestamp > verified_sth_.timestamp); if (verified_sth_.timestamp.is_null() || received_sth_is_for_larger_tree || (sths_for_same_tree && received_sth_is_newer)) { verified_sth_ = sth; } // Find out which SCTs can now be checked for inclusion. // TODO(eranm): Keep two maps of MerkleTreeLeaf instances, one for leaves // pending inclusion checks and one for leaves pending a new STH. // The comparison function between MerkleTreeLeaf instances should use the // timestamp to determine sorting order, so that bulk moving from one // map to the other can happen. auto entry = entries_status_.begin(); while (entry != entries_status_.end() && entry->first < verified_sth_.timestamp) { entry->second = SCT_PENDING_INCLUSION_CHECK; ++entry; // TODO(eranm): Check inclusion here. } } SingleTreeTracker::SCTInclusionStatus SingleTreeTracker::GetLogEntryInclusionStatus( net::X509Certificate* cert, const net::ct::SignedCertificateTimestamp* sct) { auto it = entries_status_.find(sct->timestamp); return it == entries_status_.end() ? SCT_NOT_OBSERVED : it->second; } } // namespace certificate_transparency
[ "changhyeok.bae@lge.com" ]
changhyeok.bae@lge.com
8b84891e6cc7e06d79e8eaf414552a199b986b67
9259f0e6387e85f4198931f0c489beea8e580bf9
/10.0.15063.0/winrt/Windows.ApplicationModel.h
f8ed03728c4ed9d2c4231733da8cc47050327a9d
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
part-machine/cppwinrt
68fdd6ff4be685b9626451e94a113a7c1827fc23
5086290db972a5ed15d1a3e3438b57ce2f6eecd2
refs/heads/master
2021-01-16T18:39:49.206730
2017-07-29T17:54:09
2017-07-29T17:54:09
100,108,083
0
0
null
2017-08-12T11:28:45
2017-08-12T11:28:45
null
UTF-8
C++
false
false
111,949
h
// C++ for the Windows Runtime v1.0.170406.6 // Copyright (c) 2017 Microsoft Corporation. All rights reserved. #pragma once #include "base.h" WINRT_WARNING_PUSH #include "internal/Windows.Foundation.3.h" #include "internal/Windows.Storage.Streams.3.h" #include "internal/Windows.System.3.h" #include "internal/Windows.Storage.3.h" #include "internal/Windows.Foundation.Collections.3.h" #include "internal/Windows.ApplicationModel.3.h" WINRT_EXPORT namespace winrt { namespace impl { template <typename D> struct produce<D, Windows::ApplicationModel::IAppDisplayInfo> : produce_base<D, Windows::ApplicationModel::IAppDisplayInfo> { HRESULT __stdcall get_DisplayName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DisplayName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Description(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Description()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_GetLogo(impl::abi_arg_in<Windows::Foundation::Size> size, impl::abi_arg_out<Windows::Storage::Streams::IRandomAccessStreamReference> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().GetLogo(*reinterpret_cast<const Windows::Foundation::Size *>(&size))); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IAppInfo> : produce_base<D, Windows::ApplicationModel::IAppInfo> { HRESULT __stdcall get_Id(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Id()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_AppUserModelId(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().AppUserModelId()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_DisplayInfo(impl::abi_arg_out<Windows::ApplicationModel::IAppDisplayInfo> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DisplayInfo()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_PackageFamilyName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().PackageFamilyName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::ICameraApplicationManagerStatics> : produce_base<D, Windows::ApplicationModel::ICameraApplicationManagerStatics> { HRESULT __stdcall abi_ShowInstalledApplicationsUI() noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().ShowInstalledApplicationsUI(); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IDesignModeStatics> : produce_base<D, Windows::ApplicationModel::IDesignModeStatics> { HRESULT __stdcall get_DesignModeEnabled(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DesignModeEnabled()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IEnteredBackgroundEventArgs> : produce_base<D, Windows::ApplicationModel::IEnteredBackgroundEventArgs> { HRESULT __stdcall abi_GetDeferral(impl::abi_arg_out<Windows::Foundation::IDeferral> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().GetDeferral()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IFullTrustProcessLauncherStatics> : produce_base<D, Windows::ApplicationModel::IFullTrustProcessLauncherStatics> { HRESULT __stdcall abi_LaunchFullTrustProcessForCurrentAppAsync(impl::abi_arg_out<Windows::Foundation::IAsyncAction> asyncAction) noexcept override { try { typename D::abi_guard guard(this->shim()); *asyncAction = detach_abi(this->shim().LaunchFullTrustProcessForCurrentAppAsync()); return S_OK; } catch (...) { *asyncAction = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_LaunchFullTrustProcessForCurrentAppWithParametersAsync(impl::abi_arg_in<hstring> parameterGroupId, impl::abi_arg_out<Windows::Foundation::IAsyncAction> asyncAction) noexcept override { try { typename D::abi_guard guard(this->shim()); *asyncAction = detach_abi(this->shim().LaunchFullTrustProcessForCurrentAppAsync(*reinterpret_cast<const hstring *>(&parameterGroupId))); return S_OK; } catch (...) { *asyncAction = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_LaunchFullTrustProcessForAppAsync(impl::abi_arg_in<hstring> fullTrustPackageRelativeAppId, impl::abi_arg_out<Windows::Foundation::IAsyncAction> asyncAction) noexcept override { try { typename D::abi_guard guard(this->shim()); *asyncAction = detach_abi(this->shim().LaunchFullTrustProcessForAppAsync(*reinterpret_cast<const hstring *>(&fullTrustPackageRelativeAppId))); return S_OK; } catch (...) { *asyncAction = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_LaunchFullTrustProcessForAppWithParametersAsync(impl::abi_arg_in<hstring> fullTrustPackageRelativeAppId, impl::abi_arg_in<hstring> parameterGroupId, impl::abi_arg_out<Windows::Foundation::IAsyncAction> asyncAction) noexcept override { try { typename D::abi_guard guard(this->shim()); *asyncAction = detach_abi(this->shim().LaunchFullTrustProcessForAppAsync(*reinterpret_cast<const hstring *>(&fullTrustPackageRelativeAppId), *reinterpret_cast<const hstring *>(&parameterGroupId))); return S_OK; } catch (...) { *asyncAction = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::ILeavingBackgroundEventArgs> : produce_base<D, Windows::ApplicationModel::ILeavingBackgroundEventArgs> { HRESULT __stdcall abi_GetDeferral(impl::abi_arg_out<Windows::Foundation::IDeferral> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().GetDeferral()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackage> : produce_base<D, Windows::ApplicationModel::IPackage> { HRESULT __stdcall get_Id(impl::abi_arg_out<Windows::ApplicationModel::IPackageId> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Id()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_InstalledLocation(impl::abi_arg_out<Windows::Storage::IStorageFolder> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().InstalledLocation()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_IsFramework(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsFramework()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Dependencies(impl::abi_arg_out<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Package>> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Dependencies()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackage2> : produce_base<D, Windows::ApplicationModel::IPackage2> { HRESULT __stdcall get_DisplayName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DisplayName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_PublisherDisplayName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().PublisherDisplayName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Description(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Description()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Logo(impl::abi_arg_out<Windows::Foundation::IUriRuntimeClass> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Logo()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_IsResourcePackage(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsResourcePackage()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsBundle(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsBundle()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsDevelopmentMode(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsDevelopmentMode()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackage3> : produce_base<D, Windows::ApplicationModel::IPackage3> { HRESULT __stdcall get_Status(impl::abi_arg_out<Windows::ApplicationModel::IPackageStatus> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Status()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_InstalledDate(impl::abi_arg_out<Windows::Foundation::DateTime> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().InstalledDate()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall abi_GetAppListEntriesAsync(impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Core::AppListEntry>>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().GetAppListEntriesAsync()); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackage4> : produce_base<D, Windows::ApplicationModel::IPackage4> { HRESULT __stdcall get_SignatureKind(Windows::ApplicationModel::PackageSignatureKind * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().SignatureKind()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsOptional(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsOptional()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall abi_VerifyContentIntegrityAsync(impl::abi_arg_out<Windows::Foundation::IAsyncOperation<bool>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().VerifyContentIntegrityAsync()); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackage5> : produce_base<D, Windows::ApplicationModel::IPackage5> { HRESULT __stdcall abi_GetContentGroupsAsync(impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().GetContentGroupsAsync()); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_GetContentGroupAsync(impl::abi_arg_in<hstring> name, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageContentGroup>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().GetContentGroupAsync(*reinterpret_cast<const hstring *>(&name))); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_StageContentGroupsAsync(impl::abi_arg_in<Windows::Foundation::Collections::IIterable<hstring>> names, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().StageContentGroupsAsync(*reinterpret_cast<const Windows::Foundation::Collections::IIterable<hstring> *>(&names))); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_StageContentGroupsWithPriorityAsync(impl::abi_arg_in<Windows::Foundation::Collections::IIterable<hstring>> names, bool moveToHeadOfQueue, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().StageContentGroupsAsync(*reinterpret_cast<const Windows::Foundation::Collections::IIterable<hstring> *>(&names), moveToHeadOfQueue)); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_SetInUseAsync(bool inUse, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<bool>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().SetInUseAsync(inUse)); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageCatalog> : produce_base<D, Windows::ApplicationModel::IPackageCatalog> { HRESULT __stdcall add_PackageStaging(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStagingEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageStaging(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStagingEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageStaging(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageStaging(token); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall add_PackageInstalling(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageInstallingEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageInstalling(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageInstallingEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageInstalling(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageInstalling(token); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall add_PackageUpdating(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUpdatingEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageUpdating(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUpdatingEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageUpdating(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageUpdating(token); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall add_PackageUninstalling(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUninstallingEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageUninstalling(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUninstallingEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageUninstalling(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageUninstalling(token); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall add_PackageStatusChanged(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStatusChangedEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageStatusChanged(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStatusChangedEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageStatusChanged(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageStatusChanged(token); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageCatalog2> : produce_base<D, Windows::ApplicationModel::IPackageCatalog2> { HRESULT __stdcall add_PackageContentGroupStaging(impl::abi_arg_in<Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageContentGroupStagingEventArgs>> handler, event_token * token) noexcept override { try { typename D::abi_guard guard(this->shim()); *token = detach_abi(this->shim().PackageContentGroupStaging(*reinterpret_cast<const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageContentGroupStagingEventArgs> *>(&handler))); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall remove_PackageContentGroupStaging(event_token token) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().PackageContentGroupStaging(token); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall abi_AddOptionalPackageAsync(impl::abi_arg_in<hstring> optionalPackageFamilyName, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageCatalogAddOptionalPackageResult>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().AddOptionalPackageAsync(*reinterpret_cast<const hstring *>(&optionalPackageFamilyName))); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageCatalogAddOptionalPackageResult> : produce_base<D, Windows::ApplicationModel::IPackageCatalogAddOptionalPackageResult> { HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_ExtendedError(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ExtendedError()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageCatalogStatics> : produce_base<D, Windows::ApplicationModel::IPackageCatalogStatics> { HRESULT __stdcall abi_OpenForCurrentPackage(impl::abi_arg_out<Windows::ApplicationModel::IPackageCatalog> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().OpenForCurrentPackage()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_OpenForCurrentUser(impl::abi_arg_out<Windows::ApplicationModel::IPackageCatalog> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().OpenForCurrentUser()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageContentGroup> : produce_base<D, Windows::ApplicationModel::IPackageContentGroup> { HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Name(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Name()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_State(Windows::ApplicationModel::PackageContentGroupState * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().State()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsRequired(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsRequired()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageContentGroupStagingEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageContentGroupStagingEventArgs> { HRESULT __stdcall get_ActivityId(GUID * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ActivityId()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Progress(double * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Progress()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsComplete(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsComplete()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ErrorCode(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ErrorCode()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ContentGroupName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ContentGroupName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_IsContentGroupRequired(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsContentGroupRequired()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageContentGroupStatics> : produce_base<D, Windows::ApplicationModel::IPackageContentGroupStatics> { HRESULT __stdcall get_RequiredGroupName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().RequiredGroupName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageId> : produce_base<D, Windows::ApplicationModel::IPackageId> { HRESULT __stdcall get_Name(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Name()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Version(impl::abi_arg_out<Windows::ApplicationModel::PackageVersion> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Version()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Architecture(Windows::System::ProcessorArchitecture * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Architecture()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ResourceId(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ResourceId()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Publisher(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Publisher()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_PublisherId(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().PublisherId()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_FullName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().FullName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_FamilyName(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().FamilyName()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageIdWithMetadata> : produce_base<D, Windows::ApplicationModel::IPackageIdWithMetadata> { HRESULT __stdcall get_ProductId(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ProductId()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Author(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Author()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageInstallingEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageInstallingEventArgs> { HRESULT __stdcall get_ActivityId(GUID * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ActivityId()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Progress(double * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Progress()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsComplete(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsComplete()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ErrorCode(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ErrorCode()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageStagingEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageStagingEventArgs> { HRESULT __stdcall get_ActivityId(GUID * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ActivityId()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Progress(double * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Progress()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsComplete(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsComplete()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ErrorCode(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ErrorCode()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageStatics> : produce_base<D, Windows::ApplicationModel::IPackageStatics> { HRESULT __stdcall get_Current(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Current()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageStatus> : produce_base<D, Windows::ApplicationModel::IPackageStatus> { HRESULT __stdcall abi_VerifyIsOK(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().VerifyIsOK()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_NotAvailable(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().NotAvailable()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_PackageOffline(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().PackageOffline()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_DataOffline(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DataOffline()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Disabled(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Disabled()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_NeedsRemediation(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().NeedsRemediation()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_LicenseIssue(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().LicenseIssue()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Modified(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Modified()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Tampered(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Tampered()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_DependencyIssue(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DependencyIssue()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Servicing(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Servicing()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_DeploymentInProgress(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().DeploymentInProgress()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageStatus2> : produce_base<D, Windows::ApplicationModel::IPackageStatus2> { HRESULT __stdcall get_IsPartiallyStaged(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsPartiallyStaged()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageStatusChangedEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageStatusChangedEventArgs> { HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageUninstallingEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageUninstallingEventArgs> { HRESULT __stdcall get_ActivityId(GUID * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ActivityId()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_Package(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Package()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Progress(double * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Progress()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsComplete(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsComplete()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ErrorCode(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ErrorCode()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageUpdatingEventArgs> : produce_base<D, Windows::ApplicationModel::IPackageUpdatingEventArgs> { HRESULT __stdcall get_ActivityId(GUID * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ActivityId()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_SourcePackage(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().SourcePackage()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_TargetPackage(impl::abi_arg_out<Windows::ApplicationModel::IPackage> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().TargetPackage()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Progress(double * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Progress()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_IsComplete(bool * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().IsComplete()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_ErrorCode(HRESULT * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().ErrorCode()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IPackageWithMetadata> : produce_base<D, Windows::ApplicationModel::IPackageWithMetadata> { HRESULT __stdcall get_InstallDate(impl::abi_arg_out<Windows::Foundation::DateTime> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().InstallDate()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall abi_GetThumbnailToken(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().GetThumbnailToken()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_Launch(impl::abi_arg_in<hstring> parameters) noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().Launch(*reinterpret_cast<const hstring *>(&parameters)); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IStartupTask> : produce_base<D, Windows::ApplicationModel::IStartupTask> { HRESULT __stdcall abi_RequestEnableAsync(impl::abi_arg_out<Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::StartupTaskState>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().RequestEnableAsync()); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_Disable() noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().Disable(); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_State(Windows::ApplicationModel::StartupTaskState * value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().State()); return S_OK; } catch (...) { return impl::to_hresult(); } } HRESULT __stdcall get_TaskId(impl::abi_arg_out<hstring> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().TaskId()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::IStartupTaskStatics> : produce_base<D, Windows::ApplicationModel::IStartupTaskStatics> { HRESULT __stdcall abi_GetForCurrentPackageAsync(impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::StartupTask>>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().GetForCurrentPackageAsync()); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } HRESULT __stdcall abi_GetAsync(impl::abi_arg_in<hstring> taskId, impl::abi_arg_out<Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::StartupTask>> operation) noexcept override { try { typename D::abi_guard guard(this->shim()); *operation = detach_abi(this->shim().GetAsync(*reinterpret_cast<const hstring *>(&taskId))); return S_OK; } catch (...) { *operation = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::ISuspendingDeferral> : produce_base<D, Windows::ApplicationModel::ISuspendingDeferral> { HRESULT __stdcall abi_Complete() noexcept override { try { typename D::abi_guard guard(this->shim()); this->shim().Complete(); return S_OK; } catch (...) { return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::ISuspendingEventArgs> : produce_base<D, Windows::ApplicationModel::ISuspendingEventArgs> { HRESULT __stdcall get_SuspendingOperation(impl::abi_arg_out<Windows::ApplicationModel::ISuspendingOperation> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().SuspendingOperation()); return S_OK; } catch (...) { *value = nullptr; return impl::to_hresult(); } } }; template <typename D> struct produce<D, Windows::ApplicationModel::ISuspendingOperation> : produce_base<D, Windows::ApplicationModel::ISuspendingOperation> { HRESULT __stdcall abi_GetDeferral(impl::abi_arg_out<Windows::ApplicationModel::ISuspendingDeferral> deferral) noexcept override { try { typename D::abi_guard guard(this->shim()); *deferral = detach_abi(this->shim().GetDeferral()); return S_OK; } catch (...) { *deferral = nullptr; return impl::to_hresult(); } } HRESULT __stdcall get_Deadline(impl::abi_arg_out<Windows::Foundation::DateTime> value) noexcept override { try { typename D::abi_guard guard(this->shim()); *value = detach_abi(this->shim().Deadline()); return S_OK; } catch (...) { return impl::to_hresult(); } } }; } namespace Windows::ApplicationModel { template <typename D> Windows::Foundation::IAsyncAction impl_IFullTrustProcessLauncherStatics<D>::LaunchFullTrustProcessForCurrentAppAsync() const { Windows::Foundation::IAsyncAction asyncAction; check_hresult(WINRT_SHIM(IFullTrustProcessLauncherStatics)->abi_LaunchFullTrustProcessForCurrentAppAsync(put_abi(asyncAction))); return asyncAction; } template <typename D> Windows::Foundation::IAsyncAction impl_IFullTrustProcessLauncherStatics<D>::LaunchFullTrustProcessForCurrentAppAsync(hstring_view parameterGroupId) const { Windows::Foundation::IAsyncAction asyncAction; check_hresult(WINRT_SHIM(IFullTrustProcessLauncherStatics)->abi_LaunchFullTrustProcessForCurrentAppWithParametersAsync(get_abi(parameterGroupId), put_abi(asyncAction))); return asyncAction; } template <typename D> Windows::Foundation::IAsyncAction impl_IFullTrustProcessLauncherStatics<D>::LaunchFullTrustProcessForAppAsync(hstring_view fullTrustPackageRelativeAppId) const { Windows::Foundation::IAsyncAction asyncAction; check_hresult(WINRT_SHIM(IFullTrustProcessLauncherStatics)->abi_LaunchFullTrustProcessForAppAsync(get_abi(fullTrustPackageRelativeAppId), put_abi(asyncAction))); return asyncAction; } template <typename D> Windows::Foundation::IAsyncAction impl_IFullTrustProcessLauncherStatics<D>::LaunchFullTrustProcessForAppAsync(hstring_view fullTrustPackageRelativeAppId, hstring_view parameterGroupId) const { Windows::Foundation::IAsyncAction asyncAction; check_hresult(WINRT_SHIM(IFullTrustProcessLauncherStatics)->abi_LaunchFullTrustProcessForAppWithParametersAsync(get_abi(fullTrustPackageRelativeAppId), get_abi(parameterGroupId), put_abi(asyncAction))); return asyncAction; } template <typename D> Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::StartupTaskState> impl_IStartupTask<D>::RequestEnableAsync() const { Windows::Foundation::IAsyncOperation<winrt::Windows::ApplicationModel::StartupTaskState> operation; check_hresult(WINRT_SHIM(IStartupTask)->abi_RequestEnableAsync(put_abi(operation))); return operation; } template <typename D> void impl_IStartupTask<D>::Disable() const { check_hresult(WINRT_SHIM(IStartupTask)->abi_Disable()); } template <typename D> Windows::ApplicationModel::StartupTaskState impl_IStartupTask<D>::State() const { Windows::ApplicationModel::StartupTaskState value {}; check_hresult(WINRT_SHIM(IStartupTask)->get_State(&value)); return value; } template <typename D> hstring impl_IStartupTask<D>::TaskId() const { hstring value; check_hresult(WINRT_SHIM(IStartupTask)->get_TaskId(put_abi(value))); return value; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::StartupTask>> impl_IStartupTaskStatics<D>::GetForCurrentPackageAsync() const { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::StartupTask>> operation; check_hresult(WINRT_SHIM(IStartupTaskStatics)->abi_GetForCurrentPackageAsync(put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::StartupTask> impl_IStartupTaskStatics<D>::GetAsync(hstring_view taskId) const { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::StartupTask> operation; check_hresult(WINRT_SHIM(IStartupTaskStatics)->abi_GetAsync(get_abi(taskId), put_abi(operation))); return operation; } template <typename D> hstring impl_IAppDisplayInfo<D>::DisplayName() const { hstring value; check_hresult(WINRT_SHIM(IAppDisplayInfo)->get_DisplayName(put_abi(value))); return value; } template <typename D> hstring impl_IAppDisplayInfo<D>::Description() const { hstring value; check_hresult(WINRT_SHIM(IAppDisplayInfo)->get_Description(put_abi(value))); return value; } template <typename D> Windows::Storage::Streams::RandomAccessStreamReference impl_IAppDisplayInfo<D>::GetLogo(const Windows::Foundation::Size & size) const { Windows::Storage::Streams::RandomAccessStreamReference value { nullptr }; check_hresult(WINRT_SHIM(IAppDisplayInfo)->abi_GetLogo(get_abi(size), put_abi(value))); return value; } template <typename D> hstring impl_IAppInfo<D>::Id() const { hstring value; check_hresult(WINRT_SHIM(IAppInfo)->get_Id(put_abi(value))); return value; } template <typename D> hstring impl_IAppInfo<D>::AppUserModelId() const { hstring value; check_hresult(WINRT_SHIM(IAppInfo)->get_AppUserModelId(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::AppDisplayInfo impl_IAppInfo<D>::DisplayInfo() const { Windows::ApplicationModel::AppDisplayInfo value { nullptr }; check_hresult(WINRT_SHIM(IAppInfo)->get_DisplayInfo(put_abi(value))); return value; } template <typename D> hstring impl_IAppInfo<D>::PackageFamilyName() const { hstring value; check_hresult(WINRT_SHIM(IAppInfo)->get_PackageFamilyName(put_abi(value))); return value; } template <typename D> hstring impl_IPackageIdWithMetadata<D>::ProductId() const { hstring value; check_hresult(WINRT_SHIM(IPackageIdWithMetadata)->get_ProductId(put_abi(value))); return value; } template <typename D> hstring impl_IPackageIdWithMetadata<D>::Author() const { hstring value; check_hresult(WINRT_SHIM(IPackageIdWithMetadata)->get_Author(put_abi(value))); return value; } template <typename D> Windows::Foundation::DateTime impl_IPackageWithMetadata<D>::InstallDate() const { Windows::Foundation::DateTime value {}; check_hresult(WINRT_SHIM(IPackageWithMetadata)->get_InstallDate(put_abi(value))); return value; } template <typename D> hstring impl_IPackageWithMetadata<D>::GetThumbnailToken() const { hstring value; check_hresult(WINRT_SHIM(IPackageWithMetadata)->abi_GetThumbnailToken(put_abi(value))); return value; } template <typename D> void impl_IPackageWithMetadata<D>::Launch(hstring_view parameters) const { check_hresult(WINRT_SHIM(IPackageWithMetadata)->abi_Launch(get_abi(parameters))); } template <typename D> bool impl_IPackageStatus<D>::VerifyIsOK() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->abi_VerifyIsOK(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::NotAvailable() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_NotAvailable(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::PackageOffline() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_PackageOffline(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::DataOffline() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_DataOffline(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::Disabled() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_Disabled(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::NeedsRemediation() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_NeedsRemediation(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::LicenseIssue() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_LicenseIssue(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::Modified() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_Modified(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::Tampered() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_Tampered(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::DependencyIssue() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_DependencyIssue(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::Servicing() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_Servicing(&value)); return value; } template <typename D> bool impl_IPackageStatus<D>::DeploymentInProgress() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus)->get_DeploymentInProgress(&value)); return value; } template <typename D> bool impl_IPackageStatus2<D>::IsPartiallyStaged() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStatus2)->get_IsPartiallyStaged(&value)); return value; } template <typename D> hstring impl_IPackageId<D>::Name() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_Name(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::PackageVersion impl_IPackageId<D>::Version() const { Windows::ApplicationModel::PackageVersion value {}; check_hresult(WINRT_SHIM(IPackageId)->get_Version(put_abi(value))); return value; } template <typename D> Windows::System::ProcessorArchitecture impl_IPackageId<D>::Architecture() const { Windows::System::ProcessorArchitecture value {}; check_hresult(WINRT_SHIM(IPackageId)->get_Architecture(&value)); return value; } template <typename D> hstring impl_IPackageId<D>::ResourceId() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_ResourceId(put_abi(value))); return value; } template <typename D> hstring impl_IPackageId<D>::Publisher() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_Publisher(put_abi(value))); return value; } template <typename D> hstring impl_IPackageId<D>::PublisherId() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_PublisherId(put_abi(value))); return value; } template <typename D> hstring impl_IPackageId<D>::FullName() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_FullName(put_abi(value))); return value; } template <typename D> hstring impl_IPackageId<D>::FamilyName() const { hstring value; check_hresult(WINRT_SHIM(IPackageId)->get_FamilyName(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::PackageId impl_IPackage<D>::Id() const { Windows::ApplicationModel::PackageId value { nullptr }; check_hresult(WINRT_SHIM(IPackage)->get_Id(put_abi(value))); return value; } template <typename D> Windows::Storage::StorageFolder impl_IPackage<D>::InstalledLocation() const { Windows::Storage::StorageFolder value { nullptr }; check_hresult(WINRT_SHIM(IPackage)->get_InstalledLocation(put_abi(value))); return value; } template <typename D> bool impl_IPackage<D>::IsFramework() const { bool value {}; check_hresult(WINRT_SHIM(IPackage)->get_IsFramework(&value)); return value; } template <typename D> Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Package> impl_IPackage<D>::Dependencies() const { Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Package> value; check_hresult(WINRT_SHIM(IPackage)->get_Dependencies(put_abi(value))); return value; } template <typename D> hstring impl_IPackage2<D>::DisplayName() const { hstring value; check_hresult(WINRT_SHIM(IPackage2)->get_DisplayName(put_abi(value))); return value; } template <typename D> hstring impl_IPackage2<D>::PublisherDisplayName() const { hstring value; check_hresult(WINRT_SHIM(IPackage2)->get_PublisherDisplayName(put_abi(value))); return value; } template <typename D> hstring impl_IPackage2<D>::Description() const { hstring value; check_hresult(WINRT_SHIM(IPackage2)->get_Description(put_abi(value))); return value; } template <typename D> Windows::Foundation::Uri impl_IPackage2<D>::Logo() const { Windows::Foundation::Uri value { nullptr }; check_hresult(WINRT_SHIM(IPackage2)->get_Logo(put_abi(value))); return value; } template <typename D> bool impl_IPackage2<D>::IsResourcePackage() const { bool value {}; check_hresult(WINRT_SHIM(IPackage2)->get_IsResourcePackage(&value)); return value; } template <typename D> bool impl_IPackage2<D>::IsBundle() const { bool value {}; check_hresult(WINRT_SHIM(IPackage2)->get_IsBundle(&value)); return value; } template <typename D> bool impl_IPackage2<D>::IsDevelopmentMode() const { bool value {}; check_hresult(WINRT_SHIM(IPackage2)->get_IsDevelopmentMode(&value)); return value; } template <typename D> Windows::ApplicationModel::PackageStatus impl_IPackage3<D>::Status() const { Windows::ApplicationModel::PackageStatus value { nullptr }; check_hresult(WINRT_SHIM(IPackage3)->get_Status(put_abi(value))); return value; } template <typename D> Windows::Foundation::DateTime impl_IPackage3<D>::InstalledDate() const { Windows::Foundation::DateTime value {}; check_hresult(WINRT_SHIM(IPackage3)->get_InstalledDate(put_abi(value))); return value; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Core::AppListEntry>> impl_IPackage3<D>::GetAppListEntriesAsync() const { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::Core::AppListEntry>> operation; check_hresult(WINRT_SHIM(IPackage3)->abi_GetAppListEntriesAsync(put_abi(operation))); return operation; } template <typename D> Windows::ApplicationModel::PackageSignatureKind impl_IPackage4<D>::SignatureKind() const { Windows::ApplicationModel::PackageSignatureKind value {}; check_hresult(WINRT_SHIM(IPackage4)->get_SignatureKind(&value)); return value; } template <typename D> bool impl_IPackage4<D>::IsOptional() const { bool value {}; check_hresult(WINRT_SHIM(IPackage4)->get_IsOptional(&value)); return value; } template <typename D> Windows::Foundation::IAsyncOperation<bool> impl_IPackage4<D>::VerifyContentIntegrityAsync() const { Windows::Foundation::IAsyncOperation<bool> operation; check_hresult(WINRT_SHIM(IPackage4)->abi_VerifyContentIntegrityAsync(put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> impl_IPackage5<D>::GetContentGroupsAsync() const { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> operation; check_hresult(WINRT_SHIM(IPackage5)->abi_GetContentGroupsAsync(put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageContentGroup> impl_IPackage5<D>::GetContentGroupAsync(hstring_view name) const { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageContentGroup> operation; check_hresult(WINRT_SHIM(IPackage5)->abi_GetContentGroupAsync(get_abi(name), put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> impl_IPackage5<D>::StageContentGroupsAsync(iterable<hstring> names) const { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> operation; check_hresult(WINRT_SHIM(IPackage5)->abi_StageContentGroupsAsync(get_abi(names), put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> impl_IPackage5<D>::StageContentGroupsAsync(iterable<hstring> names, bool moveToHeadOfQueue) const { Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVector<Windows::ApplicationModel::PackageContentGroup>> operation; check_hresult(WINRT_SHIM(IPackage5)->abi_StageContentGroupsWithPriorityAsync(get_abi(names), moveToHeadOfQueue, put_abi(operation))); return operation; } template <typename D> Windows::Foundation::IAsyncOperation<bool> impl_IPackage5<D>::SetInUseAsync(bool inUse) const { Windows::Foundation::IAsyncOperation<bool> operation; check_hresult(WINRT_SHIM(IPackage5)->abi_SetInUseAsync(inUse, put_abi(operation))); return operation; } template <typename D> Windows::ApplicationModel::Package impl_IPackageStatics<D>::Current() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageStatics)->get_Current(put_abi(value))); return value; } template <typename D> GUID impl_IPackageStagingEventArgs<D>::ActivityId() const { GUID value {}; check_hresult(WINRT_SHIM(IPackageStagingEventArgs)->get_ActivityId(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageStagingEventArgs<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageStagingEventArgs)->get_Package(put_abi(value))); return value; } template <typename D> double impl_IPackageStagingEventArgs<D>::Progress() const { double value {}; check_hresult(WINRT_SHIM(IPackageStagingEventArgs)->get_Progress(&value)); return value; } template <typename D> bool impl_IPackageStagingEventArgs<D>::IsComplete() const { bool value {}; check_hresult(WINRT_SHIM(IPackageStagingEventArgs)->get_IsComplete(&value)); return value; } template <typename D> HRESULT impl_IPackageStagingEventArgs<D>::ErrorCode() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageStagingEventArgs)->get_ErrorCode(&value)); return value; } template <typename D> GUID impl_IPackageInstallingEventArgs<D>::ActivityId() const { GUID value {}; check_hresult(WINRT_SHIM(IPackageInstallingEventArgs)->get_ActivityId(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageInstallingEventArgs<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageInstallingEventArgs)->get_Package(put_abi(value))); return value; } template <typename D> double impl_IPackageInstallingEventArgs<D>::Progress() const { double value {}; check_hresult(WINRT_SHIM(IPackageInstallingEventArgs)->get_Progress(&value)); return value; } template <typename D> bool impl_IPackageInstallingEventArgs<D>::IsComplete() const { bool value {}; check_hresult(WINRT_SHIM(IPackageInstallingEventArgs)->get_IsComplete(&value)); return value; } template <typename D> HRESULT impl_IPackageInstallingEventArgs<D>::ErrorCode() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageInstallingEventArgs)->get_ErrorCode(&value)); return value; } template <typename D> GUID impl_IPackageUpdatingEventArgs<D>::ActivityId() const { GUID value {}; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_ActivityId(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageUpdatingEventArgs<D>::SourcePackage() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_SourcePackage(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageUpdatingEventArgs<D>::TargetPackage() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_TargetPackage(put_abi(value))); return value; } template <typename D> double impl_IPackageUpdatingEventArgs<D>::Progress() const { double value {}; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_Progress(&value)); return value; } template <typename D> bool impl_IPackageUpdatingEventArgs<D>::IsComplete() const { bool value {}; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_IsComplete(&value)); return value; } template <typename D> HRESULT impl_IPackageUpdatingEventArgs<D>::ErrorCode() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageUpdatingEventArgs)->get_ErrorCode(&value)); return value; } template <typename D> GUID impl_IPackageUninstallingEventArgs<D>::ActivityId() const { GUID value {}; check_hresult(WINRT_SHIM(IPackageUninstallingEventArgs)->get_ActivityId(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageUninstallingEventArgs<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageUninstallingEventArgs)->get_Package(put_abi(value))); return value; } template <typename D> double impl_IPackageUninstallingEventArgs<D>::Progress() const { double value {}; check_hresult(WINRT_SHIM(IPackageUninstallingEventArgs)->get_Progress(&value)); return value; } template <typename D> bool impl_IPackageUninstallingEventArgs<D>::IsComplete() const { bool value {}; check_hresult(WINRT_SHIM(IPackageUninstallingEventArgs)->get_IsComplete(&value)); return value; } template <typename D> HRESULT impl_IPackageUninstallingEventArgs<D>::ErrorCode() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageUninstallingEventArgs)->get_ErrorCode(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageStatusChangedEventArgs<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageStatusChangedEventArgs)->get_Package(put_abi(value))); return value; } template <typename D> GUID impl_IPackageContentGroupStagingEventArgs<D>::ActivityId() const { GUID value {}; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_ActivityId(&value)); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageContentGroupStagingEventArgs<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_Package(put_abi(value))); return value; } template <typename D> double impl_IPackageContentGroupStagingEventArgs<D>::Progress() const { double value {}; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_Progress(&value)); return value; } template <typename D> bool impl_IPackageContentGroupStagingEventArgs<D>::IsComplete() const { bool value {}; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_IsComplete(&value)); return value; } template <typename D> HRESULT impl_IPackageContentGroupStagingEventArgs<D>::ErrorCode() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_ErrorCode(&value)); return value; } template <typename D> hstring impl_IPackageContentGroupStagingEventArgs<D>::ContentGroupName() const { hstring value; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_ContentGroupName(put_abi(value))); return value; } template <typename D> bool impl_IPackageContentGroupStagingEventArgs<D>::IsContentGroupRequired() const { bool value {}; check_hresult(WINRT_SHIM(IPackageContentGroupStagingEventArgs)->get_IsContentGroupRequired(&value)); return value; } template <typename D> event_token impl_IPackageCatalog<D>::PackageStaging(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStagingEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog)->add_PackageStaging(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog> impl_IPackageCatalog<D>::PackageStaging(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStagingEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog>(this, &ABI::Windows::ApplicationModel::IPackageCatalog::remove_PackageStaging, PackageStaging(handler)); } template <typename D> void impl_IPackageCatalog<D>::PackageStaging(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog)->remove_PackageStaging(token)); } template <typename D> event_token impl_IPackageCatalog<D>::PackageInstalling(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageInstallingEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog)->add_PackageInstalling(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog> impl_IPackageCatalog<D>::PackageInstalling(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageInstallingEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog>(this, &ABI::Windows::ApplicationModel::IPackageCatalog::remove_PackageInstalling, PackageInstalling(handler)); } template <typename D> void impl_IPackageCatalog<D>::PackageInstalling(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog)->remove_PackageInstalling(token)); } template <typename D> event_token impl_IPackageCatalog<D>::PackageUpdating(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUpdatingEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog)->add_PackageUpdating(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog> impl_IPackageCatalog<D>::PackageUpdating(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUpdatingEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog>(this, &ABI::Windows::ApplicationModel::IPackageCatalog::remove_PackageUpdating, PackageUpdating(handler)); } template <typename D> void impl_IPackageCatalog<D>::PackageUpdating(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog)->remove_PackageUpdating(token)); } template <typename D> event_token impl_IPackageCatalog<D>::PackageUninstalling(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUninstallingEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog)->add_PackageUninstalling(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog> impl_IPackageCatalog<D>::PackageUninstalling(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageUninstallingEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog>(this, &ABI::Windows::ApplicationModel::IPackageCatalog::remove_PackageUninstalling, PackageUninstalling(handler)); } template <typename D> void impl_IPackageCatalog<D>::PackageUninstalling(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog)->remove_PackageUninstalling(token)); } template <typename D> event_token impl_IPackageCatalog<D>::PackageStatusChanged(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStatusChangedEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog)->add_PackageStatusChanged(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog> impl_IPackageCatalog<D>::PackageStatusChanged(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageStatusChangedEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog>(this, &ABI::Windows::ApplicationModel::IPackageCatalog::remove_PackageStatusChanged, PackageStatusChanged(handler)); } template <typename D> void impl_IPackageCatalog<D>::PackageStatusChanged(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog)->remove_PackageStatusChanged(token)); } template <typename D> Windows::ApplicationModel::Package impl_IPackageCatalogAddOptionalPackageResult<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageCatalogAddOptionalPackageResult)->get_Package(put_abi(value))); return value; } template <typename D> HRESULT impl_IPackageCatalogAddOptionalPackageResult<D>::ExtendedError() const { HRESULT value {}; check_hresult(WINRT_SHIM(IPackageCatalogAddOptionalPackageResult)->get_ExtendedError(&value)); return value; } template <typename D> event_token impl_IPackageCatalog2<D>::PackageContentGroupStaging(const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageContentGroupStagingEventArgs> & handler) const { event_token token {}; check_hresult(WINRT_SHIM(IPackageCatalog2)->add_PackageContentGroupStaging(get_abi(handler), &token)); return token; } template <typename D> event_revoker<IPackageCatalog2> impl_IPackageCatalog2<D>::PackageContentGroupStaging(auto_revoke_t, const Windows::Foundation::TypedEventHandler<Windows::ApplicationModel::PackageCatalog, Windows::ApplicationModel::PackageContentGroupStagingEventArgs> & handler) const { return impl::make_event_revoker<D, IPackageCatalog2>(this, &ABI::Windows::ApplicationModel::IPackageCatalog2::remove_PackageContentGroupStaging, PackageContentGroupStaging(handler)); } template <typename D> void impl_IPackageCatalog2<D>::PackageContentGroupStaging(event_token token) const { check_hresult(WINRT_SHIM(IPackageCatalog2)->remove_PackageContentGroupStaging(token)); } template <typename D> Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageCatalogAddOptionalPackageResult> impl_IPackageCatalog2<D>::AddOptionalPackageAsync(hstring_view optionalPackageFamilyName) const { Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::PackageCatalogAddOptionalPackageResult> operation; check_hresult(WINRT_SHIM(IPackageCatalog2)->abi_AddOptionalPackageAsync(get_abi(optionalPackageFamilyName), put_abi(operation))); return operation; } template <typename D> Windows::ApplicationModel::PackageCatalog impl_IPackageCatalogStatics<D>::OpenForCurrentPackage() const { Windows::ApplicationModel::PackageCatalog value { nullptr }; check_hresult(WINRT_SHIM(IPackageCatalogStatics)->abi_OpenForCurrentPackage(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::PackageCatalog impl_IPackageCatalogStatics<D>::OpenForCurrentUser() const { Windows::ApplicationModel::PackageCatalog value { nullptr }; check_hresult(WINRT_SHIM(IPackageCatalogStatics)->abi_OpenForCurrentUser(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::Package impl_IPackageContentGroup<D>::Package() const { Windows::ApplicationModel::Package value { nullptr }; check_hresult(WINRT_SHIM(IPackageContentGroup)->get_Package(put_abi(value))); return value; } template <typename D> hstring impl_IPackageContentGroup<D>::Name() const { hstring value; check_hresult(WINRT_SHIM(IPackageContentGroup)->get_Name(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::PackageContentGroupState impl_IPackageContentGroup<D>::State() const { Windows::ApplicationModel::PackageContentGroupState value {}; check_hresult(WINRT_SHIM(IPackageContentGroup)->get_State(&value)); return value; } template <typename D> bool impl_IPackageContentGroup<D>::IsRequired() const { bool value {}; check_hresult(WINRT_SHIM(IPackageContentGroup)->get_IsRequired(&value)); return value; } template <typename D> hstring impl_IPackageContentGroupStatics<D>::RequiredGroupName() const { hstring value; check_hresult(WINRT_SHIM(IPackageContentGroupStatics)->get_RequiredGroupName(put_abi(value))); return value; } template <typename D> bool impl_IDesignModeStatics<D>::DesignModeEnabled() const { bool value {}; check_hresult(WINRT_SHIM(IDesignModeStatics)->get_DesignModeEnabled(&value)); return value; } template <typename D> void impl_ISuspendingDeferral<D>::Complete() const { check_hresult(WINRT_SHIM(ISuspendingDeferral)->abi_Complete()); } template <typename D> Windows::ApplicationModel::SuspendingDeferral impl_ISuspendingOperation<D>::GetDeferral() const { Windows::ApplicationModel::SuspendingDeferral deferral { nullptr }; check_hresult(WINRT_SHIM(ISuspendingOperation)->abi_GetDeferral(put_abi(deferral))); return deferral; } template <typename D> Windows::Foundation::DateTime impl_ISuspendingOperation<D>::Deadline() const { Windows::Foundation::DateTime value {}; check_hresult(WINRT_SHIM(ISuspendingOperation)->get_Deadline(put_abi(value))); return value; } template <typename D> Windows::ApplicationModel::SuspendingOperation impl_ISuspendingEventArgs<D>::SuspendingOperation() const { Windows::ApplicationModel::SuspendingOperation value { nullptr }; check_hresult(WINRT_SHIM(ISuspendingEventArgs)->get_SuspendingOperation(put_abi(value))); return value; } template <typename D> Windows::Foundation::Deferral impl_ILeavingBackgroundEventArgs<D>::GetDeferral() const { Windows::Foundation::Deferral value { nullptr }; check_hresult(WINRT_SHIM(ILeavingBackgroundEventArgs)->abi_GetDeferral(put_abi(value))); return value; } template <typename D> Windows::Foundation::Deferral impl_IEnteredBackgroundEventArgs<D>::GetDeferral() const { Windows::Foundation::Deferral value { nullptr }; check_hresult(WINRT_SHIM(IEnteredBackgroundEventArgs)->abi_GetDeferral(put_abi(value))); return value; } template <typename D> void impl_ICameraApplicationManagerStatics<D>::ShowInstalledApplicationsUI() const { check_hresult(WINRT_SHIM(ICameraApplicationManagerStatics)->abi_ShowInstalledApplicationsUI()); } inline void CameraApplicationManager::ShowInstalledApplicationsUI() { get_activation_factory<CameraApplicationManager, ICameraApplicationManagerStatics>().ShowInstalledApplicationsUI(); } inline bool DesignMode::DesignModeEnabled() { return get_activation_factory<DesignMode, IDesignModeStatics>().DesignModeEnabled(); } inline Windows::Foundation::IAsyncAction FullTrustProcessLauncher::LaunchFullTrustProcessForCurrentAppAsync() { return get_activation_factory<FullTrustProcessLauncher, IFullTrustProcessLauncherStatics>().LaunchFullTrustProcessForCurrentAppAsync(); } inline Windows::Foundation::IAsyncAction FullTrustProcessLauncher::LaunchFullTrustProcessForCurrentAppAsync(hstring_view parameterGroupId) { return get_activation_factory<FullTrustProcessLauncher, IFullTrustProcessLauncherStatics>().LaunchFullTrustProcessForCurrentAppAsync(parameterGroupId); } inline Windows::Foundation::IAsyncAction FullTrustProcessLauncher::LaunchFullTrustProcessForAppAsync(hstring_view fullTrustPackageRelativeAppId) { return get_activation_factory<FullTrustProcessLauncher, IFullTrustProcessLauncherStatics>().LaunchFullTrustProcessForAppAsync(fullTrustPackageRelativeAppId); } inline Windows::Foundation::IAsyncAction FullTrustProcessLauncher::LaunchFullTrustProcessForAppAsync(hstring_view fullTrustPackageRelativeAppId, hstring_view parameterGroupId) { return get_activation_factory<FullTrustProcessLauncher, IFullTrustProcessLauncherStatics>().LaunchFullTrustProcessForAppAsync(fullTrustPackageRelativeAppId, parameterGroupId); } inline Windows::ApplicationModel::Package Package::Current() { return get_activation_factory<Package, IPackageStatics>().Current(); } inline Windows::ApplicationModel::PackageCatalog PackageCatalog::OpenForCurrentPackage() { return get_activation_factory<PackageCatalog, IPackageCatalogStatics>().OpenForCurrentPackage(); } inline Windows::ApplicationModel::PackageCatalog PackageCatalog::OpenForCurrentUser() { return get_activation_factory<PackageCatalog, IPackageCatalogStatics>().OpenForCurrentUser(); } inline hstring PackageContentGroup::RequiredGroupName() { return get_activation_factory<PackageContentGroup, IPackageContentGroupStatics>().RequiredGroupName(); } inline Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<Windows::ApplicationModel::StartupTask>> StartupTask::GetForCurrentPackageAsync() { return get_activation_factory<StartupTask, IStartupTaskStatics>().GetForCurrentPackageAsync(); } inline Windows::Foundation::IAsyncOperation<Windows::ApplicationModel::StartupTask> StartupTask::GetAsync(hstring_view taskId) { return get_activation_factory<StartupTask, IStartupTaskStatics>().GetAsync(taskId); } } } template<> struct std::hash<winrt::Windows::ApplicationModel::IAppDisplayInfo> { size_t operator()(const winrt::Windows::ApplicationModel::IAppDisplayInfo & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IAppInfo> { size_t operator()(const winrt::Windows::ApplicationModel::IAppInfo & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::ICameraApplicationManagerStatics> { size_t operator()(const winrt::Windows::ApplicationModel::ICameraApplicationManagerStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IDesignModeStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IDesignModeStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IEnteredBackgroundEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IEnteredBackgroundEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IFullTrustProcessLauncherStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IFullTrustProcessLauncherStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::ILeavingBackgroundEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::ILeavingBackgroundEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackage> { size_t operator()(const winrt::Windows::ApplicationModel::IPackage & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackage2> { size_t operator()(const winrt::Windows::ApplicationModel::IPackage2 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackage3> { size_t operator()(const winrt::Windows::ApplicationModel::IPackage3 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackage4> { size_t operator()(const winrt::Windows::ApplicationModel::IPackage4 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackage5> { size_t operator()(const winrt::Windows::ApplicationModel::IPackage5 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageCatalog> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageCatalog & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageCatalog2> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageCatalog2 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageCatalogAddOptionalPackageResult> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageCatalogAddOptionalPackageResult & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageCatalogStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageCatalogStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageContentGroup> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageContentGroup & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageContentGroupStagingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageContentGroupStagingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageContentGroupStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageContentGroupStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageId> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageId & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageIdWithMetadata> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageIdWithMetadata & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageInstallingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageInstallingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageStagingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageStagingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageStatus> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageStatus & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageStatus2> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageStatus2 & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageStatusChangedEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageStatusChangedEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageUninstallingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageUninstallingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageUpdatingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageUpdatingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IPackageWithMetadata> { size_t operator()(const winrt::Windows::ApplicationModel::IPackageWithMetadata & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IStartupTask> { size_t operator()(const winrt::Windows::ApplicationModel::IStartupTask & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::IStartupTaskStatics> { size_t operator()(const winrt::Windows::ApplicationModel::IStartupTaskStatics & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::ISuspendingDeferral> { size_t operator()(const winrt::Windows::ApplicationModel::ISuspendingDeferral & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::ISuspendingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::ISuspendingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::ISuspendingOperation> { size_t operator()(const winrt::Windows::ApplicationModel::ISuspendingOperation & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::AppDisplayInfo> { size_t operator()(const winrt::Windows::ApplicationModel::AppDisplayInfo & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::AppInfo> { size_t operator()(const winrt::Windows::ApplicationModel::AppInfo & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::EnteredBackgroundEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::EnteredBackgroundEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::LeavingBackgroundEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::LeavingBackgroundEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::Package> { size_t operator()(const winrt::Windows::ApplicationModel::Package & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageCatalog> { size_t operator()(const winrt::Windows::ApplicationModel::PackageCatalog & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageCatalogAddOptionalPackageResult> { size_t operator()(const winrt::Windows::ApplicationModel::PackageCatalogAddOptionalPackageResult & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageContentGroup> { size_t operator()(const winrt::Windows::ApplicationModel::PackageContentGroup & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageContentGroupStagingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageContentGroupStagingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageId> { size_t operator()(const winrt::Windows::ApplicationModel::PackageId & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageInstallingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageInstallingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageStagingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageStagingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageStatus> { size_t operator()(const winrt::Windows::ApplicationModel::PackageStatus & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageStatusChangedEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageStatusChangedEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageUninstallingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageUninstallingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::PackageUpdatingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::PackageUpdatingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::StartupTask> { size_t operator()(const winrt::Windows::ApplicationModel::StartupTask & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::SuspendingDeferral> { size_t operator()(const winrt::Windows::ApplicationModel::SuspendingDeferral & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::SuspendingEventArgs> { size_t operator()(const winrt::Windows::ApplicationModel::SuspendingEventArgs & value) const noexcept { return winrt::impl::hash_unknown(value); } }; template<> struct std::hash<winrt::Windows::ApplicationModel::SuspendingOperation> { size_t operator()(const winrt::Windows::ApplicationModel::SuspendingOperation & value) const noexcept { return winrt::impl::hash_unknown(value); } }; WINRT_WARNING_POP
[ "kwelton@microsoft.com" ]
kwelton@microsoft.com
cfbe9db88e04e009ddf12d83d883705446ca4320
4b221f6da04e251f82b18b50a5a5f2940cf95eaa
/GoogleCodeJam/2021/1A/A/main.cpp
c108cfc428c5ae6fcde12e4fdefe6205ba004b62
[]
no_license
dmikarpoff/CompetProg
793ea52d7cfc4ad04776caac2ea56be5fe791546
f95c88f91d31edbb61c92b5b923ce76fe19c6c8b
refs/heads/master
2023-06-09T11:33:11.456774
2023-06-02T22:40:46
2023-06-02T22:40:46
122,370,845
0
0
null
null
null
null
UTF-8
C++
false
false
2,114
cpp
#include <iostream> #include <vector> #include <string> using namespace std; bool lt(const string& lhs, const string& rhs) { if (lhs.size() < rhs.size()) { return true; } if (lhs.size() > rhs.size()) { return false; } return lhs < rhs; } int main() { int t; cin >> t; for (int o = 0; o < t; ++o) { int n; cin >> n; string prev = ""; int cost = 0; for (int i = 0; i < n; ++i) { string cur; cin >> cur; if (!lt(prev, cur)) { bool done = false; for (size_t j = 0; j < cur.size(); ++j) { if (cur[j] > prev[j]) { cost += prev.size() - cur.size(); cur.resize(prev.size(), '0'); done = true; break; } if (cur[j] < prev[j]) { cost += prev.size() - cur.size() + 1; cur.resize(prev.size() + 1, '0'); done = true; break; } } if (!done) { for (size_t j = prev.size() - 1; j >= cur.size(); --j) { if (prev[j] != '9') { cost += prev.size() - cur.size(); cur = prev; cur[j] = static_cast<char>(prev[j] + 1); for (size_t h = j + 1; h < cur.size(); ++h) { cur[h] = '0'; } done = true; break; } } if (!done) { cost += prev.size() - cur.size() + 1; cur.resize(prev.size() + 1, '0'); } } } prev = move(cur); } cout << "Case #" << o + 1 << ": "; cout << cost; cout << endl; } return 0; }
[ "dmitry.karpov@wartsila.com" ]
dmitry.karpov@wartsila.com
14628e22aa43d1618cefb115cf35ee29f277cda9
164c59358a1890080089bc3d2d35562a8adf7f4c
/iiwa-driver/externals/kuka-fri/example/LBRWrenchSineOverlay/LBRWrenchSineOverlayApp.cpp
76d6a9dc4d81b362c398da1a59946bf76e9eb6ae
[]
no_license
HarvardAgileRoboticsLab/kuka-dev
ecfeeefae840b871dbebd4caa8d03d4fc46b2953
d48553cf28b5f9d38389ec44a200216f54a0506e
refs/heads/master
2021-06-13T20:39:02.518935
2017-04-08T02:17:15
2017-04-08T02:17:15
71,494,524
1
0
null
null
null
null
UTF-8
C++
false
false
5,597
cpp
/** DISCLAIMER OF WARRANTY The Software is provided "AS IS" and "WITH ALL FAULTS," without warranty of any kind, including without limitation the warranties of merchantability, fitness for a particular purpose and non-infringement. KUKA makes no warranty that the Software is free of defects or is suitable for any particular purpose. In no event shall KUKA be responsible for loss or damages arising from the installation or use of the Software, including but not limited to any indirect, punitive, special, incidental or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. The entire risk to the quality and performance of the Software is not borne by KUKA. Should the Software prove defective, KUKA is not liable for the entire cost of any service and repair. COPYRIGHT All Rights Reserved Copyright (C) 2014-2016 KUKA Roboter GmbH Augsburg, Germany This material is the exclusive property of KUKA Roboter GmbH and must be returned to KUKA Roboter GmbH immediately upon request. This material and the information illustrated or contained herein may not be used, reproduced, stored in a retrieval system, or transmitted in whole or in part in any way - electronic, mechanical, photocopying, recording, or otherwise, without the prior written consent of KUKA Roboter GmbH. \file \version {1.10} */ #include <cstdlib> #include <cstdio> #include <cstring> // strstr #include "LBRWrenchSineOverlayClient.h" #include "friUdpConnection.h" #include "friClientApplication.h" using namespace KUKA::FRI; #define DEFAULT_PORTID 30200 #define DEFAULT_FREQUENCY 0.25 #define DEFAULT_AMPLITUDE 5.0 int main (int argc, char** argv) { // parse command line arguments if (argc > 1) { if ( strstr (argv[1],"help") != NULL) { printf( "\nKUKA LBR wrench sine overlay test application\n\n" "\tCommand line arguments:\n" "\t1) remote hostname (optional)\n" "\t2) port ID (optional)\n" "\t3) sine frequency in Hertz (for Fx) (optional)\n" "\t4) sine amplitude in radians (for Fx) (optional)\n" "\t5) sine frequency in Hertz (for Fy) (optional)\n" "\t6) sine amplitude in radians (for Fy) (optional)\n" ); return 1; } } char* hostname = (argc >= 2) ? argv[1] : NULL; int port = (argc >= 3) ? atoi(argv[2]) : DEFAULT_PORTID; double frequencyX = (argc >= 4) ? atof(argv[3]) : DEFAULT_FREQUENCY; double amplitudeX = (argc >= 5) ? atof(argv[4]) : DEFAULT_AMPLITUDE; double frequencyY = (argc >= 6) ? atof(argv[5]) : DEFAULT_FREQUENCY; double amplitudeY = (argc >= 7) ? atof(argv[6]) : DEFAULT_AMPLITUDE; printf("Enter LBRWrenchSineOverlay Client Application\n"); /***************************************************************************/ /* */ /* Place user Client Code here */ /* */ /**************************************************************************/ // create new sine overlay client LBRWrenchSineOverlayClient client(frequencyX, frequencyY, amplitudeX, amplitudeY); /***************************************************************************/ /* */ /* Standard application structure */ /* Configuration */ /* */ /***************************************************************************/ // create new udp connection UdpConnection connection; // pass connection and client to a new FRI client application ClientApplication app(connection, client); // connect client application to KUKA Sunrise controller app.connect(port, hostname); /***************************************************************************/ /* */ /* Standard application structure */ /* Execution mainloop */ /* */ /***************************************************************************/ // repeatedly call the step routine to receive and process FRI packets bool success = true; while (success) { success = app.step(); } /***************************************************************************/ /* */ /* Standard application structure */ /* Dispose */ /* */ /***************************************************************************/ // disconnect from controller app.disconnect(); printf("Exit LBRWrenchSineOverlay Client Application\n"); return 1; }
[ "kuindersma@gmail.com" ]
kuindersma@gmail.com
5ede079223c69f52f2b431d9a5c857e35670b421
2eb72b2338ffbbd0ef91085379a0dc99dba41651
/ext/spyglass/size.h
95f01ee72ff9fdf7f41714bc012cbb417e919764
[ "MIT" ]
permissive
quintel/spyglass
fd150c9615bf9b1c7a53d4e9af574a5294855f90
df57dc4cdf007270210bf987eed68c284eca4da6
refs/heads/master
2021-01-15T17:41:44.077596
2013-10-04T09:32:15
2013-10-04T09:32:15
13,440,830
0
0
null
null
null
null
UTF-8
C++
false
false
677
h
#ifndef SPYGLASS_SIZE_H_ #define SPYGLASS_SIZE_H_ #include "spyglass.h" namespace Spyglass { namespace Size { void define_ruby_class(); VALUE get_ruby_class(); static VALUE rb_alloc(VALUE self); static void rb_free(cv::Size *size); static VALUE rb_initialize(VALUE self, VALUE width, VALUE height); static VALUE rb_get_area(VALUE self); static VALUE rb_get_width(VALUE self); static VALUE rb_get_height(VALUE self); static VALUE rb_set_width(VALUE self, VALUE width); static VALUE rb_set_height(VALUE self, VALUE height); VALUE from_cvmat(cv::Mat *mat); VALUE from_cvrect(cv::Rect *rect); } } #endif // SPYGLASS_SIZE_H_
[ "me@andremedeiros.info" ]
me@andremedeiros.info
0f7690c4fbd341c66d83da4ec6305b9085e725bf
18764973fb6947c80114c95e52f5e20ff1c7eda4
/src/components/application_manager/src/commands/hmi/on_vr_command_notification.cc
bcd02196a8551f6fd0cdedca317a73bb0ba3e17f
[]
no_license
FaridJafarov-l/sdl_core
a75ff5f13572d92f09c995bc5e979c8815aaeb52
11d6463b47a00334a23e8e7cadea4ab818d54f60
refs/heads/master
2023-09-04T08:55:16.628093
2016-12-19T12:33:47
2016-12-19T12:33:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,750
cc
/* * Copyright (c) 2013, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following * disclaimer in the documentation and/or other materials provided with the * distribution. * * Neither the name of the Ford Motor Company nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "application_manager/commands/hmi/on_vr_command_notification.h" #include "application_manager/application_manager_impl.h" #include "application_manager/message_helper.h" #include "config_profile/profile.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" #include "application_manager/event_engine/event.h" namespace application_manager { namespace commands { OnVRCommandNotification::OnVRCommandNotification( const MessageSharedPtr& message) : NotificationFromHMI(message) { } OnVRCommandNotification::~OnVRCommandNotification() { } void OnVRCommandNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr active_app = ApplicationManagerImpl::instance() ->active_application(); const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id] .asUInt(); uint32_t max_cmd_id = profile::Profile::instance()->max_cmd_id(); // Check if this is one of standart VR commands (i.e. "Help") if (cmd_id > max_cmd_id + 1) { LOG4CXX_INFO(logger_, "Switched App"); MessageHelper::SendActivateAppToHMI(cmd_id - max_cmd_id); return; } // Check if this is "Help" if (cmd_id == max_cmd_id + 1) { return; } const uint32_t app_id = (*message_)[strings::msg_params][strings::app_id] .asUInt(); ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id); if (!app) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; } /* check if perform interaction is active * if it is active we should sent to HMI DeleteCommand request * and PerformInterActionResponse to mobile */ if (0 != app->is_perform_interaction_active()) { event_engine::Event event(hmi_apis::FunctionID::VR_OnCommand); event.set_smart_object(*message_); event.raise(); } else { (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::eType::OnCommandID); (*message_)[strings::msg_params][strings::trigger_source] = static_cast<int32_t>(mobile_apis::TriggerSource::TS_VR); SendNotificationToMobile(message_); } } } // namespace commands } // namespace application_manager
[ "jjdickow@gmail.com" ]
jjdickow@gmail.com
34881bf5965e1d18ac06d25b610a38e072c6280c
b65af77686e4779759e0afb1af4bed33d37f714f
/cDMSavingThrowModifierDialog.h
920da02406b116d3ca857ff88ca773ed3eba19d0
[]
no_license
kearyo/DM-Helper
0afa7069a7e6668f011201465d8a724ec469d401
a90a6bc6d9c3f8f9fe7062a61f1b2888a67e9a50
refs/heads/master
2023-05-06T11:49:01.848611
2021-05-24T00:38:59
2021-05-24T00:38:59
80,240,954
0
0
null
null
null
null
UTF-8
C++
false
false
909
h
#pragma once // cDMSavingThrowModifierDialog dialog class cDMSavingThrowModifierDialog : public CDialog { DECLARE_DYNAMIC(cDMSavingThrowModifierDialog) public: cDMSavingThrowModifierDialog(int *pnSavingThrowModifiers, CWnd* pParent = NULL); // standard constructor virtual ~cDMSavingThrowModifierDialog(); int *m_pnSavingThrowModifiers; int m_nSavingThrowModifiers[5]; // local copy void Refresh(); // Dialog Data enum { IDD = IDD_SAVING_THROW_MOD_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCancel(); CString m_szSaveMod[5]; afx_msg void OnEnSetfocusSaveEdit1(); afx_msg void OnEnSetfocusSaveEdit2(); afx_msg void OnEnSetfocusSaveEdit3(); afx_msg void OnEnSetfocusSaveEdit4(); afx_msg void OnEnSetfocusSaveEdit5(); };
[ "kearyo@67horse.net" ]
kearyo@67horse.net
0afd3e2f80625096e734882e252bb2ccf0874102
9cb42ffa0a46841134fb3f72b074c31b9e389a3b
/dotbouncer/dotbouncer.ino
3a7d9be9b328668ff3b72ef69037b009e29754fd
[]
no_license
Balint-H/Arduino-Weekends
0135de727205a5424494f6f8699d5004644687d2
1e433895710191d31d29d90e6a4f29aebb943fde
refs/heads/master
2020-09-03T22:16:04.864206
2019-11-04T20:50:44
2019-11-04T20:50:44
219,586,959
0
0
null
null
null
null
UTF-8
C++
false
false
3,160
ino
#include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 /*----------------------------- Paddle class -----------------------------*/ class Paddle { private: int width; int pos; int pin; int x; int point; public: Paddle(); Paddle(int xin, int pinIn); ~Paddle(); int GetPos(){return pos;} int GetWidth(){return width;} int GetX(){return x;} void Update(); void SetWidth(int widthIn){width=widthIn;} void incrPoint(){point++;} }; Paddle::Paddle() { width=10; pos=27; pin=0; x=0; point=0; } Paddle::Paddle(int xin, int pinIn) { width=10; pos=27; pin=pinIn; x=xin; point=0; } Paddle::~Paddle() { } void Paddle::Update() { pos=analogRead(pin)/19; display.drawFastVLine(x, analogRead(pin)/16, width, WHITE); } /*----------------------------- Ball class -----------------------------*/ class Ball { private: int xPos; int yPos; int drag; int angle; long int prev; public: Ball(); ~Ball(); void Update(Paddle& paddleRight, Paddle& paddleLeft); void WallCollide(){angle=0-angle;} void PaddleCollide(Paddle& paddleIn); void CheckPoint(Paddle& paddleRight, Paddle& paddleLeft); }; Ball::Ball() { xPos=64; yPos=32; drag=10; angle=0; prev=0; } Ball::~Ball() { } void Ball::Update(Paddle& paddleRight, Paddle& paddleLeft) { if (yPos<=0 || yPos>=64)WallCollide(); if(xPos==paddleRight.GetX()-1) { PaddleCollide(paddleRight); } else if(xPos==paddleLeft.GetX()+1) { PaddleCollide(paddleLeft); } switch(angle) { case 1: xPos++; break; case 2: xPos++; yPos++; break; case 3: xPos--; yPos++; break; case -1: xPos--; break; case -2: xPos++; yPos--; break; case -3: xPos--; yPos--; break; } display.drawPixel(xPos, yPos, WHITE); } void Ball::PaddleCollide(Paddle& paddleIn) { int dif=yPos-paddleIn.GetPos(); if(angle>0) { if(dif>=0 && dif<3)angle=3; else if(dif>=3 && dif<7)angle=-1; else if(dif>=7 && dif<10)angle=-3; } else { if(dif>=0 && dif<3)angle=2; else if(dif>=3 && dif<7)angle=1; else if(dif>=7 && dif<10)angle=-2; } } void Ball::CheckPoint(Paddle& paddleRight, Paddle& paddleLeft) { if (xPos<=0) { paddleLeft.incrPoint(); xPos=64; yPos=32; } } /*------------------------------------------ Main body of code ------------------------------------------*/ void setup() { Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.display(); display.clearDisplay(); } void loop() { while(true) { } }
[ "bkh16@ic.ac.uk" ]
bkh16@ic.ac.uk
a439452fdea088616d939db17dcf4e19ee79d86a
4503b4ec29e9a30d26c433bac376f2bddaefd9e5
/XtreamToolkit/v16.4.0/Source/Chart/Appearance/XTPChartPalette.cpp
e107b021abbc3666a5201094c7255530fd35aede
[]
no_license
SwunZH/ecocommlibs
0a872e0bbecbb843a0584fb787cf0c5e8a2a270b
4cff09ff1e479f5f519f207262a61ee85f543b3a
refs/heads/master
2021-01-25T12:02:39.067444
2018-02-23T07:04:43
2018-02-23T07:04:43
123,447,012
1
0
null
2018-03-01T14:37:53
2018-03-01T14:37:53
null
UTF-8
C++
false
false
4,913
cpp
// XTPChartPalette.cpp // // This file is a part of the XTREME TOOLKIT PRO MFC class library. // (c)1998-2013 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ///////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "Common/XTPPropExchange.h" #include "../Types/XTPChartTypes.h" #include "../XTPChartElement.h" #include <Chart/XTPChartLegendItem.h> #include "XTPChartPalette.h" CXTPChartPalette::CXTPChartPalette(CXTPChartElement* pOwner) { m_pOwner = pOwner; #ifdef _XTP_ACTIVEX EnableAutomation(); EnableTypeLib(); #endif } CXTPChartPalette::~CXTPChartPalette() { } CXTPChartColor CXTPChartPalette::GetColor(int Index) const { if (m_arrEntries.GetSize() == 0) return CXTPChartColor(CXTPChartColor::White); return m_arrEntries[Index % m_arrEntries.GetSize()].Color; } CXTPChartColor CXTPChartPalette::GetColor2(int Index) const { if (m_arrEntries.GetSize() == 0) return CXTPChartColor(CXTPChartColor::Black); return m_arrEntries[Index % m_arrEntries.GetSize()].Color2; } void CXTPChartPalette::DoPropExchange(CXTPPropExchange* pPX) { CXTPPropExchangeSection pxItems(pPX->GetSection(_T("Items"))); if (pPX->IsLoading()) { m_arrEntries.RemoveAll(); CXTPPropExchangeEnumeratorPtr pEnumerator(pxItems->GetEnumerator(_T("Item"))); POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxItem(pEnumerator->GetNext(pos)); CXTPChartPaletteEntry entry; PX_Color(&pxItem, _T("Color"), entry.Color); CXTPChartColor clr2; PX_Color(&pxItem, _T("Color2"), entry.Color2); m_arrEntries.Add(entry); } } else { CXTPPropExchangeEnumeratorPtr pEnumerator(pxItems->GetEnumerator(_T("Item"))); POSITION pos = pEnumerator->GetPosition((int)m_arrEntries.GetSize()); for (int i = 0; i < GetCount(); i++) { CXTPChartPaletteEntry& entry = m_arrEntries[i]; CXTPPropExchangeSection pxItem(pEnumerator->GetNext(pos)); PX_Color(&pxItem, _T("Color"), entry.Color); PX_Color(&pxItem, _T("Color2"), entry.Color2); } } } #ifdef _XTP_ACTIVEX BEGIN_DISPATCH_MAP(CXTPChartPalette, CXTPChartElement) DISP_PROPERTY_PARAM_ID(CXTPChartPalette, "Color", 1, OleGetColor, OleSetColor, VT_COLOR, VTS_I4) DISP_PROPERTY_PARAM_ID(CXTPChartPalette, "Color2", 2, OleGetColor2, OleSetColor2, VT_COLOR, VTS_I4) DISP_PROPERTY_EX_ID(CXTPChartPalette, "Count", 3, OleGetCount, SetNotSupported, VT_I4) DISP_FUNCTION_ID(CXTPChartPalette, "DeleteAll", 4, OleDeleteAll, VT_EMPTY, VTS_NONE) DISP_FUNCTION_ID(CXTPChartPalette, "AddEntry", 5, OleAddEntry, VT_EMPTY, VTS_COLOR VTS_COLOR) END_DISPATCH_MAP() // {A67BCC77-27BF-4cb1-9ABF-4558D9835223} static const GUID IID_IChartPalette = { 0xa67bcc77, 0x27bf, 0x4cb1, { 0x9a, 0xbf, 0x45, 0x58, 0xd9, 0x83, 0x52, 0x23 } }; BEGIN_INTERFACE_MAP(CXTPChartPalette, CXTPChartElement) INTERFACE_PART(CXTPChartPalette, IID_IChartPalette, Dispatch) END_INTERFACE_MAP() IMPLEMENT_OLETYPELIB_EX(CXTPChartPalette, IID_IChartPalette) OLE_COLOR CXTPChartPalette::OleGetColor(int nIndex) { if (nIndex < 0 || nIndex >= m_arrEntries.GetSize()) AfxThrowOleException(E_INVALIDARG); return m_arrEntries[nIndex].Color.ToOleColor(); } OLE_COLOR CXTPChartPalette::OleGetColor2(int nIndex) { if (nIndex < 0 || nIndex >= m_arrEntries.GetSize()) AfxThrowOleException(E_INVALIDARG); return m_arrEntries[nIndex].Color2.ToOleColor(); } void CXTPChartPalette::OleSetColor(int nIndex, OLE_COLOR clr) { if (nIndex < 0 || nIndex >= m_arrEntries.GetSize()) AfxThrowOleException(E_INVALIDARG); m_arrEntries[nIndex].Color = CXTPChartColor::FromOleColor(clr); } void CXTPChartPalette::OleSetColor2(int nIndex, OLE_COLOR clr) { if (nIndex < 0 || nIndex >= m_arrEntries.GetSize()) AfxThrowOleException(E_INVALIDARG); m_arrEntries[nIndex].Color2 = CXTPChartColor::FromOleColor(clr); } void CXTPChartPalette::OleDeleteAll() { m_arrEntries.RemoveAll(); } int CXTPChartPalette::OleGetCount() { return m_arrEntries.GetSize(); } void CXTPChartPalette::OleAddEntry(OLE_COLOR clr, OLE_COLOR clr2) { CXTPChartPaletteEntry entry; entry.Color = CXTPChartColor::FromOleColor(clr); entry.Color2 = CXTPChartColor::FromOleColor(clr2); m_arrEntries.Add(entry); } #endif
[ "kwkang@3e9e098e-e079-49b3-9d2b-ee27db7392fb" ]
kwkang@3e9e098e-e079-49b3-9d2b-ee27db7392fb
7084ddd5c44a4acfa8fd54015bceefb154e1107f
e9bb623aad174a8067d6a5df4c3ccad211d6ffe6
/AR.h
1f8107e1c2f7ed003c87edbc284ac3df3146bbc6
[]
no_license
DevilEEE/MPR
ac6a9a5035825dc95a21e9a380983b1cc0b99cae
d38282f6c6c8f574b82da892ea81894a4a04b4f3
refs/heads/master
2020-03-23T21:46:13.214460
2018-07-24T09:16:11
2018-07-24T09:16:11
142,131,895
2
0
null
null
null
null
UTF-8
C++
false
false
824
h
#pragma once #include "model.h" class AR : public model { public: AR(corpus* corp, int K, double lambda, double biasReg) : model(corp) , K(K) , lambda(lambda) , biasReg(biasReg) {} ~AR() {} void init(); void cleanUp(); double prediction(int user, int item); void getParametersFromVector(double* g, double** beta_user, double*** gamma_user, double*** gamma_item, action_t action); int sampleItem(); void train(int iterations, double learn_rate); virtual void oneiteration(double learn_rate); virtual void updateFactors(int item_id, int pos_user_id, int neg_user_id, double learn_rate); string toString(); /* auxiliary variables */ double * beta_user; double ** gamma_user; double ** gamma_item; /* hyper-parameters */ int K; double lambda; double biasReg; };
[ "noreply@github.com" ]
noreply@github.com
a60fe2ed1a7b93a628dc19dab37d970cd1f8a652
a5d6624aa34732c6d1fc1852b720807bb765e694
/mainwindow.cpp
0209a1a6f4d937a2ebe151552991530e861cb30f
[]
no_license
edmondsb/DesktopApplication
c9d3969a7cf875333ea0dbff5419bb16965abb6d
99b4c5c432700cb045f1ef18234ca8baf6dd8857
refs/heads/master
2020-09-09T06:52:36.054260
2020-01-27T05:37:59
2020-01-27T05:37:59
221,380,727
0
0
null
null
null
null
UTF-8
C++
false
false
7,013
cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QJsonObject> #include <QJsonArray> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), timer (new QTimer), timer2 (new QTimer), httpManager(new HTTPManager) { ui->setupUi(this); connect(timer, SIGNAL(timeout()), this, SLOT(setCurrentTime())); setCurrentTime(); timer->start(1000); connect(timer2, SIGNAL(timeout()), this, SLOT(changeImage())); loadImages(); timer2->start(10000); connect(httpManager, SIGNAL(ImageReady(QPixmap *)), this, SLOT(processImage(QPixmap *))); connect(httpManager, SIGNAL(WeatherJsonReady(QJsonObject *)), this, SLOT(processWeatherJson(QJsonObject *))); } MainWindow::~MainWindow() { delete ui; } void MainWindow::setCurrentTime() { QTime time = QTime::currentTime(); QString hour = time.toString("hh"); QString minute = time.toString("mm"); QString second = time.toString("ss"); ui->hourLCD->display(hour); ui->minLCD->display(minute); ui->secLCD->display(second); int intHour = hour.toInt(); if(intHour < 12){ ui->Greeting->setText("Good Morning!"); } if(intHour >= 12){ if(intHour < 17) ui->Greeting->setText("Good Afternoon!"); if(intHour > 17) ui->Greeting->setText("Good Evening!"); if(intHour > 20) ui->Greeting->setText("Good Night!"); } } void MainWindow::processImage(QPixmap *image) { ui->imageLabel->setPixmap(*image); } void MainWindow::processWeatherJson(QJsonObject *json) { qDebug() << json->value("weather"); QString weather = json->value("weather").toArray()[0].toObject()["main"].toString(); QString weatherDesc= json->value("weather").toArray()[0].toObject()["description"].toString(); double temp = json->value("main").toObject()["temp"].toDouble(); double temp_min = json->value("main").toObject()["temp_min"].toDouble(); double temp_max = json->value("main").toObject()["temp_max"].toDouble(); double humidity = json->value("main").toObject()["humidity"].toDouble(); qDebug() << weather; qDebug() << weatherDesc; qDebug() << temp; qDebug() << temp_min; qDebug() << temp_max; qDebug() << humidity; ui->weatherLabel->setText("Weather: " +weather +"\nTemp: " + QString::number(temp) + "\nMin Temp: " + QString::number(temp_min) + "\nMax Temp: " + QString::number(temp_max) + "\nHumidity: " + QString::number(humidity)); if(weather == "Clear"){ ui->weatherIcon->setPixmap(clearImage); } if(weather == "Clouds"){ qDebug() << "here " + weather; ui->weatherIcon->setPixmap(cloudsImage); } if(weather == "Scatteredclouds"){ ui->weatherIcon->setPixmap(cloudsImage); } if(weather == "Haze"){ ui->weatherIcon->setPixmap(hazeImage); } if(weather == "Rain"){ ui->weatherIcon->setPixmap(rainImage); } if(weather == "Drizzle"){ ui->weatherIcon->setPixmap(rainImage); } if(weather == "Snow"){ ui->weatherIcon->setPixmap(snowImage); } if(weather == "thunderstorm"){ ui->weatherIcon->setPixmap(thunderstormImage); } } void MainWindow::loadImages() { QString beachFileName = "Beach.jpg"; QString gameFileName = "Game.jpg"; QString nightSkyFileName = "NightSky.jpg"; QString parkFileName = "Park.jpg"; QString waterMountFileName = "WaterMount.jpg"; if (image1.load(beachFileName)){ qDebug() << "image1 load successful"; image1 = image1.scaled(ui->DigitalPhotoFrame->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (image2.load(gameFileName)){ qDebug() << "image1 load successful"; image2 = image2.scaled(ui->DigitalPhotoFrame->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (image3.load(nightSkyFileName)){ qDebug() << "image1 load successful"; image3 = image3.scaled(ui->DigitalPhotoFrame->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (image4.load(parkFileName)){ qDebug() << "image1 load successful"; image4 = image4.scaled(ui->DigitalPhotoFrame->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (image5.load(waterMountFileName)){ qDebug() << "image1 load successful"; image5 = image5.scaled(ui->DigitalPhotoFrame->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } //load weather icons QString clearFileName = "clear.png"; QString cloudsFileName = "clouds.png"; QString hazeFileName = "haze.png"; QString rainFileName = "rain.png"; QString snowFileName = "snow.png"; QString drizzleFileName = "rain.png"; QString thunderstormFileName = "thunderstorm.png"; if (clearImage.load(clearFileName)){ clearImage = clearImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (cloudsImage.load(cloudsFileName)){ cloudsImage = cloudsImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (hazeImage.load(hazeFileName)){ hazeImage = hazeImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (rainImage.load(rainFileName)){ rainImage = rainImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (snowImage.load(clearFileName)){ snowImage = snowImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } if (thunderstormImage.load(clearFileName)){ thunderstormImage = thunderstormImage.scaled(ui->weatherIcon->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } } void MainWindow::changeImage() { if(photo == 1){ ui->DigitalPhotoFrame->setPixmap(image1); } if(photo == 2){ ui->DigitalPhotoFrame->setPixmap(image2); } if(photo == 3){ ui->DigitalPhotoFrame->setPixmap(image3); } if(photo == 4){ ui->DigitalPhotoFrame->setPixmap(image4); } if(photo == 5){ ui->DigitalPhotoFrame->setPixmap(image5); photo =0; } photo++; } void MainWindow::on_imageDownloadButton_clicked() { QString zip = ui->zipCodeEdit->text(); qDebug() << "zip"; httpManager->sendImageRequest(zip); } void MainWindow::on_weatherDownloadButton_clicked() { QString zip = ui->zipCodeEdit->text(); qDebug() << "zip"; httpManager->sendWeatherRequest(zip); }
[ "noreply@github.com" ]
noreply@github.com
6e129715331c7402fc81da889f9085c4c983c943
142af4cf8484bafa3747b6eb403d9ee487e14da9
/network/HttpRequest.cpp
f5b1e0e1550d2a1e148162eab63afbd4b98f85e3
[]
no_license
brianuuuu/IMServer
130ebef8d21398f9492286c222ab027a22ef2318
d6a15599ea5947a71f6fdd657b337a45a0a2273f
refs/heads/master
2021-01-25T06:05:52.788742
2013-01-16T02:58:37
2013-01-16T02:58:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,792
cpp
/***************************************************************** * Http Request Generate and parse * Frank Song 2005-8-22 ****************************************************************/ #include "CmBase.h" #include "TimeValue.h" #include "HttpRequest.h" #include "Addr.h" #include "NetworkInterface.h" #include "base64.h" /* * CHTTPRequest */ CHTTPRequest::CHTTPRequest() { } CHTTPRequest::~CHTTPRequest() { } int CHTTPRequest::BuildHttpGetRequest(char *pBuf, int *pLen, char *strHostName, short nHostPort, void *pProxySetting) { return BuildHttpMethod(HTTP_GET, pBuf, pLen, strHostName, nHostPort, -1, pProxySetting); } int CHTTPRequest::BuildHttpPutRequest(char *pBuf, int *pLen, char *strHostName, short nHostPort, int nContentLen, void *pProxySetting /* = NULL */) { return BuildHttpMethod(HTTP_PUT, pBuf, pLen, strHostName, nHostPort, 0, pProxySetting); } int CHTTPRequest::BuildHttpPostRequest(char *pBuf, int *pLen, char *strHostName, short nHostPort, int nContentLen, void *pProxySetting /* = NULL */) { return BuildHttpMethod(HTTP_POST, pBuf, pLen, strHostName, nHostPort, 0, pProxySetting); } char *CHTTPRequest::HttpMethodToString (Http_method nMethod) { switch (nMethod) { case HTTP_GET: return "GET"; case HTTP_PUT: return "PUT"; case HTTP_POST: return "POST"; case HTTP_OPTIONS: return "OPTIONS"; case HTTP_HEAD: return "HEAD"; case HTTP_DELETE: return "DELETE"; case HTTP_TRACE: return "TRACE"; } return "(uknown)"; } int CHTTPRequest::HttpStringToMethod(char *pStr) { if (strncmp (pStr, "GET", 3) == 0) return HTTP_GET; if (strncmp (pStr, "PUT", 3) == 0) return HTTP_PUT; if (strncmp (pStr, "POST", 4) == 0) return HTTP_POST; if (strncmp (pStr, "OPTIONS", 7) == 0) return HTTP_OPTIONS; if (strncmp (pStr, "HEAD", 4) == 0) return HTTP_HEAD; if (strncmp (pStr, "DELETE", 6) == 0) return HTTP_DELETE; if (strncmp (pStr, "TRACE", 5) == 0) return HTTP_TRACE; return -1; } /* * The value of proxy addr and proxy port should be dest addr and dest port here */ int CHTTPRequest::BuildHttpMethod(Http_method nMethod, char *pBuf, int *pLen, char *strHostName, short nHostPort, int nContentLen, void *pProxySetting /* = NULL */) { int n = 0; int m = 0; char str[512] = {0}; char auth[256] = {0}; struct ProxySetting* pProxy = (struct ProxySetting*)pProxySetting; if (pProxy != NULL) { CInetAddr addr(pProxy->ProxyAddr, pProxy->ProxyPort); n = sprintf (str, "http://%s:%d", addr.GetHostAddr(), addr.GetPort()); } n += sprintf (str + n, "/index.html?crap=%u", (unsigned long)((CTimeValue::GetTimeOfDay()).GetSec())); m = sprintf (pBuf, "%s %s HTTP/%d.%d\r\n", HttpMethodToString (nMethod), str, 1, /*Major version*/ 1); /*Minor version*/ m += sprintf (pBuf+m, "Host: %s:%d\r\n", strHostName, nHostPort); if (nContentLen >= 0) { m += sprintf (pBuf+m, "Content-Length: 9999999999999999\r\n", nContentLen); } m += sprintf(pBuf+m, "Connection: close\r\n"); if (pProxy != NULL && pProxy->UserName[0] != '\0') { sprintf(auth, "%s:%s", pProxy->UserName, pProxy->Password); encode_base64(auth, strlen(auth), str, 512); m += sprintf(pBuf+m, "Proxy-Authorization: Basic %s\r\n", str); } m += sprintf(pBuf+m, "\r\n"); *pLen = m; return m; } /* * return value: * n>0: Ok, n bytes used * 0: Packet incomplete * -1: parse error */ int CHTTPRequest::ParseHttpRequest(char *pBuf, int nLen, int *pMethod) { char *p, *p1; int method, retlen; int major_version, minor_version; if ((p1 = strstr(pBuf, "\r\n\r\n")) == NULL) return 0; retlen = (p1 - pBuf) + 4; p1 = strstr(pBuf, " "); if (p1 == NULL) { return -1; } method = HttpStringToMethod (pBuf); if (method == -1) return -1; p = p1 + 1; *pMethod = method; p1 = strstr (p, " "); if (p1 == NULL) return -1; p = p1 +1; p1 = strstr (p, "/"); if (p1 == NULL) return -1; else if (p1 - p != 4 || memcmp (p, "HTTP", 4) != 0) return -1; p = p1 + 1; p1 = strstr(p, "."); if (p1 == NULL) return -1; *p1 = 0; major_version = atoi (p); if (major_version != 1) return -1; p = p1 + 1; p1 = strstr(p, "\r"); if (p1 == NULL) return -1; *p1 = 0; minor_version = atoi (p); if (minor_version != 1 && minor_version != 0) return -1; p = p1 + 1; return retlen; } /* * return value: * n>0: Ok, n bytes used * 0: Packet incomplete * -1: parse error */ int CHTTPRequest::ParseHttpResponse(char *pBuf, int nLen) { char *p, *p1; int retlen; int major_version, minor_version, status_code; if ((p1 = strstr(pBuf, "\r\n\r\n")) == NULL) return 0; retlen = (p1 - pBuf) + 4; p = strstr (pBuf, "/"); if (p == NULL) return -1; else if (p - pBuf != 4 || memcmp (pBuf, "HTTP", 4) != 0) return -1; p = p+1; /* * Major version */ p1 = strstr (p, "."); if (p1 == NULL) return -1; *p1 = '\0'; major_version = atoi (p); p = p1 + 1; if (major_version != 1) return -1; /* * Minor Version */ p1 = strstr(p, " "); if (p1 == NULL) return -1; *p1 = '\0'; minor_version = atoi (p); if(minor_version != 0 && minor_version != 1) return -1; p = p1 +1; p1 = strstr(p, " "); if (p1 == NULL) return -1; *p1 = '\0'; status_code = atoi (p); if (status_code == 407) return -407; if (status_code != 200) return -1; return retlen; } int CHTTPRequest::BuildHttpResponse(char *pBuf, int *pLen, int nContentLen) { *pLen = sprintf (pBuf, "HTTP/1.1 200 OK\r\n" "Content-Length: 9999999999999999\r\n" "Connection: close\r\n" "Pragma: no-cache\r\n" "Cache-Control: no-cache, no-store, must-revalidate\r\n" "Expires: 0\r\n" /* FIXME: "0" is not a legitimate HTTP date. */ "Content-Type: text/html\r\n" "\r\n"); return *pLen; }
[ "brianuuuu@hotmail.com" ]
brianuuuu@hotmail.com
19510dbe56a847d008339ec040c908f021db70ad
c2152fc0dde1f6596ccae020ec94d3957ef34327
/source/ScrollBar.cpp
0c87a01420a090efdfdda4f6eccdd33510334fc4
[]
no_license
Mosshide/InfiniteTD
85e6ec23c67f428eb4f63f761eff8db35138eaae
2cb7515a0bf5c7489ecd064d2ce515668f573351
refs/heads/master
2020-04-11T09:54:09.849150
2018-12-13T21:25:34
2018-12-13T21:25:34
161,696,388
0
0
null
null
null
null
UTF-8
C++
false
false
2,054
cpp
#include "ScrollBar.h" ScrollBar::ScrollBar() { presence.x = 0; presence.y = 0; presence.w = 64; presence.h = 64; activeArea = presence; _btn.setRGBA(Color(0.f, 0.f, 0.f, 0.f)); active = true; _nav.speed = .5f; _percent = 0; scrollAmount = 0; changed = false; realign(); } ScrollBar::~ScrollBar() { } void ScrollBar::update() { updateWheel(); updateClick(); } void ScrollBar::updateWheel() { if (active) { if (_btn.getClick(leftClick) != clickHold && pointInRect(mouse->p, activeArea)) { if (mouse->wheel != 0.f) { _nav.target.y += mouse->wheel * -40.f; if (_nav.target.y < _minY) { _nav.target.y = _minY; } else if (_nav.target.y > _maxY) { _nav.target.y = _maxY; } } _nav.moveTowardTarget(presence); if (_nav.moved) changed = true; realign(); } _percent = (presence.y - _minY) / (_maxY - _minY); scrollAmount = _percent * _scrollLimit; } } void ScrollBar::updateClick() { changed = false; if (active) { _btn.update(); if (_btn.getClick(leftClick) == clickHold) { if (mouse->dY != 0) { changed = true; presence.y += mouse->dY; if (presence.y < _minY) { presence.y = _minY; } else if (presence.y > _maxY) { presence.y = _maxY; } _nav.target.x = presence.x; _nav.target.y = presence.y; } _btn.hovering = true; } _percent = (presence.y - _minY) / (_maxY - _minY); scrollAmount = _percent * _scrollLimit; realign(); } } void ScrollBar::draw() { if (active) { _btn.draw(); } } void ScrollBar::fitArea(float x, float y, float h, float scrollLimit) { setSize(5, 10); _scrollLimit = scrollLimit; if (h - (scrollLimit / 2) > presence.h) setSize(5.f, h - (scrollLimit / 2)); _minY = y; _maxY = y + h - presence.h; setPosition(x, _minY + (_percent * (_maxY - _minY))); if (_scrollLimit > 0) active = true; else { active = false; } realign(); _nav.target.x = presence.x; _nav.target.y = presence.y; } void ScrollBar::realign() { _btn.setRect(presence); }
[ "wyattsushi@gmail.com" ]
wyattsushi@gmail.com
368f4b3481845d2e29266e9059bffaa97767aa17
ef7bed98689a693c0a89cebeb874869a9189b16e
/src/noui.cpp
3732f4e3eb2ae36030848c867aac5a36467ab004
[ "MIT" ]
permissive
CoiningPress/UKcoin
99d754d9556b50d585ccf919982634b904dfbb02
f196ef2feee0a4af62cb95784ebdedfd03c634c7
refs/heads/master
2021-01-19T14:20:46.872272
2014-03-16T16:29:57
2014-03-16T16:29:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,505
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "ui_interface.h" #include "init.h" #include "bitcoinrpc.h" #include <string> static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style) { std::string strCaption; // Check for usage of predefined caption switch (style) { case CClientUIInterface::MSG_ERROR: strCaption += _("Error"); break; case CClientUIInterface::MSG_WARNING: strCaption += _("Warning"); break; case CClientUIInterface::MSG_INFORMATION: strCaption += _("Information"); break; default: strCaption += caption; // Use supplied caption (can be empty) } printf("%s: %s\n", strCaption.c_str(), message.c_str()); fprintf(stderr, "%s: %s\n", strCaption.c_str(), message.c_str()); return false; } static bool noui_ThreadSafeAskFee(int64 /*nFeeRequired*/) { return true; } static void noui_InitMessage(const std::string &message) { printf("init message: %s\n", message.c_str()); } void noui_connect() { // Connect UKCoind signal handlers uiInterface.ThreadSafeMessageBox.connect(noui_ThreadSafeMessageBox); uiInterface.ThreadSafeAskFee.connect(noui_ThreadSafeAskFee); uiInterface.InitMessage.connect(noui_InitMessage); }
[ "cthulhu@theoldone.net" ]
cthulhu@theoldone.net
5c6e32f20c04f816d90d1b60d8dd73079044d593
431bb52aa5b3afca3c19055fda97f6a6b2550f2f
/3sum.cpp
9dc84e97127b0a71d38d610f6229e0e573ce3d42
[]
no_license
ouchengeng/Leetcode
c486fd900c17db1438e0fd0c7935da7461ac3352
ea219ac2819a461ff545fb8498a823ee7de0b44a
refs/heads/master
2021-01-16T18:39:59.761965
2016-08-28T08:08:16
2016-08-28T08:08:16
32,621,790
1
1
null
null
null
null
UTF-8
C++
false
false
1,055
cpp
class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> ans; sort(nums.begin(), nums.end()); vector<int> tmp(3); for(int i = 0; i < nums.size(); i++) { if(i > 0 && nums[i] == nums[i-1]) continue; int l = i + 1, j = nums.size()-1; while(l < j) { while(l != i+1 && l < j && nums[l] == nums[l-1]) l++; while(j != nums.size()-1 && l < j && nums[j] == nums[j+1]) j--; if(l >= j) break; int sum = nums[i] + nums[l] + nums[j]; if(sum == 0) { tmp[0] = nums[i], tmp[1] = nums[l], tmp[2] = nums[j]; ans.push_back(tmp); l++,j--; } else if(sum < 0) l++; else j--; } } return ans; } };
[ "ouchengeng@qq.com" ]
ouchengeng@qq.com
ff773afe85952ea02809db244845fa240d011529
0ae7360df49aa224c4fb26924c9826e16581ff79
/cutvoxel.h
18954744e8314490c6d8cd968b829f07977f2e6d
[]
no_license
ipolinha/Projeto-parte-II
aef878df1d2117034da6401bed1bba247bada76d
cda6a74e7c3ee8d35001ffdedd580373d44c5479
refs/heads/main
2023-04-03T18:53:42.325720
2021-04-13T16:39:58
2021-04-13T16:39:58
356,025,611
0
0
null
null
null
null
UTF-8
C++
false
false
394
h
#ifndef CUTVOXEL_H #define CUTVOXEL_H #include "figura_geometrica.h" #include <sculptor.h> /** @brief Classe herdeira de FiguraGeometrica, * responsável por remover pontos em nossa escultura. */ class Cutvoxel : public Figura_Geometrica { protected: int x,y,z; public: Cutvoxel(int x_, int y_, int z_); ~Cutvoxel(); void draw(Sculptor &t); }; #endif // CUTVOXEL_H
[ "noreply@github.com" ]
noreply@github.com
73b010fe0e8d9cf82bd141bdb9f6dc6fb8267fe1
7a40560e182003321d6f02c764b8cba915bb8a24
/vm.cpp
8911709bfb76df990dd2896245c75a0e0c283091
[ "MIT" ]
permissive
armatthews/Spp
dc7fd304c33419945833c313716dbc1fd8922498
8f12cfb463e43d988ae86878d935c598da12c9ba
refs/heads/master
2021-01-11T19:10:54.347866
2015-07-28T15:37:54
2015-07-28T15:37:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,393
cpp
#include <iostream> #include <vector> #include <windows.h> #include <time.h> #include "vm.h" #include "token_types.h" #include "vs.h" using namespace std; vm::vm(){ //DeclareHostFuncs(); //Vars["endl"] = var( TOK_STRING , "\n" ); //Vars["tab"] = var( TOK_STRING , "\t" ); DeclareHostFuncs(); DeclareHostTypes(); LoopInterrupt = 0; } vm::vm(parser& Parser){ *this = vm(); } vm::~vm(){ } int vm::SizeOf(var Var){ switch(Var.Type){ case T_INT: return sizeof(int); case T_FLOAT: return sizeof(float); case T_CHAR: return sizeof(char); case T_BOOL: return sizeof(bool); case T_VOID: return 0; case T_OBJECT: return Types[Var.Class].Size; } return 1; } int vm::SizeOf(int Type){ switch(Type){ case T_FUNC: return sizeof(ptr); case T_PTR: return sizeof(ptr); case T_INT: return sizeof(int); case T_FLOAT: return sizeof(float); case T_CHAR: return sizeof(char); case T_BOOL: return sizeof(bool); case T_VOID: return 0; case T_INT64: return sizeof(__int64); } return 1; } string vm::TypeId(var Var){ string Type; switch(Var.Type){ case T_INT: Type="int"; break; case T_FLOAT: Type="float"; break; case T_CHAR: Type="char"; break; case T_BOOL: Type="bool"; break; case T_VOID: Type="void"; break; case T_FUNC: Type="fpointer"; break; case T_OBJECT: Type = ClassIdToName(Var.Class); break; case T_PTR:{ Var.Type = Var.PtrType; Type = TypeId(Var); for(int i=0; i<Var.Dim; i++) Type += "*"; } } return Type; } int vm::TokToType(int TokenType){ switch( TokenType ){ case TOK_ARRAY_SCOPE: case OP_ADDRESS: case RES_TYPEID: case RES_SIZEOF: case OP_POINTER_MEMBER: case OP_OBJECT_MEMBER: case TOK_INT: return T_INT; case TOK_FLOAT: return T_FLOAT; case TOK_CHAR: return T_CHAR; case TOK_STRING: return T_STRING; } return TokenType+100; } string vm::ClassIdToName( int Id ){ for(map<string,int>::iterator i=TypeMap.begin(); i!=TypeMap.end(); i++){ if( i->second == Id ) return i->first; } return ""; }
[ "alexey.melnichenko@avalara.com" ]
alexey.melnichenko@avalara.com
da3dae69aa8fc2e4c50bf43bb9aa3490babd32db
f3a35f1e9d803a1ad409bec1e58024e825f87141
/05/HCOK/MODIFISINGER.cpp
3275e76f8aeccc05e0b18ab40feb84aaedaf3b1b
[]
no_license
xuezchuang/C-Project
ed4406f913e853b981063e726ab505ada36b1f90
4d5a64429fde2d37ba77974dd6cf7526833e55be
refs/heads/master
2020-03-24T20:04:26.082584
2017-11-14T10:11:40
2017-11-14T10:11:40
null
0
0
null
null
null
null
GB18030
C++
false
false
2,882
cpp
// MODIFISINGER.cpp : implementation file // #include "stdafx.h" #include "HCOK.h" #include "MODIFISINGER.h" #include "ADOConn.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // MODIFISINGER dialog MODIFISINGER::MODIFISINGER(CWnd* pParent /*=NULL*/) : CDialog(MODIFISINGER::IDD, pParent) { //{{AFX_DATA_INIT(MODIFISINGER) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void MODIFISINGER::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(MODIFISINGER) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(MODIFISINGER, CDialog) //{{AFX_MSG_MAP(MODIFISINGER) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MODIFISINGER message handlers BOOL MODIFISINGER::OnInitDialog() { CDialog::OnInitDialog(); CString temp=mkusingerarea.Left(4); CString temp2= mkusingersex.Left(2); GetDlgItem(IDC_SINGER)->SetWindowText( mkusingername); GetDlgItem(IDC_SINGERSEX)->SetWindowText(temp2); GetDlgItem(IDC_SGEAREA)->SetWindowText(temp); GetDlgItem(IDC_SGEPIN)->SetWindowText( mkusingerpin); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void MODIFISINGER::OnOK() { CString newkusingername,newkusingersex,newkusingerarea,newkusingerpin; GetDlgItem(IDC_SINGER)->GetWindowText( newkusingername);//得到新的姓名 GetDlgItem(IDC_SINGERSEX)->GetWindowText( newkusingersex);//得到新的性别 GetDlgItem(IDC_SGEAREA)->GetWindowText(newkusingerarea); //得到新的地区 GetDlgItem(IDC_SGEPIN)->GetWindowText( newkusingerpin); //得到新的拼音 newkusingerarea=newkusingerarea+"歌手"; newkusingersex=newkusingersex+"歌手"; //////////////////////////////////////////////////// ADOConn m_AdoConn;//创建数据库操作对象 m_AdoConn.OnInitADOConn(); //连接数据库 _RecordsetPtr m_pRecordset; _bstr_t sql; sql = "select*from singer where sinnam='"+mkusingername+"'"; m_pRecordset=m_AdoConn.GetRecordSet(sql);//用记录集覆盖当前的 m_pRecordset->GetFields()->GetItem("sinnam")->Value=(_bstr_t) newkusingername ; ///写入歌手名 m_pRecordset->GetFields()->GetItem("sinsex")->Value=(_bstr_t) newkusingersex;////写入性别 m_pRecordset->GetFields()->GetItem("sinarea")->Value=(_bstr_t) newkusingerarea;////写入地区 m_pRecordset->GetFields()->GetItem("sinpin")->Value=(_bstr_t) newkusingerpin;////写入拼音 m_pRecordset->Update(); m_AdoConn.ExitConnect();//释放数据库资源 MessageBox("歌手资料更新成功!","系统提示:",MB_OK|MB_ICONASTERISK); CDialog::OnOK(); }
[ "1182741213@qq.com" ]
1182741213@qq.com
a398834cbeb39aae58aec6c4e4555d6ec7257c21
036c026ca90f4a4a663f914b5333ecd1da9ff4d3
/bin/windows/obj/include/openfl/display3D/_Context3DBufferUsage/Context3DBufferUsage_Impl_.h
3e07c7c9ca16f4c392e55b2f8ce36a67801e28b6
[]
no_license
alexey-kolonitsky/hxlines
d049f9ea9cc038eaca814d99f26588abb7e67f44
96e1e7ff58b787985d87512e78929a367e27640b
refs/heads/master
2021-01-22T04:27:53.064692
2018-05-18T02:06:09
2018-05-18T02:06:09
102,267,235
0
1
null
2018-03-25T19:11:08
2017-09-03T13:40:29
C++
UTF-8
C++
false
true
2,606
h
// Generated by Haxe 3.4.0 (git build development @ d2a02e8) #ifndef INCLUDED_openfl_display3D__Context3DBufferUsage_Context3DBufferUsage_Impl_ #define INCLUDED_openfl_display3D__Context3DBufferUsage_Context3DBufferUsage_Impl_ #ifndef HXCPP_H #include <hxcpp.h> #endif HX_DECLARE_CLASS3(openfl,display3D,_Context3DBufferUsage,Context3DBufferUsage_Impl_) namespace openfl{ namespace display3D{ namespace _Context3DBufferUsage{ class HXCPP_CLASS_ATTRIBUTES Context3DBufferUsage_Impl__obj : public hx::Object { public: typedef hx::Object super; typedef Context3DBufferUsage_Impl__obj OBJ_; Context3DBufferUsage_Impl__obj(); public: enum { _hx_ClassId = 0x3108c5a2 }; void __construct(); inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="openfl.display3D._Context3DBufferUsage.Context3DBufferUsage_Impl_") { return hx::Object::operator new(inSize,inContainer,inName); } inline void *operator new(size_t inSize, int extra) { return hx::Object::operator new(inSize+extra,false,"openfl.display3D._Context3DBufferUsage.Context3DBufferUsage_Impl_"); } hx::ObjectPtr< Context3DBufferUsage_Impl__obj > __new() { hx::ObjectPtr< Context3DBufferUsage_Impl__obj > __this = new Context3DBufferUsage_Impl__obj(); __this->__construct(); return __this; } static hx::ObjectPtr< Context3DBufferUsage_Impl__obj > __alloc(hx::Ctx *_hx_ctx) { Context3DBufferUsage_Impl__obj *__this = (Context3DBufferUsage_Impl__obj*)(hx::Ctx::alloc(_hx_ctx, sizeof(Context3DBufferUsage_Impl__obj), false, "openfl.display3D._Context3DBufferUsage.Context3DBufferUsage_Impl_")); *(void **)__this = Context3DBufferUsage_Impl__obj::_hx_vtable; return __this; } static void * _hx_vtable; static Dynamic __CreateEmpty(); static Dynamic __Create(hx::DynamicArray inArgs); //~Context3DBufferUsage_Impl__obj(); HX_DO_RTTI_ALL; static bool __GetStatic(const ::String &inString, Dynamic &outValue, hx::PropertyAccess inCallProp); static void __register(); bool _hx_isInstanceOf(int inClassId); ::String __ToString() const { return HX_HCSTRING("Context3DBufferUsage_Impl_","\x01","\x5f","\x3c","\xc9"); } static void __boot(); static ::Dynamic DYNAMIC_DRAW; static ::Dynamic STATIC_DRAW; static ::Dynamic fromString(::String value); static ::Dynamic fromString_dyn(); static ::String toString(int value); static ::Dynamic toString_dyn(); }; } // end namespace openfl } // end namespace display3D } // end namespace _Context3DBufferUsage #endif /* INCLUDED_openfl_display3D__Context3DBufferUsage_Context3DBufferUsage_Impl_ */
[ "akalanitski@playtika.com" ]
akalanitski@playtika.com
5de8a78ba8a9454630a90478d4f73653fc4d951a
152cb7bfd2762400904d8362750b93a87e62b2d7
/Jin/VertexArray.cpp
296346ddd6636e0943b2aa07b309741b61c5c4ce
[]
no_license
Ahsan-Sarbaz/Jin
4c0a3083f7a3d68d2b784300c58f50681d82afbd
4dacc68a1c7d5458e27b4be31f3d461816f62444
refs/heads/master
2020-09-02T07:29:23.344580
2020-05-03T14:45:43
2020-05-03T14:45:43
219,167,303
0
0
null
null
null
null
UTF-8
C++
false
false
854
cpp
#include "pch.h" #include "VertexArray.h" VertexArray::VertexArray() { } void VertexArray::Init() { glGenVertexArrays(1, &m_id); } void VertexArray::Bind() { glBindVertexArray(m_id); } void VertexArray::Unbind() { glBindVertexArray(0); } void VertexArray::PushVertexBuffer(const VertexBuffer& buffer) { const VertexAttrib* attribs = buffer.GetAttribs(); u32 attribsCount = buffer.GetAttribsCount(); Bind(); buffer.Bind(); for(u32 i = 0; i < attribsCount; ++i) { glEnableVertexAttribArray(attribs[i].index); glVertexAttribPointer(attribs[i].index, attribs[i].size, attribs[i].type, attribs[i].normalized, attribs[i].stride, attribs[i].pointer); } Unbind(); buffer.Unbind(); } void VertexArray::PushIndexBuffer(const IndexBuffer& buffer) { Bind(); buffer.Bind(); Unbind(); }
[ "geeksdotpk@gmail.com" ]
geeksdotpk@gmail.com
33dd5b33034befdfd8ae23824eab752f5e9d79d1
31039fb15fe14ad51b88742f7c72224531da6b26
/Health.cpp
b628d2d2c6a4ec660e8d7cebcf3b6030b89186c9
[]
no_license
Mathieu417/brickshooter
d71b5e4e462b84a7c070a4e0ca388a1c5859e0ff
ed70329b75a4a7bf0d9d7750eb1212427db841d3
refs/heads/master
2023-03-22T06:34:46.485876
2021-03-04T16:49:05
2021-03-04T16:49:05
344,543,803
0
0
null
null
null
null
UTF-8
C++
false
false
481
cpp
#include "Health.h" #include <QFont> Health::Health(QGraphicsItem *parent): QGraphicsTextItem(parent){ // mettre score a 0 health = 3; // ajouter text setPlainText(QString("Health: ") + QString::number(health)); // Health: 3 setDefaultTextColor(Qt::red); setFont(QFont("times",16)); } void Health::decrease(){ health--; setPlainText(QString("Health: ") + QString::number(health)); // Health: 2 } int Health::getHealth(){ return health; }
[ "mathieu.desmoucelle@ynov.com" ]
mathieu.desmoucelle@ynov.com
24afe669085ec30a91e86289ace5046e59ca893d
8567438779e6af0754620a25d379c348e4cd5a5d
/third_party/WebKit/Source/platform/graphics/FirstPaintInvalidationTracking.cpp
3702d7ee082f2e7bd21103e5dad8805357cfda61
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "MIT", "Apache-2.0", "BSD-3-Clause" ]
permissive
thngkaiyuan/chromium
c389ac4b50ccba28ee077cbf6115c41b547955ae
dab56a4a71f87f64ecc0044e97b4a8f247787a68
refs/heads/master
2022-11-10T02:50:29.326119
2017-04-08T12:28:57
2017-04-08T12:28:57
84,073,924
0
1
BSD-3-Clause
2022-10-25T19:47:15
2017-03-06T13:04:15
null
UTF-8
C++
false
false
344
cpp
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "platform/graphics/FirstPaintInvalidationTracking.h" namespace blink { bool FirstPaintInvalidationTracking::s_enabledForShowPaintRects = false; } // namespace blink
[ "hedonist.ky@gmail.com" ]
hedonist.ky@gmail.com
91bff816b236b5ca799230ae4cf0729a1afc19e9
dd961cca83cde79c17a361ec02fcd392d573b56b
/src/polys/H7.cpp
cc53fc7383b63da5137b1660e97aeec76fbc0f9a
[]
no_license
cran/nortestARMA
8c8aaef117b8580057df9a09354f1f111daf70df
78fa208b8ef4136deefb7fbc7a0188000ec2b69d
refs/heads/master
2021-01-01T05:11:58.559030
2017-04-14T13:37:35
2017-04-14T13:37:35
58,066,264
0
0
null
null
null
null
UTF-8
C++
false
false
1,774
cpp
/* Debut-Commentaires Nom de la fonction: H7 Entrees: n entier, longueur du vecteur x ; x, un vecteur de n nombres de type double Sorties: void Description: Calcul de H7(x), H7 etant le septieme polynome de Legendre Modifie le vecteur x dans le programme principal, en le remplacant par H7(x) Utilisation dans une fonction main: ------------------------------------- #include <iostream.h> #include "H7.cc" int main() { int i,n; double *x,*y,*xavant; n=5; // longueur du vecteur x x=new double[n]; // initialisation de x y=new double [n]; // initialisation de y xavant=new double [n]; // initialisation de xavant x[0]=1;x[1]=2;x[2]=3;x[3]=4;x[4]=5; // affectation de valeurs a x for (i=0;i<n;i++){xavant[i]=x[i];} // On sauvegarde les valeurs de x dans xavant H7(n,x); // calcul de H7(x), remplace x par H7(x) for (i=0;i<n;i++){y[i]=x[i];} // affecte a y le resultat for (i=0;i<n;i++){x[i]=xavant[i];} // remet les bonnes valeurs dans x cout << "Affichage des valeurs de y\n"; for (i=0;i<n;i++) cout << y[i] << " "; // Affichage des valeurs de y=H7(x) cout << "\n"; cout << "Affichage des valeurs de x\n"; for (i=0;i<n;i++) cout << x[i] << " "; // Affichage des valeurs de x cout << "\n"; delete [] xavant; // On libere de la memoire return(0); } ------------------------------------- Instructions de compilation: g++ -Wall -O nom_du_fichier_contenant_la_fonction_main.cc Fonctions exterieures appelees: Auteur: Pierre Lafaye de Micheaux Date: 04/01/2001 Fin-Commentaires */ #include<math.h> void H7(int n, double *x) { int i; for (i = 0; i < n; i++) { x[i] = std::sqrt(15.0) * (429.0 * std::pow(x[i], 7.0) - 693.0 * std::pow(x[i], 5.0) + 315.0 * std::pow(x[i], 3.0) - 35.0 * x[i]) / 16.0; } return; }
[ "csardi.gabor+cran@gmail.com" ]
csardi.gabor+cran@gmail.com
60346f19537597eb21ea6de081b6c79e7c25936b
17f9e8d702c348de8ddc4375e63bd36e855e89b0
/Source/FPSGame/Private/FPSCharacter.cpp
339cb84ecf738bdd4c07408a40c622953528fd90
[]
no_license
KawaSquad/StealthGame
ecbbd6187edf166b72ef78cd6324485509d8b68e
fc84123fb5332cea406369afa6eb73cf7ff5e2d5
refs/heads/master
2020-04-01T10:49:57.188196
2018-10-18T19:57:46
2018-10-18T19:57:46
153,133,424
0
0
null
null
null
null
UTF-8
C++
false
false
4,150
cpp
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. #include "FPSCharacter.h" #include "FPSProjectile.h" #include "Animation/AnimInstance.h" #include "Camera/CameraComponent.h" #include "Components/CapsuleComponent.h" #include "Kismet/GameplayStatics.h" #include "Components/PawnNoiseEmitterComponent.h" #include "Net/UnrealNetwork.h" AFPSCharacter::AFPSCharacter() { // Create a CameraComponent CameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera")); CameraComponent->SetupAttachment(GetCapsuleComponent()); CameraComponent->RelativeLocation = FVector(0, 0, BaseEyeHeight); // Position the camera CameraComponent->bUsePawnControlRotation = true; // Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn) Mesh1PComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh")); Mesh1PComponent->SetupAttachment(CameraComponent); Mesh1PComponent->CastShadow = false; Mesh1PComponent->RelativeRotation = FRotator(2.0f, -15.0f, 5.0f); Mesh1PComponent->RelativeLocation = FVector(0, 0, -160.0f); // Create a gun mesh component GunMeshComponent = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("FP_Gun")); GunMeshComponent->CastShadow = false; GunMeshComponent->SetupAttachment(Mesh1PComponent, "GripPoint"); NoiseEmitterComp = CreateDefaultSubobject<UPawnNoiseEmitterComponent>(TEXT("NoiseMeitter")); } void AFPSCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) { // set up gameplay key bindings check(PlayerInputComponent); PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); PlayerInputComponent->BindAction("Fire", IE_Pressed, this, &AFPSCharacter::Fire); PlayerInputComponent->BindAxis("MoveForward", this, &AFPSCharacter::MoveForward); PlayerInputComponent->BindAxis("MoveRight", this, &AFPSCharacter::MoveRight); PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput); PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput); } void AFPSCharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); if (!IsLocallyControlled()) { FRotator NewRot = CameraComponent->RelativeRotation; NewRot.Pitch = RemoteViewPitch * 360.0f / 255.f; CameraComponent->SetRelativeRotation(NewRot); } } void AFPSCharacter::Fire() { ServerFire(); // try and play the sound if specified if (FireSound) { UGameplayStatics::PlaySoundAtLocation(this, FireSound, GetActorLocation()); } // try and play a firing animation if specified if (FireAnimation) { // Get the animation object for the arms mesh UAnimInstance* AnimInstance = Mesh1PComponent->GetAnimInstance(); if (AnimInstance) { AnimInstance->PlaySlotAnimationAsDynamicMontage(FireAnimation, "Arms", 0.0f); } } } void AFPSCharacter::ServerFire_Implementation() { if (ProjectileClass) { FVector MuzzleLocation = GunMeshComponent->GetSocketLocation("Muzzle"); FRotator MuzzleRotation = GunMeshComponent->GetSocketRotation("Muzzle"); //Set Spawn Collision Handling Override FActorSpawnParameters ActorSpawnParams; ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding; ActorSpawnParams.Instigator = this; // spawn the projectile at the muzzle GetWorld()->SpawnActor<AFPSProjectile>(ProjectileClass, MuzzleLocation, MuzzleRotation, ActorSpawnParams); } } bool AFPSCharacter::ServerFire_Validate() { return true; } void AFPSCharacter::MoveForward(float Value) { if (Value != 0.0f) { // add movement in that direction AddMovementInput(GetActorForwardVector(), Value); } } void AFPSCharacter::MoveRight(float Value) { if (Value != 0.0f) { // add movement in that direction AddMovementInput(GetActorRightVector(), Value); } } void AFPSCharacter::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME(AFPSCharacter, bIsCarryingObjective); //DOREPLIFETIME_CONDITION(AFPSCharacter, bIsCarryingObjective,COND_OwnerOnly); }
[ "styven184@gmail.com" ]
styven184@gmail.com
8650eedb7f9a17e2ad34d1c6edb4f289c6a8b6a9
8f0ccafc42cd2ec64549b18461af7723b83405a7
/MQ-6 LPG Gas Sensor.ino
2edb189e62113261f34d10734cba60962051bbfd
[]
no_license
ac005sheekar/Gas-Sensors-Interfacing-with-Arduino-and-Firmware
8dc84fa1d5fb9ea725d769e0c09590743cd7d08b
e813486acf56e9180e6d0cbca1f67be9a4be75cd
refs/heads/master
2022-12-14T00:51:11.054938
2020-09-16T08:42:58
2020-09-16T08:42:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
946
ino
void setup() { Serial.begin(9600); // Start Serial Communication/ Baud Rate } /* This Particular Function is used for Repeated Execution of the Circuit until Specified. */ void loop() { float sensorVoltage; // Initialize Variable for Sensor Voltage float sensorValue; // Initialize Variable for Sensor Value sensorValue = analogRead(A0); // Read the Sensor Values from Analog Pin A0 sensorVoltage = sensorValue/1024*5.0; // Calculate the Sensor Voltage Serial.print("sensor voltage = "); // Print the Message Serial.print(sensorVoltage); // Print the Values Serial.println(" V"); // Print the Message delay(1000); // Wait for 1000 ms }
[ "noreply@github.com" ]
noreply@github.com
b48b1630e4d2c355d67ecafbe19960e48cdc6428
b0eb5f8c2656afa1a77e3dfb407d03025a9c1d84
/D3D11/Tesselation_BezierSurface/Managers/ResourcesManager.h
c88efb91ac69a80eace7ef0e2c7663cbdd76aeb1
[]
no_license
mandragorn66/dx11
ee1126d6487dfe0dac1c1d3aa945f39510a446f5
7807a73bd58011e1fc43dc3a4404ed4e9027bc39
refs/heads/master
2021-01-13T02:03:14.816972
2014-05-31T20:58:16
2014-05-31T20:58:16
35,515,523
0
0
null
null
null
null
UTF-8
C++
false
false
653
h
#pragma once struct ID3D11Device; struct ID3D11DeviceContext; struct ID3D11ShaderResourceView; struct ID3D11UnorderedAccessView; struct ID3D11RenderTargetView; namespace Managers { class ResourcesManager { public: static void initAll(ID3D11Device* device, ID3D11DeviceContext* context); static void destroyAll(); static ID3D11ShaderResourceView* mSandSRV; private: ResourcesManager(); ~ResourcesManager(); ResourcesManager(const ResourcesManager& resourcesManager); const ResourcesManager& operator=(const ResourcesManager& resourcesManager); }; }
[ "nicobertoa@gmail.com@e0b89612-44f1-daff-93c3-99ecbe7956b2" ]
nicobertoa@gmail.com@e0b89612-44f1-daff-93c3-99ecbe7956b2
9679488febcd5b5585fcf3d09cd39655f2fd1f90
504d813445c361bc2b66b9b3b6059b3ac7f2b67e
/week5/reference.cpp
514afd0e6dfa28a4ec43033928b18b34662a6f7d
[]
no_license
kien-vu-uet/HomeWork
29164e9f856b1691ccdd92aea77e60c8340d5894
3516bf404ee20a1e9f572efe80d15f531f4091d7
refs/heads/master
2023-03-24T00:11:50.921578
2021-03-26T07:24:03
2021-03-26T07:24:03
342,454,181
0
0
null
null
null
null
UTF-8
C++
false
false
763
cpp
#include <iostream> using namespace std; void swap_pass_by_reference(int a, int b){ int temp = a; a = b; b = temp; } void swap_pass_by_value(int &a, int &b) { int temp = a; a = b; b = temp; } int main() { int a = 5, b = 10; //mechanism of parameter transmission: cout << "before : " << a << " " << b << endl; swap_pass_by_reference(a, b); cout << "after : " << a << " " << b << endl; // there is no change in the value of a and b cout << "-----------------" << endl; //value-based parameter transmission cout << "before : " << a << " " << b << endl; swap_pass_by_value(a, b); cout << "after : " << a << " " << b << endl; //The values ​​of a and b have been exchanged return 0; }
[ "kienkienkienvu@gmail.com" ]
kienkienkienvu@gmail.com