blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
c847a4374dec5232ecf6e422f6a3fa374d3fcdcd
0fceffd86e5eebcca6c9de8c6e15ffa355b34cc2
/HavokOpenGL/HavokOpenGL/HvkOGLObj.cpp
2ee09c3c098248f989b645cea90bc7cacbfbbfdb
[]
no_license
lxq2537664558/BallDropper
b40d9a3f731d7b0ddc18ebd6fd016f365072c738
424f871540b2282c62b4f00ad2506a8fd40cf9cc
refs/heads/master
2021-01-22T20:00:20.860109
2014-05-02T17:22:04
2014-05-02T17:22:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,083
cpp
#include "HvkOGLObj.h" HvkOGLObj::HvkOGLObj(HavokObj* havokObj){ hObj = havokObj; angle = 0; r = g = b = 0.5f; } HvkOGLObj::HvkOGLObj(HavokObj* havokObj, char* img){ hObj = havokObj; angle = 0; r = g = b = 0.5f; LoadTextures *lt = new LoadTextures(img); //for texture texture = lt->getTexture(); delete lt; } void HvkOGLObj::setRGB(float r, float g, float b){ this->r = r; this->g = g; this->b = b; } void HvkOGLObj::update(){ if(hObj->getRigidBody()){ hObj->setPos(Vector(hObj->getRigidBody()->getPosition().getComponent(0), //get physics obj pos hObj->getRigidBody()->getPosition().getComponent(1), hObj->getRigidBody()->getPosition().getComponent(2))); hkQuaternion quaternion = hObj->getRigidBody()->getRotation(); //get orientation as a quaternion if(quaternion.hasValidAxis()){ angle = quaternion.getAngle() * 180.0f / HK_REAL_PI; //convert to degrees for OpenGL rotation hkVector4 axis; quaternion.getAxis(axis); hObj->setDir(Vector(axis.getSimdAt(0), axis.getSimdAt(1), axis.getSimdAt(2))); } } } HvkOGLObj::~HvkOGLObj(void){ }
[ "rseymour8@gmail.com" ]
rseymour8@gmail.com
c6303206455e0c0390cbb348f183b71b81582e38
2e676e3b1cebfbb9d20f9b935ceacd507c57d36a
/Octave/octave-4.2.1/include/octave-4.2.1/octave/lo-array-gripes.h
a934fa28d420492cf46ff03251c790bed103aeae
[ "MIT", "Zlib", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-public-domain" ]
permissive
vohrahul/ML-ang-coursera
239469e763b290aa178b7aa8a86eda08e4e7f4be
4c24fd2ecfb9f3de7df15e3a9f75627f782f9915
refs/heads/master
2022-12-28T03:45:54.810173
2020-10-16T12:33:25
2020-10-16T12:33:25
304,620,441
1
0
null
null
null
null
UTF-8
C++
false
false
3,752
h
/* Copyright (C) 2000-2017 John W. Eaton This file is part of Octave. Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ // FIXME: All gripe_XXX functions deprecated in 4.2. Remove file in 4.6 #if ! defined (octave_lo_array_gripes_h) #define octave_lo_array_gripes_h 1 #include "octave-config.h" #include "lo-array-errwarn.h" #include "dim-vector.h" #include "quit.h" OCTAVE_DEPRECATED ("use 'octave::err_nan_to_logical_conversion' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_nan_to_logical_conversion (void); OCTAVE_DEPRECATED ("use 'octave::err_nan_to_character_conversion' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_nan_to_character_conversion (void); OCTAVE_DEPRECATED ("use 'octave::err_nonconformant' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_nonconformant (const char *op, octave_idx_type op1_len, octave_idx_type op2_len); OCTAVE_DEPRECATED ("use 'octave::err_nonconformant' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_nonconformant (const char *op, octave_idx_type op1_nr, octave_idx_type op1_nc, octave_idx_type op2_nr, octave_idx_type op2_nc); OCTAVE_DEPRECATED ("use 'octave::err_nonconformant' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_nonconformant (const char *op, const dim_vector& op1_dims, const dim_vector& op2_dims); OCTAVE_DEPRECATED ("use 'octave::err_index_out_of_range' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_index_out_of_range (int nd, int dim, octave_idx_type iext, octave_idx_type ext, const dim_vector& d); OCTAVE_DEPRECATED ("use 'octave::err_index_out_of_range' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_index_out_of_range (int nd, int dim, octave_idx_type iext, octave_idx_type ext); OCTAVE_DEPRECATED ("use 'octave::err_del_index_out_of_range' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_del_index_out_of_range (bool is1d, octave_idx_type iext, octave_idx_type ext); OCTAVE_DEPRECATED ("use 'octave::err_invalid_index' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_invalid_index (double, octave_idx_type nd = 0, octave_idx_type dim = 0, const std::string& var = ""); OCTAVE_DEPRECATED ("use 'octave::err_invalid_index' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_invalid_index (octave_idx_type n, octave_idx_type nd = 0, octave_idx_type dim = 0, const std::string& var = ""); OCTAVE_DEPRECATED ("use 'octave::err_invalid_index' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_invalid_index (const std::string& idx, octave_idx_type nd = 0, octave_idx_type dim = 0, const std::string& var = ""); OCTAVE_DEPRECATED ("use 'octave::err_invalid_resize' instead") OCTAVE_NORETURN OCTAVE_API extern void gripe_invalid_resize (void); OCTAVE_DEPRECATED ("use 'octave::err_singular_matrix' instead") OCTAVE_API extern void gripe_singular_matrix (double rcond = 0.0); #endif
[ "rvohra91@gmail.com" ]
rvohra91@gmail.com
7305c4bfd048c32cc8babae08b531c81df6dcb8d
d61b37777151cae274b071f6af1a89356273cb61
/CDAC/DS/DoubleEndedQueue.cpp
db9362f14b5ebd191f0a6db0682958fe00ddc591
[]
no_license
Arun-A-Patil/CDAC
bb63cb308d5ba02011a9aa13ca962bbba8ee2e8a
fd1775ba4dc22931a3ca6fe9243182fb47fdf794
refs/heads/master
2023-02-25T09:17:29.000689
2021-02-02T17:42:59
2021-02-02T17:42:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,885
cpp
#include<iostream> #include<stdlib.h> using namespace std; class Queue{ private: int size; int *arr; int front; int rear; public: Queue(){ size=0; front=-1; rear=-1; } Queue(int size){ this->size=size; arr = new int[size]; front=-1; rear=-1; } bool isEmpty(){ if((front == -1 && rear == -1) || front>rear){ return true; }else { return false; } } bool isFull(){ if(front == 0 && rear >= size-1) return true; else { return false; } } void enqueueAtEnd(int data){ if(!isFull()){ if(rear >= size-1){ cout<<"Insertion is not possible at end"<<endl; }else{ if(front == -1){ front = 0; } rear++; arr[rear]=data; } }else { cout<<"Queue is full"<<endl; } } void enqueueAtStart(int data){ if(!isFull()){ if(front == -1) { front = 0; rear++; arr[rear]=data; }else if(front != 0){ front--; arr[front]=data; }else{ cout<<"Insertion is not possible at start"<<endl; } }else{ cout<<"Queue is full"<<endl; } } void dequeueAtStart(){ if(!isEmpty()){ if(front <= rear){ cout<<"Dequeued element: "<<arr[front]<<endl; front++; }else{ cout<<"Deletion is not possible from start"<<endl; } }else{ cout<<"Queue is empty"<<endl; } } void dequeueAtEnd(){ if(!isEmpty()){ if(front <= rear){ cout<<"Dequeued element: "<<arr[rear]<<endl; rear--; }else{ cout<<"Deletion is not possible from end"<<endl; } }else{ cout<<"Queue is empty"<<endl; } } void display(){ if(!isEmpty()){ for(int i=front;i<=rear;i++) cout<<arr[i]<<" "; cout<<endl; }else{ cout<<"Queue is empty"<<endl; } } }; int main(){ int size,data,choice; cout<<"Enter the size of queue: "<<endl; cin>>size; Queue q(size); while(1){ cout<<"1. Enqueue at start\n2. Dequeue from start\n3. Enqueue at end\n4. Dequeue at end\n5. Display\n6. Exit"<<endl; cout<<"Enter the choice: "; cin>>choice; switch(choice){ case 1: cout<<"Enter the data: "; cin>>data; q.enqueueAtStart(data); break; case 2: q.dequeueAtStart(); break; case 3: cout<<"Enter the data: "; cin>>data; q.enqueueAtEnd(data); break; case 4: q.dequeueAtEnd(); break; case 5: q.display(); break; case 6: exit(0); default: cout<<"Please enter correct choice"<<endl; break; } } }
[ "nipun_madaan@yahoo.com" ]
nipun_madaan@yahoo.com
cb0e7e99d3af9f27c262008c880d91b5bbdcbac8
0ed3ff478ea539c975438027f91737b2f0995736
/garli/tags/0.952b2/src/utility.h
1d7bc2c16fcbc54318e7c2c4c30b9994c51d19f9
[]
no_license
zwickl/garli
a275d6fad15c0d3e5d12fe6821efbfff1e1c7520
65fb3e7e967109d1c0a3a9b3fa5eeb0df89285ff
refs/heads/master
2022-09-24T16:39:32.643748
2022-09-15T23:11:54
2022-09-15T23:11:54
39,407,170
4
3
null
null
null
null
UTF-8
C++
false
false
5,705
h
#ifndef GAML_UTIL_HPP #define GAML_UTIL_HPP // code from MTH for allocating flattened matrices #include "memchk.h" #include <stdlib.h> #include <cassert> #define DBL_ALIGN 32 template<typename T> T ***New3DArray(unsigned f , unsigned s , unsigned t); template<typename T> T **New2DArray(unsigned f , unsigned s); template<typename T> void Delete3DArray (T ***temp); template<typename T> void Delete2DArray (T **temp); //aligned versions template<typename T> T ***New3DAlignedArray(unsigned f , unsigned s , unsigned t, unsigned a); template<typename T> T **New2DAlignedArray(unsigned f , unsigned s, unsigned a); template<typename T> void Delete3DAlignedArray (T ***temp); template<typename T> void Delete2DAlignedArray (T **temp); template<typename T> T *NewAlignedArray(unsigned len, unsigned align ){ #ifdef _MSC_VER return (T*) _aligned_malloc(sizeof(T)*len, align); #endif } template<typename T> void DeleteAlignedArray(T *a){ #ifdef _MSC_VER _aligned_free(a); #endif } /*-------------------------------------------------------------------------------------------------------------------------- | Allocates a three dimensional array of FLOAT_TYPEs as one contiguous block of memory | the dimensions are f two dimensional arrays that are s by t. | the array is set up so that | for(i = 0 ; i < f ; i++) | for (j = 0 ; j < s ; j++) | for (k = 0 ; k < t; k++) | array[i][j][k]; | would be the same order of access as: | | T *temp = **array; | for (i = 0 ; i < f*s*t ; i++) | { | *temp++; | } */ template<typename T> T ***New3DArray(unsigned f , unsigned s , unsigned t) { assert(f > 0 && s > 0 && t> 0); T ***temp; temp = new T **[f]; *temp = new T *[f * s]; **temp = new T[f * s * t]; for (unsigned sIt = 1 ; sIt < s ; sIt++) temp[0][sIt] = temp[0][sIt-1] + t ; for (unsigned fIt = 1 ; fIt < f ; fIt ++) { temp[fIt] = temp[fIt -1] + s ; temp[fIt][0] = temp[fIt -1][0] + (s*t); for (unsigned sIt = 1 ; sIt < s ; sIt++) temp[fIt][sIt] = temp[fIt][sIt-1] + t ; } return temp; } /*-------------------------------------------------------------------------------------------------------------------------- | Delete a Three Dimensional Array that has been allocated using New3DArray */ template<typename T> void Delete3DArray (T ***temp) { assert(temp); //these asserts aren't necessary, but right now I can't think of a case in which they'd fail other than following an allocation error assert(*temp); assert(**temp); if (temp) { if (*temp) { if (**temp) delete [] **temp; delete [] * temp; } delete [] temp; } } /*-------------------------------------------------------------------------------------------------------------------------- | Allocates a two dimensional array of FLOAT_TYPEs as one contiguous block of memory | the dimensions are f by s. | the array is set up so that | | for(i = 0 ; i < f ; i++) | for (j = 0 ; j < s ; j++) | array[i][j]; | | would be the same order of access as: | | T *temp = **array; | for (i = 0 ; i < f*s*t ; i++) | *temp++; */ template<typename T> T **New2DArray(unsigned f , unsigned s) { assert(f > 0 && s > 0); T **temp; temp = new T *[f]; *temp = new T [f * s]; for (unsigned fIt = 1 ; fIt < f ; fIt ++) temp[fIt] = temp[fIt -1] + s ; return temp; } /*-------------------------------------------------------------------------------------------------------------------------- | Delete a 2 Dimensional Array New2DArray */ template<typename T> inline void Delete2DArray (T **temp) { assert(temp); //these asserts aren't necessary, but right now I can't think of a case in which they'd fail other than following an allocation error assert(*temp); if (temp) { if (*temp) delete [] * temp; delete [] temp; } } //aligned version template<typename T> T ***New3DAlignedArray(unsigned f , unsigned s , unsigned t) { assert(f > 0 && s > 0 && t> 0); T ***temp; temp = new T **[f]; *temp = new T *[f * s]; **temp = new T[f * s * t]; **temp = NewAlignedArray<T>(f * s * t, DBL_ALIGN); for (unsigned sIt = 1 ; sIt < s ; sIt++) temp[0][sIt] = temp[0][sIt-1] + t ; for (unsigned fIt = 1 ; fIt < f ; fIt ++) { temp[fIt] = temp[fIt -1] + s ; temp[fIt][0] = temp[fIt -1][0] + (s*t); for (unsigned sIt = 1 ; sIt < s ; sIt++) temp[fIt][sIt] = temp[fIt][sIt-1] + t ; } return temp; } /*-------------------------------------------------------------------------------------------------------------------------- | Delete a Three Dimensional Array that has been allocated using New3DArray */ template<typename T> void Delete3DAlignedArray (T ***temp) { assert(temp); //these asserts aren't necessary, but right now I can't think of a case in which they'd fail other than following an allocation error assert(*temp); assert(**temp); if (temp) { if (*temp) { if (**temp) DeleteAlignedArray(**temp); delete [] * temp; } delete [] temp; } } template<typename T> T **New2DAlignedArray(unsigned f , unsigned s) { assert(f > 0 && s > 0); T **temp; temp = new T *[f]; *temp = NewAlignedArray<T>(f * s, DBL_ALIGN); for (unsigned fIt = 1 ; fIt < f ; fIt ++) temp[fIt] = temp[fIt -1] + s ; return temp; } /*-------------------------------------------------------------------------------------------------------------------------- | Delete a 2 Dimensional Array New2DArray */ template<typename T> inline void Delete2DAlignedArray (T **temp) { assert(temp); //these asserts aren't necessary, but right now I can't think of a case in which they'd fail other than following an allocation error assert(*temp); if (temp) { if (*temp) DeleteAlignedArray(*temp); delete [] temp; } } #endif //
[ "zwickl@f68b6e6a-deb8-11de-9f73-7335da764322" ]
zwickl@f68b6e6a-deb8-11de-9f73-7335da764322
44a558aac6fd6019698897640c03d082068f6695
11ffb89cf392367646a88844982d0dc06453eb7c
/Homework06/Dragon.h
3dfdf5399012e7a91655a56afb8a87beb0640eda
[]
no_license
prog1261-2020/homework-atoledanoh
0114bad2f773fab9191d678e3c1a9feba7e18453
f600099876e01daede6f39a3bac3a9d68acb4f3c
refs/heads/master
2020-12-09T22:09:01.933624
2020-03-22T23:52:55
2020-03-22T23:52:55
233,429,881
0
0
null
null
null
null
UTF-8
C++
false
false
192
h
#pragma once #include "Animal.h" class Dragon : public Animal { public: Dragon(std::string n); int pet(); void speak() const override; void move() override; private: int petted = 0; };
[ "55004603+atoledanoh@users.noreply.github.com" ]
55004603+atoledanoh@users.noreply.github.com
b2126d4f68cf9679ace3cd57fca87fb0d5f398e3
6c71067a78989f1d287368a5537609fd3f4200f3
/qgis/include/ui/ui_qgsidentifyresultsbase.h
8bd4dff2a1b0a401e6a7db53b9ce175b654d0372
[]
no_license
3DGISKing/MarineAlarmSystem
c12569d4f300dd8cc783fea4b66de69d8ea17139
0151edbe0fbb422d95a8675f3bbbfc1d215dfb27
refs/heads/master
2021-06-15T20:53:23.547139
2017-03-30T20:16:28
2017-03-30T20:16:28
86,743,988
1
2
null
null
null
null
UTF-8
C++
false
false
16,556
h
/******************************************************************************** ** Form generated from reading UI file 'qgsidentifyresultsbase.ui' ** ** Created: Sat Jan 17 20:06:26 2015 ** by: Qt User Interface Compiler version 4.8.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_QGSIDENTIFYRESULTSBASE_H #define UI_QGSIDENTIFYRESULTSBASE_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QCheckBox> #include <QtGui/QComboBox> #include <QtGui/QDialog> #include <QtGui/QHBoxLayout> #include <QtGui/QHeaderView> #include <QtGui/QLabel> #include <QtGui/QSpacerItem> #include <QtGui/QStackedWidget> #include <QtGui/QTableWidget> #include <QtGui/QToolButton> #include <QtGui/QTreeWidget> #include <QtGui/QVBoxLayout> #include <QtGui/QWidget> #include "qwt_plot.h" QT_BEGIN_NAMESPACE class Ui_QgsIdentifyResultsBase { public: QVBoxLayout *verticalLayout_4; QStackedWidget *stackedWidget; QWidget *stackedWidgetPage1; QVBoxLayout *verticalLayout; QHBoxLayout *horizontalLayout; QToolButton *mExpandToolButton; QToolButton *mCollapseToolButton; QToolButton *mExpandNewToolButton; QToolButton *mOpenFormButton; QToolButton *mClearToolButton; QToolButton *mCopyToolButton; QToolButton *mPrintToolButton; QSpacerItem *horizontalSpacer; QTreeWidget *lstResults; QHBoxLayout *horizontalLayout_2; QLabel *lblIdentifyMode; QComboBox *cmbIdentifyMode; QSpacerItem *horizontalSpacer_43; QCheckBox *cbxAutoFeatureForm; QWidget *stackedWidgetPage2; QVBoxLayout *verticalLayout_2; QTableWidget *tblResults; QWidget *stackedWidgetPage3; QVBoxLayout *verticalLayout_3; QwtPlot *mPlot; QHBoxLayout *horizontalLayout_3; QLabel *lblViewMode; QComboBox *cmbViewMode; QSpacerItem *horizontalSpacer_2; QToolButton *mHelpToolButton; void setupUi(QDialog *QgsIdentifyResultsBase) { if (QgsIdentifyResultsBase->objectName().isEmpty()) QgsIdentifyResultsBase->setObjectName(QString::fromUtf8("QgsIdentifyResultsBase")); QgsIdentifyResultsBase->resize(355, 390); verticalLayout_4 = new QVBoxLayout(QgsIdentifyResultsBase); verticalLayout_4->setSpacing(0); verticalLayout_4->setContentsMargins(0, 0, 0, 0); verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4")); stackedWidget = new QStackedWidget(QgsIdentifyResultsBase); stackedWidget->setObjectName(QString::fromUtf8("stackedWidget")); stackedWidgetPage1 = new QWidget(); stackedWidgetPage1->setObjectName(QString::fromUtf8("stackedWidgetPage1")); verticalLayout = new QVBoxLayout(stackedWidgetPage1); verticalLayout->setSpacing(0); verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); horizontalLayout = new QHBoxLayout(); horizontalLayout->setSpacing(6); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); horizontalLayout->setContentsMargins(5, -1, 5, 6); mExpandToolButton = new QToolButton(stackedWidgetPage1); mExpandToolButton->setObjectName(QString::fromUtf8("mExpandToolButton")); QIcon icon; icon.addFile(QString::fromUtf8("../../images/themes/default/mActionExpandTree.png"), QSize(), QIcon::Normal, QIcon::Off); mExpandToolButton->setIcon(icon); mExpandToolButton->setAutoRaise(true); horizontalLayout->addWidget(mExpandToolButton); mCollapseToolButton = new QToolButton(stackedWidgetPage1); mCollapseToolButton->setObjectName(QString::fromUtf8("mCollapseToolButton")); QIcon icon1; icon1.addFile(QString::fromUtf8("../../images/themes/default/mActionCollapseTree.png"), QSize(), QIcon::Normal, QIcon::Off); mCollapseToolButton->setIcon(icon1); mCollapseToolButton->setAutoRaise(true); horizontalLayout->addWidget(mCollapseToolButton); mExpandNewToolButton = new QToolButton(stackedWidgetPage1); mExpandNewToolButton->setObjectName(QString::fromUtf8("mExpandNewToolButton")); QIcon icon2; icon2.addFile(QString::fromUtf8("../../images/themes/default/mActionExpandNewTree.png"), QSize(), QIcon::Normal, QIcon::Off); mExpandNewToolButton->setIcon(icon2); mExpandNewToolButton->setCheckable(true); mExpandNewToolButton->setAutoRaise(true); horizontalLayout->addWidget(mExpandNewToolButton); mOpenFormButton = new QToolButton(stackedWidgetPage1); mOpenFormButton->setObjectName(QString::fromUtf8("mOpenFormButton")); QIcon icon3; icon3.addFile(QString::fromUtf8(":/images/themes/default/mActionPropertyItem.png"), QSize(), QIcon::Normal, QIcon::Off); mOpenFormButton->setIcon(icon3); mOpenFormButton->setAutoRaise(true); horizontalLayout->addWidget(mOpenFormButton); mClearToolButton = new QToolButton(stackedWidgetPage1); mClearToolButton->setObjectName(QString::fromUtf8("mClearToolButton")); QIcon icon4; icon4.addFile(QString::fromUtf8(":/images/themes/default/mActionDeselectAll.svg"), QSize(), QIcon::Normal, QIcon::Off); mClearToolButton->setIcon(icon4); mClearToolButton->setCheckable(false); mClearToolButton->setAutoRaise(true); horizontalLayout->addWidget(mClearToolButton); mCopyToolButton = new QToolButton(stackedWidgetPage1); mCopyToolButton->setObjectName(QString::fromUtf8("mCopyToolButton")); QIcon icon5; icon5.addFile(QString::fromUtf8(":/images/themes/default/mActionEditCopy.png"), QSize(), QIcon::Normal, QIcon::Off); mCopyToolButton->setIcon(icon5); mCopyToolButton->setCheckable(false); mCopyToolButton->setAutoRaise(true); horizontalLayout->addWidget(mCopyToolButton); mPrintToolButton = new QToolButton(stackedWidgetPage1); mPrintToolButton->setObjectName(QString::fromUtf8("mPrintToolButton")); mPrintToolButton->setEnabled(true); QIcon icon6; icon6.addFile(QString::fromUtf8("../../images/themes/default/mActionFilePrint.png"), QSize(), QIcon::Normal, QIcon::Off); mPrintToolButton->setIcon(icon6); mPrintToolButton->setCheckable(false); mPrintToolButton->setAutoRaise(true); horizontalLayout->addWidget(mPrintToolButton); horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); verticalLayout->addLayout(horizontalLayout); lstResults = new QTreeWidget(stackedWidgetPage1); QTreeWidgetItem *__qtreewidgetitem = new QTreeWidgetItem(); __qtreewidgetitem->setText(0, QString::fromUtf8("1")); lstResults->setHeaderItem(__qtreewidgetitem); lstResults->setObjectName(QString::fromUtf8("lstResults")); lstResults->setLineWidth(2); lstResults->setAlternatingRowColors(true); lstResults->setSortingEnabled(true); verticalLayout->addWidget(lstResults); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setSpacing(6); horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2")); horizontalLayout_2->setContentsMargins(5, 5, 5, -1); lblIdentifyMode = new QLabel(stackedWidgetPage1); lblIdentifyMode->setObjectName(QString::fromUtf8("lblIdentifyMode")); horizontalLayout_2->addWidget(lblIdentifyMode); cmbIdentifyMode = new QComboBox(stackedWidgetPage1); cmbIdentifyMode->setObjectName(QString::fromUtf8("cmbIdentifyMode")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(cmbIdentifyMode->sizePolicy().hasHeightForWidth()); cmbIdentifyMode->setSizePolicy(sizePolicy); horizontalLayout_2->addWidget(cmbIdentifyMode); horizontalSpacer_43 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_2->addItem(horizontalSpacer_43); cbxAutoFeatureForm = new QCheckBox(stackedWidgetPage1); cbxAutoFeatureForm->setObjectName(QString::fromUtf8("cbxAutoFeatureForm")); horizontalLayout_2->addWidget(cbxAutoFeatureForm); verticalLayout->addLayout(horizontalLayout_2); stackedWidget->addWidget(stackedWidgetPage1); stackedWidgetPage2 = new QWidget(); stackedWidgetPage2->setObjectName(QString::fromUtf8("stackedWidgetPage2")); verticalLayout_2 = new QVBoxLayout(stackedWidgetPage2); verticalLayout_2->setSpacing(0); verticalLayout_2->setContentsMargins(0, 0, 0, 0); verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); tblResults = new QTableWidget(stackedWidgetPage2); if (tblResults->columnCount() < 4) tblResults->setColumnCount(4); QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); tblResults->setHorizontalHeaderItem(0, __qtablewidgetitem); QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); tblResults->setHorizontalHeaderItem(1, __qtablewidgetitem1); QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem(); tblResults->setHorizontalHeaderItem(2, __qtablewidgetitem2); QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem(); tblResults->setHorizontalHeaderItem(3, __qtablewidgetitem3); tblResults->setObjectName(QString::fromUtf8("tblResults")); tblResults->setEditTriggers(QAbstractItemView::NoEditTriggers); tblResults->setSortingEnabled(false); verticalLayout_2->addWidget(tblResults); stackedWidget->addWidget(stackedWidgetPage2); stackedWidgetPage3 = new QWidget(); stackedWidgetPage3->setObjectName(QString::fromUtf8("stackedWidgetPage3")); verticalLayout_3 = new QVBoxLayout(stackedWidgetPage3); verticalLayout_3->setSpacing(6); verticalLayout_3->setContentsMargins(11, 11, 11, 11); verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); mPlot = new QwtPlot(stackedWidgetPage3); mPlot->setObjectName(QString::fromUtf8("mPlot")); verticalLayout_3->addWidget(mPlot); stackedWidget->addWidget(stackedWidgetPage3); verticalLayout_4->addWidget(stackedWidget); horizontalLayout_3 = new QHBoxLayout(); horizontalLayout_3->setSpacing(6); horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3")); horizontalLayout_3->setContentsMargins(5, -1, 5, -1); lblViewMode = new QLabel(QgsIdentifyResultsBase); lblViewMode->setObjectName(QString::fromUtf8("lblViewMode")); horizontalLayout_3->addWidget(lblViewMode); cmbViewMode = new QComboBox(QgsIdentifyResultsBase); cmbViewMode->setObjectName(QString::fromUtf8("cmbViewMode")); horizontalLayout_3->addWidget(cmbViewMode); horizontalSpacer_2 = new QSpacerItem(58, 38, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_3->addItem(horizontalSpacer_2); mHelpToolButton = new QToolButton(QgsIdentifyResultsBase); mHelpToolButton->setObjectName(QString::fromUtf8("mHelpToolButton")); mHelpToolButton->setEnabled(true); mHelpToolButton->setCheckable(false); horizontalLayout_3->addWidget(mHelpToolButton); verticalLayout_4->addLayout(horizontalLayout_3); retranslateUi(QgsIdentifyResultsBase); stackedWidget->setCurrentIndex(0); QMetaObject::connectSlotsByName(QgsIdentifyResultsBase); } // setupUi void retranslateUi(QDialog *QgsIdentifyResultsBase) { QgsIdentifyResultsBase->setWindowTitle(QApplication::translate("QgsIdentifyResultsBase", "Identify Results", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mExpandToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Expand tree", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mExpandToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mCollapseToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Collapse tree", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mCollapseToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mExpandNewToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "New results will be expanded by default.", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mExpandNewToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); mOpenFormButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mClearToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Clear Results", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mClearToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mCopyToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Copy selected feature to clipboard.", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mCopyToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP mPrintToolButton->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Print selected HTML response.", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP mPrintToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "...", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP lblIdentifyMode->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Select identify mode", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP lblIdentifyMode->setText(QApplication::translate("QgsIdentifyResultsBase", "Mode", 0, QApplication::UnicodeUTF8)); cbxAutoFeatureForm->setText(QApplication::translate("QgsIdentifyResultsBase", "Auto open form", 0, QApplication::UnicodeUTF8)); QTableWidgetItem *___qtablewidgetitem = tblResults->horizontalHeaderItem(0); ___qtablewidgetitem->setText(QApplication::translate("QgsIdentifyResultsBase", "Layer", 0, QApplication::UnicodeUTF8)); QTableWidgetItem *___qtablewidgetitem1 = tblResults->horizontalHeaderItem(1); ___qtablewidgetitem1->setText(QApplication::translate("QgsIdentifyResultsBase", "FID", 0, QApplication::UnicodeUTF8)); QTableWidgetItem *___qtablewidgetitem2 = tblResults->horizontalHeaderItem(2); ___qtablewidgetitem2->setText(QApplication::translate("QgsIdentifyResultsBase", "Attribute", 0, QApplication::UnicodeUTF8)); QTableWidgetItem *___qtablewidgetitem3 = tblResults->horizontalHeaderItem(3); ___qtablewidgetitem3->setText(QApplication::translate("QgsIdentifyResultsBase", "Value", 0, QApplication::UnicodeUTF8)); #ifndef QT_NO_TOOLTIP lblViewMode->setToolTip(QApplication::translate("QgsIdentifyResultsBase", "Select view mode for raster layers", 0, QApplication::UnicodeUTF8)); #endif // QT_NO_TOOLTIP lblViewMode->setText(QApplication::translate("QgsIdentifyResultsBase", "View", 0, QApplication::UnicodeUTF8)); mHelpToolButton->setText(QApplication::translate("QgsIdentifyResultsBase", "Help", 0, QApplication::UnicodeUTF8)); } // retranslateUi }; namespace Ui { class QgsIdentifyResultsBase: public Ui_QgsIdentifyResultsBase {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_QGSIDENTIFYRESULTSBASE_H
[ "wugis3@yahoo.com" ]
wugis3@yahoo.com
2f75e2add20d9b66f0fe3b600aef1c82580cbde6
c91e272cfd99013ef9d56acfa95f5aed39d5c943
/codes-20180817T022617Z-001/ARM_codes/LEDS/led2/led2.cp
2927ab07c5d6713a2130907580671b4a7f7c74a6
[]
no_license
KhaledAbdelgalil/ITI-internship
334a4d26e686f107abaaf7a002bfaf3a757f445a
8393d2584948647914fa958d483e59f1ef41cdba
refs/heads/master
2021-10-23T00:55:19.068152
2019-03-14T01:22:05
2019-03-14T01:22:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
566
cp
#line 1 "C:/Users/pc2/Desktop/embded/microCforArm/led2/led2.c" void main() { GPIO_Digital_Output(&GPIOA_ODR,_GPIO_PINMASK_ALL); GPIO_Digital_Output(&GPIOB_ODR,_GPIO_PINMASK_ALL); GPIO_Digital_Output(&GPIOC_ODR,_GPIO_PINMASK_ALL); GPIO_Digital_Output(&GPIOD_ODR,_GPIO_PINMASK_ALL); GPIO_Digital_Output(&GPIOE_ODR,_GPIO_PINMASK_ALL); GPIOA_ODR = 0xFFFF; GPIOB_ODR = 0xFFFF; GPIOC_ODR = 0xFFFF; GPIOD_ODR = 0xFFFF; GPIOE_ODR = 0xFFFF; while(1) { GPIOA_ODR~ = 0xFFFF; GPIOB_ODR ~= 0xFFFF; GPIOC_ODR ~= 0xFFFF; GPIOD_ODR ~= 0xFFFF; GPIOE_ODR ~= 0xFFFF; Delay_ms(500); }
[ "khaled.abdelgalil96@gmail.com" ]
khaled.abdelgalil96@gmail.com
a38a4a156ff1a5f78bfd385dd1174b05c6205593
a4a018a69e15e2edd43d1c4331b611c46f7a9277
/CodeChef/FCTRL.cpp
9657dce29ac9565a8daf5a5f1229e02ad7cb84ee
[]
no_license
sanchitkum/algorithmic-solutions
207765580d02869cd59ec577db8662a6752a40e2
b1eebee2ca3a012caf5f3cb6aa5cd799113218e8
refs/heads/master
2016-09-05T17:17:55.031903
2016-03-01T02:10:18
2016-03-01T02:10:18
40,711,722
11
1
null
null
null
null
UTF-8
C++
false
false
231
cpp
#include<stdio.h> int main() { int n,i,cnt; long unsigned no,div; scanf("%d",&n); for(i=1;i<=n;i++) { cnt=0; scanf("%lu",&no); for(div=5;div<=no;div*=5) cnt=cnt+(int)(no/div); printf("%lu\n",cnt); } return 0; }
[ "sanchitkum@gmail.com" ]
sanchitkum@gmail.com
0ce03a6d485539a1e5ffef4639e74d0506dd03bd
8e6d8ffb5f6ff074a00dcbef20f26684355fe1d1
/Source/C3PhysicalImpl.h
62164394d98eb7ecab6f9c22981113e42be2e94c
[ "MIT" ]
permissive
keelanstuart/Celerity
53f2c02531fef8c2cd5005fedaacfce8494f3740
e611d7abd663bcd6fac13533c4b3ebe055b6044f
refs/heads/master
2023-08-03T05:15:46.873982
2023-08-01T15:43:13
2023-08-01T15:43:30
231,425,821
3
0
null
null
null
null
WINDOWS-1252
C++
false
false
4,084
h
// ************************************************************** // Celerity v3 Game / Visualization Engine Source File // // Copyright © 2001-2023, Keelan Stuart #pragma once #include <C3.h> #include <C3Physical.h> namespace c3 { class PhysicalImpl : public Physical, props::IPropertyChangeListener { protected: Object *m_pOwner; glm::vec3 m_LinVel; glm::vec3 m_LinAcc; float m_LinSpeedFalloff; float m_maxLinSpeed; glm::vec3 m_RotVel; glm::vec3 m_RotAcc; glm::vec3 m_RotVelFalloff; glm::vec3 m_maxRotSpeed; props::TFlags64 m_Flags; Positionable *m_pPositionable; glm::fvec3 m_DeltaPos; public: PhysicalImpl(); virtual ~PhysicalImpl(); virtual void Release(); virtual const ComponentType *GetType() const; virtual props::TFlags64 Flags() const; virtual bool Initialize(Object *pobject); virtual void Update(float elapsed_time = 0.0f); virtual bool Prerender(Object::RenderFlags flags); virtual void Render(Object::RenderFlags flags); virtual void PropertyChanged(const props::IProperty *pprop); virtual bool Intersect(const glm::vec3 *pRayPos, const glm::vec3 *pRayDir, float *pDistance) const; // *** LINEAR VELOCITY FUNCTIONS ******************************* virtual void SetLinVel(float x, float y, float z); virtual void SetLinVelVec(const glm::fvec3 *lvel); virtual void SetLinVelX(float x); virtual void SetLinVelY(float y); virtual void SetLinVelZ(float z); virtual const glm::fvec3 *GetLinVel(glm::fvec3 *vel = nullptr); virtual float GetLinVelX(); virtual float GetLinVelY(); virtual float GetLinVelZ(); virtual void AdjustLinVel(float xadj = 0.0f, float yadj = 0.0f, float zadj = 0.0f); virtual void SetMaxLinSpeed(float speed = FLT_MAX); virtual float GetMaxLinSpeed(); virtual void SetLinSpeedFalloffFactor(float factor = 0.0f); // *** LINEAR ACCELERATION FUNCTIONS ******************************* virtual void SetLinAcc(float x, float y, float z); virtual void SetLinAccVec(const glm::fvec3 *lacc); virtual void SetLinAccX(float x); virtual void SetLinAccY(float y); virtual void SetLinAccZ(float z); virtual const glm::fvec3 *GetLinAcc(glm::fvec3 *lacc = nullptr); virtual float GetLinAccX(); virtual float GetLinAccY(); virtual float GetLinAccZ(); virtual void AdjustLinAcc(float xadj = 0.0f, float yadj = 0.0f, float zadj = 0.0f); // *** ROTATIONAL VELOCITY FUNCTIONS ******************************* virtual void SetRotVel(float y, float p, float r); virtual void SetRotVelVec(const glm::fvec3 *rvel); virtual void SetRotVelY(float y); virtual void SetRotVelP(float p); virtual void SetRotVelR(float r); virtual const glm::fvec3 *GetRotVel(glm::fvec3 *rvel = nullptr); virtual float GetRotVelY(); virtual float GetRotVelP(); virtual float GetRotVelR(); virtual void AdjustRotVel(float yadj = 0.0f, float padj = 0.0f, float radj = 0.0f); virtual void SetMaxRotSpeed(glm::fvec3 *speed = nullptr); virtual glm::fvec3 *GetMaxRotSpeed(glm::fvec3 *speed = nullptr); virtual void SetRotVelFalloffFactor(glm::fvec3 *factor = nullptr); virtual glm::fvec3 *GetRotVelFalloffFactor(glm::fvec3 *factor = nullptr); // *** ROTATIONAL ACCELERATION FUNCTIONS ******************************* virtual void SetRotAcc(float y, float p, float r); virtual void SetRotAccVec(const glm::fvec3 *racc); virtual void SetRotAccY(float y); virtual void SetRotAccP(float p); virtual void SetRotAccR(float r); virtual const glm::fvec3 *GetRotAcc(glm::fvec3 *racc = nullptr); virtual float GetRotAccY(); virtual float GetRotAccP(); virtual float GetRotAccR(); virtual void AdjustRotAcc(float yadj = 0.0f, float padj = 0.0f, float radj = 0.0f); }; DEFINE_COMPONENTTYPE(Physical, PhysicalImpl, GUID({0xf8641b51, 0xa0fc, 0x4d93, {0x89, 0x2f, 0x48, 0xb, 0x7, 0xba, 0x28, 0x61}}), "Physical", "Allows the Object to move through space, requires Positional", 0); };
[ "keelanstuart@gmail.com" ]
keelanstuart@gmail.com
d56a62d3c018b034023c6d986d2aebf0ce791abd
30e1dc84fe8c54d26ef4a1aff000a83af6f612be
/src/external/boost/boost_1_68_0/tools/bcp/copy_path.cpp
c65c1b3b5e72ed56916436a23ac4020c84b3099b
[ "BSL-1.0", "LicenseRef-scancode-other-permissive", "Zlib", "Spencer-86", "LicenseRef-scancode-mit-old-style", "Jam", "GPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-bison-exception-2.0", "LicenseRef-scancode-stlport-4.5", "LicenseRef-scancode-public-domain", ...
permissive
Sitispeaks/turicreate
0bda7c21ee97f5ae7dc09502f6a72abcb729536d
d42280b16cb466a608e7e723d8edfbe5977253b6
refs/heads/main
2023-05-19T17:55:21.938724
2021-06-14T17:53:17
2021-06-14T17:53:17
385,034,849
1
0
BSD-3-Clause
2021-07-11T19:23:21
2021-07-11T19:23:20
null
UTF-8
C++
false
false
7,871
cpp
/* * * Copyright (c) 2003 Dr John Maddock * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * * This file implements the following: * void bcp_implementation::copy_path(const fs::path& p) * void bcp_implementation::create_path(const fs::path& p) */ #include "bcp_imp.hpp" #include "fileview.hpp" #include <boost/filesystem/operations.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/regex.hpp> #include <fstream> #include <iterator> #include <algorithm> #include <iostream> struct get_new_library_name { get_new_library_name(const std::string& n) : m_new_name(n) {} template <class I> std::string operator()(const boost::match_results<I>& what) { std::string s = what[0]; std::string::size_type n = s.find("boost"); if(n == std::string::npos) { s.insert(0, m_new_name); } else { s.replace(n, 5, m_new_name); } return s; } private: std::string m_new_name; }; void bcp_implementation::copy_path(const fs::path& p) { assert(!fs::is_directory(m_boost_path / p)); if(fs::exists(m_dest_path / p)) { std::cout << "Copying (and overwriting) file: " << p.string() << "\n"; fs::remove(m_dest_path / p); } else std::cout << "Copying file: " << p.string() << "\n"; // // create the path to the new file if it doesn't already exist: // create_path(p.branch_path()); // // do text based copy if requested: // if((p.leaf() == "Jamroot") && m_namespace_name.size()) { static std::vector<char> v1, v2; v1.clear(); v2.clear(); boost::filesystem::ifstream is((m_boost_path / p)); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static boost::regex libname_matcher; if(libname_matcher.empty()) { libname_matcher.assign("boost_"); } regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, m_namespace_name + "_"); std::swap(v1, v2); v2.clear(); boost::filesystem::ofstream os; if(m_unix_lines) os.open((m_dest_path / p), std::ios_base::binary | std::ios_base::out); else os.open((m_dest_path / p), std::ios_base::out); os.write(&*v1.begin(), v1.size()); os.close(); } else if(m_namespace_name.size() && m_lib_names.size() && is_jam_file(p)) { static std::vector<char> v1, v2; v1.clear(); v2.clear(); boost::filesystem::ifstream is((m_boost_path / p)); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static boost::regex libname_matcher; if(libname_matcher.empty()) { std::string re = "\\<"; re += *m_lib_names.begin(); for(std::set<std::string>::const_iterator i = ++m_lib_names.begin(); i != m_lib_names.end(); ++i) { re += "|" + *i; } re += "\\>"; libname_matcher.assign(re); } regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), libname_matcher, get_new_library_name(m_namespace_name)); std::swap(v1, v2); v2.clear(); boost::filesystem::ofstream os; if(m_unix_lines) os.open((m_dest_path / p), std::ios_base::binary | std::ios_base::out); else os.open((m_dest_path / p), std::ios_base::out); os.write(&*v1.begin(), v1.size()); os.close(); } else if(m_namespace_name.size() && is_source_file(p)) { // // v1 hold the current content, v2 is temp buffer. // Each time we do a search and replace the new content // ends up in v2: we then swap v1 and v2, and clear v2. // static std::vector<char> v1, v2; v1.clear(); v2.clear(); boost::filesystem::ifstream is((m_boost_path / p)); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static const boost::regex namespace_matcher( "(?|" "(namespace\\s+)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?" "|" "(namespace\\s+(?:detail::)?)(adstl|phoenix|rapidxml)\\>" "|" "()\\<boost((?:_(?!intrusive_tags)\\w+)?\\s*(?:::))(?:(\\s*)phoenix)?" "|" "()\\<((?:adstl|phoenix|rapidxml)\\s*(?:::))" "|" "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?" "|" "(namespace\\s+\\w+\\s*=\\s*(?:::\\s*)?(?:\\w+\\s*::\\s*)?)(adstl|phoenix|rapidxml)\\>" "|" "(^\\s*#\\s*define\\s+\\w+\\s+)boost((?:_\\w+)?\\s*)$" "|" "(^\\s*#\\s*define[^\\n]+)((?:adstl|phoenix|rapidxml)\\s*)$" "|" "()boost(_asio_detail_posix_thread_function|_regex_free_static_mutex)" "|" "()\\<(lw_thread_routine|at_thread_exit|on_process_enter|on_process_exit|on_thread_enter|on_thread_exit|tss_cleanup_implemented)\\>" "|" "(BOOST_CLASS_REQUIRE4?[^;]*)boost((?:_\\w+)?\\s*,)" "|" "(::tr1::|TR1_DECL\\s+)boost(_\\w+\\s*)" // math tr1 "|" "(\\(\\s*)boost(\\s*\\))\\s*(\\(\\s*)phoenix(\\s*\\))" "|" "(\\(\\s*)boost(\\s*\\))" ")" ); regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2(?3$3" + m_namespace_name + "phoenix?4$4)", boost::regex_constants::format_all); std::swap(v1, v2); v2.clear(); if(m_namespace_alias) { static const boost::regex namespace_alias( /* "namespace\\s+" + m_namespace_name + "\\s*" "(" "\\{" "(?:" "(?>[^\\{\\}/]+)" "(?>" "(?:" "(?1)" "|//[^\\n]+$" "|/[^/]" "|(?:^\\s*#[^\\n]*" "(?:(?<=\\\\)\\n[^\\n]*)*)" ")" "[^\\{\\}]+" ")*" ")*" "\\}" ")" */ /* "(namespace\\s+" + m_namespace_name + "\\s*\\{.*" "\\})([^\\{\\};]*)\\z" */ "(namespace)(\\s+)(" + m_namespace_name + ")" "(adstl|phoenix|rapidxml)?(\\s*\\{)" ); regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_alias, "$1 $3$4 {} $1 (?4$4:boost) = $3$4; $1$2$3$4$5", boost::regex_constants::format_all); std::swap(v1, v2); v2.clear(); } boost::filesystem::ofstream os; if(m_unix_lines) os.open((m_dest_path / p), std::ios_base::binary | std::ios_base::out); else os.open((m_dest_path / p), std::ios_base::out); if(v1.size()) os.write(&*v1.begin(), v1.size()); os.close(); } else if(m_unix_lines && !is_binary_file(p)) { boost::filesystem::ifstream is((m_boost_path / p)); std::istreambuf_iterator<char> isi(is); std::istreambuf_iterator<char> end; boost::filesystem::ofstream os((m_dest_path / p), std::ios_base::binary | std::ios_base::out); std::ostreambuf_iterator<char> osi(os); std::copy(isi, end, osi); } else { // binary copy: fs::copy_file(m_boost_path / p, m_dest_path / p); } } void bcp_implementation::create_path(const fs::path& p) { if(!fs::exists(m_dest_path / p)) { // recurse then create the path: create_path(p.branch_path()); fs::create_directory(m_dest_path / p); } }
[ "znation@apple.com" ]
znation@apple.com
63b26bbaee1633aa57fc358047709d4daf3f37b1
d25f34c7c2feedc72bcc6c7af2b624e1c1605eee
/modules/common/vehicle_state/vehicle_state_provider.h
59c1a10d414d23b567fa9e9f1160927733661acb
[ "Apache-2.0" ]
permissive
wangzhongchuan1973/2020-w1
aefecada26376f49cc88b652378920647ae3af78
f9fb019d6b5ebbba4b4e9cf5e98544fa9bc3c7a6
refs/heads/master
2022-12-11T14:06:04.564465
2020-03-08T07:11:25
2020-03-08T07:11:25
245,765,118
0
0
Apache-2.0
2022-12-07T02:18:33
2020-03-08T06:37:00
C++
UTF-8
C++
false
false
5,447
h
/****************************************************************************** * Copyright 2017 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ /** * @file vehicle_state.h * * @brief Declaration of the class VehicleStateProvider. */ #ifndef MODULES_COMMON_VEHICLE_STATE_VEHICLE_STATE_PROVIDER_H_ #define MODULES_COMMON_VEHICLE_STATE_VEHICLE_STATE_PROVIDER_H_ #include <memory> #include <string> #include "modules/canbus/proto/chassis.pb.h" #include "modules/common/proto/vehicle_state.pb.h" #include "modules/localization/proto/localization.pb.h" #include "modules/common/macro.h" #include "modules/common/math/box2d.h" #include "modules/common/math/vec2d.h" #include "modules/common/status/status.h" /** * @namespace apollo::common * @brief apollo::common */ namespace apollo { namespace common { /** * @class VehicleStateProvider * @brief The class of vehicle state. * It includes basic information and computation * about the state of the vehicle. */ class VehicleStateProvider { public: /** * @brief Constructor by information of localization and chassis. * @param localization Localization information of the vehicle. * @param chassis Chassis information of the vehicle. */ Status Update(const localization::LocalizationEstimate& localization, const canbus::Chassis& chassis); /** * @brief Update VehicleStateProvider instance by protobuf files. * @param localization_file the localization protobuf file. * @param chassis_file The chassis protobuf file */ void Update(const std::string& localization_file, const std::string& chassis_file); double timestamp() const; const localization::Pose& pose() const; /** * @brief Default destructor. */ virtual ~VehicleStateProvider() = default; /** * @brief Get the x-coordinate of vehicle position. * @return The x-coordinate of vehicle position. */ double x() const; /** * @brief Get the y-coordinate of vehicle position. * @return The y-coordinate of vehicle position. */ double y() const; /** * @brief Get the z coordinate of vehicle position. * @return The z coordinate of vehicle position. */ double z() const; double kappa() const; /** * @brief Get the vehicle roll angle. * @return The euler roll angle. */ double roll() const; /** * @brief Get the vehicle pitch angle. * @return The euler pitch angle. */ double pitch() const; /** * @brief Get the vehicle yaw angle. * As of now, use the heading instead of yaw angle. * Heading angle with East as zero, yaw angle has North as zero * @return The euler yaw angle. */ double yaw() const; /** * @brief Get the heading of vehicle position, which is the angle * between the vehicle's heading direction and the x-axis. * @return The angle between the vehicle's heading direction * and the x-axis. */ double heading() const; /** * @brief Get the vehicle's linear velocity. * @return The vehicle's linear velocity. */ double linear_velocity() const; /** * @brief Get the vehicle's angular velocity. * @return The vehicle's angular velocity. */ double angular_velocity() const; /** * @brief Get the vehicle's linear acceleration. * @return The vehicle's linear acceleration. */ double linear_acceleration() const; /** * @brief Get the vehicle's gear position. * @return The vehicle's gear position. */ double gear() const; /** * @brief Set the vehicle's linear velocity. * @param linear_velocity The value to set the vehicle's linear velocity. */ void set_linear_velocity(const double linear_velocity); /** * @brief Estimate future position from current position and heading, * along a period of time, by constant linear velocity, * linear acceleration, angular velocity. * @param t The length of time period. * @return The estimated future position in time t. */ math::Vec2d EstimateFuturePosition(const double t) const; /** * @brief Compute the position of center of mass(COM) of the vehicle, * given the distance from rear wheels to the center of mass. * @param rear_to_com_distance Distance from rear wheels to * the vehicle's center of mass. * @return The position of the vehicle's center of mass. */ math::Vec2d ComputeCOMPosition(const double rear_to_com_distance) const; const VehicleState& vehicle_state() const; private: bool ConstructExceptLinearVelocity( const localization::LocalizationEstimate& localization); common::VehicleState vehicle_state_; DECLARE_SINGLETON(VehicleStateProvider); }; } // namespace common } // namespace apollo #endif // MODULES_COMMON_VEHICLE_STATE_VEHICLE_STATE_PROVIDER_H_
[ "wzc1973@163.com" ]
wzc1973@163.com
643f7ae71c761d9173ed5494783e46541626109a
801f7ed77fb05b1a19df738ad7903c3e3b302692
/refactoringOptimisation/differentiatedCAD/occt-min-topo-src/src/TDataStd/TDataStd_TreeNode.hxx
f9459a4fa828f4abfdf116479a5225844642d901
[]
no_license
salvAuri/optimisationRefactoring
9507bdb837cabe10099d9481bb10a7e65331aa9d
e39e19da548cb5b9c0885753fe2e3a306632d2ba
refs/heads/master
2021-01-20T03:47:54.825311
2017-04-27T11:31:24
2017-04-27T11:31:24
89,588,404
0
1
null
null
null
null
UTF-8
C++
false
false
9,500
hxx
// Created on: 1999-06-10 // Created by: Vladislav ROMASHKO // Copyright (c) 1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #ifndef _TDataStd_TreeNode_HeaderFile #define _TDataStd_TreeNode_HeaderFile #include <Standard.hxx> #include <Standard_Type.hxx> #include <TDataStd_PtrTreeNode.hxx> #include <Standard_GUID.hxx> #include <TDF_Attribute.hxx> #include <Standard_Boolean.hxx> #include <Standard_Integer.hxx> #include <Standard_OStream.hxx> class TDataStd_ChildNodeIterator; class TDF_Label; class Standard_GUID; class TDF_AttributeDelta; class TDF_Attribute; class TDF_RelocationTable; class TDF_DataSet; class TDataStd_TreeNode; DEFINE_STANDARD_HANDLE(TDataStd_TreeNode, TDF_Attribute) //! Allows you to define an explicit tree of labels //! which you can also edit. //! Without this class, the data structure cannot be fully edited. //! This service is required if for presentation //! purposes, you want to create an application with //! a tree which allows you to organize and link data //! as a function of application features. class TDataStd_TreeNode : public TDF_Attribute { public: //! class methods working on the node //! =================================== //! Returns true if the tree node T is found on the label L. //! Otherwise, false is returned. Standard_EXPORT static Standard_Boolean Find (const TDF_Label& L, Handle(TDataStd_TreeNode)& T); //! Finds or Creates a TreeNode attribute on the label <L> //! with the default tree ID, returned by the method //! <GetDefaultTreeID>. Returns the created/found TreeNode //! attribute. Standard_EXPORT static Handle(TDataStd_TreeNode) Set (const TDF_Label& L); //! Finds or Creates a TreeNode attribute on the label //! <L>, with an explicit tree ID. <ExplicitTreeID> is //! the ID returned by <TDF_Attribute::ID> method. //! Returns the found/created TreeNode attribute. Standard_EXPORT static Handle(TDataStd_TreeNode) Set (const TDF_Label& L, const Standard_GUID& ExplicitTreeID); //! returns a default tree ID. this ID is used by the //! <Set> method without explicit tree ID. //! Instance methods: //! ================ Standard_EXPORT static const Standard_GUID& GetDefaultTreeID(); Standard_EXPORT TDataStd_TreeNode(); //! Insert the TreeNode <Child> as last child of <me>. If //! the insertion is successful <me> becomes the Father of <Child>. Standard_EXPORT Standard_Boolean Append (const Handle(TDataStd_TreeNode)& Child); //! Insert the the TreeNode <Child> as first child of //! <me>. If the insertion is successful <me> becomes the Father of <Child> Standard_EXPORT Standard_Boolean Prepend (const Handle(TDataStd_TreeNode)& Child); //! Inserts the TreeNode <Node> before <me>. If insertion is successful <me> //! and <Node> belongs to the same Father. Standard_EXPORT Standard_Boolean InsertBefore (const Handle(TDataStd_TreeNode)& Node); //! Inserts the TreeNode <Node> after <me>. If insertion is successful <me> //! and <Node> belongs to the same Father. Standard_EXPORT Standard_Boolean InsertAfter (const Handle(TDataStd_TreeNode)& Node); //! Removes this tree node attribute from its father //! node. The result is that this attribute becomes a root node. Standard_EXPORT Standard_Boolean Remove(); //! Returns the depth of this tree node in the overall tree node structure. //! In other words, the number of father tree nodes of this one is returned. Standard_EXPORT Standard_Integer Depth() const; //! Returns the number of child nodes. //! If <allLevels> is true, the method counts children of all levels //! (children of children ...) Standard_EXPORT Standard_Integer NbChildren (const Standard_Boolean allLevels = Standard_False) const; //! Returns true if this tree node attribute is an //! ascendant of of. In other words, if it is a father or //! the father of a father of of. Standard_EXPORT Standard_Boolean IsAscendant (const Handle(TDataStd_TreeNode)& of) const; //! Returns true if this tree node attribute is a //! descendant of of. In other words, if it is a child or //! the child of a child of of. Standard_EXPORT Standard_Boolean IsDescendant (const Handle(TDataStd_TreeNode)& of) const; //! Returns true if this tree node attribute is the //! ultimate father in the tree. Standard_EXPORT Standard_Boolean IsRoot() const; //! Returns the ultimate father of this tree node attribute. Standard_EXPORT Handle(TDataStd_TreeNode) Root() const; //! Returns true if this tree node attribute is a father of of. Standard_EXPORT Standard_Boolean IsFather (const Handle(TDataStd_TreeNode)& of) const; //! Returns true if this tree node attribute is a child of of. Standard_EXPORT Standard_Boolean IsChild (const Handle(TDataStd_TreeNode)& of) const; //! Returns true if this tree node attribute has a father tree node. Standard_Boolean HasFather() const; //! Returns the father TreeNode of <me>. Null if root. Standard_EXPORT Handle(TDataStd_TreeNode) Father() const; //! Returns true if this tree node attribute has a next tree node. Standard_Boolean HasNext() const; //! Returns the next tree node in this tree node attribute. //! Warning //! This tree node is null if it is the last one in this //! tree node attribute.Returns the next TreeNode of <me>. Null if last. Standard_EXPORT Handle(TDataStd_TreeNode) Next() const; //! Returns true if this tree node attribute has a previous tree node. Standard_Boolean HasPrevious() const; //! Returns the previous tree node of this tree node attribute. //! Warning //! This tree node is null if it is the first one in this tree node attribute. Standard_EXPORT Handle(TDataStd_TreeNode) Previous() const; //! Returns true if this tree node attribute has a first child tree node. Standard_Boolean HasFirst() const; //! Returns the first child tree node in this tree node object. Standard_EXPORT Handle(TDataStd_TreeNode) First() const; //! Returns true if this tree node attribute has a last child tree node. Standard_Boolean HasLast() const; //! Returns the last child tree node in this tree node object. Standard_EXPORT Handle(TDataStd_TreeNode) Last(); //! Returns the last child tree node in this tree node object. //! to set fields //! ============= Standard_EXPORT Handle(TDataStd_TreeNode) FindLast(); Standard_EXPORT void SetTreeID (const Standard_GUID& explicitID); Standard_EXPORT void SetFather (const Handle(TDataStd_TreeNode)& F); Standard_EXPORT void SetNext (const Handle(TDataStd_TreeNode)& F); Standard_EXPORT void SetPrevious (const Handle(TDataStd_TreeNode)& F); Standard_EXPORT void SetFirst (const Handle(TDataStd_TreeNode)& F); //! TreeNode callback: //! ================== Standard_EXPORT void SetLast (const Handle(TDataStd_TreeNode)& F); //! Connect the TreeNode to its father child list Standard_EXPORT virtual void AfterAddition() Standard_OVERRIDE; //! Disconnect the TreeNode from its Father child list Standard_EXPORT virtual void BeforeForget() Standard_OVERRIDE; //! Reconnect the TreeNode to its father child list. Standard_EXPORT virtual void AfterResume() Standard_OVERRIDE; //! Disconnect the TreeNode, if necessary. Standard_EXPORT virtual Standard_Boolean BeforeUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE; //! Reconnect the TreeNode, if necessary. //! Implementation of Attribute methods: //! =================================== Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE; //! Returns the tree ID (default or explicit one depending //! onthe Set method used). Standard_EXPORT const Standard_GUID& ID() const; Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& with); Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const; Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE; Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const Standard_OVERRIDE; Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE; friend class TDataStd_ChildNodeIterator; DEFINE_STANDARD_RTTI(TDataStd_TreeNode,TDF_Attribute) protected: private: TDataStd_PtrTreeNode myFather; TDataStd_PtrTreeNode myPrevious; TDataStd_PtrTreeNode myNext; TDataStd_PtrTreeNode myFirst; TDataStd_PtrTreeNode myLast; Standard_GUID myTreeID; }; #include <TDataStd_TreeNode.lxx> #endif // _TDataStd_TreeNode_HeaderFile
[ "salvatore.auriemma@opencascade.com" ]
salvatore.auriemma@opencascade.com
5643a447e254d4fecdd84417c2204a63d79677c1
33cb74df7b3fa922a18453a01cf1040e9b0f40bb
/include/stxmodel/GstmtInvokeSub.h
0d6ff19441867a425a8d43d3251393451cafda38
[]
no_license
OPRoS/TaskEngine
8f9f7a65ac38127a796f0f258aa7f95644937d5f
cfc703a23f31865220a9f66e82188fc05d14d9a9
refs/heads/master
2021-01-21T23:33:51.611221
2013-08-27T05:39:16
2013-08-27T05:39:16
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,163
h
/************************************************************************************************* ** Project: OPRoS ** Package: OPRoS Task Executor ** Date: 2010.10.30 ** Author: Rockwon Kim (rwkim@etri.re.kr) ** Copyright: Copyright (C) 2010 ETRI ** License: OPRoS Source Codes License (www.opros.or.kr) *************************************************************************************************/ #pragma once #include <iostream> #include "stxmodel/Gstmt.h" #include "stxmodel/Gtoken.h" #include "stxmodel/GstmtCall.h" class GstmtInvokeSub : public Gstmt { private: Gcall* m_behavior; //goto behavior, connector Gtoken* m_nextTarget; //next target Gtoken* m_boolVar; int m_period; //run, withÀÇ ¼Ó¼º public: GstmtInvokeSub(std::string file, int eol, std::string blockname, std::string blockpath); virtual ~GstmtInvokeSub(void); char* toString(){return NULL;}; void print(unsigned int); void setInvokeCall(Gcall*); void setNextTarget(Gtoken*); void setBoolVar(Gtoken*); Gcall* getInvokeCall(); Gtoken* getNextTarget(); Gtoken* getBoolVar(); void setPeriod(int period); int getPeriod(); };
[ "yudonguk@naver.com" ]
yudonguk@naver.com
e5e440387ee130a7e555c23d79630738ea39db0b
e99c20155e9b08c7e7598a3f85ccaedbd127f632
/ sjtu-project-pipe/thirdparties/VTK.Net/src/Imaging/vtkImageMathematics.h
993201e88baa9b5961bdc4fe154e46220835c162
[ "BSD-3-Clause" ]
permissive
unidevop/sjtu-project-pipe
38f00462d501d9b1134ce736bdfbfe4f9d075e4a
5a09f098db834d5276a2921d861ef549961decbe
refs/heads/master
2020-05-16T21:32:47.772410
2012-03-19T01:24:14
2012-03-19T01:24:14
38,281,086
1
1
null
null
null
null
UTF-8
C++
false
false
5,030
h
/*========================================================================= Program: Visualization Toolkit Module: $RCSfile: vtkImageMathematics.h,v $ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkImageMathematics - Add, subtract, multiply, divide, invert, sin, cos, exp, log. // .SECTION Description // vtkImageMathematics implements basic mathematic operations SetOperation is // used to select the filters behavior. The filter can take two or one // input. #ifndef __vtkImageMathematics_h #define __vtkImageMathematics_h // Operation options. #define VTK_ADD 0 #define VTK_SUBTRACT 1 #define VTK_MULTIPLY 2 #define VTK_DIVIDE 3 #define VTK_INVERT 4 #define VTK_SIN 5 #define VTK_COS 6 #define VTK_EXP 7 #define VTK_LOG 8 #define VTK_ABS 9 #define VTK_SQR 10 #define VTK_SQRT 11 #define VTK_MIN 12 #define VTK_MAX 13 #define VTK_ATAN 14 #define VTK_ATAN2 15 #define VTK_MULTIPLYBYK 16 #define VTK_ADDC 17 #define VTK_CONJUGATE 18 #define VTK_COMPLEX_MULTIPLY 19 #define VTK_REPLACECBYK 20 #include "vtkThreadedImageAlgorithm.h" class VTK_IMAGING_EXPORT vtkImageMathematics : public vtkThreadedImageAlgorithm { public: static vtkImageMathematics *New(); vtkTypeRevisionMacro(vtkImageMathematics,vtkThreadedImageAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Set/Get the Operation to perform. vtkSetMacro(Operation,int); vtkGetMacro(Operation,int); void SetOperationToAdd() {this->SetOperation(VTK_ADD);}; void SetOperationToSubtract() {this->SetOperation(VTK_SUBTRACT);}; void SetOperationToMultiply() {this->SetOperation(VTK_MULTIPLY);}; void SetOperationToDivide() {this->SetOperation(VTK_DIVIDE);}; void SetOperationToConjugate() {this->SetOperation(VTK_CONJUGATE);}; void SetOperationToComplexMultiply() {this->SetOperation(VTK_COMPLEX_MULTIPLY);}; void SetOperationToInvert() {this->SetOperation(VTK_INVERT);}; void SetOperationToSin() {this->SetOperation(VTK_SIN);}; void SetOperationToCos() {this->SetOperation(VTK_COS);}; void SetOperationToExp() {this->SetOperation(VTK_EXP);}; void SetOperationToLog() {this->SetOperation(VTK_LOG);}; void SetOperationToAbsoluteValue() {this->SetOperation(VTK_ABS);}; void SetOperationToSquare() {this->SetOperation(VTK_SQR);}; void SetOperationToSquareRoot() {this->SetOperation(VTK_SQRT);}; void SetOperationToMin() {this->SetOperation(VTK_MIN);}; void SetOperationToMax() {this->SetOperation(VTK_MAX);}; void SetOperationToATAN() {this->SetOperation(VTK_ATAN);}; void SetOperationToATAN2() {this->SetOperation(VTK_ATAN2);}; void SetOperationToMultiplyByK() {this->SetOperation(VTK_MULTIPLYBYK);}; void SetOperationToAddConstant() {this->SetOperation(VTK_ADDC);}; void SetOperationToReplaceCByK() {this->SetOperation(VTK_REPLACECBYK);}; vtkSetMacro(ConstantK,double); vtkGetMacro(ConstantK,double); vtkSetMacro(ConstantC,double); vtkGetMacro(ConstantC,double); // How to handle divide by zero vtkSetMacro(DivideByZeroToC,int); vtkGetMacro(DivideByZeroToC,int); vtkBooleanMacro(DivideByZeroToC,int); // Description: // Set the two inputs to this filter virtual void SetInput1(vtkDataObject *in) { this->SetInput(0,in); } virtual void SetInput2(vtkDataObject *in) { this->SetInput(1,in); } protected: vtkImageMathematics(); ~vtkImageMathematics() {}; int Operation; double ConstantK; double ConstantC; int DivideByZeroToC; virtual int RequestInformation (vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId); virtual int FillInputPortInformation(int port, vtkInformation* info); private: vtkImageMathematics(const vtkImageMathematics&); // Not implemented. void operator=(const vtkImageMathematics&); // Not implemented. }; #endif
[ "useminmin@gmail.com" ]
useminmin@gmail.com
8b446392a59acb8c613c41e9954a93199fd9de60
534e163a6b106e4466c6661199bb7bfcdc7ccd3d
/序列/75.*(双指针)颜色分类.cpp
0b9bbbdb71e51cc059c58866d15dab148177388c
[]
no_license
skJack/Leetcode
9f39818aa1cfb058e76d0c5ca84c2ad57b5a4626
8d1b37b0e9df97e48d18879aaf310aecbe5616fe
refs/heads/master
2020-11-30T15:33:24.400176
2020-09-02T13:35:00
2020-09-02T13:35:00
230,431,404
2
0
null
null
null
null
UTF-8
C++
false
false
2,618
cpp
/* Category Difficulty Likes Dislikes algorithms Medium (54.29%) 435 - Tags Companies 给定一个包含红色、白色和蓝色,一共 n 个元素的数组,原地对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 此题中,我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 注意: 不能使用代码库中的排序函数来解决这道题。 示例: 输入: [2,0,2,1,1,0] 输出: [0,0,1,1,2,2] 进阶: 一个直观的解决方案是使用计数排序的两趟扫描算法。 首先,迭代计算出0、1 和 2 元素的个数,然后按照0、1、2的排序,重写当前数组。 你能想出一个仅使用常数空间的一趟扫描算法吗? */ // @lc code=start class Solution { public: void swap(vector<int>& nums,int i,int j) { int t = nums[i]; nums[i] = nums[j]; nums[j] = t; } //思路:双指针法 //左右两个指针分别指向0和2的边界 //最后一个遍历指针curr.保证curr左边全部是有序排序,curr右边全部都是未排序的 //所以我们当curr指针遇到2时,和right交换,同时right--,此时不能保证交换过来的值一定是正确值,所以curr不动 //当curr指针遇到0时,和left交换,同时left++,此时交换过来的要么是1,可以直接++,要么是0,直接有序,也可以直接++,所以 //curr遇到0的时候curr不用动。 void sortColors(vector<int>& nums) { int len = nums.size(); if(len==1) return; int i=0; int left = 0,right = len-1; while(i<=right) { if(nums[i]==0) { swap(nums,i,left); left++; i++; } else if(nums[i]==2) { swap(nums,i,right); right--; } else i++; } } void sortColors1(vector<int>& nums) { //方法二:笨办法,统计0,1,2的个数,直接改写 int len = nums.size(); int count0=0,count1=0; for(int i=0;i<len;i++) { if(nums[i]==0) count0++; if(nums[i]==1) count1++; } int count2 = len-count0-count1; for(int i=0;i<len;i++) { if(i<count0) nums[i] = 0; if(i>=count0||i<count1) nums[i] = 1; else nums[i] = 2; } } };
[ "noreply@github.com" ]
skJack.noreply@github.com
45cfd7784c06345055942f91af91aa16cea6e46b
f40b6f8755c776d617fd1abe2aa8d8f9f748fde6
/src/GameBoard/Card.cpp
69330efe944b00df108314f1b121f3401c116052
[]
no_license
Harian-Elyoth/Smoke
4c8668a011c0b34e2f0c0951dd27f3b90994581b
4a67ef39eace21b92a25287d32e636fbd68bcb7e
refs/heads/master
2020-09-11T15:51:45.982786
2019-12-13T13:13:49
2019-12-13T13:13:49
222,116,545
0
0
null
2019-11-20T15:54:17
2019-11-16T15:10:04
C++
UTF-8
C++
false
false
961
cpp
#include "Card.h" Card::Card () { initAttributes(); } Card::Card (int c, std::string n, int id, std::string tr, std::string ty): cost(c), name(n), owner(id), tribe(tr), type(ty){} Card::~Card () { } std::ostream& operator<<(std::ostream& os, const Card& c){ os << c.cost << " | " << c.name << std::endl; return os; } bool Card::operator!=(const Card& c){ if(cost != c.cost) return true; if(name != c.name) return true; if(owner != c.owner) return true; if(tribe != c.tribe) return true; if(type != c.type) return true; return false; } bool Card::operator==(const Card& c){ if(cost != c.cost) return false; if(name != c.name) return false; if(owner != c.owner) return false; if(tribe != c.tribe) return false; if(type != c.type) return false; return true; } void Card::initAttributes () { cost = 0; name = "ERROR"; owner = -1; tribe = "ERROR"; type = "ERROR"; return; }
[ "axel@arctique.fr" ]
axel@arctique.fr
81c75580fd54a9c32e73c5a36f51a38f3e0860a5
25b218c6fa6f3b0d232140b429106ae8d27e1cfd
/hw_impl_2/ad_grid_update.hpp
b9961e48cca657ab7ed3d2ee48ff7cdf11bed0c0
[]
no_license
djmmoss/SAD
108bf9816bbe83cf083fe6ad297a24ce5cd086e8
3c0b974e5bff788091389d40ac07934be23a8188
refs/heads/master
2021-05-16T04:20:27.478159
2016-01-15T02:53:38
2016-01-15T02:53:38
25,385,078
0
0
null
null
null
null
UTF-8
C++
false
false
139
hpp
#ifndef AD_GRID_UPDATE_H_ #define AD_GRID_UPDATE_H_ void ad_grid_update(stream<axiIndex> &inData, stream<axiRawValues> &outData); #endif
[ "djm.moss@gmail.com" ]
djm.moss@gmail.com
726757763bf4ef065e82a8d8b9536cebd788e2f7
84b2888af824cdfaf14d1f03ce592d924889d90f
/myFramework/material.cpp
880c36366d43202eaa150ed0498635f8bbe9d0b8
[]
no_license
GermanScientist/Framework
26d8a5a3b2f2647765ab9c67f46bf5587faa7743
48f925bc4f4058b93bfac989e80921b5ab367c5c
refs/heads/master
2023-08-16T23:42:58.946416
2023-08-09T14:56:41
2023-08-09T14:56:41
313,586,894
0
1
null
2021-03-16T19:31:07
2020-11-17T10:41:12
C++
UTF-8
C++
false
false
338
cpp
#include <myFramework/material.h> //Constructor Material::Material() { texture = -1; //Load shaders shader = new Shader(); // Load the texture using the texture loader textureloader = new Textureloader(); } //Destructor Material::~Material() { //Deletes texture loader delete textureloader; //Deletes shader delete shader; }
[ "jack_hulspas@hotmail.com" ]
jack_hulspas@hotmail.com
57c5e0bb12cb93b29c0179bf2ab7b940d346a03c
7f461f4a8be5e42a20b150ac170b040e6a068e1f
/library/sequence/lcslen-string.cpp
74cc8a7302f4f5998aa1dbb0c54e0bef73fc089e
[]
no_license
idaten459/competitive-programming
abf46a811bef848173899fac2d66cd253f523832
c46813bc8f77d600cd585f5fefb5a48cc60ce95f
refs/heads/master
2023-05-04T11:34:03.732318
2021-05-29T10:28:49
2021-05-29T10:28:49
185,630,869
0
0
null
null
null
null
UTF-8
C++
false
false
623
cpp
/* LCS(最長共通部分列)のlcs長 vectorを引数にとる stringではlcs-stringを参照 計算量はO(st) */ template<typename T> int lcslen(string& s,string& t){ ll ls = s.size(); ll lt = t.size(); vector<vector<int>> lcs(ls+1,vector<int>(lt+1,0)); REP(i,ls+1){ REP(j,lt+1){ if(i==0||j==0){ lcs[i][j]=0; }else{ if(s[i-1]==t[j-1]){ lcs[i][j]=lcs[i-1][j-1]+1; }else{ lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]); } } } } return lcs[ls][lt]; }
[ "shukai2013@gmail.com" ]
shukai2013@gmail.com
42ff1a6a87e991900bb6cda519acee229450dc84
fe47c9f5c6e79fdf8994a9262520d33e29e0f9b2
/buttons/buttons.ino
c277a5eddfff943a0356e16e941d4da22b87fd6f
[]
no_license
pedrorv/arduino-courses
7ae65b76bcdd3cf0e90004e3682870743a44b91f
81374e3cb9721a57113d71d3eff6cc064d257dec
refs/heads/master
2020-05-21T02:37:22.990353
2017-07-13T20:26:20
2017-07-13T20:26:20
84,561,609
0
0
null
null
null
null
UTF-8
C++
false
false
277
ino
const int ledPin = 13; const int inputPin = 2; void setup() { // put your setup code here, to run once: pinMode(ledPin, OUTPUT); pinMode(inputPin, INPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(ledPin, digitalRead(inputPin)); }
[ "pedroreisv@gmail.com" ]
pedroreisv@gmail.com
05ac3c583023dbb0d765c501b12a9a1021d1cdfb
4b648bd3a6f59e3cd0bda329bb1eb5c97380015a
/1474.cpp
b32c980c64395fce8d15606476861d5c9cbdbf07
[]
no_license
CLDP/UVa
1ff3cd61319ce80e7e70cb13436d30ee9af67411
27965c523be1524344e3fa8ac969c0d2b2377117
refs/heads/master
2021-01-23T03:44:12.513831
2017-09-01T17:49:48
2017-09-01T17:49:48
86,119,523
0
0
null
null
null
null
UTF-8
C++
false
false
1,670
cpp
#include <iostream> #include <vector> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 4010; const long long INF = 1LL * 1000000000 * 1000000000; pair<int, int> X[MAXN], Y[MAXN]; long long f[MAXN][MAXN]; int g[MAXN]; int main() { ios_base::sync_with_stdio(false); int N, M; while (cin >> N) { for (int i = 1; i <= N; ++i) { cin >> X[i].first; X[i].second = i; } cin >> M; for (int i = 1; i <= M; ++i) { cin >> Y[i].first; Y[i].second = i; } sort(X + 1, X + N + 1); sort(Y + 1, Y + M + 1); for (int i = 0; i <= N + 1; ++i) { for (int j = 0; j <= M + 1; ++j) f[i][j] = INF; } f[0][0] = 0; for (int i = 1; i <= N; ++i) { for (int j = 1; j <= min(i, M); ++j) { f[i][j] = min(f[i - 1][j], f[i - 1][j - 1]) + abs(X[i].first - Y[j].first); } } cout << f[N][M] << endl; int A = N, B = M; while (A > 0) { if (f[A][B] == f[A - 1][B] + abs(X[A].first - Y[B].first)) { g[A--] = B; continue; } if (f[A][B] == f[A - 1][B - 1] + abs(X[A].first - Y[B].first)) { g[A--] = B--; continue; } } vector<pair<int, int> > ans; for (int i = 1; i <= N; ++i) { ans.push_back(make_pair(X[i].second, Y[g[i]].second)); } sort(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); ++i) cout << ans[i].second << " "; cout << endl; } return 0; }
[ "noreply@github.com" ]
CLDP.noreply@github.com
d522adb8e3921863ee872208cc1177dbded78987
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
/ACE/ACE_wrappers/TAO/TAO_IDL/be_include/be_visitor_interface_fwd/interface_fwd_ch.h
f40ecff308d8ba96415093612384b44e20ba6cfd
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-sun-iiop" ]
permissive
msrLi/portingSources
fe7528b3fd08eed4a1b41383c88ee5c09c2294ef
57d561730ab27804a3172b33807f2bffbc9e52ae
refs/heads/master
2021-07-08T01:22:29.604203
2019-07-10T13:07:06
2019-07-10T13:07:06
196,183,165
2
1
Apache-2.0
2020-10-13T14:30:53
2019-07-10T10:16:46
null
UTF-8
C++
false
false
951
h
/* -*- c++ -*- */ //============================================================================= /** * @file interface_fwd_ch.h * * Concrete visitor for the Interface Forward node. * This one provides code generation for interface forward node. * * @author Aniruddha Gokhale */ //============================================================================= #ifndef _BE_INTERFACE_INTERFACE_FWD_CH_H_ #define _BE_INTERFACE_INTERFACE_FWD_CH_H_ /** * @class be_visitor_interface_fwd_ch * * @brief be_visitor_interface_fwd_ch * * This is the visitor for interface_fwd for the header file */ class be_visitor_interface_fwd_ch : public be_visitor_decl { public: /// constructor be_visitor_interface_fwd_ch (be_visitor_context *ctx); /// destructor ~be_visitor_interface_fwd_ch (void); /// visit interface_fwd. virtual int visit_interface_fwd (be_interface_fwd *node); }; #endif /* _BE_INTERFACE_INTERFACE_FWD_CH_H_ */
[ "lihuibin705@163.com" ]
lihuibin705@163.com
5bc23f7119e94f001780f044911d776db2633250
a5a99f646e371b45974a6fb6ccc06b0a674818f2
/RecoMTD/DetLayers/src/MTDDiskSectorBuilderFromDet.cc
da8bc0caadb5fbf31fc1d8f3922017c7ae73107f
[ "Apache-2.0" ]
permissive
cms-sw/cmssw
4ecd2c1105d59c66d385551230542c6615b9ab58
19c178740257eb48367778593da55dcad08b7a4f
refs/heads/master
2023-08-23T21:57:42.491143
2023-08-22T20:22:40
2023-08-22T20:22:40
10,969,551
1,006
3,696
Apache-2.0
2023-09-14T19:14:28
2013-06-26T14:09:07
C++
UTF-8
C++
false
false
3,824
cc
//#define EDM_ML_DEBUG #include "MTDDiskSectorBuilderFromDet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/GeometryVector/interface/VectorUtil.h" #include "DataFormats/GeometrySurface/interface/BoundingBox.h" #include <iomanip> using namespace std; namespace { pair<DiskSectorBounds*, GlobalVector> computeBounds(const vector<const GeomDet*>& dets) { // go over all corners and compute maximum deviations float rmin(dets.front()->surface().position().perp()); float rmax(rmin); float zmin(dets.front()->surface().position().z()); float zmax(zmin); float phimin(dets.front()->surface().position().phi()); float phimax(phimin); for (auto const& idet : dets) { vector<GlobalPoint> corners = BoundingBox().corners(idet->specificSurface()); for (auto const& i : corners) { float r = i.perp(); float z = i.z(); float phi = i.phi(); rmin = min(rmin, r); rmax = max(rmax, r); zmin = min(zmin, z); zmax = max(zmax, z); if (Geom::phiLess(phi, phimin)) phimin = phi; if (Geom::phiLess(phimax, phi)) phimax = phi; } } if (!Geom::phiLess(phimin, phimax)) edm::LogError("MTDDetLayers") << " MTDDiskSectorBuilderFromDet : " << "Something went wrong with Phi Sorting !"; float zPos = (zmax + zmin) / 2.; float phiWin = phimax - phimin; float phiPos = (phimax + phimin) / 2.; float rmed = (rmin + rmax) / 2.; if (phiWin < 0.) { if ((phimin < Geom::pi() / 2.) || (phimax > -Geom::pi() / 2.)) { edm::LogError("MTDDetLayers") << " something strange going on, please check " << phimin << " " << phimax << " " << phiWin; } phiWin += 2. * Geom::pi(); phiPos += Geom::pi(); } GlobalVector pos(rmed * cos(phiPos), rmed * sin(phiPos), zPos); LogTrace("MTDDetLayers") << "MTDDiskSectorBuilderFromDet::computeBounds sector at: " << std::fixed << pos << "\n" << "zmin : " << std::setw(14) << zmin << "\n" << "zmax : " << std::setw(14) << zmax << "\n" << "rmin : " << std::setw(14) << rmin << "\n" << "rmax : " << std::setw(14) << rmax << "\n" << "phi ref : " << std::setw(14) << phiPos << "\n" << "phi win : " << std::setw(14) << phiWin; return make_pair(new DiskSectorBounds(rmin, rmax, zmin - zPos, zmax - zPos, phiWin), pos); } Surface::RotationType computeRotation(const vector<const GeomDet*>& dets, const Surface::PositionType pos) { GlobalVector yAxis = (GlobalVector(pos.x(), pos.y(), 0.)).unit(); GlobalVector zAxis(0., 0., 1.); GlobalVector xAxis = yAxis.cross(zAxis); return Surface::RotationType(xAxis, yAxis); } } // namespace BoundDiskSector* MTDDiskSectorBuilderFromDet::operator()(const vector<const GeomDet*>& dets) const { // check that the dets are all at about the same z float zcheck = dets.front()->surface().position().z(); constexpr double tol(0.5); // minimal safety check on z position of modules within a sector, width ~ 10 mm for (auto const& idet : dets) { float zdiff = zcheck - (*idet).surface().position().z(); if (std::abs(zdiff) > tol) { edm::LogError("MTDDetLayers") << " MTDDiskSectorBuilderFromDet: Trying to build sector from Dets at different z positions !! Delta_z = " << zdiff; } } auto bo = computeBounds(dets); Surface::PositionType pos(bo.second.x(), bo.second.y(), bo.second.z()); Surface::RotationType rot = computeRotation(dets, pos); return new BoundDiskSector(pos, rot, bo.first); }
[ "fabio.cossutti@ts.infn.it" ]
fabio.cossutti@ts.infn.it
363764ed50a60230a0cacc2743500f112a9e29bf
0a3940d6f8c083900db072876f3afd769bbfdb71
/2019 July 28/soldiers.cpp
cb5cc76fe924850866eafcc62181000837b34eb6
[]
no_license
HelioStrike/Arjuna-Code
174a104d4c8687535ae06ca28d71188eeb95784e
1679ba15990116e6abba80979f228b0860ce8dc4
refs/heads/master
2020-04-21T23:38:11.147929
2019-09-08T05:05:36
2019-09-08T05:05:36
169,952,501
0
0
null
null
null
null
UTF-8
C++
false
false
1,269
cpp
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i = (a); i < (b); i++) using namespace std; string s,t,p,q; int x,dp[10010]; int stoin(string k) { int ret=0; FOR(i,0,k.length()) ret*=10,ret+=k[i]-'0'; return ret; } string to_str(int k) { string ret=""; while(k) ret=(char)('0'+(k%10))+ret,k/=10; return ret; } int main() { t="10001"; memset(dp,16,sizeof(dp)); dp[0]=dp[10000]=0; while(cin>>s) dp[stoin(t)]=-1,t=s; if(dp[0]==-1) { cout<<-1<<'\n'; return 0; } FOR(i,0,10000) { if(dp[i]==-1) continue; p=to_str(i); while(p.length()<4) p="0"+p; FOR(j,0,4) { q=p; q[j]+=1; if(q[j]>'9') q[j]='0'; x=stoin(q); if(dp[x]==-1) continue; dp[x]=min(dp[x],dp[i]+1); } } for(int i=10000;i>0;i--) { if(dp[i]==-1) continue; p=to_str(i); while(p.length()<4) p="0"+p; if(p.length()>4) p=p.substr(1,4); FOR(j,0,4) { q=p; q[j]-=1; if(q[j]<'0') q[j]='9'; x=stoin(q); if(dp[x]==-1) continue; dp[x]=min(dp[x],dp[i]+1); } } cout<<(dp[stoin(t)]==269488144?-1:dp[stoin(t)])<<'\n'; return 0; }
[ "rageofepicfury@gmail.com" ]
rageofepicfury@gmail.com
aeed529d373d38b1067ac18d73ec77e35a7f575b
326ba98eabaa3a05ceb5e314dd1cc8de301fa19a
/ffscript/StaticContext.h
860d9f91fed9ee0021adf635df4cade970142aad
[ "MIT" ]
permissive
heruix/ffscript
4823e9afd3ce8eba104ec65d6e0ff2fbba74d8d5
1ee86fdaae8e188e4c99ab4cb0c878be919d7d47
refs/heads/master
2020-08-01T12:23:26.006286
2019-09-24T10:15:27
2019-09-24T10:15:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,164
h
/****************************************************************** * File: StaticContext.h * Description: declare StaticContext class. A type of context, but * the memory of its is global shared memory and can be * accessed any where, any time in the program. * Author: Vincent Pham * * Copyright (c) 2018 VincentPT. ** Distributed under the MIT License (http://opensource.org/licenses/MIT) ** * **********************************************************************/ #pragma once #include "Context.h" #include <list> #include <memory> namespace ffscript { class StaticContext : public Context { protected: std::list<CommandPointer> _globalCommands; std::list<CommandPointer> _destructorCommands; void runCommands(const std::list<CommandPointer>& commands); public: StaticContext(unsigned char* threadData, int bufferSize); StaticContext(int bufferSize); virtual ~StaticContext(); void addCommand(CommandPointer command); void addDestructorCommand(CommandPointer command); virtual void run(); virtual void runDestructorCommands(); }; typedef std::shared_ptr<StaticContext> StaticContextRef; }
[ "minhpta@outlook.com" ]
minhpta@outlook.com
3ec0931a3983e352576a86997932857a7faa6624
b21d7b3a901f751aa9f500dc5b310fc273f869f3
/Nexus/Source/Nexus/Graphics/GLMessage.cpp
b7d0f2ecfff7c25209158c93e8b84bcd634fc550
[]
no_license
jkstpierre/Nexus
0fc8d5af7c622e6ee7e7a526ad917bfbe290245f
9fc38141ebfb2a284fb9168d4acda2115539454d
refs/heads/master
2021-05-18T06:05:35.225543
2020-04-23T21:50:04
2020-04-23T21:50:04
251,149,197
0
0
null
null
null
null
UTF-8
C++
false
false
1,197
cpp
/// File: Source\Nexus\Graphics\GLMessage.cpp. /// /// Summary: Implements the gl message class. #include <cstring> #include <Nexus\Graphics\GLMessage.hpp> namespace Nexus::Graphics { GLMessage::GLMessage(const GLMessageSource& source, const GLMessageType& type, const GLMessageSeverity& severity, const unsigned int& glID, const char* message, const size_t& messageLength) noexcept : mSource(source), mType(type), mSeverity(severity), mMessage(message, messageLength), GLObject(glID) { } bool GLMessage::operator==(const GLMessage& msg) const noexcept { return (mSource == msg.GetSource()) && (mType == msg.GetType()) && (mSeverity == msg.GetSeverity()) && (mGLID == msg.GetGLID()); } bool GLMessage::operator!=(const GLMessage& msg) const noexcept { return !(*this == msg); } const GLMessageSource& GLMessage::GetSource() const noexcept { return mSource; } const GLMessageType& GLMessage::GetType() const noexcept { return mType; } const GLMessageSeverity& GLMessage::GetSeverity() const noexcept { return mSeverity; } const char* GLMessage::ReadMessage() const noexcept { return mMessage.c_str(); } } // End of Source\Nexus\Graphics\GLMessage.cpp
[ "jkstpierre@wpi.edu" ]
jkstpierre@wpi.edu
b2a8bb4f65a4f2704675a663d066c6df02b5c491
8356182f1c38a2602598b5a530f8c86fb37c141b
/200506_WiFi8266_OTA_GarageLEDs/LEDPIR_Unit.h
f6cf06329e860e797f56dafaf0c7cb5a3638aa27
[]
no_license
robertbrianhemingway/200506_WiFi8266_OTA_Blynk_GarageLEDs
77ca161aa7b40ffcfee7a4b482d1828359cad3d1
d658df453184d35315f57665982d6041ae831e97
refs/heads/master
2022-06-28T15:46:54.569966
2020-05-06T01:04:44
2020-05-06T01:04:44
261,618,500
0
0
null
null
null
null
UTF-8
C++
false
false
2,214
h
/** * 200424 rewrite of a class used in * C:\Users\Robert\Documents\PlatformIO\Projects\200424-134832-esp32doit-devkit-v1 * usage * LEDUnit frontLED(22,26); * LEDUnit ;backLED(23,27); * */ #include <arduino.h> #define setTimeOn 10000 // 10000 milliseconds class LEDUnit { // ==================== class LEDUnit // Class Member Variables private: byte ledPin; byte pirPin; byte isTriggered; // true when PIR triggered unsigned long lastTrigger; // millis() at time of trigger unsigned long time2StayOn; // = 10000; //------------------------------------ // Constructor public: LEDUnit(byte _ledPin, byte _pirPin) { ledPin = _ledPin; pirPin = _pirPin; isTriggered = false; time2StayOn = setTimeOn; // ***** read LDR if available pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); pinMode(pirPin, INPUT_PULLUP); } void setOn() { /* called by ISR */ if (!isTriggered) { isTriggered = true; lastTrigger = millis(); digitalWrite(ledPin,HIGH); } } byte getPin() {return pirPin;} byte getPirPinState() { return (digitalRead(pirPin)); } byte isPirTimeUp() { /* polled in loop to turn led off returns state of isTriggered */ if (isTriggered) { if ((millis()-lastTrigger)>time2StayOn) { // yes, time is up digitalWrite(ledPin,LOW); isTriggered = false; } } return isTriggered; // use to keep 1 buzzer // synched between 2 pir's } /* void setTime2StayOn(unsigned long _ms) { /* * usually read from an analog input * connected to a pot. */ /* time2StayOn = _ms; } */ }; // ------------------------------------ end Class LEDUnit
[ "noreply@github.com" ]
robertbrianhemingway.noreply@github.com
6ecf889d4170b7c45b6d50f00fca255ba4d72612
9028516ff0b2d95b8000b9fc4c44c29aa73c926c
/src/wallet/walletdb.cpp
a2ec603929ba00bd0ff8a54f747d13360e0a915a
[ "MIT" ]
permissive
lycion/TripOne
a9e546eac9ad6179c0b6bd4f868162f70930b6ac
c6ae7d9163ef4095fe0e143d26f3311182551147
refs/heads/master
2020-03-28T22:29:06.119551
2018-09-18T06:07:06
2018-09-18T06:07:06
149,236,186
0
0
null
null
null
null
UTF-8
C++
false
false
36,000
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2015-2018 The Bitcoin Unlimited developers // Copyright (c) 2017 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "wallet/walletdb.h" #include "base58.h" #include "consensus/tx_verify.h" #include "consensus/validation.h" #include "dstencode.h" #include "fs.h" #include "main.h" // For CheckTransaction #include "protocol.h" #include "serialize.h" #include "sync.h" #include "util.h" #include "utiltime.h" #include "wallet/wallet.h" #include <boost/scoped_ptr.hpp> #include <boost/thread.hpp> #include <boost/version.hpp> #include <fstream> using namespace std; static uint64_t nAccountingEntryNumber = 0; // // CWalletDB // bool CWalletDB::WriteName(const CTxDestination &address, const std::string &strName) { if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Write(std::make_pair(std::string("name"), EncodeLegacyAddr(address, Params())), strName); } bool CWalletDB::EraseName(const CTxDestination &address) { // This should only be used for sending addresses, never for receiving // addresses, receiving addresses must always have an address book entry if // they're not change return. if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Erase(std::make_pair(std::string("name"), EncodeLegacyAddr(address, Params()))); } bool CWalletDB::WritePurpose(const CTxDestination &address, const std::string &strPurpose) { if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Write(std::make_pair(std::string("purpose"), EncodeLegacyAddr(address, Params())), strPurpose); } bool CWalletDB::ErasePurpose(const CTxDestination &address) { if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Erase(std::make_pair(std::string("purpose"), EncodeLegacyAddr(address, Params()))); } bool CWalletDB::WriteTx(uint256 hash, const CWalletTx &wtx) { nWalletDBUpdated++; return Write(std::make_pair(std::string("tx"), hash), wtx); } bool CWalletDB::EraseTx(uint256 hash) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("tx"), hash)); } bool CWalletDB::WriteKey(const CPubKey &vchPubKey, const CPrivKey &vchPrivKey, const CKeyMetadata &keyMeta) { nWalletDBUpdated++; if (!Write(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta, false)) return false; // hash pubkey/privkey to accelerate wallet load std::vector<unsigned char> vchKey; vchKey.reserve(vchPubKey.size() + vchPrivKey.size()); vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); vchKey.insert(vchKey.end(), vchPrivKey.begin(), vchPrivKey.end()); return Write(std::make_pair(std::string("key"), vchPubKey), std::make_pair(vchPrivKey, Hash(vchKey.begin(), vchKey.end())), false); } bool CWalletDB::WriteCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret, const CKeyMetadata &keyMeta) { const bool fEraseUnencryptedKey = true; nWalletDBUpdated++; if (!Write(std::make_pair(std::string("keymeta"), vchPubKey), keyMeta)) return false; if (!Write(std::make_pair(std::string("ckey"), vchPubKey), vchCryptedSecret, false)) return false; if (fEraseUnencryptedKey) { Erase(std::make_pair(std::string("key"), vchPubKey)); Erase(std::make_pair(std::string("wkey"), vchPubKey)); } return true; } bool CWalletDB::WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey) { nWalletDBUpdated++; return Write(std::make_pair(std::string("mkey"), nID), kMasterKey, true); } bool CWalletDB::WriteCScript(const uint160 &hash, const CScript &redeemScript) { nWalletDBUpdated++; return Write(std::make_pair(std::string("cscript"), hash), *(const CScriptBase *)(&redeemScript), false); } bool CWalletDB::WriteWatchOnly(const CScript &dest) { nWalletDBUpdated++; return Write(std::make_pair(std::string("watchs"), *(const CScriptBase *)(&dest)), '1'); } bool CWalletDB::EraseWatchOnly(const CScript &dest) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("watchs"), *(const CScriptBase *)(&dest))); } bool CWalletDB::WriteBestBlock(const CBlockLocator &locator) { nWalletDBUpdated++; // Write empty block locator so versions that require a merkle branch automatically rescan Write(std::string("bestblock"), CBlockLocator()); return Write(std::string("bestblock_nomerkle"), locator); } bool CWalletDB::ReadBestBlock(CBlockLocator &locator) { if (Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true; return Read(std::string("bestblock_nomerkle"), locator); } bool CWalletDB::WriteOrderPosNext(int64_t nOrderPosNext) { nWalletDBUpdated++; return Write(std::string("orderposnext"), nOrderPosNext); } bool CWalletDB::WriteDefaultKey(const CPubKey &vchPubKey) { nWalletDBUpdated++; return Write(std::string("defaultkey"), vchPubKey); } bool CWalletDB::ReadPool(int64_t nPool, CKeyPool &keypool) { return Read(std::make_pair(std::string("pool"), nPool), keypool); } bool CWalletDB::WritePool(int64_t nPool, const CKeyPool &keypool) { nWalletDBUpdated++; return Write(std::make_pair(std::string("pool"), nPool), keypool); } bool CWalletDB::ErasePool(int64_t nPool) { nWalletDBUpdated++; return Erase(std::make_pair(std::string("pool"), nPool)); } bool CWalletDB::WriteMinVersion(int nVersion) { return Write(std::string("minversion"), nVersion); } bool CWalletDB::ReadAccount(const string &strAccount, CAccount &account) { account.SetNull(); return Read(make_pair(string("acc"), strAccount), account); } bool CWalletDB::WriteAccount(const string &strAccount, const CAccount &account) { return Write(make_pair(string("acc"), strAccount), account); } bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry &acentry) { return Write(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry); } bool CWalletDB::WriteAccountingEntry_Backend(const CAccountingEntry &acentry) { return WriteAccountingEntry(++nAccountingEntryNumber, acentry); } CAmount CWalletDB::GetAccountCreditDebit(const string &strAccount) { list<CAccountingEntry> entries; ListAccountCreditDebit(strAccount, entries); CAmount nCreditDebit = 0; for (const CAccountingEntry &entry : entries) { nCreditDebit += entry.nCreditDebit; } return nCreditDebit; } void CWalletDB::ListAccountCreditDebit(const string &strAccount, list<CAccountingEntry> &entries) { bool fAllAccounts = (strAccount == "*"); Dbc *pcursor = GetCursor(); if (!pcursor) throw runtime_error("CWalletDB::ListAccountCreditDebit(): cannot create DB cursor"); unsigned int fFlags = DB_SET_RANGE; while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); if (fFlags == DB_SET_RANGE) ssKey << std::make_pair( std::string("acentry"), std::make_pair((fAllAccounts ? string("") : strAccount), uint64_t(0))); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags); fFlags = DB_NEXT; if (ret == DB_NOTFOUND) break; else if (ret != 0) { pcursor->close(); throw runtime_error("CWalletDB::ListAccountCreditDebit(): error scanning DB"); } // Unserialize string strType; ssKey >> strType; if (strType != "acentry") break; CAccountingEntry acentry; ssKey >> acentry.strAccount; if (!fAllAccounts && acentry.strAccount != strAccount) break; ssValue >> acentry; ssKey >> acentry.nEntryNo; entries.push_back(acentry); } pcursor->close(); } DBErrors CWalletDB::ReorderTransactions(CWallet *pwallet) { LOCK(pwallet->cs_wallet); // Old wallets didn't have any defined order for transactions // Probably a bad idea to change the output of this // First: get all CWalletTx and CAccountingEntry into a sorted-by-time multimap. typedef pair<CWalletTx *, CAccountingEntry *> TxPair; typedef multimap<int64_t, TxPair> TxItems; TxItems txByTime; for (map<uint256, CWalletTx>::iterator it = pwallet->mapWallet.begin(); it != pwallet->mapWallet.end(); ++it) { CWalletTx *wtx = &((*it).second); txByTime.insert(make_pair(wtx->nTimeReceived, TxPair(wtx, (CAccountingEntry *)0))); } list<CAccountingEntry> acentries; ListAccountCreditDebit("", acentries); for (CAccountingEntry &entry : acentries) { txByTime.insert(make_pair(entry.nTime, TxPair((CWalletTx *)0, &entry))); } int64_t &nOrderPosNext = pwallet->nOrderPosNext; nOrderPosNext = 0; std::vector<int64_t> nOrderPosOffsets; for (TxItems::iterator it = txByTime.begin(); it != txByTime.end(); ++it) { CWalletTx *const pwtx = (*it).second.first; CAccountingEntry *const pacentry = (*it).second.second; int64_t &nOrderPos = (pwtx != 0) ? pwtx->nOrderPos : pacentry->nOrderPos; if (nOrderPos == -1) { nOrderPos = nOrderPosNext++; nOrderPosOffsets.push_back(nOrderPos); if (pwtx) { if (!WriteTx(pwtx->GetHash(), *pwtx)) return DB_LOAD_FAIL; } else if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry)) return DB_LOAD_FAIL; } else { int64_t nOrderPosOff = 0; for (const int64_t &nOffsetStart : nOrderPosOffsets) { if (nOrderPos >= nOffsetStart) ++nOrderPosOff; } nOrderPos += nOrderPosOff; nOrderPosNext = std::max(nOrderPosNext, nOrderPos + 1); if (!nOrderPosOff) continue; // Since we're changing the order, write it back if (pwtx) { if (!WriteTx(pwtx->GetHash(), *pwtx)) return DB_LOAD_FAIL; } else if (!WriteAccountingEntry(pacentry->nEntryNo, *pacentry)) return DB_LOAD_FAIL; } } WriteOrderPosNext(nOrderPosNext); return DB_LOAD_OK; } class CWalletScanState { public: unsigned int nKeys; unsigned int nCKeys; unsigned int nKeyMeta; bool fIsEncrypted; bool fAnyUnordered; int nFileVersion; vector<uint256> vWalletUpgrade; CWalletScanState() { nKeys = nCKeys = nKeyMeta = 0; fIsEncrypted = false; fAnyUnordered = false; nFileVersion = 0; } }; bool ReadKeyValue(CWallet *pwallet, CDataStream &ssKey, CDataStream &ssValue, CWalletScanState &wss, string &strType, string &strErr) { try { // Unserialize // Taking advantage of the fact that pair serialization // is just the two items serialized one after the other ssKey >> strType; if (strType == "name") { string strAddress; ssKey >> strAddress; ssValue >> pwallet->mapAddressBook[DecodeDestination(strAddress)].name; } else if (strType == "purpose") { std::string strAddress; ssKey >> strAddress; ssValue >> pwallet->mapAddressBook[DecodeDestination(strAddress)].purpose; } else if (strType == "tx") { uint256 hash; ssKey >> hash; CWalletTx wtx; ssValue >> wtx; CValidationState state; if (!(CheckTransaction(wtx, state) && (wtx.GetHash() == hash) && state.IsValid())) return false; // Undo serialize changes in 31600 if (31404 <= wtx.fTimeReceivedIsTxTime && wtx.fTimeReceivedIsTxTime <= 31703) { if (!ssValue.empty()) { char fTmp; char fUnused; ssValue >> fTmp >> fUnused >> wtx.strFromAccount; strErr = strprintf("LoadWallet() upgrading tx ver=%d %d '%s' %s", wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount, hash.ToString()); wtx.fTimeReceivedIsTxTime = fTmp; } else { strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString()); wtx.fTimeReceivedIsTxTime = 0; } wss.vWalletUpgrade.push_back(hash); } if (wtx.nOrderPos == -1) wss.fAnyUnordered = true; pwallet->AddToWallet(wtx, true, nullptr); } else if (strType == "acentry") { string strAccount; ssKey >> strAccount; uint64_t nNumber; ssKey >> nNumber; if (nNumber > nAccountingEntryNumber) nAccountingEntryNumber = nNumber; if (!wss.fAnyUnordered) { CAccountingEntry acentry; ssValue >> acentry; if (acentry.nOrderPos == -1) wss.fAnyUnordered = true; } } else if (strType == "watchs") { CScript script; ssKey >> *(CScriptBase *)(&script); char fYes; ssValue >> fYes; if (fYes == '1') pwallet->LoadWatchOnly(script); // Watch-only addresses have no birthday information for now, // so set the wallet birthday to the beginning of time. pwallet->nTimeFirstKey = 1; } else if (strType == "key" || strType == "wkey") { CPubKey vchPubKey; ssKey >> vchPubKey; if (!vchPubKey.IsValid()) { strErr = "Error reading wallet database: CPubKey corrupt"; return false; } CKey key; CPrivKey pkey; uint256 hash; if (strType == "key") { wss.nKeys++; ssValue >> pkey; } else { CWalletKey wkey; ssValue >> wkey; pkey = wkey.vchPrivKey; } // Old wallets store keys as "key" [pubkey] => [privkey] // ... which was slow for wallets with lots of keys, because the public key is re-derived from the private // key // using EC operations as a checksum. // Newer wallets store keys as "key"[pubkey] => [privkey][hash(pubkey,privkey)], which is much faster while // remaining backwards-compatible. try { ssValue >> hash; } catch (...) { } bool fSkipCheck = false; if (!hash.IsNull()) { // hash pubkey/privkey to accelerate wallet load std::vector<unsigned char> vchKey; vchKey.reserve(vchPubKey.size() + pkey.size()); vchKey.insert(vchKey.end(), vchPubKey.begin(), vchPubKey.end()); vchKey.insert(vchKey.end(), pkey.begin(), pkey.end()); if (Hash(vchKey.begin(), vchKey.end()) != hash) { strErr = "Error reading wallet database: CPubKey/CPrivKey corrupt"; return false; } fSkipCheck = true; } if (!key.Load(pkey, vchPubKey, fSkipCheck)) { strErr = "Error reading wallet database: CPrivKey corrupt"; return false; } if (!pwallet->LoadKey(key, vchPubKey)) { strErr = "Error reading wallet database: LoadKey failed"; return false; } } else if (strType == "mkey") { unsigned int nID; ssKey >> nID; CMasterKey kMasterKey; ssValue >> kMasterKey; if (pwallet->mapMasterKeys.count(nID) != 0) { strErr = strprintf("Error reading wallet database: duplicate CMasterKey id %u", nID); return false; } pwallet->mapMasterKeys[nID] = kMasterKey; if (pwallet->nMasterKeyMaxID < nID) pwallet->nMasterKeyMaxID = nID; } else if (strType == "ckey") { CPubKey vchPubKey; ssKey >> vchPubKey; if (!vchPubKey.IsValid()) { strErr = "Error reading wallet database: CPubKey corrupt"; return false; } vector<unsigned char> vchPrivKey; ssValue >> vchPrivKey; wss.nCKeys++; if (!pwallet->LoadCryptedKey(vchPubKey, vchPrivKey)) { strErr = "Error reading wallet database: LoadCryptedKey failed"; return false; } wss.fIsEncrypted = true; } else if (strType == "keymeta") { CPubKey vchPubKey; ssKey >> vchPubKey; CKeyMetadata keyMeta; ssValue >> keyMeta; wss.nKeyMeta++; pwallet->LoadKeyMetadata(vchPubKey, keyMeta); // find earliest key creation time, as wallet birthday if (!pwallet->nTimeFirstKey || (keyMeta.nCreateTime < pwallet->nTimeFirstKey)) pwallet->nTimeFirstKey = keyMeta.nCreateTime; } else if (strType == "defaultkey") { ssValue >> pwallet->vchDefaultKey; } else if (strType == "pool") { int64_t nIndex; ssKey >> nIndex; CKeyPool keypool; ssValue >> keypool; pwallet->setKeyPool.insert(nIndex); // If no metadata exists yet, create a default with the pool key's // creation time. Note that this may be overwritten by actually // stored metadata for that key later, which is fine. CKeyID keyid = keypool.vchPubKey.GetID(); if (pwallet->mapKeyMetadata.count(keyid) == 0) pwallet->mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime); } else if (strType == "version") { ssValue >> wss.nFileVersion; if (wss.nFileVersion == 10300) wss.nFileVersion = 300; } else if (strType == "cscript") { uint160 hash; ssKey >> hash; CScript script; ssValue >> *(CScriptBase *)(&script); if (!pwallet->LoadCScript(script)) { strErr = "Error reading wallet database: LoadCScript failed"; return false; } } else if (strType == "orderposnext") { ssValue >> pwallet->nOrderPosNext; } else if (strType == "destdata") { std::string strAddress, strKey, strValue; ssKey >> strAddress; ssKey >> strKey; ssValue >> strValue; if (!pwallet->LoadDestData(DecodeDestination(strAddress), strKey, strValue)) { strErr = "Error reading wallet database: LoadDestData failed"; return false; } } else if (strType == "hdchain") { CHDChain chain; ssValue >> chain; if (!pwallet->SetHDChain(chain, true)) { strErr = "Error reading wallet database: SetHDChain failed"; return false; } } } catch (...) { return false; } return true; } static bool IsKeyType(string strType) { return (strType == "key" || strType == "wkey" || strType == "mkey" || strType == "ckey"); } DBErrors CWalletDB::LoadWallet(CWallet *pwallet) { pwallet->vchDefaultKey = CPubKey(); CWalletScanState wss; bool fNoncriticalErrors = false; DBErrors result = DB_LOAD_OK; LOCK2(cs_main, pwallet->cs_wallet); try { int nMinVersion = 0; if (Read((string) "minversion", nMinVersion)) { if (nMinVersion > CLIENT_VERSION) return DB_TOO_NEW; pwallet->LoadMinVersion(nMinVersion); } // Get cursor Dbc *pcursor = GetCursor(); if (!pcursor) { LOGA("Error getting wallet database cursor\n"); return DB_CORRUPT; } while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue); if (ret == DB_NOTFOUND) break; else if (ret != 0) { LOGA("Error reading next record from wallet database\n"); return DB_CORRUPT; } // Try to be tolerant of single corrupt records: string strType, strErr; if (!ReadKeyValue(pwallet, ssKey, ssValue, wss, strType, strErr)) { // losing keys is considered a catastrophic error, anything else // we assume the user can live with: if (IsKeyType(strType)) result = DB_CORRUPT; else { // Leave other errors alone, if we try to fix them we might make things worse. fNoncriticalErrors = true; // ... but do warn the user there is something wrong. if (strType == "tx") // Rescan if there is a bad transaction record: SoftSetBoolArg("-rescan", true); } } if (!strErr.empty()) LOGA("%s\n", strErr); } pcursor->close(); } catch (const boost::thread_interrupted &) { throw; } catch (...) { result = DB_CORRUPT; } if (fNoncriticalErrors && result == DB_LOAD_OK) result = DB_NONCRITICAL_ERROR; // Any wallet corruption at all: skip any rewriting or // upgrading, we don't want to make it worse. if (result != DB_LOAD_OK) return result; LOGA("nFileVersion = %d\n", wss.nFileVersion); LOGA("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total\n", wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys); // nTimeFirstKey is only reliable if all keys have metadata if ((wss.nKeys + wss.nCKeys) != wss.nKeyMeta) pwallet->nTimeFirstKey = 1; // 0 would be considered 'no value' for (uint256 &hash : wss.vWalletUpgrade) { WriteTx(hash, pwallet->mapWallet[hash]); } // Rewrite encrypted wallets of versions 0.4.0 and 0.5.0rc: if (wss.fIsEncrypted && (wss.nFileVersion == 40000 || wss.nFileVersion == 50000)) return DB_NEED_REWRITE; if (wss.nFileVersion < CLIENT_VERSION) // Update WriteVersion(CLIENT_VERSION); if (wss.fAnyUnordered) result = ReorderTransactions(pwallet); pwallet->laccentries.clear(); ListAccountCreditDebit("*", pwallet->laccentries); for (CAccountingEntry &entry : pwallet->laccentries) { pwallet->wtxOrdered.insert(make_pair(entry.nOrderPos, CWallet::TxPair((CWalletTx *)0, &entry))); } return result; } DBErrors CWalletDB::FindWalletTx(CWallet *pwallet, vector<uint256> &vTxHash, vector<CWalletTx> &vWtx) { pwallet->vchDefaultKey = CPubKey(); bool fNoncriticalErrors = false; DBErrors result = DB_LOAD_OK; LOCK(pwallet->cs_wallet); try { int nMinVersion = 0; if (Read((string) "minversion", nMinVersion)) { if (nMinVersion > CLIENT_VERSION) return DB_TOO_NEW; pwallet->LoadMinVersion(nMinVersion); } // Get cursor Dbc *pcursor = GetCursor(); if (!pcursor) { LOGA("Error getting wallet database cursor\n"); return DB_CORRUPT; } while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue); if (ret == DB_NOTFOUND) break; else if (ret != 0) { LOGA("Error reading next record from wallet database\n"); return DB_CORRUPT; } string strType; ssKey >> strType; if (strType == "tx") { uint256 hash; ssKey >> hash; CWalletTx wtx; ssValue >> wtx; vTxHash.push_back(hash); vWtx.push_back(wtx); } } pcursor->close(); } catch (const boost::thread_interrupted &) { throw; } catch (...) { result = DB_CORRUPT; } if (fNoncriticalErrors && result == DB_LOAD_OK) result = DB_NONCRITICAL_ERROR; return result; } DBErrors CWalletDB::ZapSelectTx(CWallet *pwallet, vector<uint256> &vTxHashIn, vector<uint256> &vTxHashOut) { // build list of wallet TXs and hashes vector<uint256> vTxHash; vector<CWalletTx> vWtx; DBErrors err = FindWalletTx(pwallet, vTxHash, vWtx); if (err != DB_LOAD_OK) { return err; } std::sort(vTxHash.begin(), vTxHash.end()); std::sort(vTxHashIn.begin(), vTxHashIn.end()); // erase each matching wallet TX bool delerror = false; vector<uint256>::iterator it = vTxHashIn.begin(); for (uint256 hash : vTxHash) { while (it < vTxHashIn.end() && (*it) < hash) { it++; } if (it == vTxHashIn.end()) { break; } else if ((*it) == hash) { pwallet->mapWallet.erase(hash); if (!EraseTx(hash)) { LOG(DBASE, "Transaction was found for deletion but returned database error: %s\n", hash.GetHex()); delerror = true; } vTxHashOut.push_back(hash); } } if (delerror) { return DB_CORRUPT; } return DB_LOAD_OK; } DBErrors CWalletDB::ZapWalletTx(CWallet *pwallet, vector<CWalletTx> &vWtx) { // build list of wallet TXs vector<uint256> vTxHash; DBErrors err = FindWalletTx(pwallet, vTxHash, vWtx); if (err != DB_LOAD_OK) return err; // erase each wallet TX for (uint256 &hash : vTxHash) { if (!EraseTx(hash)) return DB_CORRUPT; } return DB_LOAD_OK; } void ThreadFlushWalletDB(const string &strFile) { // Make this thread recognisable as the wallet flushing thread RenameThread("tripone-wallet"); static bool fOneThread; if (fOneThread) return; fOneThread = true; if (!GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET)) return; unsigned int nLastSeen = nWalletDBUpdated; unsigned int nLastFlushed = nWalletDBUpdated; int64_t nLastWalletUpdate = GetTime(); while (true) { MilliSleep(500); if (nLastSeen != nWalletDBUpdated) { nLastSeen = nWalletDBUpdated; nLastWalletUpdate = GetTime(); } if (nLastFlushed != nWalletDBUpdated && GetTime() - nLastWalletUpdate >= 2) { TRY_LOCK(bitdb.cs_db, lockDb); if (lockDb) { // Don't do this if any databases are in use int nRefCount = 0; map<string, int>::iterator mi = bitdb.mapFileUseCount.begin(); while (mi != bitdb.mapFileUseCount.end()) { nRefCount += (*mi).second; mi++; } if (nRefCount == 0) { boost::this_thread::interruption_point(); map<string, int>::iterator mi2 = bitdb.mapFileUseCount.find(strFile); if (mi2 != bitdb.mapFileUseCount.end()) { LOG(DBASE, "Flushing wallet.dat\n"); nLastFlushed = nWalletDBUpdated; int64_t nStart = GetTimeMillis(); // Flush wallet.dat so it's self contained bitdb.CloseDb(strFile); bitdb.CheckpointLSN(strFile); bitdb.mapFileUseCount.erase(mi2++); LOG(DBASE, "Flushed wallet.dat %dms\n", GetTimeMillis() - nStart); } } } } } } bool BackupWallet(const CWallet &wallet, const string &strDest) { if (!wallet.fFileBacked) return false; while (true) { { LOCK(bitdb.cs_db); if (!bitdb.mapFileUseCount.count(wallet.strWalletFile) || bitdb.mapFileUseCount[wallet.strWalletFile] == 0) { // Flush log data to the dat file bitdb.CloseDb(wallet.strWalletFile); bitdb.CheckpointLSN(wallet.strWalletFile); bitdb.mapFileUseCount.erase(wallet.strWalletFile); // Copy wallet.dat boost::filesystem::path pathSrc = GetDataDir() / wallet.strWalletFile; boost::filesystem::path pathDest(strDest); if (boost::filesystem::is_directory(pathDest)) pathDest /= wallet.strWalletFile; // BU copy_file does not work with c++11, due to a link error in many versions of boost. Return this // code to use when the default boost version in most distros fix this bug. // try { //#if BOOST_VERSION >= 104000 // boost::filesystem::copy_file(pathSrc, pathDest, // boost::filesystem::copy_option::overwrite_if_exists); //#else // boost::filesystem::copy_file(pathSrc, pathDest); //#endif // LOGA("copied wallet.dat to %s\n", pathDest.string()); // return true; // } catch (const boost::filesystem::filesystem_error& e) { // LOGA("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what()); // return false; // } // Replacement copy code try { ifstream source(pathSrc.string(), ios::binary); ofstream dest(pathDest.string(), ios::binary); if (!source) { LOGA("error opening source wallet file %s\n", pathSrc.string()); return false; } if (!dest) { LOGA("error opening destination wallet file %s\n", pathDest.string()); return false; } dest << source.rdbuf(); return true; } catch (std::ios_base::failure &e) { LOGA("error copying wallet from %s to %s - %s\n", pathSrc.string(), pathDest.string(), e.what()); return false; } // end replacement copy code } } MilliSleep(100); } return false; } // // Try to (very carefully!) recover wallet.dat if there is a problem. // bool CWalletDB::Recover(CDBEnv &dbenv, const std::string &filename, bool fOnlyKeys) { // Recovery procedure: // move wallet.dat to wallet.timestamp.bak // Call Salvage with fAggressive=true to // get as much data as possible. // Rewrite salvaged data to wallet.dat // Set -rescan so any missing transactions will be // found. int64_t now = GetTime(); std::string newFilename = strprintf("wallet.%d.bak", now); int result = dbenv.dbenv->dbrename(nullptr, filename.c_str(), nullptr, newFilename.c_str(), DB_AUTO_COMMIT); if (result == 0) LOGA("Renamed %s to %s\n", filename, newFilename); else { LOGA("Failed to rename %s to %s\n", filename, newFilename); return false; } std::vector<CDBEnv::KeyValPair> salvagedData; bool fSuccess = dbenv.Salvage(newFilename, true, salvagedData); if (salvagedData.empty()) { LOGA("Salvage(aggressive) found no records in %s.\n", newFilename); return false; } LOGA("Salvage(aggressive) found %u records\n", salvagedData.size()); boost::scoped_ptr<Db> pdbCopy(new Db(dbenv.dbenv, 0)); int ret = pdbCopy->open(nullptr, // Txn pointer filename.c_str(), // Filename "main", // Logical db name DB_BTREE, // Database type DB_CREATE, // Flags 0); if (ret > 0) { LOGA("Cannot create database file %s\n", filename); return false; } CWallet dummyWallet; CWalletScanState wss; DbTxn *ptxn = dbenv.TxnBegin(); for (CDBEnv::KeyValPair &row : salvagedData) { if (fOnlyKeys) { CDataStream ssKey(row.first, SER_DISK, CLIENT_VERSION); CDataStream ssValue(row.second, SER_DISK, CLIENT_VERSION); string strType, strErr; bool fReadOK; { // Required in LoadKeyMetadata(): LOCK(dummyWallet.cs_wallet); fReadOK = ReadKeyValue(&dummyWallet, ssKey, ssValue, wss, strType, strErr); } if (!IsKeyType(strType)) continue; if (!fReadOK) { LOGA("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, strErr); continue; } } Dbt datKey(&row.first[0], row.first.size()); Dbt datValue(&row.second[0], row.second.size()); int ret2 = pdbCopy->put(ptxn, &datKey, &datValue, DB_NOOVERWRITE); if (ret2 > 0) fSuccess = false; } ptxn->commit(0); pdbCopy->close(0); return fSuccess; } bool CWalletDB::Recover(CDBEnv &dbenv, const std::string &filename) { return CWalletDB::Recover(dbenv, filename, false); } bool CWalletDB::WriteDestData(const CTxDestination &address, const std::string &key, const std::string &value) { if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Write( std::make_pair(std::string("destdata"), std::make_pair(EncodeLegacyAddr(address, Params()), key)), value); } bool CWalletDB::EraseDestData(const CTxDestination &address, const std::string &key) { if (!IsValidDestination(address)) return false; nWalletDBUpdated++; return Erase(std::make_pair(std::string("destdata"), std::make_pair(EncodeLegacyAddr(address, Params()), key))); } bool CWalletDB::WriteHDChain(const CHDChain &chain) { nWalletDBUpdated++; return Write(std::string("hdchain"), chain); }
[ "lycion@gmail.com" ]
lycion@gmail.com
c418f39f1f85bc15613ae1d74bb3cad62469daed
72852e07bb30adbee608275d6048b2121a5b9d82
/algorithms/problem_1320/other2.cpp
32fa01f5ddb28379091e56f9e90b9bdc47caf69e
[]
no_license
drlongle/leetcode
e172ae29ea63911ccc3afb815f6dbff041609939
8e61ddf06fb3a4fb4a4e3d8466f3367ee1f27e13
refs/heads/master
2023-01-08T16:26:12.370098
2023-01-03T09:08:24
2023-01-03T09:08:24
81,335,609
0
0
null
null
null
null
UTF-8
C++
false
false
1,361
cpp
/* In our dynamic programming, dp[a] means that, if our left finger ends at character a, the maximum we can save is dp[a]. Now our right finger tapped all letters, and left finger did nothing. We iterate through the whole string one by one and select some letter to tap with the left finger. By doing this, we want to find out the maximum distance that we can save from the tapping with one finger. Assume that our left finger is at a now, our right finger is at b, and we the right finger will tap c next. Instead of moving right finger from b to c with distance d(b, c), we try moving left finger from a to c with distance d(a, c). Hopely this will save d(b, c) - d(a, c). And finaly, we have one fingers at b and the other at c now. The finger at b will be new left finger, and the other will be the right. */ class Solution { public: int minimumDistance(string word) { vector<int> dp(26); int res = 0, save = 0, n = word.size(); for (int i = 0; i < n - 1; ++i) { int b = word[i] - 'A', c = word[i + 1] - 'A'; for (int a = 0; a < 26; ++a) dp[b] = max(dp[b], dp[a] + d(b, c) - d(a, c)); save = max(save, dp[b]); res += d(b, c); } return res - save; } int d(int a, int b) { return abs(a / 6 - b / 6) + abs(a % 6 - b % 6); } };
[ "drlongle@gmail.com" ]
drlongle@gmail.com
3904dfbe0f23a0af81734bd1b6576b83ab71f46e
5700dac204805d113492a1147ac07fde952a4952
/T3000/DialogT3.cpp
5af365fd0cef76048119e500162c79fa31c355fe
[ "MIT" ]
permissive
Doanlmit/T3000_Building_Automation_System
2e1cfe7154cb4fea8e7311765e3dbe29f1a2c264
f7824c1772a04624f1de29e6e92cf20e5597aa36
refs/heads/master
2021-01-20T16:22:12.710466
2017-05-09T08:56:21
2017-05-09T08:56:21
90,835,334
1
0
null
2017-05-10T07:43:06
2017-05-10T07:43:06
null
GB18030
C++
false
false
8,091
cpp
// DialogT3.cpp : implementation file // #include "stdafx.h" #include "T3000.h" #include "DialogT3.h" // CDialogT3 IMPLEMENT_DYNCREATE(CDialogT3, CFormView) CDialogT3::CDialogT3() : CFormView(CDialogT3::IDD) , m_address(0) , m_firmware(0) , m_serial(0) , m_hardware(0) , m_model(_T("")) , m_picVersion(0) { } CDialogT3::~CDialogT3() { } void CDialogT3::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); DDX_Text(pDX, IDC_EDIT_T3ADDRESS, m_address); DDX_Text(pDX, IDC_EDIT_T3FIRMWARE, m_firmware); DDX_Text(pDX, IDC_EDIT_T3SERIAL, m_serial); DDX_Text(pDX, IDC_EDIT_T3HARDWARE, m_hardware); DDX_Text(pDX, IDC_EDIT_T3MODEL, m_model); DDX_Text(pDX, IDC_EDIT_T3PICVERSION, m_picVersion); DDX_Control(pDX, IDC_MSFLEXGRID_INPUT, m_msflexgrid_input); DDX_Control(pDX, IDC_MSFLEXGRID_OUTPUT, m_msflexgrid_output); } BEGIN_MESSAGE_MAP(CDialogT3, CFormView) END_MESSAGE_MAP() // CDialogT3 diagnostics #ifdef _DEBUG void CDialogT3::AssertValid() const { CFormView::AssertValid(); } #ifndef _WIN32_WCE void CDialogT3::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } #endif #endif //_DEBUG // CDialogT3 message handlers void CDialogT3::OnInitialUpdate() { return CFormView::OnInitialUpdate(); //============================================================================================================界面Input部份列表框 //显示横标题 m_msflexgrid_input.put_TextMatrix(0,1,_T("Input Name")); m_msflexgrid_input.put_TextMatrix(0,2,_T("Value")); //m_msflexgrid_input.put_TextMatrix(0,3,_T("Hand/Off/Auto")); m_msflexgrid_input.put_TextMatrix(0,3,_T("Input Filter")); m_msflexgrid_input.put_TextMatrix(0,4,_T("Range")); m_msflexgrid_input.put_TextMatrix(0,5,_T("Function")); //设置排/行数量 m_msflexgrid_input.put_Cols(6); m_msflexgrid_input.put_Rows(9); //设置列宽 m_msflexgrid_input.put_ColWidth(0,400); //m_msflexgrid_input.put_ColWidth(3,1500); //居中显示 for (int col=0;col<6;col++) { m_msflexgrid_input.put_ColAlignment(col,4); } //彩色显示 for(int i=1;i<9;i++) //排数量 { for(int k=0;k<6;k++) //列数量 { if (i%2==1) { m_msflexgrid_input.put_Row(i);m_msflexgrid_input.put_Col(k);m_msflexgrid_input.put_CellBackColor(RGB(255,255,255)); } else { m_msflexgrid_input.put_Row(i);m_msflexgrid_input.put_Col(k);m_msflexgrid_input.put_CellBackColor(COLOR_CELL); } } } //第3,4列11-26灰色显示 for (int i=1;i<9;i++) { m_msflexgrid_input.put_TextMatrix(i,4,_T("°C")); m_msflexgrid_input.put_Row(i); m_msflexgrid_input.put_Col(4); m_msflexgrid_input.put_CellBackColor(FLEXGRID_CELL_GRAY_COLOR); //灰色 } //显示纵标题 CString str; for(int i=1;i<=8;i++) { str.Format(_T("%d"),i); m_msflexgrid_input.put_TextMatrix(i,0,str); str = _T("Input ")+str; m_msflexgrid_input.put_TextMatrix(i,1,str); m_msflexgrid_input.put_TextMatrix(i,5,_T("Default")); } //显示纵标题 str =_T(""); for(int i=11;i<9;i++) { str.Format(_T("%d"),i); m_msflexgrid_input.put_TextMatrix(i,0,str); str = _T("Input ")+str; m_msflexgrid_input.put_TextMatrix(i,1,str); m_msflexgrid_input.put_TextMatrix(i,3,_T("Auto")); m_msflexgrid_input.put_TextMatrix(i,4,_T("On/Off")); m_msflexgrid_input.put_TextMatrix(i,5,_T("Default")); } //unsigned char writevalue[1]; //writevalue[0] = 0; //int flg = Write_Multi(g_tstat_id,writevalue,144,10); //TRACE(_T("flg=%d\n"),flg); //ASSERT(flg>0); //============================================================================================================界面Output部份列表框 //设置行/列数量 m_msflexgrid_output.put_Rows(14); m_msflexgrid_output.put_Cols(6); //设置列宽 m_msflexgrid_output.put_ColWidth(0,400); m_msflexgrid_output.put_ColWidth(3,1500); //显示横标题 m_msflexgrid_output.put_TextMatrix(0,1,_T("Input Name")); m_msflexgrid_output.put_TextMatrix(0,2,_T("Value")); m_msflexgrid_output.put_TextMatrix(0,3,_T("Auto/Manual")); m_msflexgrid_output.put_TextMatrix(0,4,_T("Range")); m_msflexgrid_output.put_TextMatrix(0,5,_T("Function")); //居中显示 for (int col=0;col<6;col++) { m_msflexgrid_output.put_ColAlignment(col,4); } //彩色显示 for(int i=1;i<14;i++) //排数量 { for(int k=0;k<6;k++) //列数量 { if (i%2==1) { m_msflexgrid_output.put_Row(i);m_msflexgrid_output.put_Col(k);m_msflexgrid_output.put_CellBackColor(RGB(255,255,255)); } else { m_msflexgrid_output.put_Row(i);m_msflexgrid_output.put_Col(k);m_msflexgrid_output.put_CellBackColor(COLOR_CELL); } } } //显示纵标题 CString str_output; for(int i=1;i<=13;i++) { str_output.Format(_T("%d"),i); m_msflexgrid_output.put_TextMatrix(i,0,str_output); str_output = _T("Output ")+str_output; m_msflexgrid_output.put_TextMatrix(i,1,str_output); //m_msflexgrid_output.put_TextMatrix(i,3,_T("Off")); m_msflexgrid_output.put_TextMatrix(i,4,_T("On/Off")); m_msflexgrid_output.put_TextMatrix(i,5,_T("Default")); m_msflexgrid_output.put_Row(i); m_msflexgrid_output.put_Col(4); m_msflexgrid_output.put_CellBackColor(FLEXGRID_CELL_GRAY_COLOR); } } void CDialogT3::Fresh() { ShowDialogData(); } void CDialogT3::ShowDialogData() { m_address= multi_register_value[6]; m_firmware= multi_register_value[5]; m_serial= get_serialnumber(); //Address 0-3 m_hardware= multi_register_value[4]; if (multi_register_value[7] == 20) m_model= _T("T3-8AI13O"); m_picVersion= multi_register_value[9]; UpdateData(FALSE); //183 1 Range Setting for each input. //184 1 183 correspond to input1, //185 1 184 correspond to input2, etc. //186 1 0 = raw data, //187 1 1 = 10K Celsius, //188 1 2 = 10K Fahrenheit, //189 1 3 = 0-100% //190 1 4 = ON/OFF, // 5 = OFF/ON // 6 = Pulse Input // 7 = Lighting Control for (int i = 183;i<=190;i++) { int retRangSet =write_one(g_tstat_id,i,1); TRACE(_T("retRangSet=%d\n"),retRangSet); } CString strinput,stroutput,strfilter; //Input Register address 118-133 eg:input1-> 118 high word 119 low word int numrow = 1; for (int i = 1;i<=16;i++) { int temphigh = multi_register_value[i+117]<<16; i++; int templow = multi_register_value[i+117]&0x0000ffff; int temp = temphigh|templow; strinput.Format(_T("%d°C"),temp); m_msflexgrid_input.put_TextMatrix(numrow,2,strinput); //Input Filter address 191-198 strfilter.Format(_T("%d"),multi_register_value[190+numrow]); m_msflexgrid_input.put_TextMatrix(numrow,3,strfilter); numrow++; } //Output Register address 100-112 for (int i = 1;i<=13;i++) { if (multi_register_value[i+99] == 0) { m_msflexgrid_output.put_TextMatrix(i,2,_T("Off")); } else if(multi_register_value[i+99] > 0) { m_msflexgrid_output.put_TextMatrix(i,2,_T("On")); } } //显示Auto/Manual //116 2 Switch Status, 1 Register output 1-8 //117 2 Switch Status, 2 Register output 9-13 //当output全按至HAND时,116 117的二进制值: // high 8 bit | low 8 bit //HAND INPUT 1 2 3 4 5 6 7 8 9 10 11 12 13 //register:116 117 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 //当output全按至AUTO时,116 117的二进制值: //AUTO INPUT 1 2 3 4 5 6 7 8 9 10 11 12 13 //register;116 117 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 int temp = 1; for (int i = 8;i>=1;i--) { //Manual if((multi_register_value[116]&temp)!= 0) m_msflexgrid_output.put_TextMatrix(i,3,_T("Manual")); temp = temp<<1; if ((multi_register_value[116]&temp)!=0) m_msflexgrid_output.put_TextMatrix(i,3,_T("Auto")); temp = temp<<1; } temp = 1; temp = temp<<6; for (int i = 13;i>=9;i--) { //Manual if((multi_register_value[117]&temp)!= 0) m_msflexgrid_output.put_TextMatrix(i,3,_T("Manual")); temp = temp<<1; if ((multi_register_value[117]&temp)!=0) m_msflexgrid_output.put_TextMatrix(i,3,_T("Auto")); temp = temp<<1; } }
[ "register@temcocontrols.com" ]
register@temcocontrols.com
1a8ac8fbc73fedae45580ea982ba0df272ed944a
9ec8f808b70b30e6dea8c2a98b4a269b7a4021a6
/meshshaderclass.h
1f7a41a10db728d7401e176d06a4313e150969b3
[]
no_license
adomalewski/DirectXGame
5daaeb78ca308aff8a7ce24dc7bd5cc253d779ab
6d706c7450eba9a69bba670a33d9da414cded83c
refs/heads/master
2021-01-13T12:35:37.839306
2017-01-22T20:11:24
2017-01-22T20:11:24
72,575,223
0
0
null
null
null
null
UTF-8
C++
false
false
1,740
h
#ifndef MESHSHADERCLASS_H #define MESHSHADERCLASS_H #include <d3d11.h> #include <d3dx10math.h> #include <d3dx11async.h> #include <fstream> using namespace std; class MeshShaderClass { private: struct MatrixBufferType { D3DXMATRIX world; D3DXMATRIX view; D3DXMATRIX projection; }; struct MeshBufferType { D3DXVECTOR4 difColor; bool hasTexture; D3DXVECTOR3 padding; }; struct CameraBufferType { D3DXVECTOR3 cameraPosition; float padding; }; struct LightBufferType { D3DXVECTOR4 ambientColor; D3DXVECTOR4 diffuseColor; D3DXVECTOR3 lightDirection; float specularPower; D3DXVECTOR4 specularColor; }; public: MeshShaderClass(); MeshShaderClass(const MeshShaderClass&); ~MeshShaderClass(); bool Initialize(ID3D11Device*, HWND); void Shutdown(); bool Render(ID3D11DeviceContext*, int, int, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, ID3D11ShaderResourceView*, D3DXVECTOR3, D3DXVECTOR4, D3DXVECTOR4, D3DXVECTOR3, D3DXVECTOR4, float, D3DXVECTOR4, bool); private: bool InitializeShader(ID3D11Device*, HWND, LPCSTR, LPCSTR); void ShutdownShader(); void OutputShaderErrorMessage(ID3D10Blob*, HWND, LPCSTR); bool SetShaderParameters(ID3D11DeviceContext*, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, ID3D11ShaderResourceView*, D3DXVECTOR3, D3DXVECTOR4, D3DXVECTOR4, D3DXVECTOR3, D3DXVECTOR4, float, D3DXVECTOR4, bool); void RenderShader(ID3D11DeviceContext*, int, int); private: ID3D11VertexShader* m_vertexShader; ID3D11PixelShader* m_pixelShader; ID3D11InputLayout* m_layout; ID3D11SamplerState* m_sampleState; ID3D11Buffer* m_matrixBuffer; ID3D11Buffer* m_meshBuffer; ID3D11Buffer* m_cameraBuffer; ID3D11Buffer* m_lightBuffer; ID3D11RasterizerState* RSCullNone; }; #endif // MESHSHADERCLASS_H
[ "adomalewski@adomalewski-wro.pgs-soft.com" ]
adomalewski@adomalewski-wro.pgs-soft.com
fb3489c6263909cf91ccb78abc9a8e927d6a1ca5
eec2eb8d09c05ae3ef92ff1ff7c43d8e0ee67784
/rfc/threads/KThread.h
f4167f898b63e0e1fa583328672a0c43e6ef5d30
[ "MIT" ]
permissive
camark/RFC-Framework
6dc9c6668f2d01c6648f99c1b86913c2b257ad51
e82b51be20750f47ab73bb2176bd0344d3f32b57
refs/heads/master
2020-03-24T16:48:20.644669
2018-07-19T03:05:26
2018-07-19T03:05:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,308
h
/* RFC - KThread.h Copyright (C) 2013-2018 CrownSoft This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef _RFC_KTHREAD_H_ #define _RFC_KTHREAD_H_ #include "../config.h" #include <windows.h> #include "../containers/KLeakDetector.h" /** Encapsulates a thread. Subclasses derive from KThread and implement the Run() method, in which they do their business. The thread can then be started with the StartThread() method and controlled with various other methods. Run() method implementation might be like this @code virtual void Run() { while(!threadShouldStop) { // your code goes here... } isThreadRunning=false; } @endcode */ class RFC_API KThread { protected: HANDLE handle; volatile bool isThreadRunning; volatile bool threadShouldStop; public: KThread(); /** Sets thread handle. */ virtual void SetHandle(HANDLE handle); /** Returns handle of the thread */ virtual HANDLE GetHandle(); /** Override this method in your class. */ virtual void Run(); /** Starts thread */ virtual bool StartThread(); /** Another thread can signal this thread should stop. */ virtual void ThreadShouldStop(); /** @returns true if thread is still running */ virtual bool IsThreadRunning(); /** Calling thread is not return until this thread finish. */ virtual void WaitUntilThreadFinish(); /** Sleeps calling thread to given micro seconds. */ static void uSleep(int waitTime); virtual ~KThread(); private: RFC_LEAK_DETECTOR(KThread) }; #endif
[ "ruchira66@gmail.com" ]
ruchira66@gmail.com
ed5e039effcb86da8179069736626b794ce028c5
a9b03f4730534da6e25e8a52ea0cd870db7c28b4
/modules/perception/lib/test/lib_registerer_test.cc
717da1f30cff1152f2b4d2bd28dfec849b2e77ac
[ "Apache-2.0" ]
permissive
zhuangli1987/apollo
6bcf2ddebb23377e701ec9bf2b56c1ea4632bab9
2210bef1ef5aadfeccb48949c07b31de4e581b25
refs/heads/master
2020-03-28T00:31:50.529228
2018-09-25T01:29:51
2018-09-25T01:31:39
147,425,981
0
0
null
2018-09-04T22:11:18
2018-09-04T22:11:18
null
UTF-8
C++
false
false
2,491
cc
/****************************************************************************** * Copyright 2018 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ #include <gtest/gtest.h> #include <string> #include <vector> #include "modules/perception/lib/registerer/registerer.h" namespace apollo { namespace perception { namespace lib { class BaseClass { public: BaseClass() = default; ~BaseClass() = default; virtual std::string Name() const { return "BaseClass1"; } }; PERCEPTION_REGISTER_REGISTERER(BaseClass); #define PERCEPTION_REGISTER_TEST(name) \ PERCEPTION_REGISTER_CLASS(BaseClass, name) class DerivedClass1 : BaseClass { public: DerivedClass1() = default; ~DerivedClass1() = default; virtual std::string Name() const { return "DerivedClass1"; } }; PERCEPTION_REGISTER_TEST(DerivedClass1); TEST(RegistererTest, Test) { BaseClass* ptr = nullptr; ptr = BaseClassRegisterer::GetInstanceByName("DerivedClass1"); ASSERT_TRUE(ptr != nullptr); EXPECT_EQ(ptr->Name(), "DerivedClass1"); ptr = BaseClassRegisterer::GetInstanceByName("NotExists"); ASSERT_TRUE(ptr == nullptr); EXPECT_TRUE(BaseClassRegisterer::IsValid("DerivedClass1")); EXPECT_FALSE(BaseClassRegisterer::IsValid("NotExists")); EXPECT_EQ(BaseClassRegisterer::GetUniqInstanceName(), "DerivedClass1"); BaseClass* ptr1 = BaseClassRegisterer::GetUniqInstance(); EXPECT_FALSE(ptr1 == nullptr); std::vector<std::string> derived_classes; EXPECT_TRUE(GetRegisteredClasses("BaseClass", &derived_classes)); EXPECT_FALSE(GetRegisteredClasses("BaseClass2", &derived_classes)); EXPECT_EQ(derived_classes.size(), 1u); EXPECT_EQ(derived_classes[0], "DerivedClass1"); ObjectFactoryDerivedClass1 obj_factory_drived1; obj_factory_drived1.NewInstance(); Any any; EXPECT_EQ(any.content_, nullptr); } } // namespace lib } // namespace perception } // namespace apollo
[ "ycool@users.noreply.github.com" ]
ycool@users.noreply.github.com
29da4a8169419f219f25a7fa0811d9b800fe958c
3ccd0ebe02db743f78b9d9e73a1746f98d797718
/VLP16/VLP16_Test/Singleton.h
45cc9298efa52f3cb2db7b32dfae0c134754d7e6
[]
no_license
sxy2996534527/3DCameraDataAcquisition
93543df80085291c492d0b57ff3cb7acb9256605
908608413e745192d824e5bb58dd792c64cdcee0
refs/heads/main
2023-06-18T02:46:45.144648
2021-07-19T09:19:54
2021-07-19T09:19:54
386,486,146
0
0
null
null
null
null
UTF-8
C++
false
false
675
h
// // Singleton.h // PhDanceMasterApp // // Created by YOHEI KAJIWARA on 2014/12/24. // // #ifndef __Ainz_FaceMoverTest__Singleton__ #define __Ainz_FaceMoverTest__Singleton__ #include <stdio.h> template <typename T> class Singleton{ public: // 唯一のアクセス経路 static inline T& GetInstance() { static T instance; // 唯一のインスタンス return instance; } protected: Singleton(){} virtual ~Singleton() {} private: // 生成やコピーを禁止する Singleton(const Singleton& rhs); Singleton& operator=(const Singleton& rhs); }; #endif /* defined(__Ainz_FaceMoverTest__Singleton__) */
[ "noreply@github.com" ]
sxy2996534527.noreply@github.com
5fb7eecdea4c86ecaf93e503fd22ffacb30f94c5
c301c81f7560125e130a9eb67f5231b3d08a9d67
/lc/lc/2021_target/companies/amazon/lc_347_top_k_frequent_elements.cpp
8038df016945bf7d029bb55ad5925f83014fff73
[]
no_license
vikashkumarjha/missionpeace
f55f593b52754c9681e6c32d46337e5e4b2d5f8b
7d5db52486c55b48fe761e0616d550439584f199
refs/heads/master
2021-07-11T07:34:08.789819
2021-07-06T04:25:18
2021-07-06T04:25:18
241,745,271
0
0
null
null
null
null
UTF-8
C++
false
false
1,823
cpp
/* Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = [1], k = 1 Output: [1] */ #include "header.hpp" class Solution { public: vector<int> topKFrequent(vector<int>& nums, int k) { std::unordered_map<int,int> m; for ( auto n : nums ) { m[n]++; } std::priority_queue<std::pair<int,int>> pq; for ( auto it = m.begin(); it != m.end(); it++) { pq.push(std::make_pair(it->second,it->first)); } int count = 0; std::vector<int> result; while ( !pq.empty()){ auto it = pq.top(); ++count; pq.pop(); result.push_back(it.second); if ( count == k ) break; } return result; } }; class Solution { public: vector<int> topKFrequent(vector<int> &nums, in k) { std::unordered_map<int, int> frequency; for (auto n : nums) { frequency[n]++; } std::vector<std::list<int>> bucket(nums.size() + 1, std::list<int>{}); for (auto it = frequency.begin(); it != frequency.end(); it++) { bucket[it->second].push_back(it->first); } int count = 0; std::vector<int> result; for (int j = bucket.size() - 1; j >= 0 && count < k; j--) { if (bucket[j].size() > 0) { for (auto it = bucket[j].begin(); it != bucket[j].end(); it++) { ++count; result.push_back(*it); if (count == k) break; } } } return result; } };
[ "vjha2100@gmail.com" ]
vjha2100@gmail.com
d63a0db323c182c1ec1a577d059ea377ddfa283d
a437bc72452f07c66b14ca7d01a530742b8d46f3
/d03/ex02/ClapTrap.cpp
90ebf08c090141141b9a9163a83ede3483e49816
[]
no_license
armou/piscine_cpp
b73086a1411d3c7fab713ea442b3ac14bf7e1309
69e315ffdce8ae2ff0d9bb24dc3bc92b22d16ed0
refs/heads/master
2022-11-22T08:55:37.813096
2020-07-27T14:07:16
2020-07-27T14:07:16
282,916,084
0
0
null
null
null
null
UTF-8
C++
false
false
4,471
cpp
#include "ClapTrap.hpp" ClapTrap::ClapTrap ( void ) { this->_init(); this->_name = "Rick the Default ClapTrap"; std::cout << this->_name << "(ClapTrap) : Introduction." << std::endl; return; } ClapTrap::ClapTrap ( std::string name ) { this->_init(); this->_name = name; std::cout << this->_name << "(ClapTrap) : Introduction." << std::endl; return; } ClapTrap::ClapTrap ( ClapTrap const & src ) { std::cout << "(ClapTrap) : BLIP BLIP!!!" << std::endl; *this = src; return; } ClapTrap::~ClapTrap ( void ) { std::cout << this->_name << "(ClapTrap): Bye bye." << std::endl; return; } void ClapTrap::_init ( void ) { srand(time(NULL)); this->_hitPoints = 100; this->_maxHitPoints = 100; this->_energyPoints = 100; this->_maxEnergyPoints = 100; this->_level = 1; this->_meleeADmg = 30; this->_rangedADmg = 20; this->_armorDmgReduc = 5; } void ClapTrap::_init ( ClapTrap const & rhs ) { this->_hitPoints = rhs.getHitPoints(); this->_maxHitPoints = rhs.getMaxHitPoints(); this->_energyPoints = rhs.getEnergyPoints(); this->_maxEnergyPoints = rhs.getMaxEnergyPoints(); this->_level = rhs.getLevel(); this->_meleeADmg = rhs.getMeleeADmg(); this->_rangedADmg = rhs.getRangedADmg(); this->_armorDmgReduc = rhs.getArmorDmgReduc(); this->_name = rhs.getName(); } ClapTrap & ClapTrap::operator= ( ClapTrap const & rhs ) { std::cout << "(ClapTrap) Assignation operator called" << std::endl; this->_hitPoints = rhs.getHitPoints(); this->_maxHitPoints = rhs.getMaxHitPoints(); this->_energyPoints = rhs.getEnergyPoints(); this->_maxEnergyPoints = rhs.getMaxEnergyPoints(); this->_level = rhs.getLevel(); this->_meleeADmg = rhs.getMeleeADmg(); this->_rangedADmg = rhs.getRangedADmg(); this->_armorDmgReduc = rhs.getArmorDmgReduc(); this->_name = rhs.getName(); return *this; } int ClapTrap::rangedAttack(std::string const & target) { if (this->_hitPoints == 0) { std::cout << this->_name << " is already dead." << std::endl; return 0; } std::cout << this->_name << " attacks " << target << " with a ranged attack." << std::endl; return this->_rangedADmg; } int ClapTrap::meleeAttack(std::string const & target) { if (this->_hitPoints == 0) { std::cout << this->_name << " is already dead." << std::endl; return 0; } std::cout << this->_name << " attacks " << target << " with a melee attack." << std::endl; return this->_meleeADmg; } void ClapTrap::takeDamage(unsigned int amount) { if (this->_hitPoints == 0) { std::cout << this->_name << " is already dead." << std::endl; } else if (amount - this->_armorDmgReduc == 0) { std::cout << this->_name << " take 0 damage."; } else { this->_hitPoints = this->_hitPoints - (amount - this->_armorDmgReduc); if (this->_hitPoints < 0) { this->_hitPoints = 0; } if (this->_hitPoints <= 0) { std::cout << this->_name << " shut down. RIP" << std::endl; } else { std::cout << this->_name << " take " << amount << " damage. Reduced by "; std::cout << this->_armorDmgReduc << std::endl; std::cout << this->_name << " now has " << this->_hitPoints << " hp." << std::endl; } } } void ClapTrap::beRepaired(unsigned int amount) { this->_hitPoints += amount; if (this->_hitPoints > this->_maxHitPoints) { this->_hitPoints = this->_maxHitPoints; } std::cout << this->_name << " get repaired of " << amount << " hp."; std::cout << " He has now " << this->_hitPoints << " hp." << std::endl; } int ClapTrap::getHitPoints() const{ return this->_hitPoints; } int ClapTrap::getMaxHitPoints() const{ return this->_maxHitPoints; } int ClapTrap::getEnergyPoints() const{ return this->_energyPoints; } int ClapTrap::getMaxEnergyPoints() const{ return this->_maxEnergyPoints; } std::string ClapTrap::getName() const{ return this->_name; } int ClapTrap::getLevel() const{ return this->_level; } int ClapTrap::getMeleeADmg() const{ return this->_meleeADmg; } int ClapTrap::getRangedADmg() const{ return this->_rangedADmg; } int ClapTrap::getArmorDmgReduc() const{ return this->_armorDmgReduc; } void ClapTrap::setName(std::string name) { this->_name = name; }
[ "aoudin@e2r6p18.42.fr" ]
aoudin@e2r6p18.42.fr
dc7c28353660e12f28d792e09d754839a3a6f30b
62e1b92bdca09eb6e61bf5463ec4952c76b46f35
/src/rpcmining.cpp
5c3b0b9ef178f1f623d5dac51479eb62d7754b30
[ "MIT" ]
permissive
zealdeal/zeal
9406e63b73cb0460581bd07c168bfca8d83ea23a
9e2049dc506d97d9d184826c8364206b0360f960
refs/heads/master
2020-04-02T15:17:25.854093
2018-10-29T22:44:27
2018-10-29T22:44:27
154,561,705
0
0
null
null
null
null
UTF-8
C++
false
false
25,341
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 "rpcserver.h" #include "chainparams.h" #include "main.h" #include "db.h" #include "txdb.h" #include "init.h" #include "miner.h" #include "kernel.h" #include <boost/assign/list_of.hpp> using namespace json_spirit; using namespace std; using namespace boost::assign; // Key used by getwork/getblocktemplate miners. // Allocated in InitRPCMining, free'd in ShutdownRPCMining static CReserveKey* pMiningKey = NULL; void InitRPCMining() { if (!pwalletMain) return; // getwork/getblocktemplate mining rewards paid here: pMiningKey = new CReserveKey(pwalletMain); } void ShutdownRPCMining() { if (!pMiningKey) return; delete pMiningKey; pMiningKey = NULL; } Value getsubsidy(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getsubsidy [nTarget]\n" "Returns proof-of-work subsidy value for the specified value of target."); return (uint64_t)GetProofOfWorkReward(0); } Value getstakesubsidy(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "getstakesubsidy <hex string>\n" "Returns proof-of-stake subsidy value for the specified coinstake."); RPCTypeCheck(params, list_of(str_type)); vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; try { ssData >> tx; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } uint64_t nCoinAge; CTxDB txdb("r"); if (!tx.GetCoinAge(txdb, pindexBest, nCoinAge)) throw JSONRPCError(RPC_MISC_ERROR, "GetCoinAge failed"); return (uint64_t)GetProofOfStakeReward(pindexBest, nCoinAge, 0); } Value getmininginfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getmininginfo\n" "Returns an object containing mining-related information."); uint64_t nWeight = 0; if (pwalletMain) nWeight = pwalletMain->GetStakeWeight(); Object obj, diff, weight; obj.push_back(Pair("blocks", (int)nBestHeight)); obj.push_back(Pair("currentblocksize",(uint64_t)nLastBlockSize)); obj.push_back(Pair("currentblocktx",(uint64_t)nLastBlockTx)); diff.push_back(Pair("proof-of-work", GetDifficulty())); diff.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true)))); diff.push_back(Pair("search-interval", (int)nLastCoinStakeSearchInterval)); obj.push_back(Pair("difficulty", diff)); obj.push_back(Pair("blockvalue", (uint64_t)GetProofOfWorkReward(0))); obj.push_back(Pair("netmhashps", GetPoWMHashPS())); obj.push_back(Pair("netstakeweight", GetPoSKernelPS())); obj.push_back(Pair("errors", GetWarnings("statusbar"))); obj.push_back(Pair("pooledtx", (uint64_t)mempool.size())); weight.push_back(Pair("minimum", (uint64_t)nWeight)); weight.push_back(Pair("maximum", (uint64_t)0)); weight.push_back(Pair("combined", (uint64_t)nWeight)); obj.push_back(Pair("stakeweight", weight)); obj.push_back(Pair("stakeinterest", (uint64_t)COIN_YEAR_REWARD)); obj.push_back(Pair("testnet", TestNet())); return obj; } Value getstakinginfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getstakinginfo\n" "Returns an object containing staking-related information."); uint64_t nWeight = 0; if (pwalletMain) nWeight = pwalletMain->GetStakeWeight(); uint64_t nNetworkWeight = GetPoSKernelPS(); bool staking = nLastCoinStakeSearchInterval && nWeight; uint64_t nExpectedTime = staking ? (GetTargetSpacing(nBestHeight) * nNetworkWeight / nWeight) : 0; Object obj; obj.push_back(Pair("enabled", GetBoolArg("-staking", true))); obj.push_back(Pair("staking", staking)); obj.push_back(Pair("errors", GetWarnings("statusbar"))); obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize)); obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx)); obj.push_back(Pair("pooledtx", (uint64_t)mempool.size())); obj.push_back(Pair("difficulty", GetDifficulty(GetLastBlockIndex(pindexBest, true)))); obj.push_back(Pair("search-interval", (int)nLastCoinStakeSearchInterval)); obj.push_back(Pair("weight", (uint64_t)nWeight)); obj.push_back(Pair("netstakeweight", (uint64_t)nNetworkWeight)); obj.push_back(Pair("expectedtime", nExpectedTime)); return obj; } Value checkkernel(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "checkkernel [{\"txid\":txid,\"vout\":n},...] [createblocktemplate=false]\n" "Check if one of given inputs is a kernel input at the moment.\n" ); RPCTypeCheck(params, list_of(array_type)(bool_type)); Array inputs = params[0].get_array(); bool fCreateBlockTemplate = params.size() > 1 ? params[1].get_bool() : false; if (vNodes.empty()) throw JSONRPCError(-9, "Zeal is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(-10, "Zeal is downloading blocks..."); COutPoint kernel; CBlockIndex* pindexPrev = pindexBest; unsigned int nBits = GetNextTargetRequired(pindexPrev, true); int64_t nTime = GetAdjustedTime(); nTime &= ~STAKE_TIMESTAMP_MASK; BOOST_FOREACH(Value& input, inputs) { const Object& o = input.get_obj(); const Value& txid_v = find_value(o, "txid"); if (txid_v.type() != str_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing txid key"); string txid = txid_v.get_str(); if (!IsHex(txid)) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected hex txid"); const Value& vout_v = find_value(o, "vout"); if (vout_v.type() != int_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key"); int nOutput = vout_v.get_int(); if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); COutPoint cInput(uint256(txid), nOutput); if (CheckKernel(pindexPrev, nBits, nTime, cInput)) { kernel = cInput; break; } } Object result; result.push_back(Pair("found", !kernel.IsNull())); if (kernel.IsNull()) return result; Object oKernel; oKernel.push_back(Pair("txid", kernel.hash.GetHex())); oKernel.push_back(Pair("vout", (int64_t)kernel.n)); oKernel.push_back(Pair("time", nTime)); result.push_back(Pair("kernel", oKernel)); if (!fCreateBlockTemplate) return result; int64_t nFees; auto_ptr<CBlock> pblock(CreateNewBlock(*pMiningKey, true, &nFees)); pblock->nTime = pblock->vtx[0].nTime = nTime; CDataStream ss(SER_DISK, PROTOCOL_VERSION); ss << *pblock; result.push_back(Pair("blocktemplate", HexStr(ss.begin(), ss.end()))); result.push_back(Pair("blocktemplatefees", nFees)); CPubKey pubkey; if (!pMiningKey->GetReservedKey(pubkey)) throw JSONRPCError(RPC_MISC_ERROR, "GetReservedKey failed"); result.push_back(Pair("blocktemplatesignkey", HexStr(pubkey))); return result; } Value getworkex(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "getworkex [data, coinbase]\n" "If [data, coinbase] is not specified, returns extended work data.\n" ); if (vNodes.empty()) throw JSONRPCError(-9, "Zeal is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(-10, "Zeal is downloading blocks..."); if (pindexBest->nHeight >= Params().LastPOWBlock()) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; static mapNewBlock_t mapNewBlock; static vector<CBlock*> vNewBlock; if (params.size() == 0) { // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)) { if (pindexPrev != pindexBest) { // Deallocate old blocks since they're obsolete now mapNewBlock.clear(); BOOST_FOREACH(CBlock* pblock, vNewBlock) delete pblock; vNewBlock.clear(); } nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); pindexPrev = pindexBest; nStart = GetTime(); // Create new block pblock = CreateNewBlock(*pMiningKey); if (!pblock) throw JSONRPCError(-7, "Out of memory"); vNewBlock.push_back(pblock); } // Update nTime pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, GetAdjustedTime()); pblock->nNonce = 0; // Update nExtraNonce static unsigned int nExtraNonce = 0; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); // Prebuild hash buffers char pmidstate[32]; char pdata[128]; char phash1[64]; FormatHashBuffers(pblock, pmidstate, pdata, phash1); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); CTransaction coinbaseTx = pblock->vtx[0]; std::vector<uint256> merkle = pblock->GetMerkleBranch(0); Object result; result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata)))); result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget)))); CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << coinbaseTx; result.push_back(Pair("coinbase", HexStr(ssTx.begin(), ssTx.end()))); Array merkle_arr; BOOST_FOREACH(uint256 merkleh, merkle) { merkle_arr.push_back(HexStr(BEGIN(merkleh), END(merkleh))); } result.push_back(Pair("merkle", merkle_arr)); return result; } else { // Parse parameters vector<unsigned char> vchData = ParseHex(params[0].get_str()); vector<unsigned char> coinbase; if(params.size() == 2) coinbase = ParseHex(params[1].get_str()); if (vchData.size() != 128) throw JSONRPCError(-8, "Invalid parameter"); CBlock* pdata = (CBlock*)&vchData[0]; // Byte reverse for (int i = 0; i < 128/4; i++) ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]); // Get saved block if (!mapNewBlock.count(pdata->hashMerkleRoot)) return false; CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first; pblock->nTime = pdata->nTime; pblock->nNonce = pdata->nNonce; if(coinbase.size() == 0) pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second; else CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0]; // FIXME - HACK! pblock->hashMerkleRoot = pblock->BuildMerkleTree(); assert(pwalletMain != NULL); return CheckWork(pblock, *pwalletMain, *pMiningKey); } } Value getwork(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getwork [data]\n" "If [data] is not specified, returns formatted hash data to work on:\n" " \"midstate\" : precomputed hash state after hashing the first half of the data (DEPRECATED)\n" // deprecated " \"data\" : block data\n" " \"hash1\" : formatted hash buffer for second hash (DEPRECATED)\n" // deprecated " \"target\" : little endian hash target\n" "If [data] is specified, tries to solve the block and returns true if it was successful."); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Zeal is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Zeal is downloading blocks..."); if (pindexBest->nHeight >= Params().LastPOWBlock()) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; static mapNewBlock_t mapNewBlock; // FIXME: thread safety static vector<CBlock*> vNewBlock; if (params.size() == 0) { // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 60)) { if (pindexPrev != pindexBest) { // Deallocate old blocks since they're obsolete now mapNewBlock.clear(); BOOST_FOREACH(CBlock* pblock, vNewBlock) delete pblock; vNewBlock.clear(); } // Clear pindexPrev so future getworks make a new block, despite any failures from here on pindexPrev = NULL; // Store the pindexBest used before CreateNewBlock, to avoid races nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); CBlockIndex* pindexPrevNew = pindexBest; nStart = GetTime(); // Create new block pblock = CreateNewBlock(*pMiningKey); if (!pblock) throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory"); vNewBlock.push_back(pblock); // Need to update only after we know CreateNewBlock succeeded pindexPrev = pindexPrevNew; } // Update nTime pblock->UpdateTime(pindexPrev); pblock->nNonce = 0; // Update nExtraNonce static unsigned int nExtraNonce = 0; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); // Pre-build hash buffers char pmidstate[32]; char pdata[128]; char phash1[64]; FormatHashBuffers(pblock, pmidstate, pdata, phash1); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); Object result; result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate)))); // deprecated result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata)))); result.push_back(Pair("hash1", HexStr(BEGIN(phash1), END(phash1)))); // deprecated result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget)))); return result; } else { // Parse parameters vector<unsigned char> vchData = ParseHex(params[0].get_str()); if (vchData.size() != 128) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter"); CBlock* pdata = (CBlock*)&vchData[0]; // Byte reverse for (int i = 0; i < 128/4; i++) ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]); // Get saved block if (!mapNewBlock.count(pdata->hashMerkleRoot)) return false; CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first; pblock->nTime = pdata->nTime; pblock->nNonce = pdata->nNonce; pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second; pblock->hashMerkleRoot = pblock->BuildMerkleTree(); assert(pwalletMain != NULL); return CheckWork(pblock, *pwalletMain, *pMiningKey); } } Value getblocktemplate(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getblocktemplate [params]\n" "Returns data needed to construct a block to work on:\n" " \"version\" : block version\n" " \"previousblockhash\" : hash of current highest block\n" " \"transactions\" : contents of non-coinbase transactions that should be included in the next block\n" " \"coinbaseaux\" : data that should be included in coinbase\n" " \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n" " \"target\" : hash target\n" " \"mintime\" : minimum timestamp appropriate for next block\n" " \"curtime\" : current timestamp\n" " \"mutable\" : list of ways the block template may be changed\n" " \"noncerange\" : range of valid nonces\n" " \"sigoplimit\" : limit of sigops in blocks\n" " \"sizelimit\" : limit of block size\n" " \"bits\" : compressed target of next block\n" " \"height\" : height of the next block\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification."); std::string strMode = "template"; if (params.size() > 0) { const Object& oparam = params[0].get_obj(); const Value& modeval = find_value(oparam, "mode"); if (modeval.type() == str_type) strMode = modeval.get_str(); else if (modeval.type() == null_type) { /* Do nothing */ } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); } if (strMode != "template") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "Zeal is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Zeal is downloading blocks..."); if (pindexBest->nHeight >= Params().LastPOWBlock()) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLast && GetTime() - nStart > 5)) { // Clear pindexPrev so future calls make a new block, despite any failures from here on pindexPrev = NULL; // Store the pindexBest used before CreateNewBlock, to avoid races nTransactionsUpdatedLast = mempool.GetTransactionsUpdated(); CBlockIndex* pindexPrevNew = pindexBest; nStart = GetTime(); // Create new block if(pblock) { delete pblock; pblock = NULL; } pblock = CreateNewBlock(*pMiningKey); if (!pblock) throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory"); // Need to update only after we know CreateNewBlock succeeded pindexPrev = pindexPrevNew; } // Update nTime pblock->UpdateTime(pindexPrev); pblock->nNonce = 0; Array transactions; map<uint256, int64_t> setTxIndex; int i = 0; CTxDB txdb("r"); BOOST_FOREACH (CTransaction& tx, pblock->vtx) { uint256 txHash = tx.GetHash(); setTxIndex[txHash] = i++; if (tx.IsCoinBase() || tx.IsCoinStake()) continue; Object entry; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << tx; entry.push_back(Pair("data", HexStr(ssTx.begin(), ssTx.end()))); entry.push_back(Pair("hash", txHash.GetHex())); MapPrevTx mapInputs; map<uint256, CTxIndex> mapUnused; bool fInvalid = false; if (tx.FetchInputs(txdb, mapUnused, false, false, mapInputs, fInvalid)) { entry.push_back(Pair("fee", (int64_t)(tx.GetValueIn(mapInputs) - tx.GetValueOut()))); Array deps; BOOST_FOREACH (MapPrevTx::value_type& inp, mapInputs) { if (setTxIndex.count(inp.first)) deps.push_back(setTxIndex[inp.first]); } entry.push_back(Pair("depends", deps)); int64_t nSigOps = GetLegacySigOpCount(tx); nSigOps += GetP2SHSigOpCount(tx, mapInputs); entry.push_back(Pair("sigops", nSigOps)); } transactions.push_back(entry); } Object aux; aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()))); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); static Array aMutable; if (aMutable.empty()) { aMutable.push_back("time"); aMutable.push_back("transactions"); aMutable.push_back("prevblock"); } Object result; result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); result.push_back(Pair("coinbaseaux", aux)); result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); result.push_back(Pair("target", hashTarget.GetHex())); result.push_back(Pair("mintime", (int64_t)pindexPrev->GetPastTimeLimit()+1)); result.push_back(Pair("mutable", aMutable)); result.push_back(Pair("noncerange", "00000000ffffffff")); result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS)); result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE)); result.push_back(Pair("curtime", (int64_t)pblock->nTime)); result.push_back(Pair("bits", strprintf("%08x", pblock->nBits))); result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1))); return result; } Value submitblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "submitblock <hex data> [optional-params-obj]\n" "[optional-params-obj] parameter is currently ignored.\n" "Attempts to submit new block to network.\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification."); vector<unsigned char> blockData(ParseHex(params[0].get_str())); CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION); CBlock block; try { ssBlock >> block; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed"); } if (params.size() > 1) { const Object& oparam = params[1].get_obj(); const Value& coinstake_v = find_value(oparam, "coinstake"); if (coinstake_v.type() == str_type) { vector<unsigned char> txData(ParseHex(coinstake_v.get_str())); CDataStream ssTx(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction txCoinStake; try { ssTx >> txCoinStake; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Coinstake decode failed"); } block.vtx.insert(block.vtx.begin() + 1, txCoinStake); block.hashMerkleRoot = block.BuildMerkleTree(); CPubKey pubkey; if (!pMiningKey->GetReservedKey(pubkey)) throw JSONRPCError(RPC_MISC_ERROR, "GetReservedKey failed"); CKey key; if (!pwalletMain->GetKey(pubkey.GetID(), key)) throw JSONRPCError(RPC_MISC_ERROR, "GetKey failed"); if (!key.Sign(block.GetHash(), block.vchBlockSig)) throw JSONRPCError(RPC_MISC_ERROR, "Sign failed"); } } bool fAccepted = ProcessBlock(NULL, &block); if (!fAccepted) return "rejected"; return Value::null; } Value setgenerate(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "setgenerate <generate> [genproclimit]\n" "<generate> is true or false to turn generation on or off.\n" "Generation is limited to [genproclimit] processors, -1 is unlimited."); bool fGenerate = true; if (params.size() > 0) fGenerate = params[0].get_bool(); int nGenProcLimit = 1; if (params.size() > 1) { nGenProcLimit = params[1].get_int(); mapArgs["-genproclimit"] = itostr(nGenProcLimit); if (nGenProcLimit == 0) fGenerate = false; } mapArgs["-gen"] = (fGenerate ? "1" : "0"); GenerateBitcoins(fGenerate, pwalletMain, nGenProcLimit); return Value::null; }
[ "root@Razvoj-Rasa.localdomain" ]
root@Razvoj-Rasa.localdomain
8d1e847d5ce2fa845d6a3c65d5ebe4f93e0d7c78
814fd0bea5bc063a4e34ebdd0a5597c9ff67532b
/components/password_manager/core/browser/password_manager_url_collection_experiment.h
3ba8f4171e55264f8f3f75a722a133a0e39a6ef1
[ "BSD-3-Clause" ]
permissive
rzr/chromium-crosswalk
1b22208ff556d69c009ad292bc17dca3fe15c493
d391344809adf7b4f39764ac0e15c378169b805f
refs/heads/master
2021-01-21T09:11:07.316526
2015-02-16T11:52:21
2015-02-16T11:52:21
38,887,985
0
0
NOASSERTION
2019-08-07T21:59:20
2015-07-10T15:35:50
C++
UTF-8
C++
false
false
2,293
h
// 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. #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_URL_COLLECTION_EXPERIMENT_H_ #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_URL_COLLECTION_EXPERIMENT_H_ #include "base/time/time.h" namespace user_prefs { class PrefRegistrySyncable; } class PrefService; // These functions implement the algorithms according to which the "Allow to // collect URL?" bubble is shown to user. namespace password_manager { namespace urls_collection_experiment { void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); // Implements an algorithm determining when the period starts, in which "Allow // to collect URL?" bubble can be shown. base::Time DetermineStartOfActivityPeriod(PrefService* prefs, int experiment_length_in_days); // Based on |prefs| and experiment settings, decides whether to show the // "Allow to collect URL?" bubble and should be called before showing it. // The default value is false. bool ShouldShowBubble(PrefService* prefs); // Should be called when the "Allow to collect URL?" bubble was shown. // It stores the fact that bubble was shown in |prefs|. void RecordBubbleOpened(PrefService* prefs); // The name of the finch experiment controlling the algorithm. extern const char kExperimentName[]; // The name of the experiment parameter, value of which determines determines // how long the experiment is active. extern const char kParamExperimentLengthInDays[]; // The bubble is shown only once and only within a certain period. The length of // the period is the value of the experiment parameter |kParamTimePeriodInDays|. extern const char kParamActivePeriodInDays[]; // The name of the experiment parameter, value of which defines whether // the bubble should appear or not. extern const char kParamBubbleStatus[]; // The value of the experiment parameter, when bubble should appear. extern const char kParamBubbleStatusValueWhenShouldShow[]; } // namespace urls_collection_experiment } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_MANAGER_URL_COLLECTION_EXPERIMENT_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
da18895ca675ce4517c85436f3ca7a98e20de1d2
c181f915220d2f182e237cebddceffc20052930c
/Classes/MapSprite/MapSprite10.h
a306b51e55da4d027519315a1cd570c01ae6222f
[]
no_license
sharezer/HC
cf46003b19f497c259198002fe319aca0101728c
bb03a5c8458eed03c82942a9ec7a1d2dfc4a3dc8
refs/heads/master
2021-01-21T01:49:32.989854
2019-10-23T08:07:29
2019-10-23T08:07:29
15,626,010
0
0
null
null
null
null
UTF-8
C++
false
false
146
h
#pragma once #include "MapSprite.h" class CMapSprite10 : public CMapSprite { public: void firstAction(); public: virtual bool initSprite(); };
[ "liangshaoze@sina.cn" ]
liangshaoze@sina.cn
e41caa7f92cb18e9c4c002f838bc8ebf6e24e10d
3edc478db837a27dbf8df7eded45df909dfe3cf9
/CodeForces/455a.cpp
93ea09ddcf467464c856ca79758f508c8c1caeca
[]
no_license
ronistone/Maratonas
b60ebeb9e7e9298399652df88faa83389bd94542
8bd0bedd476645081a09b19152a007ca1497fe20
refs/heads/master
2021-01-12T10:06:04.016208
2018-10-19T02:40:54
2018-10-19T02:40:54
76,360,276
1
0
null
null
null
null
UTF-8
C++
false
false
514
cpp
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int n; ll dp[100010]; ll A[100010]; ll solve(int current){ if(current < 0) return 0; if(dp[current]!=-1) return dp[current]; return dp[current] = max(solve(current-1),solve(current-2)+A[current]); } main(){ ios_base::sync_with_stdio(0); cin.tie(0); int aux,maior=-1; cin >> n; //A[0] = -3; for(int i=0;i<n;i++){ cin >> aux; A[aux]+=aux; maior = max(maior,aux); } memset(dp,-1,sizeof dp); cout << solve(maior) << endl; }
[ "ronistonejunior@gmail.com" ]
ronistonejunior@gmail.com
b4de7ff718a6b765d7eaad0c35c99b6e8ca2200f
a6b46ceba9753a519a5db131df26ca41b5f31ac3
/No3/No3/main.cpp
ca6f9d855d511e74f23ebc3e25cd18f544f653ab
[]
no_license
YugoTakagi/yukicoder
697d1414a6b2a26aebedabcdfa6846720e1e0232
a8563806b4d22747d0caf8f34220f70b6a748e70
refs/heads/master
2020-06-08T06:27:44.214856
2019-06-22T01:29:03
2019-06-22T01:29:03
193,177,419
0
0
null
null
null
null
UTF-8
C++
false
false
1,256
cpp
// // main.cpp // No3 // // Created by 高城友豪 on 2019/06/21. // Copyright © 2019 高城友豪. All rights reserved. // #include <iostream> #include <bitset> #include <queue> int main(int argc, const char * argv[]) { // insert code here... int N; std::cin >> N ; std::queue<int> q; std::vector<int> directions(N+1); q.push(1); directions[1]=1; int state=1; while (state != N) { int bit = std::bitset<32>(state).count(); int v1 = state +bit, v2 = state -bit; if (v1 <= N && directions[v1] == 0) { q.push(v1); directions[v1] = directions[state] + 1; } if (v2 > 0 && directions[v2] == 0) { q.push(v2); directions[v2] = directions[state] + 1; } if (q.size() == 0) { std::cout << -1 << std::endl; return 0; } state = q.front(); q.pop(); } std::cout << directions[state] << std::endl; return 0; } // std::bitset<8>bit = std::bitset<8>(i); // std::cout << std::bitset<8>(8).count() << std::endl; // std::cout << std::bitset<8>(i) << std::endl; // std::cout << bit.count() << std::endl; // state = q.front();
[ "a217048@ns.kogakuin.ac.jp" ]
a217048@ns.kogakuin.ac.jp
e25fab947e04640a6b01d3891156423f5b01ba5a
c3ad6263554e6b5c8b7c4ff969d9296f708778fa
/HW_Project_9/homework_1572887168/Lesson9_1/Lesson9_1/Lesson9_1.cpp
9aa83491a0da5b83b5e0f1244a961e82177de1e4
[]
no_license
Cybr0/C_Cpp__Part-3
47b5f4bd1b069e678a08848cdf5e95c4c05b86c5
5015c285b6735e7de7b4f84300e585b8f80e2b6c
refs/heads/master
2022-10-19T05:09:30.976833
2020-06-12T12:20:16
2020-06-12T12:20:16
271,791,390
0
0
null
null
null
null
UTF-8
C++
false
false
920
cpp
#include <iostream> #include <sstream> #include "Array.h" void check_true(bool v) { if (v) { std::cout << "OK" << std::endl; } else { std::cout << "FAIL" << std::endl; } } bool compare(double a, double b) { return (fabs(a - b) < DBL_EPSILON); } int main() { Array arr; arr.push_back(1); arr.push_back(2); arr.push_back(3); arr.push_back(4); check_true(arr[0] == 1); check_true(arr[1] == 2); check_true(arr[2] == 3); check_true(arr[3] == 4); check_true(arr.size() == 4); check_true(arr.capacity() == 10); arr[0] = 10; arr.operator[](1) = 20; arr[2] = 30; arr[3] = 40; check_true(arr[0] == 10); check_true(arr[1] == 20); check_true(arr[2] == 30); check_true(arr[3] == 40); arr(6); check_true(arr[0] == 16); check_true(arr[1] == 26); check_true(arr[2] == 36); check_true(arr[3] == 46); std::stringstream ss; ss << arr; check_true(ss.str() == std::string("16 26 36 46 ")); }
[ "44771809+Cybr0@users.noreply.github.com" ]
44771809+Cybr0@users.noreply.github.com
a90b5158640e4114f5a4609c34cb44363f503cf0
3a164e9ef0d99d006fd5ff6d67d4a11e3e7b2856
/race_to_expiry_chtc/eh-sim/libtorch/include/ATen/core/TensorMethods.h
6b25d5ad90e74c92ad7cae90f12ae7fd57151f13
[ "MIT" ]
permissive
abhijiths94/r2e_results
bb320ac388a0bbd1eeae23218b97024991c9bc69
96def5313b7f46122e6c814c91971521fd6d858f
refs/heads/master
2021-05-17T22:43:10.798201
2020-03-29T19:39:47
2020-03-29T19:39:47
250,985,394
0
0
null
null
null
null
UTF-8
C++
false
false
280,198
h
#pragma once #include <c10/core/Scalar.h> #include <c10/core/MemoryFormat.h> #include <c10/core/QScheme.h> #include <c10/macros/Macros.h> #include <c10/core/TensorOptions.h> #include <c10/util/intrusive_ptr.h> #include <ATen/core/DeprecatedTypeProperties.h> #include <ATen/core/dispatch/Dispatcher.h> #include <ATen/core/NamedTensor.h> #include <ATen/core/LegacyTypeDispatch.h> #ifdef USE_STATIC_DISPATCH #include <ATen/TypeDefault.h> #include <ATen/CPUType.h> #include <ATen/QuantizedCPUType.h> #include <ATen/SparseCPUType.h> #endif namespace at { struct Quantizer; // This is temporary typedef to enable Quantizer in aten native function API // we'll remove them when we are actually exposing Quantizer class // to frontend using ConstQuantizerPtr = const c10::intrusive_ptr<Quantizer>&; inline Tensor Tensor::cpu() const { return to(options().device(DeviceType::CPU), /*non_blocking*/ false, /*copy*/ false); } // TODO: The Python version also accepts arguments inline Tensor Tensor::cuda() const { return to(options().device(DeviceType::CUDA), /*non_blocking*/ false, /*copy*/ false); } inline Tensor Tensor::hip() const { return to(options().device(DeviceType::HIP), /*non_blocking*/ false, /*copy*/ false); } inline Tensor Tensor::toType(ScalarType t) const { return to(options().dtype(t), /*non_blocking*/ false, /*copy*/ false); } // TODO: Deprecate me inline Tensor Tensor::toBackend(Backend b) const { return to(options().device(backendToDeviceType(b)).layout(layout_from_backend(b)), /*non_blocking*/ false, /*copy*/ false); } inline TensorOptions Tensor::options() const { return TensorOptions().dtype(dtype()) .device(device()) .layout(layout()); } // all static inline to allow for inlining of the non-dynamic part of dispatch inline void Tensor::backward(const Tensor & gradient, bool keep_graph, bool create_graph) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); TypeDefault::backward(const_cast<Tensor&>(*this), gradient, keep_graph, create_graph); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::backward", ""); return op.callUnboxed<void, const Tensor &, const Tensor &, bool, bool>(const_cast<Tensor&>(*this), gradient, keep_graph, create_graph); #endif } inline void Tensor::set_data(const Tensor & new_data) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); TypeDefault::set_data(const_cast<Tensor&>(*this), new_data); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_data", ""); return op.callUnboxed<void, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), new_data); #endif } inline Tensor Tensor::data() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::data(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::data", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_leaf() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_leaf(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_leaf", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::output_nr() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::output_nr(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::output_nr", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::_version() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::_version(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_version", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::requires_grad_(bool _requires_grad) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::requires_grad_(const_cast<Tensor&>(*this), _requires_grad); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::requires_grad_", ""); return op.callUnboxed<Tensor &, Tensor &, bool>(const_cast<Tensor&>(*this), _requires_grad); #endif } inline Tensor & Tensor::rename_(c10::optional<DimnameList> names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rename_(const_cast<Tensor&>(*this), names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rename_", ""); return op.callUnboxed<Tensor &, Tensor &, c10::optional<DimnameList>>(const_cast<Tensor&>(*this), names); #endif } inline Tensor Tensor::rename(c10::optional<DimnameList> names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rename(const_cast<Tensor&>(*this), names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rename", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<DimnameList>>(const_cast<Tensor&>(*this), names); #endif } inline Tensor Tensor::align_to(DimnameList names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::align_to(const_cast<Tensor&>(*this), names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::align_to", ""); return op.callUnboxed<Tensor, const Tensor &, DimnameList>(const_cast<Tensor&>(*this), names); #endif } inline Tensor Tensor::align_to(DimnameList order, int64_t ellipsis_idx) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::align_to(const_cast<Tensor&>(*this), order, ellipsis_idx); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::align_to", "ellipsis_idx"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, int64_t>(const_cast<Tensor&>(*this), order, ellipsis_idx); #endif } inline Tensor Tensor::align_as(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::align_as(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::align_as", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::refine_names(DimnameList names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::refine_names(const_cast<Tensor&>(*this), names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::refine_names", ""); return op.callUnboxed<Tensor, const Tensor &, DimnameList>(const_cast<Tensor&>(*this), names); #endif } inline Tensor Tensor::unflatten(Dimname dim, IntArrayRef sizes, DimnameList names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unflatten(const_cast<Tensor&>(*this), dim, sizes, names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unflatten", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, IntArrayRef, DimnameList>(const_cast<Tensor&>(*this), dim, sizes, names); #endif } inline Tensor Tensor::unflatten(int64_t dim, IntArrayRef sizes, DimnameList names) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unflatten(const_cast<Tensor&>(*this), dim, sizes, names); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unflatten", "int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, IntArrayRef, DimnameList>(const_cast<Tensor&>(*this), dim, sizes, names); #endif } inline Tensor Tensor::abs() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::abs(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::abs", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::abs_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::abs_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::abs_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::angle() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::angle(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::angle", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::real() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::real(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::real", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::imag() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::imag(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::imag", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::conj() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::conj(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::conj", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::acos() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::acos(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::acos", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::acos_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::acos_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::acos_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::add(const Tensor & other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::add(const_cast<Tensor&>(*this), other, alpha); break; case Backend::SparseCPU: return SparseCPUType::add(const_cast<Tensor&>(*this), other, alpha); break; default: AT_ERROR("add not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::add", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor & Tensor::add_(const Tensor & other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::add_(const_cast<Tensor&>(*this), other, alpha); break; case Backend::SparseCPU: return SparseCPUType::add_(const_cast<Tensor&>(*this), other, alpha); break; default: AT_ERROR("add_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::add_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor Tensor::add(Scalar other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::add(const_cast<Tensor&>(*this), other, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::add", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor & Tensor::add_(Scalar other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::add_(const_cast<Tensor&>(*this), other, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::add_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor Tensor::addmv(const Tensor & mat, const Tensor & vec, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addmv(const_cast<Tensor&>(*this), mat, vec, beta, alpha); break; default: AT_ERROR("addmv not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addmv", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), mat, vec, beta, alpha); #endif } inline Tensor & Tensor::addmv_(const Tensor & mat, const Tensor & vec, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addmv_(const_cast<Tensor&>(*this), mat, vec, beta, alpha); break; default: AT_ERROR("addmv_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addmv_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), mat, vec, beta, alpha); #endif } inline Tensor Tensor::addr(const Tensor & vec1, const Tensor & vec2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addr(const_cast<Tensor&>(*this), vec1, vec2, beta, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addr", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), vec1, vec2, beta, alpha); #endif } inline Tensor & Tensor::addr_(const Tensor & vec1, const Tensor & vec2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addr_(const_cast<Tensor&>(*this), vec1, vec2, beta, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addr_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), vec1, vec2, beta, alpha); #endif } inline Tensor Tensor::all(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::all(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::all", "dim"); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::all(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::all(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::all", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline bool Tensor::allclose(const Tensor & other, double rtol, double atol, bool equal_nan) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::allclose(const_cast<Tensor&>(*this), other, rtol, atol, equal_nan); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::allclose", ""); return op.callUnboxed<bool, const Tensor &, const Tensor &, double, double, bool>(const_cast<Tensor&>(*this), other, rtol, atol, equal_nan); #endif } inline Tensor Tensor::any(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::any(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::any", "dim"); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::any(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::any(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::any", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::argmax(c10::optional<int64_t> dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::argmax(const_cast<Tensor&>(*this), dim, keepdim); break; default: AT_ERROR("argmax not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::argmax", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<int64_t>, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::argmin(c10::optional<int64_t> dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::argmin(const_cast<Tensor&>(*this), dim, keepdim); break; default: AT_ERROR("argmin not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::argmin", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<int64_t>, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::as_strided(IntArrayRef size, IntArrayRef stride, c10::optional<int64_t> storage_offset) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::as_strided(const_cast<Tensor&>(*this), size, stride, storage_offset); break; case Backend::QuantizedCPU: return QuantizedCPUType::as_strided(const_cast<Tensor&>(*this), size, stride, storage_offset); break; default: AT_ERROR("as_strided not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::as_strided", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, IntArrayRef, c10::optional<int64_t>>(const_cast<Tensor&>(*this), size, stride, storage_offset); #endif } inline Tensor & Tensor::as_strided_(IntArrayRef size, IntArrayRef stride, c10::optional<int64_t> storage_offset) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::as_strided_(const_cast<Tensor&>(*this), size, stride, storage_offset); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::as_strided_", ""); return op.callUnboxed<Tensor &, Tensor &, IntArrayRef, IntArrayRef, c10::optional<int64_t>>(const_cast<Tensor&>(*this), size, stride, storage_offset); #endif } inline Tensor Tensor::asin() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::asin(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::asin", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::asin_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::asin_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::asin_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::atan() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::atan(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::atan", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::atan_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::atan_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("atan_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::atan_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::baddbmm(const Tensor & batch1, const Tensor & batch2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::baddbmm(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); break; default: AT_ERROR("baddbmm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::baddbmm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); #endif } inline Tensor & Tensor::baddbmm_(const Tensor & batch1, const Tensor & batch2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::baddbmm_(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); break; default: AT_ERROR("baddbmm_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::baddbmm_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); #endif } inline Tensor Tensor::bernoulli(Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bernoulli(const_cast<Tensor&>(*this), generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bernoulli", ""); return op.callUnboxed<Tensor, const Tensor &, Generator *>(const_cast<Tensor&>(*this), generator); #endif } inline Tensor & Tensor::bernoulli_(const Tensor & p, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::bernoulli_(const_cast<Tensor&>(*this), p, generator); break; default: AT_ERROR("bernoulli_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bernoulli_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, Generator *>(const_cast<Tensor&>(*this), p, generator); #endif } inline Tensor & Tensor::bernoulli_(double p, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::bernoulli_(const_cast<Tensor&>(*this), p, generator); break; default: AT_ERROR("bernoulli_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bernoulli_", "float"); return op.callUnboxed<Tensor &, Tensor &, double, Generator *>(const_cast<Tensor&>(*this), p, generator); #endif } inline Tensor Tensor::bernoulli(double p, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bernoulli(const_cast<Tensor&>(*this), p, generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bernoulli", "p"); return op.callUnboxed<Tensor, const Tensor &, double, Generator *>(const_cast<Tensor&>(*this), p, generator); #endif } inline Tensor Tensor::bincount(const Tensor & weights, int64_t minlength) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::bincount(const_cast<Tensor&>(*this), weights, minlength); break; default: AT_ERROR("bincount not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bincount", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, int64_t>(const_cast<Tensor&>(*this), weights, minlength); #endif } inline Tensor Tensor::bitwise_not() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_not(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_not", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::bitwise_not_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_not_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_not_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::logical_not() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_not(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_not", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::logical_not_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_not_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_not_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::logical_xor(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_xor(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_xor", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::logical_xor_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_xor_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_xor_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::logical_and(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_and(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_and", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::logical_and_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_and_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_and_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::logical_or(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_or(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_or", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::logical_or_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logical_or_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logical_or_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bmm(const Tensor & mat2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::bmm(const_cast<Tensor&>(*this), mat2); break; default: AT_ERROR("bmm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bmm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mat2); #endif } inline Tensor Tensor::ceil() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ceil(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ceil", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::ceil_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ceil_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ceil_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::vector<Tensor> Tensor::chunk(int64_t chunks, int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::chunk(const_cast<Tensor&>(*this), chunks, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::chunk", ""); return op.callUnboxed<std::vector<Tensor>, const Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), chunks, dim); #endif } inline Tensor Tensor::clamp(c10::optional<Scalar> min, c10::optional<Scalar> max) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::clamp(const_cast<Tensor&>(*this), min, max); break; case Backend::QuantizedCPU: return QuantizedCPUType::clamp(const_cast<Tensor&>(*this), min, max); break; default: AT_ERROR("clamp not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, c10::optional<Scalar>>(const_cast<Tensor&>(*this), min, max); #endif } inline Tensor & Tensor::clamp_(c10::optional<Scalar> min, c10::optional<Scalar> max) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::clamp_(const_cast<Tensor&>(*this), min, max); break; default: AT_ERROR("clamp_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp_", ""); return op.callUnboxed<Tensor &, Tensor &, c10::optional<Scalar>, c10::optional<Scalar>>(const_cast<Tensor&>(*this), min, max); #endif } inline Tensor Tensor::clamp_max(Scalar max) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::clamp_max(const_cast<Tensor&>(*this), max); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp_max", ""); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), max); #endif } inline Tensor & Tensor::clamp_max_(Scalar max) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::clamp_max_(const_cast<Tensor&>(*this), max); break; default: AT_ERROR("clamp_max_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp_max_", ""); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), max); #endif } inline Tensor Tensor::clamp_min(Scalar min) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::clamp_min(const_cast<Tensor&>(*this), min); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp_min", ""); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), min); #endif } inline Tensor & Tensor::clamp_min_(Scalar min) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::clamp_min_(const_cast<Tensor&>(*this), min); break; default: AT_ERROR("clamp_min_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clamp_min_", ""); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), min); #endif } inline Tensor Tensor::contiguous(MemoryFormat memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::contiguous(const_cast<Tensor&>(*this), memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::contiguous", ""); return op.callUnboxed<Tensor, const Tensor &, MemoryFormat>(const_cast<Tensor&>(*this), memory_format); #endif } inline Tensor & Tensor::copy_(const Tensor & src, bool non_blocking) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::copy_(const_cast<Tensor&>(*this), src, non_blocking); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::copy_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, bool>(const_cast<Tensor&>(*this), src, non_blocking); #endif } inline Tensor Tensor::cos() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cos(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cos", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::cos_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::cos_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("cos_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cos_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::cosh() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cosh(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cosh", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::cosh_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::cosh_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("cosh_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cosh_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::tuple<Tensor,Tensor> Tensor::cummax(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cummax(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cummax", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline std::tuple<Tensor,Tensor> Tensor::cummax(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cummax(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cummax", "dimname"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline std::tuple<Tensor,Tensor> Tensor::cummin(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cummin(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cummin", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline std::tuple<Tensor,Tensor> Tensor::cummin(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cummin(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cummin", "dimname"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::cumprod(int64_t dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cumprod(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cumprod", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::cumprod(Dimname dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cumprod(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cumprod", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::cumsum(int64_t dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cumsum(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cumsum", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::cumsum(Dimname dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cumsum(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cumsum", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::det() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::det(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::det", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::diag_embed(int64_t offset, int64_t dim1, int64_t dim2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::diag_embed(const_cast<Tensor&>(*this), offset, dim1, dim2); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::diag_embed", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), offset, dim1, dim2); #endif } inline Tensor Tensor::diagflat(int64_t offset) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::diagflat(const_cast<Tensor&>(*this), offset); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::diagflat", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), offset); #endif } inline Tensor Tensor::diagonal(int64_t offset, int64_t dim1, int64_t dim2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::diagonal(const_cast<Tensor&>(*this), offset, dim1, dim2); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::diagonal", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), offset, dim1, dim2); #endif } inline Tensor Tensor::diagonal(Dimname outdim, Dimname dim1, Dimname dim2, int64_t offset) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::diagonal(const_cast<Tensor&>(*this), outdim, dim1, dim2, offset); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::diagonal", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, Dimname, Dimname, int64_t>(const_cast<Tensor&>(*this), outdim, dim1, dim2, offset); #endif } inline Tensor & Tensor::fill_diagonal_(Scalar fill_value, bool wrap) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::fill_diagonal_(const_cast<Tensor&>(*this), fill_value, wrap); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fill_diagonal_", ""); return op.callUnboxed<Tensor &, Tensor &, Scalar, bool>(const_cast<Tensor&>(*this), fill_value, wrap); #endif } inline Tensor Tensor::div(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::div(const_cast<Tensor&>(*this), other); break; case Backend::SparseCPU: return SparseCPUType::div(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("div not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::div", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::div_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::div_(const_cast<Tensor&>(*this), other); break; case Backend::SparseCPU: return SparseCPUType::div_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("div_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::div_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::div(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::div(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::div", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::div_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::div_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::div_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::dot(const Tensor & tensor) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::dot(const_cast<Tensor&>(*this), tensor); break; default: AT_ERROR("dot not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::dot", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), tensor); #endif } inline Tensor Tensor::new_empty(IntArrayRef size, const TensorOptions & options) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::new_empty(const_cast<Tensor&>(*this), size, options); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::new_empty", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, const TensorOptions &>(const_cast<Tensor&>(*this), size, options); #endif } inline Tensor Tensor::new_full(IntArrayRef size, Scalar fill_value, const TensorOptions & options) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::new_full(const_cast<Tensor&>(*this), size, fill_value, options); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::new_full", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, Scalar, const TensorOptions &>(const_cast<Tensor&>(*this), size, fill_value, options); #endif } inline Tensor Tensor::new_zeros(IntArrayRef size, const TensorOptions & options) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::new_zeros(const_cast<Tensor&>(*this), size, options); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::new_zeros", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, const TensorOptions &>(const_cast<Tensor&>(*this), size, options); #endif } inline Tensor & Tensor::resize_(IntArrayRef size, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::resize_(const_cast<Tensor&>(*this), size, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::resize_", ""); return op.callUnboxed<Tensor &, Tensor &, IntArrayRef, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), size, memory_format); #endif } inline Tensor Tensor::erf() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::erf(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erf", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::erf_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::erf_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("erf_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erf_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::erfc() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::erfc(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erfc", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::erfc_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::erfc_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("erfc_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erfc_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::exp() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::exp(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::exp", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::exp_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::exp_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("exp_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::exp_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::expm1() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::expm1(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::expm1", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::expm1_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::expm1_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::expm1_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::expand(IntArrayRef size, bool implicit) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::expand(const_cast<Tensor&>(*this), size, implicit); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::expand", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool>(const_cast<Tensor&>(*this), size, implicit); #endif } inline Tensor Tensor::expand_as(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::expand_as(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::expand_as", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::flatten(int64_t start_dim, int64_t end_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::flatten(const_cast<Tensor&>(*this), start_dim, end_dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::flatten", "using_ints"); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), start_dim, end_dim); #endif } inline Tensor Tensor::flatten(int64_t start_dim, int64_t end_dim, Dimname out_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::flatten(const_cast<Tensor&>(*this), start_dim, end_dim, out_dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::flatten", "named_out_dim"); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, Dimname>(const_cast<Tensor&>(*this), start_dim, end_dim, out_dim); #endif } inline Tensor Tensor::flatten(Dimname start_dim, Dimname end_dim, Dimname out_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::flatten(const_cast<Tensor&>(*this), start_dim, end_dim, out_dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::flatten", "using_names"); return op.callUnboxed<Tensor, const Tensor &, Dimname, Dimname, Dimname>(const_cast<Tensor&>(*this), start_dim, end_dim, out_dim); #endif } inline Tensor Tensor::flatten(DimnameList dims, Dimname out_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::flatten(const_cast<Tensor&>(*this), dims, out_dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::flatten", "DimnameList"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, Dimname>(const_cast<Tensor&>(*this), dims, out_dim); #endif } inline Tensor & Tensor::fill_(Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::fill_(const_cast<Tensor&>(*this), value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fill_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), value); #endif } inline Tensor & Tensor::fill_(const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::fill_(const_cast<Tensor&>(*this), value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fill_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), value); #endif } inline Tensor Tensor::floor() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::floor(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::floor", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::floor_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::floor_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::floor_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::frac() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::frac(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::frac", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::frac_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::frac_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::frac_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::ger(const Tensor & vec2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ger(const_cast<Tensor&>(*this), vec2); break; default: AT_ERROR("ger not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ger", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), vec2); #endif } inline Tensor Tensor::fft(int64_t signal_ndim, bool normalized) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::fft(const_cast<Tensor&>(*this), signal_ndim, normalized); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fft", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), signal_ndim, normalized); #endif } inline Tensor Tensor::ifft(int64_t signal_ndim, bool normalized) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ifft(const_cast<Tensor&>(*this), signal_ndim, normalized); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ifft", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), signal_ndim, normalized); #endif } inline Tensor Tensor::rfft(int64_t signal_ndim, bool normalized, bool onesided) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rfft(const_cast<Tensor&>(*this), signal_ndim, normalized, onesided); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rfft", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool, bool>(const_cast<Tensor&>(*this), signal_ndim, normalized, onesided); #endif } inline Tensor Tensor::irfft(int64_t signal_ndim, bool normalized, bool onesided, IntArrayRef signal_sizes) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::irfft(const_cast<Tensor&>(*this), signal_ndim, normalized, onesided, signal_sizes); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::irfft", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool, bool, IntArrayRef>(const_cast<Tensor&>(*this), signal_ndim, normalized, onesided, signal_sizes); #endif } inline Tensor Tensor::index(TensorList indices) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index(const_cast<Tensor&>(*this), indices); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, TensorList>(const_cast<Tensor&>(*this), indices); #endif } inline Tensor & Tensor::index_copy_(int64_t dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_copy_(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_copy_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor Tensor::index_copy(int64_t dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_copy(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_copy", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor & Tensor::index_copy_(Dimname dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_copy_(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_copy_", "dimname"); return op.callUnboxed<Tensor &, Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor Tensor::index_copy(Dimname dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_copy(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_copy", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor & Tensor::index_put_(TensorList indices, const Tensor & values, bool accumulate) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_put_(const_cast<Tensor&>(*this), indices, values, accumulate); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_put_", ""); return op.callUnboxed<Tensor &, Tensor &, TensorList, const Tensor &, bool>(const_cast<Tensor&>(*this), indices, values, accumulate); #endif } inline Tensor Tensor::index_put(TensorList indices, const Tensor & values, bool accumulate) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_put(const_cast<Tensor&>(*this), indices, values, accumulate); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_put", ""); return op.callUnboxed<Tensor, const Tensor &, TensorList, const Tensor &, bool>(const_cast<Tensor&>(*this), indices, values, accumulate); #endif } inline Tensor Tensor::inverse() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::inverse(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::inverse", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::isclose(const Tensor & other, double rtol, double atol, bool equal_nan) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::isclose(const_cast<Tensor&>(*this), other, rtol, atol, equal_nan); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::isclose", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, double, double, bool>(const_cast<Tensor&>(*this), other, rtol, atol, equal_nan); #endif } inline bool Tensor::is_distributed() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_distributed(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_distributed", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_floating_point() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_floating_point(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_floating_point", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_complex() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_complex(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_complex", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_nonzero() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_nonzero(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_nonzero", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_same_size(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_same_size(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_same_size", ""); return op.callUnboxed<bool, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline bool Tensor::is_signed() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_signed(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_signed", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::tuple<Tensor,Tensor> Tensor::kthvalue(int64_t k, int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::kthvalue(const_cast<Tensor&>(*this), k, dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::kthvalue", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, int64_t, bool>(const_cast<Tensor&>(*this), k, dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::kthvalue(int64_t k, Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::kthvalue(const_cast<Tensor&>(*this), k, dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::kthvalue", "dimname"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, Dimname, bool>(const_cast<Tensor&>(*this), k, dim, keepdim); #endif } inline Tensor Tensor::log() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::log_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::log10() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log10(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log10", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::log10_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log10_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log10_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::log1p() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log1p(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log1p", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::log1p_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::log1p_(const_cast<Tensor&>(*this)); break; case Backend::SparseCPU: return SparseCPUType::log1p_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("log1p_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log1p_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::log2() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log2(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log2", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::log2_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log2_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log2_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::logdet() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logdet(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logdet", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::log_softmax(int64_t dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log_softmax(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log_softmax", "int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::log_softmax(Dimname dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log_softmax(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log_softmax", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::logsumexp(IntArrayRef dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logsumexp(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logsumexp", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::logsumexp(DimnameList dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::logsumexp(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::logsumexp", "names"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::matmul(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::matmul(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::matmul", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::matrix_power(int64_t n) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::matrix_power(const_cast<Tensor&>(*this), n); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::matrix_power", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), n); #endif } inline std::tuple<Tensor,Tensor> Tensor::max(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::max(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max", "dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::max_values(IntArrayRef dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::max_values(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max_values", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::max(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::max(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max", "names_dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::max_values(DimnameList dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::max_values(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max_values", "names"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::mean(c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mean(const_cast<Tensor&>(*this), dtype); break; case Backend::QuantizedCPU: return QuantizedCPUType::mean(const_cast<Tensor&>(*this), dtype); break; default: AT_ERROR("mean not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mean", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dtype); #endif } inline Tensor Tensor::mean(IntArrayRef dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mean(const_cast<Tensor&>(*this), dim, keepdim, dtype); break; case Backend::QuantizedCPU: return QuantizedCPUType::mean(const_cast<Tensor&>(*this), dim, keepdim, dtype); break; default: AT_ERROR("mean not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mean", "dim"); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline Tensor Tensor::mean(DimnameList dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mean(const_cast<Tensor&>(*this), dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mean", "names_dim"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline std::tuple<Tensor,Tensor> Tensor::median(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::median(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::median", "dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::median(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::median(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::median", "names_dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::min(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::min(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min", "dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::min_values(IntArrayRef dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::min_values(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min_values", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::min(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::min(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min", "names_dim"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::min_values(DimnameList dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::min_values(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min_values", "names"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::mm(const Tensor & mat2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mm(const_cast<Tensor&>(*this), mat2); break; case Backend::SparseCPU: return SparseCPUType::mm(const_cast<Tensor&>(*this), mat2); break; default: AT_ERROR("mm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mat2); #endif } inline std::tuple<Tensor,Tensor> Tensor::mode(int64_t dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mode(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mode", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline std::tuple<Tensor,Tensor> Tensor::mode(Dimname dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mode(const_cast<Tensor&>(*this), dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mode", "dimname"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, keepdim); #endif } inline Tensor Tensor::mul(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mul(const_cast<Tensor&>(*this), other); break; case Backend::SparseCPU: return SparseCPUType::mul(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("mul not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mul", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::mul_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mul_(const_cast<Tensor&>(*this), other); break; case Backend::SparseCPU: return SparseCPUType::mul_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("mul_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mul_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::mul(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mul(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mul", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::mul_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mul_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mul_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::mv(const Tensor & vec) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::mv(const_cast<Tensor&>(*this), vec); break; default: AT_ERROR("mv not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mv", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), vec); #endif } inline Tensor Tensor::mvlgamma(int64_t p) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mvlgamma(const_cast<Tensor&>(*this), p); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mvlgamma", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), p); #endif } inline Tensor & Tensor::mvlgamma_(int64_t p) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::mvlgamma_(const_cast<Tensor&>(*this), p); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::mvlgamma_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), p); #endif } inline Tensor Tensor::narrow_copy(int64_t dim, int64_t start, int64_t length) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::narrow_copy(const_cast<Tensor&>(*this), dim, start, length); break; case Backend::SparseCPU: return SparseCPUType::narrow_copy(const_cast<Tensor&>(*this), dim, start, length); break; default: AT_ERROR("narrow_copy not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::narrow_copy", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), dim, start, length); #endif } inline Tensor Tensor::narrow(int64_t dim, int64_t start, int64_t length) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::narrow(const_cast<Tensor&>(*this), dim, start, length); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::narrow", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), dim, start, length); #endif } inline Tensor Tensor::permute(IntArrayRef dims) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::permute(const_cast<Tensor&>(*this), dims); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::permute", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), dims); #endif } inline Tensor Tensor::numpy_T() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::numpy_T(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::numpy_T", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_pinned() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::is_pinned(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_pinned", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::pin_memory() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::pin_memory(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pin_memory", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::pinverse(double rcond) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::pinverse(const_cast<Tensor&>(*this), rcond); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pinverse", ""); return op.callUnboxed<Tensor, const Tensor &, double>(const_cast<Tensor&>(*this), rcond); #endif } inline Tensor Tensor::reciprocal() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::reciprocal(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::reciprocal", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::reciprocal_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::reciprocal_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::reciprocal_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::neg() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::neg(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::neg", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::neg_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::neg_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::neg_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::repeat(IntArrayRef repeats) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::repeat(const_cast<Tensor&>(*this), repeats); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::repeat", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), repeats); #endif } inline Tensor Tensor::repeat_interleave(const Tensor & repeats, c10::optional<int64_t> dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::repeat_interleave(const_cast<Tensor&>(*this), repeats, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::repeat_interleave", "self_Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, c10::optional<int64_t>>(const_cast<Tensor&>(*this), repeats, dim); #endif } inline Tensor Tensor::repeat_interleave(int64_t repeats, c10::optional<int64_t> dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::repeat_interleave(const_cast<Tensor&>(*this), repeats, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::repeat_interleave", "self_int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<int64_t>>(const_cast<Tensor&>(*this), repeats, dim); #endif } inline Tensor Tensor::reshape(IntArrayRef shape) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::reshape(const_cast<Tensor&>(*this), shape); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::reshape", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), shape); #endif } inline Tensor Tensor::reshape_as(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::reshape_as(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::reshape_as", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::round() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::round(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::round", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::round_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::round_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::round_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::relu() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::relu(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::relu(const_cast<Tensor&>(*this)); break; default: AT_ERROR("relu not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::relu", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::relu_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::relu_(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::relu_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("relu_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::relu_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::prelu(const Tensor & weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::prelu(const_cast<Tensor&>(*this), weight); break; default: AT_ERROR("prelu not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::prelu", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), weight); #endif } inline std::tuple<Tensor,Tensor> Tensor::prelu_backward(const Tensor & grad_output, const Tensor & weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::prelu_backward(grad_output, const_cast<Tensor&>(*this), weight); break; default: AT_ERROR("prelu_backward not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::prelu_backward", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, const Tensor &, const Tensor &>(grad_output, const_cast<Tensor&>(*this), weight); #endif } inline Tensor Tensor::hardshrink(Scalar lambd) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::hardshrink(const_cast<Tensor&>(*this), lambd); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::hardshrink", ""); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), lambd); #endif } inline Tensor Tensor::hardshrink_backward(const Tensor & grad_out, Scalar lambd) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::hardshrink_backward(grad_out, const_cast<Tensor&>(*this), lambd); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::hardshrink_backward", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(grad_out, const_cast<Tensor&>(*this), lambd); #endif } inline Tensor Tensor::rsqrt() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rsqrt(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rsqrt", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::rsqrt_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rsqrt_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rsqrt_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::select(Dimname dim, int64_t index) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::select(const_cast<Tensor&>(*this), dim, index); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::select", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, int64_t>(const_cast<Tensor&>(*this), dim, index); #endif } inline Tensor Tensor::select(int64_t dim, int64_t index) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::select(const_cast<Tensor&>(*this), dim, index); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::select", "int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), dim, index); #endif } inline Tensor Tensor::sigmoid() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::sigmoid(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::sigmoid(const_cast<Tensor&>(*this)); break; default: AT_ERROR("sigmoid not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sigmoid", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::sigmoid_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::sigmoid_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("sigmoid_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sigmoid_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::sin() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sin(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sin", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::sin_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sin_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sin_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::sinh() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sinh(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sinh", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::sinh_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sinh_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sinh_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::detach() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::detach(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::detach", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::detach_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::detach_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::detach_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::size(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::size(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::size", "int"); return op.callUnboxed<int64_t, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline int64_t Tensor::size(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::size(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::size", "Dimname"); return op.callUnboxed<int64_t, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::slice(int64_t dim, int64_t start, int64_t end, int64_t step) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::slice(const_cast<Tensor&>(*this), dim, start, end, step); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::slice", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), dim, start, end, step); #endif } inline std::tuple<Tensor,Tensor> Tensor::slogdet() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::slogdet(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::slogdet", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::smm(const Tensor & mat2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::smm(const_cast<Tensor&>(*this), mat2); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::smm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mat2); #endif } inline Tensor Tensor::softmax(int64_t dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::softmax(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::softmax", "int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline Tensor Tensor::softmax(Dimname dim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::softmax(const_cast<Tensor&>(*this), dim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::softmax", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, dtype); #endif } inline std::vector<Tensor> Tensor::split(int64_t split_size, int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::split(const_cast<Tensor&>(*this), split_size, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::split", "Tensor"); return op.callUnboxed<std::vector<Tensor>, const Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), split_size, dim); #endif } inline std::vector<Tensor> Tensor::split_with_sizes(IntArrayRef split_sizes, int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::split_with_sizes(const_cast<Tensor&>(*this), split_sizes, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::split_with_sizes", ""); return op.callUnboxed<std::vector<Tensor>, const Tensor &, IntArrayRef, int64_t>(const_cast<Tensor&>(*this), split_sizes, dim); #endif } inline Tensor Tensor::squeeze() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::squeeze(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze", "dim"); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::squeeze(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor & Tensor::squeeze_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::squeeze_(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze_(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze_", "dim"); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor & Tensor::squeeze_(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::squeeze_(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::squeeze_", "dimname"); return op.callUnboxed<Tensor &, Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::sspaddmm(const Tensor & mat1, const Tensor & mat2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sspaddmm(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sspaddmm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); #endif } inline Tensor Tensor::stft(int64_t n_fft, c10::optional<int64_t> hop_length, c10::optional<int64_t> win_length, const Tensor & window, bool normalized, bool onesided) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::stft(const_cast<Tensor&>(*this), n_fft, hop_length, win_length, window, normalized, onesided); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::stft", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, c10::optional<int64_t>, c10::optional<int64_t>, const Tensor &, bool, bool>(const_cast<Tensor&>(*this), n_fft, hop_length, win_length, window, normalized, onesided); #endif } inline int64_t Tensor::stride(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::stride(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::stride", "int"); return op.callUnboxed<int64_t, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline int64_t Tensor::stride(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::stride(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::stride", "Dimname"); return op.callUnboxed<int64_t, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::sum(c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sum(const_cast<Tensor&>(*this), dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sum", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dtype); #endif } inline Tensor Tensor::sum(IntArrayRef dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sum(const_cast<Tensor&>(*this), dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sum", "dim_IntList"); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline Tensor Tensor::sum(DimnameList dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sum(const_cast<Tensor&>(*this), dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sum", "dim_DimnameList"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline Tensor Tensor::sum_to_size(IntArrayRef size) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sum_to_size(const_cast<Tensor&>(*this), size); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sum_to_size", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), size); #endif } inline Tensor Tensor::sqrt() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sqrt(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sqrt", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::sqrt_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sqrt_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sqrt_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::square() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::square(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::square", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::square_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::square_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::square_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::std(bool unbiased) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::std(const_cast<Tensor&>(*this), unbiased); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::std", ""); return op.callUnboxed<Tensor, const Tensor &, bool>(const_cast<Tensor&>(*this), unbiased); #endif } inline Tensor Tensor::std(IntArrayRef dim, bool unbiased, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::std(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::std", "dim"); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool, bool>(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #endif } inline Tensor Tensor::std(DimnameList dim, bool unbiased, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::std(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::std", "names_dim"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool, bool>(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #endif } inline Tensor Tensor::prod(c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::prod(const_cast<Tensor&>(*this), dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::prod", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dtype); #endif } inline Tensor Tensor::prod(int64_t dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::prod(const_cast<Tensor&>(*this), dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::prod", "dim_int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline Tensor Tensor::prod(Dimname dim, bool keepdim, c10::optional<ScalarType> dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::prod(const_cast<Tensor&>(*this), dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::prod", "dim_Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, bool, c10::optional<ScalarType>>(const_cast<Tensor&>(*this), dim, keepdim, dtype); #endif } inline Tensor Tensor::t() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::t(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::t", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::t_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::t_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::t_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::tan() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::tan(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tan", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::tan_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::tan_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("tan_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tan_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::tanh() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::tanh(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::tanh(const_cast<Tensor&>(*this)); break; default: AT_ERROR("tanh not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tanh", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::tanh_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::tanh_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("tanh_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tanh_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::transpose(int64_t dim0, int64_t dim1) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::transpose(const_cast<Tensor&>(*this), dim0, dim1); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::transpose", "int"); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), dim0, dim1); #endif } inline Tensor Tensor::transpose(Dimname dim0, Dimname dim1) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::transpose(const_cast<Tensor&>(*this), dim0, dim1); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::transpose", "Dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, Dimname>(const_cast<Tensor&>(*this), dim0, dim1); #endif } inline Tensor & Tensor::transpose_(int64_t dim0, int64_t dim1) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::transpose_(const_cast<Tensor&>(*this), dim0, dim1); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::transpose_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t, int64_t>(const_cast<Tensor&>(*this), dim0, dim1); #endif } inline Tensor Tensor::flip(IntArrayRef dims) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::flip(const_cast<Tensor&>(*this), dims); break; default: AT_ERROR("flip not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::flip", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), dims); #endif } inline Tensor Tensor::roll(IntArrayRef shifts, IntArrayRef dims) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::roll(const_cast<Tensor&>(*this), shifts, dims); break; default: AT_ERROR("roll not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::roll", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, IntArrayRef>(const_cast<Tensor&>(*this), shifts, dims); #endif } inline Tensor Tensor::rot90(int64_t k, IntArrayRef dims) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::rot90(const_cast<Tensor&>(*this), k, dims); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::rot90", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, IntArrayRef>(const_cast<Tensor&>(*this), k, dims); #endif } inline Tensor Tensor::trunc() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::trunc(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::trunc", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::trunc_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::trunc_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::trunc_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::type_as(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::type_as(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::type_as", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::unsqueeze(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unsqueeze(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unsqueeze", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor & Tensor::unsqueeze_(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unsqueeze_(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unsqueeze_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::var(bool unbiased) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::var(const_cast<Tensor&>(*this), unbiased); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::var", ""); return op.callUnboxed<Tensor, const Tensor &, bool>(const_cast<Tensor&>(*this), unbiased); #endif } inline Tensor Tensor::var(IntArrayRef dim, bool unbiased, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::var(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::var", "dim"); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef, bool, bool>(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #endif } inline Tensor Tensor::var(DimnameList dim, bool unbiased, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::var(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::var", "names_dim"); return op.callUnboxed<Tensor, const Tensor &, DimnameList, bool, bool>(const_cast<Tensor&>(*this), dim, unbiased, keepdim); #endif } inline Tensor Tensor::view_as(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::view_as(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::view_as", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::where(const Tensor & condition, const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::where(condition, const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::where", "self"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &>(condition, const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::norm(c10::optional<Scalar> p, ScalarType dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "ScalarOpt_dtype"); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, ScalarType>(const_cast<Tensor&>(*this), p, dtype); #endif } inline Tensor Tensor::norm(Scalar p) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), p); #endif } inline Tensor Tensor::norm(c10::optional<Scalar> p, IntArrayRef dim, bool keepdim, ScalarType dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p, dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "ScalarOpt_dim_dtype"); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, IntArrayRef, bool, ScalarType>(const_cast<Tensor&>(*this), p, dim, keepdim, dtype); #endif } inline Tensor Tensor::norm(c10::optional<Scalar> p, IntArrayRef dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p, dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "ScalarOpt_dim"); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, IntArrayRef, bool>(const_cast<Tensor&>(*this), p, dim, keepdim); #endif } inline Tensor Tensor::norm(c10::optional<Scalar> p, DimnameList dim, bool keepdim, ScalarType dtype) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p, dim, keepdim, dtype); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "names_ScalarOpt_dim_dtype"); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, DimnameList, bool, ScalarType>(const_cast<Tensor&>(*this), p, dim, keepdim, dtype); #endif } inline Tensor Tensor::norm(c10::optional<Scalar> p, DimnameList dim, bool keepdim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::norm(const_cast<Tensor&>(*this), p, dim, keepdim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::norm", "names_ScalarOpt_dim"); return op.callUnboxed<Tensor, const Tensor &, c10::optional<Scalar>, DimnameList, bool>(const_cast<Tensor&>(*this), p, dim, keepdim); #endif } inline Tensor Tensor::clone(c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::clone(const_cast<Tensor&>(*this), memory_format); break; case Backend::QuantizedCPU: return QuantizedCPUType::clone(const_cast<Tensor&>(*this), memory_format); break; case Backend::SparseCPU: return SparseCPUType::clone(const_cast<Tensor&>(*this), memory_format); break; default: AT_ERROR("clone not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::clone", ""); return op.callUnboxed<Tensor, const Tensor &, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), memory_format); #endif } inline Tensor & Tensor::resize_as_(const Tensor & the_template, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::resize_as_(const_cast<Tensor&>(*this), the_template, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::resize_as_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), the_template, memory_format); #endif } inline Tensor Tensor::pow(Scalar exponent) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::pow(const_cast<Tensor&>(*this), exponent); break; case Backend::SparseCPU: return SparseCPUType::pow(const_cast<Tensor&>(*this), exponent); break; default: AT_ERROR("pow not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pow", "Tensor_Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), exponent); #endif } inline Tensor & Tensor::zero_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::zero_(const_cast<Tensor&>(*this)); break; case Backend::SparseCPU: return SparseCPUType::zero_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("zero_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::zero_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::sub(const Tensor & other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::sub(const_cast<Tensor&>(*this), other, alpha); break; case Backend::SparseCPU: return SparseCPUType::sub(const_cast<Tensor&>(*this), other, alpha); break; default: AT_ERROR("sub not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sub", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor & Tensor::sub_(const Tensor & other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::sub_(const_cast<Tensor&>(*this), other, alpha); break; case Backend::SparseCPU: return SparseCPUType::sub_(const_cast<Tensor&>(*this), other, alpha); break; default: AT_ERROR("sub_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sub_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor Tensor::sub(Scalar other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sub(const_cast<Tensor&>(*this), other, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sub", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor & Tensor::sub_(Scalar other, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sub_(const_cast<Tensor&>(*this), other, alpha); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sub_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), other, alpha); #endif } inline Tensor Tensor::addmm(const Tensor & mat1, const Tensor & mat2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addmm(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); break; case Backend::SparseCPU: return SparseCPUType::addmm(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); break; default: AT_ERROR("addmm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addmm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); #endif } inline Tensor & Tensor::addmm_(const Tensor & mat1, const Tensor & mat2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addmm_(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); break; case Backend::SparseCPU: return SparseCPUType::addmm_(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); break; default: AT_ERROR("addmm_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addmm_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), mat1, mat2, beta, alpha); #endif } inline Tensor & Tensor::sparse_resize_(IntArrayRef size, int64_t sparse_dim, int64_t dense_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::sparse_resize_(const_cast<Tensor&>(*this), size, sparse_dim, dense_dim); break; default: AT_ERROR("sparse_resize_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sparse_resize_", ""); return op.callUnboxed<Tensor &, Tensor &, IntArrayRef, int64_t, int64_t>(const_cast<Tensor&>(*this), size, sparse_dim, dense_dim); #endif } inline Tensor & Tensor::sparse_resize_and_clear_(IntArrayRef size, int64_t sparse_dim, int64_t dense_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::sparse_resize_and_clear_(const_cast<Tensor&>(*this), size, sparse_dim, dense_dim); break; default: AT_ERROR("sparse_resize_and_clear_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sparse_resize_and_clear_", ""); return op.callUnboxed<Tensor &, Tensor &, IntArrayRef, int64_t, int64_t>(const_cast<Tensor&>(*this), size, sparse_dim, dense_dim); #endif } inline Tensor Tensor::sparse_mask(const Tensor & mask) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::sparse_mask(const_cast<Tensor&>(*this), mask); break; default: AT_ERROR("sparse_mask not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sparse_mask", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask); #endif } inline Tensor Tensor::to_dense() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::to_dense(const_cast<Tensor&>(*this)); break; default: AT_ERROR("to_dense not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to_dense", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::sparse_dim() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::sparse_dim(const_cast<Tensor&>(*this)); break; default: AT_ERROR("sparse_dim not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sparse_dim", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::_dimI() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_dimI(const_cast<Tensor&>(*this)); break; default: AT_ERROR("_dimI not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_dimI", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::dense_dim() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::dense_dim(const_cast<Tensor&>(*this)); break; default: AT_ERROR("dense_dim not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::dense_dim", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::_dimV() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_dimV(const_cast<Tensor&>(*this)); break; default: AT_ERROR("_dimV not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_dimV", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::_nnz() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_nnz(const_cast<Tensor&>(*this)); break; default: AT_ERROR("_nnz not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_nnz", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::coalesce() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::coalesce(const_cast<Tensor&>(*this)); break; default: AT_ERROR("coalesce not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::coalesce", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline bool Tensor::is_coalesced() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::is_coalesced(const_cast<Tensor&>(*this)); break; default: AT_ERROR("is_coalesced not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_coalesced", ""); return op.callUnboxed<bool, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::_indices() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_indices(const_cast<Tensor&>(*this)); break; default: AT_ERROR("_indices not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_indices", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::_values() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_values(const_cast<Tensor&>(*this)); break; default: AT_ERROR("_values not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_values", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::_coalesced_(bool coalesced) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::_coalesced_(const_cast<Tensor&>(*this), coalesced); break; default: AT_ERROR("_coalesced_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::_coalesced_", ""); return op.callUnboxed<Tensor &, Tensor &, bool>(const_cast<Tensor&>(*this), coalesced); #endif } inline Tensor Tensor::indices() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::indices(const_cast<Tensor&>(*this)); break; default: AT_ERROR("indices not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::indices", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::values() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::SparseCPU: return SparseCPUType::values(const_cast<Tensor&>(*this)); break; default: AT_ERROR("values not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::values", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::vector<Tensor> Tensor::unbind(int64_t dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unbind(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unbind", "int"); return op.callUnboxed<std::vector<Tensor>, const Tensor &, int64_t>(const_cast<Tensor&>(*this), dim); #endif } inline std::vector<Tensor> Tensor::unbind(Dimname dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::unbind(const_cast<Tensor&>(*this), dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unbind", "Dimname"); return op.callUnboxed<std::vector<Tensor>, const Tensor &, Dimname>(const_cast<Tensor&>(*this), dim); #endif } inline Tensor Tensor::to_sparse(int64_t sparse_dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::to_sparse(const_cast<Tensor&>(*this), sparse_dim); break; default: AT_ERROR("to_sparse not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to_sparse", "sparse_dim"); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), sparse_dim); #endif } inline Tensor Tensor::to_sparse() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::to_sparse(const_cast<Tensor&>(*this)); break; default: AT_ERROR("to_sparse not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to_sparse", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::to_mkldnn() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::to_mkldnn(const_cast<Tensor&>(*this)); break; default: AT_ERROR("to_mkldnn not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to_mkldnn", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::dequantize() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::dequantize(const_cast<Tensor&>(*this)); break; default: AT_ERROR("dequantize not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::dequantize", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline double Tensor::q_scale() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::q_scale(const_cast<Tensor&>(*this)); break; default: AT_ERROR("q_scale not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::q_scale", ""); return op.callUnboxed<double, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::q_zero_point() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::q_zero_point(const_cast<Tensor&>(*this)); break; default: AT_ERROR("q_zero_point not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::q_zero_point", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::q_per_channel_scales() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::q_per_channel_scales(const_cast<Tensor&>(*this)); break; default: AT_ERROR("q_per_channel_scales not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::q_per_channel_scales", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::q_per_channel_zero_points() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::q_per_channel_zero_points(const_cast<Tensor&>(*this)); break; default: AT_ERROR("q_per_channel_zero_points not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::q_per_channel_zero_points", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline int64_t Tensor::q_per_channel_axis() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::q_per_channel_axis(const_cast<Tensor&>(*this)); break; default: AT_ERROR("q_per_channel_axis not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::q_per_channel_axis", ""); return op.callUnboxed<int64_t, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::int_repr() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::int_repr(const_cast<Tensor&>(*this)); break; default: AT_ERROR("int_repr not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::int_repr", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline QScheme Tensor::qscheme() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::qscheme(const_cast<Tensor&>(*this)); break; default: AT_ERROR("qscheme not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::qscheme", ""); return op.callUnboxed<QScheme, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::to(const TensorOptions & options, bool non_blocking, bool copy, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::to(const_cast<Tensor&>(*this), options, non_blocking, copy, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to", "dtype_layout"); return op.callUnboxed<Tensor, const Tensor &, const TensorOptions &, bool, bool, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), options, non_blocking, copy, memory_format); #endif } inline Tensor Tensor::to(Device device, ScalarType dtype, bool non_blocking, bool copy, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::to(const_cast<Tensor&>(*this), device, dtype, non_blocking, copy, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to", "device"); return op.callUnboxed<Tensor, const Tensor &, Device, ScalarType, bool, bool, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), device, dtype, non_blocking, copy, memory_format); #endif } inline Tensor Tensor::to(ScalarType dtype, bool non_blocking, bool copy, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::to(const_cast<Tensor&>(*this), dtype, non_blocking, copy, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to", "dtype"); return op.callUnboxed<Tensor, const Tensor &, ScalarType, bool, bool, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), dtype, non_blocking, copy, memory_format); #endif } inline Tensor Tensor::to(const Tensor & other, bool non_blocking, bool copy, c10::optional<MemoryFormat> memory_format) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::to(const_cast<Tensor&>(*this), other, non_blocking, copy, memory_format); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::to", "other"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, bool, bool, c10::optional<MemoryFormat>>(const_cast<Tensor&>(*this), other, non_blocking, copy, memory_format); #endif } inline Scalar Tensor::item() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::item(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::item", ""); return op.callUnboxed<Scalar, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::set_(Storage source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::set_(const_cast<Tensor&>(*this), source); break; default: AT_ERROR("set_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_", "source_Storage"); return op.callUnboxed<Tensor &, Tensor &, Storage>(const_cast<Tensor&>(*this), source); #endif } inline Tensor & Tensor::set_(Storage source, int64_t storage_offset, IntArrayRef size, IntArrayRef stride) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::set_(const_cast<Tensor&>(*this), source, storage_offset, size, stride); break; case Backend::QuantizedCPU: return QuantizedCPUType::set_(const_cast<Tensor&>(*this), source, storage_offset, size, stride); break; default: AT_ERROR("set_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_", "source_Storage_storage_offset"); return op.callUnboxed<Tensor &, Tensor &, Storage, int64_t, IntArrayRef, IntArrayRef>(const_cast<Tensor&>(*this), source, storage_offset, size, stride); #endif } inline Tensor & Tensor::set_(const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::set_(const_cast<Tensor&>(*this), source); break; default: AT_ERROR("set_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_", "source_Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), source); #endif } inline Tensor & Tensor::set_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::set_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("set_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::set_quantizer_(ConstQuantizerPtr quantizer) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::QuantizedCPU: return QuantizedCPUType::set_quantizer_(const_cast<Tensor&>(*this), quantizer); break; default: AT_ERROR("set_quantizer_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::set_quantizer_", ""); return op.callUnboxed<Tensor &, Tensor &, ConstQuantizerPtr>(const_cast<Tensor&>(*this), quantizer); #endif } inline bool Tensor::is_set_to(const Tensor & tensor) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::is_set_to(const_cast<Tensor&>(*this), tensor); break; default: AT_ERROR("is_set_to not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::is_set_to", ""); return op.callUnboxed<bool, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), tensor); #endif } inline Tensor & Tensor::masked_fill_(const Tensor & mask, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::masked_fill_(const_cast<Tensor&>(*this), mask, value); break; default: AT_ERROR("masked_fill_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_fill_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), mask, value); #endif } inline Tensor Tensor::masked_fill(const Tensor & mask, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::masked_fill(const_cast<Tensor&>(*this), mask, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_fill", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), mask, value); #endif } inline Tensor & Tensor::masked_fill_(const Tensor & mask, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::masked_fill_(const_cast<Tensor&>(*this), mask, value); break; default: AT_ERROR("masked_fill_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_fill_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask, value); #endif } inline Tensor Tensor::masked_fill(const Tensor & mask, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::masked_fill(const_cast<Tensor&>(*this), mask, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_fill", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask, value); #endif } inline Tensor & Tensor::masked_scatter_(const Tensor & mask, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::masked_scatter_(const_cast<Tensor&>(*this), mask, source); break; default: AT_ERROR("masked_scatter_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_scatter_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask, source); #endif } inline Tensor Tensor::masked_scatter(const Tensor & mask, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::masked_scatter(const_cast<Tensor&>(*this), mask, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_scatter", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask, source); #endif } inline Tensor Tensor::view(IntArrayRef size) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::view(const_cast<Tensor&>(*this), size); break; case Backend::QuantizedCPU: return QuantizedCPUType::view(const_cast<Tensor&>(*this), size); break; default: AT_ERROR("view not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::view", ""); return op.callUnboxed<Tensor, const Tensor &, IntArrayRef>(const_cast<Tensor&>(*this), size); #endif } inline Tensor & Tensor::put_(const Tensor & index, const Tensor & source, bool accumulate) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::put_(const_cast<Tensor&>(*this), index, source, accumulate); break; default: AT_ERROR("put_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::put_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, bool>(const_cast<Tensor&>(*this), index, source, accumulate); #endif } inline Tensor & Tensor::index_add_(int64_t dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::index_add_(const_cast<Tensor&>(*this), dim, index, source); break; default: AT_ERROR("index_add_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_add_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor Tensor::index_add(int64_t dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_add(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_add", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor Tensor::index_add(Dimname dim, const Tensor & index, const Tensor & source) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_add(const_cast<Tensor&>(*this), dim, index, source); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_add", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, source); #endif } inline Tensor & Tensor::index_fill_(int64_t dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::index_fill_(const_cast<Tensor&>(*this), dim, index, value); break; default: AT_ERROR("index_fill_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill_", "int_Scalar"); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::index_fill(int64_t dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill", "int_Scalar"); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor & Tensor::index_fill_(int64_t dim, const Tensor & index, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::index_fill_(const_cast<Tensor&>(*this), dim, index, value); break; default: AT_ERROR("index_fill_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill_", "int_Tensor"); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::index_fill(int64_t dim, const Tensor & index, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill", "int_Tensor"); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor & Tensor::index_fill_(Dimname dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill_(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill_", "Dimname_Scalar"); return op.callUnboxed<Tensor &, Tensor &, Dimname, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor & Tensor::index_fill_(Dimname dim, const Tensor & index, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill_(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill_", "Dimname_Tensor"); return op.callUnboxed<Tensor &, Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::index_fill(Dimname dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill", "Dimname_Scalar"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::index_fill(Dimname dim, const Tensor & index, const Tensor & value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_fill(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_fill", "Dimname_Tensor"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor & Tensor::scatter_(int64_t dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::scatter_(const_cast<Tensor&>(*this), dim, index, src); break; default: AT_ERROR("scatter_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter_", "src"); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor Tensor::scatter(int64_t dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter(const_cast<Tensor&>(*this), dim, index, src); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter", "src"); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor & Tensor::scatter_(int64_t dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::scatter_(const_cast<Tensor&>(*this), dim, index, value); break; default: AT_ERROR("scatter_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter_", "value"); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::scatter(int64_t dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter", "value"); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor Tensor::scatter(Dimname dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter(const_cast<Tensor&>(*this), dim, index, src); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter", "dimname_src"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor Tensor::scatter(Dimname dim, const Tensor & index, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter(const_cast<Tensor&>(*this), dim, index, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter", "dimname_value"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, Scalar>(const_cast<Tensor&>(*this), dim, index, value); #endif } inline Tensor & Tensor::scatter_add_(int64_t dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::scatter_add_(const_cast<Tensor&>(*this), dim, index, src); break; default: AT_ERROR("scatter_add_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter_add_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor Tensor::scatter_add(int64_t dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter_add(const_cast<Tensor&>(*this), dim, index, src); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter_add", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor Tensor::scatter_add(Dimname dim, const Tensor & index, const Tensor & src) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::scatter_add(const_cast<Tensor&>(*this), dim, index, src); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::scatter_add", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), dim, index, src); #endif } inline Tensor & Tensor::lt_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::lt_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lt_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::lt_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::lt_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lt_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::gt_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::gt_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gt_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::gt_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::gt_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gt_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::le_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::le_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::le_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::le_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::le_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::le_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::ge_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ge_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ge_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::ge_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ge_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ge_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::eq_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::eq_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::eq_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::eq_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::eq_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::eq_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::ne_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ne_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ne_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::ne_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::ne_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ne_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_and(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_and(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_and", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_and(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_and(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_and", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_and_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_and_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_and_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_and_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_and_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_and_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__and__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__and__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__and__", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__and__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__and__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__and__", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__iand__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__iand__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__iand__", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__iand__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__iand__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__iand__", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_or(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_or(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_or", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_or(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_or(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_or", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_or_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_or_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_or_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_or_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_or_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_or_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__or__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__or__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__or__", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__or__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__or__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__or__", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ior__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__ior__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ior__", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ior__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__ior__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ior__", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_xor(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_xor(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_xor", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::bitwise_xor(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_xor(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_xor", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_xor_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_xor_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_xor_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::bitwise_xor_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::bitwise_xor_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::bitwise_xor_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__xor__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__xor__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__xor__", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__xor__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__xor__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__xor__", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ixor__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__ixor__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ixor__", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ixor__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::__ixor__(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ixor__", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__lshift__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__lshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__lshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__lshift__", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__lshift__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__lshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__lshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__lshift__", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ilshift__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__ilshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__ilshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ilshift__", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__ilshift__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__ilshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__ilshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__ilshift__", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__rshift__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__rshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__rshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__rshift__", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::__rshift__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__rshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__rshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__rshift__", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__irshift__(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__irshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__irshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__irshift__", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::__irshift__(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::__irshift__(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("__irshift__ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::__irshift__", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::lgamma_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lgamma_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("lgamma_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lgamma_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::atan2_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::atan2_(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::atan2_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::tril_(int64_t diagonal) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::tril_(const_cast<Tensor&>(*this), diagonal); break; default: AT_ERROR("tril_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tril_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), diagonal); #endif } inline Tensor & Tensor::triu_(int64_t diagonal) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::triu_(const_cast<Tensor&>(*this), diagonal); break; default: AT_ERROR("triu_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::triu_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), diagonal); #endif } inline Tensor & Tensor::digamma_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::digamma_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::digamma_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::polygamma_(int64_t n) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::polygamma_(const_cast<Tensor&>(*this), n); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::polygamma_", ""); return op.callUnboxed<Tensor &, Tensor &, int64_t>(const_cast<Tensor&>(*this), n); #endif } inline Tensor & Tensor::renorm_(Scalar p, int64_t dim, Scalar maxnorm) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::renorm_(const_cast<Tensor&>(*this), p, dim, maxnorm); break; default: AT_ERROR("renorm_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::renorm_", ""); return op.callUnboxed<Tensor &, Tensor &, Scalar, int64_t, Scalar>(const_cast<Tensor&>(*this), p, dim, maxnorm); #endif } inline Tensor & Tensor::pow_(Scalar exponent) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::pow_(const_cast<Tensor&>(*this), exponent); break; default: AT_ERROR("pow_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pow_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), exponent); #endif } inline Tensor & Tensor::pow_(const Tensor & exponent) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::pow_(const_cast<Tensor&>(*this), exponent); break; default: AT_ERROR("pow_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pow_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), exponent); #endif } inline Tensor & Tensor::lerp_(const Tensor & end, Scalar weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lerp_(const_cast<Tensor&>(*this), end, weight); break; default: AT_ERROR("lerp_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lerp_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), end, weight); #endif } inline Tensor & Tensor::lerp_(const Tensor & end, const Tensor & weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lerp_(const_cast<Tensor&>(*this), end, weight); break; default: AT_ERROR("lerp_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lerp_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), end, weight); #endif } inline Tensor & Tensor::fmod_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::fmod_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("fmod_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fmod_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::fmod_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::fmod_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("fmod_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fmod_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::remainder_(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::remainder_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("remainder_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::remainder_", "Scalar"); return op.callUnboxed<Tensor &, Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::remainder_(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::remainder_(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("remainder_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::remainder_", "Tensor"); return op.callUnboxed<Tensor &, Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor & Tensor::addbmm_(const Tensor & batch1, const Tensor & batch2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addbmm_(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); break; default: AT_ERROR("addbmm_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addbmm_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); #endif } inline Tensor Tensor::addbmm(const Tensor & batch1, const Tensor & batch2, Scalar beta, Scalar alpha) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::addbmm(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); break; default: AT_ERROR("addbmm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addbmm", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar, Scalar>(const_cast<Tensor&>(*this), batch1, batch2, beta, alpha); #endif } inline Tensor & Tensor::addcdiv_(const Tensor & tensor1, const Tensor & tensor2, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addcdiv_(const_cast<Tensor&>(*this), tensor1, tensor2, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addcdiv_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), tensor1, tensor2, value); #endif } inline Tensor & Tensor::random_(int64_t from, int64_t to, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::random_(const_cast<Tensor&>(*this), from, to, generator); break; default: AT_ERROR("random_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::random_", "from"); return op.callUnboxed<Tensor &, Tensor &, int64_t, int64_t, Generator *>(const_cast<Tensor&>(*this), from, to, generator); #endif } inline Tensor & Tensor::random_(int64_t to, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::random_(const_cast<Tensor&>(*this), to, generator); break; default: AT_ERROR("random_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::random_", "to"); return op.callUnboxed<Tensor &, Tensor &, int64_t, Generator *>(const_cast<Tensor&>(*this), to, generator); #endif } inline Tensor & Tensor::random_(Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::random_(const_cast<Tensor&>(*this), generator); break; default: AT_ERROR("random_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::random_", ""); return op.callUnboxed<Tensor &, Tensor &, Generator *>(const_cast<Tensor&>(*this), generator); #endif } inline Tensor & Tensor::uniform_(double from, double to, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::uniform_(const_cast<Tensor&>(*this), from, to, generator); break; default: AT_ERROR("uniform_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::uniform_", ""); return op.callUnboxed<Tensor &, Tensor &, double, double, Generator *>(const_cast<Tensor&>(*this), from, to, generator); #endif } inline Tensor & Tensor::cauchy_(double median, double sigma, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cauchy_(const_cast<Tensor&>(*this), median, sigma, generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cauchy_", ""); return op.callUnboxed<Tensor &, Tensor &, double, double, Generator *>(const_cast<Tensor&>(*this), median, sigma, generator); #endif } inline Tensor & Tensor::log_normal_(double mean, double std, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::log_normal_(const_cast<Tensor&>(*this), mean, std, generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::log_normal_", ""); return op.callUnboxed<Tensor &, Tensor &, double, double, Generator *>(const_cast<Tensor&>(*this), mean, std, generator); #endif } inline Tensor & Tensor::exponential_(double lambd, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::exponential_(const_cast<Tensor&>(*this), lambd, generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::exponential_", ""); return op.callUnboxed<Tensor &, Tensor &, double, Generator *>(const_cast<Tensor&>(*this), lambd, generator); #endif } inline Tensor & Tensor::geometric_(double p, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::geometric_(const_cast<Tensor&>(*this), p, generator); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::geometric_", ""); return op.callUnboxed<Tensor &, Tensor &, double, Generator *>(const_cast<Tensor&>(*this), p, generator); #endif } inline Tensor Tensor::diag(int64_t diagonal) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::diag(const_cast<Tensor&>(*this), diagonal); break; default: AT_ERROR("diag not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::diag", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), diagonal); #endif } inline Tensor Tensor::cross(const Tensor & other, c10::optional<int64_t> dim) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cross(const_cast<Tensor&>(*this), other, dim); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cross", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, c10::optional<int64_t>>(const_cast<Tensor&>(*this), other, dim); #endif } inline Tensor Tensor::triu(int64_t diagonal) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::triu(const_cast<Tensor&>(*this), diagonal); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::triu", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), diagonal); #endif } inline Tensor Tensor::tril(int64_t diagonal) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::tril(const_cast<Tensor&>(*this), diagonal); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::tril", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t>(const_cast<Tensor&>(*this), diagonal); #endif } inline Tensor Tensor::trace() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::trace(const_cast<Tensor&>(*this)); break; default: AT_ERROR("trace not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::trace", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::ne(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ne(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::ne(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("ne not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ne", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::ne(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ne(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::ne(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("ne not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ne", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::eq(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::eq(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::eq(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("eq not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::eq", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::eq(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::eq(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::eq(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("eq not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::eq", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::ge(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ge(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::ge(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("ge not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ge", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::ge(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ge(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::ge(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("ge not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ge", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::le(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::le(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::le(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("le not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::le", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::le(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::le(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::le(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("le not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::le", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::gt(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::gt(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::gt(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("gt not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gt", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::gt(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::gt(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::gt(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("gt not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gt", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::lt(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lt(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::lt(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("lt not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lt", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::lt(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lt(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::lt(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("lt not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lt", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::take(const Tensor & index) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::take(const_cast<Tensor&>(*this), index); break; default: AT_ERROR("take not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::take", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), index); #endif } inline Tensor Tensor::index_select(int64_t dim, const Tensor & index) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::index_select(const_cast<Tensor&>(*this), dim, index); break; case Backend::SparseCPU: return SparseCPUType::index_select(const_cast<Tensor&>(*this), dim, index); break; default: AT_ERROR("index_select not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_select", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &>(const_cast<Tensor&>(*this), dim, index); #endif } inline Tensor Tensor::index_select(Dimname dim, const Tensor & index) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::index_select(const_cast<Tensor&>(*this), dim, index); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::index_select", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &>(const_cast<Tensor&>(*this), dim, index); #endif } inline Tensor Tensor::masked_select(const Tensor & mask) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::masked_select(const_cast<Tensor&>(*this), mask); break; default: AT_ERROR("masked_select not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::masked_select", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), mask); #endif } inline Tensor Tensor::nonzero() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::nonzero(const_cast<Tensor&>(*this)); break; default: AT_ERROR("nonzero not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::nonzero", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::vector<Tensor> Tensor::nonzero_numpy() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::nonzero_numpy(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::nonzero_numpy", ""); return op.callUnboxed<std::vector<Tensor>, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::gather(int64_t dim, const Tensor & index, bool sparse_grad) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::gather(const_cast<Tensor&>(*this), dim, index, sparse_grad); break; default: AT_ERROR("gather not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gather", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, const Tensor &, bool>(const_cast<Tensor&>(*this), dim, index, sparse_grad); #endif } inline Tensor Tensor::gather(Dimname dim, const Tensor & index, bool sparse_grad) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::gather(const_cast<Tensor&>(*this), dim, index, sparse_grad); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::gather", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, const Tensor &, bool>(const_cast<Tensor&>(*this), dim, index, sparse_grad); #endif } inline Tensor Tensor::addcmul(const Tensor & tensor1, const Tensor & tensor2, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addcmul(const_cast<Tensor&>(*this), tensor1, tensor2, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addcmul", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), tensor1, tensor2, value); #endif } inline Tensor & Tensor::addcmul_(const Tensor & tensor1, const Tensor & tensor2, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addcmul_(const_cast<Tensor&>(*this), tensor1, tensor2, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addcmul_", ""); return op.callUnboxed<Tensor &, Tensor &, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), tensor1, tensor2, value); #endif } inline Tensor Tensor::addcdiv(const Tensor & tensor1, const Tensor & tensor2, Scalar value) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::addcdiv(const_cast<Tensor&>(*this), tensor1, tensor2, value); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::addcdiv", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), tensor1, tensor2, value); #endif } inline std::tuple<Tensor,Tensor> Tensor::lstsq(const Tensor & A) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lstsq(const_cast<Tensor&>(*this), A); break; default: AT_ERROR("lstsq not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lstsq", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), A); #endif } inline std::tuple<Tensor,Tensor> Tensor::triangular_solve(const Tensor & A, bool upper, bool transpose, bool unitriangular) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::triangular_solve(const_cast<Tensor&>(*this), A, upper, transpose, unitriangular); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::triangular_solve", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, const Tensor &, bool, bool, bool>(const_cast<Tensor&>(*this), A, upper, transpose, unitriangular); #endif } inline std::tuple<Tensor,Tensor> Tensor::symeig(bool eigenvectors, bool upper) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::symeig(const_cast<Tensor&>(*this), eigenvectors, upper); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::symeig", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, bool, bool>(const_cast<Tensor&>(*this), eigenvectors, upper); #endif } inline std::tuple<Tensor,Tensor> Tensor::eig(bool eigenvectors) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::eig(const_cast<Tensor&>(*this), eigenvectors); break; default: AT_ERROR("eig not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::eig", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, bool>(const_cast<Tensor&>(*this), eigenvectors); #endif } inline std::tuple<Tensor,Tensor,Tensor> Tensor::svd(bool some, bool compute_uv) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::svd(const_cast<Tensor&>(*this), some, compute_uv); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::svd", ""); return op.callUnboxed<std::tuple<Tensor,Tensor,Tensor>, const Tensor &, bool, bool>(const_cast<Tensor&>(*this), some, compute_uv); #endif } inline Tensor Tensor::cholesky(bool upper) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cholesky(const_cast<Tensor&>(*this), upper); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cholesky", ""); return op.callUnboxed<Tensor, const Tensor &, bool>(const_cast<Tensor&>(*this), upper); #endif } inline Tensor Tensor::cholesky_solve(const Tensor & input2, bool upper) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::cholesky_solve(const_cast<Tensor&>(*this), input2, upper); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cholesky_solve", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, bool>(const_cast<Tensor&>(*this), input2, upper); #endif } inline std::tuple<Tensor,Tensor> Tensor::solve(const Tensor & A) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::solve(const_cast<Tensor&>(*this), A); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::solve", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), A); #endif } inline Tensor Tensor::cholesky_inverse(bool upper) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::cholesky_inverse(const_cast<Tensor&>(*this), upper); break; default: AT_ERROR("cholesky_inverse not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::cholesky_inverse", ""); return op.callUnboxed<Tensor, const Tensor &, bool>(const_cast<Tensor&>(*this), upper); #endif } inline std::tuple<Tensor,Tensor> Tensor::qr(bool some) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::qr(const_cast<Tensor&>(*this), some); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::qr", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, bool>(const_cast<Tensor&>(*this), some); #endif } inline std::tuple<Tensor,Tensor> Tensor::geqrf() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::geqrf(const_cast<Tensor&>(*this)); break; default: AT_ERROR("geqrf not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::geqrf", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::orgqr(const Tensor & input2) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::orgqr(const_cast<Tensor&>(*this), input2); break; default: AT_ERROR("orgqr not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::orgqr", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), input2); #endif } inline Tensor Tensor::ormqr(const Tensor & input2, const Tensor & input3, bool left, bool transpose) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::ormqr(const_cast<Tensor&>(*this), input2, input3, left, transpose); break; default: AT_ERROR("ormqr not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::ormqr", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &, bool, bool>(const_cast<Tensor&>(*this), input2, input3, left, transpose); #endif } inline Tensor Tensor::lu_solve(const Tensor & LU_data, const Tensor & LU_pivots) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::lu_solve(const_cast<Tensor&>(*this), LU_data, LU_pivots); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lu_solve", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), LU_data, LU_pivots); #endif } inline Tensor Tensor::multinomial(int64_t num_samples, bool replacement, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::multinomial(const_cast<Tensor&>(*this), num_samples, replacement, generator); break; default: AT_ERROR("multinomial not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::multinomial", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool, Generator *>(const_cast<Tensor&>(*this), num_samples, replacement, generator); #endif } inline Tensor Tensor::lgamma() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lgamma(const_cast<Tensor&>(*this)); break; default: AT_ERROR("lgamma not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lgamma", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::digamma() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::digamma(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::digamma", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::polygamma(int64_t n) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::polygamma(n, const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::polygamma", ""); return op.callUnboxed<Tensor, int64_t, const Tensor &>(n, const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::erfinv() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::erfinv(const_cast<Tensor&>(*this)); break; default: AT_ERROR("erfinv not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erfinv", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::erfinv_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::erfinv_(const_cast<Tensor&>(*this)); break; default: AT_ERROR("erfinv_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::erfinv_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::sign() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sign(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sign", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor & Tensor::sign_() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sign_(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sign_", ""); return op.callUnboxed<Tensor &, Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::dist(const Tensor & other, Scalar p) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::dist(const_cast<Tensor&>(*this), other, p); break; default: AT_ERROR("dist not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::dist", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other, p); #endif } inline Tensor Tensor::atan2(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::atan2(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::atan2", ""); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::lerp(const Tensor & end, Scalar weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lerp(const_cast<Tensor&>(*this), end, weight); break; default: AT_ERROR("lerp not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lerp", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, Scalar>(const_cast<Tensor&>(*this), end, weight); #endif } inline Tensor Tensor::lerp(const Tensor & end, const Tensor & weight) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::lerp(const_cast<Tensor&>(*this), end, weight); break; default: AT_ERROR("lerp not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::lerp", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), end, weight); #endif } inline Tensor Tensor::histc(int64_t bins, Scalar min, Scalar max) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::histc(const_cast<Tensor&>(*this), bins, min, max); break; default: AT_ERROR("histc not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::histc", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, Scalar, Scalar>(const_cast<Tensor&>(*this), bins, min, max); #endif } inline Tensor Tensor::fmod(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::fmod(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("fmod not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fmod", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::fmod(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::fmod(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("fmod not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::fmod", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::remainder(Scalar other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::remainder(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("remainder not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::remainder", "Scalar"); return op.callUnboxed<Tensor, const Tensor &, Scalar>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::remainder(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::remainder(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("remainder not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::remainder", "Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::min(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::min(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min", "other"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::min() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::min(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::min(const_cast<Tensor&>(*this)); break; default: AT_ERROR("min not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::min", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::max(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::max(const_cast<Tensor&>(*this), other); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max", "other"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::max() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::max(const_cast<Tensor&>(*this)); break; case Backend::QuantizedCPU: return QuantizedCPUType::max(const_cast<Tensor&>(*this)); break; default: AT_ERROR("max not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::max", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::median() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::median(const_cast<Tensor&>(*this)); break; default: AT_ERROR("median not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::median", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline std::tuple<Tensor,Tensor> Tensor::sort(int64_t dim, bool descending) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::sort(const_cast<Tensor&>(*this), dim, descending); break; case Backend::QuantizedCPU: return QuantizedCPUType::sort(const_cast<Tensor&>(*this), dim, descending); break; default: AT_ERROR("sort not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sort", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, descending); #endif } inline std::tuple<Tensor,Tensor> Tensor::sort(Dimname dim, bool descending) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::sort(const_cast<Tensor&>(*this), dim, descending); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::sort", "dimname"); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, descending); #endif } inline Tensor Tensor::argsort(int64_t dim, bool descending) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::argsort(const_cast<Tensor&>(*this), dim, descending); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::argsort", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, bool>(const_cast<Tensor&>(*this), dim, descending); #endif } inline Tensor Tensor::argsort(Dimname dim, bool descending) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::argsort(const_cast<Tensor&>(*this), dim, descending); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::argsort", "dimname"); return op.callUnboxed<Tensor, const Tensor &, Dimname, bool>(const_cast<Tensor&>(*this), dim, descending); #endif } inline std::tuple<Tensor,Tensor> Tensor::topk(int64_t k, int64_t dim, bool largest, bool sorted) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::topk(const_cast<Tensor&>(*this), k, dim, largest, sorted); break; case Backend::QuantizedCPU: return QuantizedCPUType::topk(const_cast<Tensor&>(*this), k, dim, largest, sorted); break; default: AT_ERROR("topk not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::topk", ""); return op.callUnboxed<std::tuple<Tensor,Tensor>, const Tensor &, int64_t, int64_t, bool, bool>(const_cast<Tensor&>(*this), k, dim, largest, sorted); #endif } inline Tensor Tensor::all() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::all(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::all", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::any() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::any(const_cast<Tensor&>(*this)); break; case Backend::SparseCPU: return SparseCPUType::any(const_cast<Tensor&>(*this)); break; default: AT_ERROR("any not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::any", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline Tensor Tensor::renorm(Scalar p, int64_t dim, Scalar maxnorm) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::renorm(const_cast<Tensor&>(*this), p, dim, maxnorm); break; default: AT_ERROR("renorm not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::renorm", ""); return op.callUnboxed<Tensor, const Tensor &, Scalar, int64_t, Scalar>(const_cast<Tensor&>(*this), p, dim, maxnorm); #endif } inline Tensor Tensor::unfold(int64_t dimension, int64_t size, int64_t step) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::unfold(const_cast<Tensor&>(*this), dimension, size, step); break; default: AT_ERROR("unfold not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::unfold", ""); return op.callUnboxed<Tensor, const Tensor &, int64_t, int64_t, int64_t>(const_cast<Tensor&>(*this), dimension, size, step); #endif } inline bool Tensor::equal(const Tensor & other) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::equal(const_cast<Tensor&>(*this), other); break; case Backend::QuantizedCPU: return QuantizedCPUType::equal(const_cast<Tensor&>(*this), other); break; default: AT_ERROR("equal not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::equal", ""); return op.callUnboxed<bool, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), other); #endif } inline Tensor Tensor::pow(const Tensor & exponent) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::pow(const_cast<Tensor&>(*this), exponent); break; default: AT_ERROR("pow not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::pow", "Tensor_Tensor"); return op.callUnboxed<Tensor, const Tensor &, const Tensor &>(const_cast<Tensor&>(*this), exponent); #endif } inline Tensor & Tensor::normal_(double mean, double std, Generator * generator) const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); switch(dispatchKeyToBackend(c10::impl::dispatchTypeId(key_set(), c10::DispatchKeySet(c10::DispatchKeySet::FULL)))) { case Backend::CPU: return CPUType::normal_(const_cast<Tensor&>(*this), mean, std, generator); break; default: AT_ERROR("normal_ not implemented for ", at::toString(key_set())); } #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::normal_", ""); return op.callUnboxed<Tensor &, Tensor &, double, double, Generator *>(const_cast<Tensor&>(*this), mean, std, generator); #endif } inline Tensor Tensor::alias() const { #ifdef USE_STATIC_DISPATCH at::AutoNonVariableTypeMode _var_guard(true); return TypeDefault::alias(const_cast<Tensor&>(*this)); #else static c10::OperatorHandle op = c10::Dispatcher::singleton().findSchemaOrThrow("aten::alias", ""); return op.callUnboxed<Tensor, const Tensor &>(const_cast<Tensor&>(*this)); #endif } inline caffe2::TypeMeta Tensor::dtype() const noexcept { return impl_->dtype(); } inline Layout Tensor::layout() const noexcept { return impl_->layout(); } inline Device Tensor::device() const { return impl_->device(); } inline int64_t Tensor::get_device() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->get_device(); } inline int64_t get_device(Tensor self) { return self.get_device(); } inline bool Tensor::is_cuda() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->is_cuda(); } inline NamedTensorMeta* Tensor::get_named_tensor_meta() { return static_cast<NamedTensorMeta*>(impl_->named_tensor_meta()); } inline const NamedTensorMeta* Tensor::get_named_tensor_meta() const { return static_cast<NamedTensorMeta*>(impl_->named_tensor_meta()); } inline bool Tensor::has_names() const { // If a user is using unnamed tensors, then we can short-circuit right here. // Otherwise, impl::has_names attempts to retrieve names. if (!impl_->has_named_tensor_meta()) { return false; } return impl::has_names(unsafeGetTensorImpl()); } inline bool is_cuda(Tensor self) { return self.is_cuda(); } inline bool Tensor::is_hip() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->is_hip(); } inline bool is_hip(Tensor self) { return self.is_hip(); } inline bool Tensor::is_sparse() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->is_sparse(); } inline bool is_sparse(Tensor self) { return self.is_sparse(); } inline bool Tensor::is_mkldnn() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->is_mkldnn(); } inline bool is_mkldnn(Tensor self) { return self.is_mkldnn(); } inline bool Tensor::is_quantized() const { // NB: this is not a native function to avoid dispatching overhead. return impl_->is_quantized(); } inline bool is_quantized(Tensor self) { return self.is_quantized(); } #define DEFINE_CAST(T, name) \ template <> \ inline T* Tensor::data_ptr() const { \ TORCH_CHECK( \ scalar_type() == ScalarType::name, \ "expected scalar type ", \ #name, \ " but found ", \ c10::toString(scalar_type())); \ return static_cast<T*>(this->unsafeGetTensorImpl()->data()); \ } AT_FORALL_SCALAR_TYPES_WITH_COMPLEX_EXCEPT_COMPLEX_HALF(DEFINE_CAST) AT_FORALL_QINT_TYPES(DEFINE_CAST) #undef DEFINE_CAST #define DEFINE_ITEM(T, name) \ template <> \ inline T Tensor::item() const { \ return item().to##name(); \ } AT_FORALL_SCALAR_TYPES_WITH_COMPLEX_EXCEPT_COMPLEX_HALF(DEFINE_ITEM) #undef DEFINE_ITEM // Gradient Node and Edges //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ template <typename T> auto Tensor::register_hook(T&& hook) const -> Tensor::hook_return_void_t<T> { // Return the grad argument in case of a hook with void return type to have an // std::function with Tensor return type std::function<void(Tensor)> fn(hook); return _register_hook([fn](const Tensor& grad) { fn(grad); return Tensor(); }); } template <typename T> auto Tensor::register_hook(T&& hook) const -> Tensor::hook_return_var_t<T> { return _register_hook(hook); } } //namespace at
[ "somashekhar@submit2.chtc.wisc.edu" ]
somashekhar@submit2.chtc.wisc.edu
3c5b11582811bd14f8a18d04ccb21db42e6cb779
f2eeceec70af215dfc9a0181aa2696b710cad7ac
/mod03/ex03/ClapTrap.cpp
f06626b08da1d04e469a8fcb900d6c92448ad333
[]
no_license
a-cha/cpp_beginning
034ca58a2f3029c651405e9515a1eb0faa2e3506
15860bf225793c94e86dfc86702b81856682c44b
refs/heads/master
2023-03-13T13:14:20.750910
2021-03-26T09:00:55
2021-03-26T09:00:55
339,658,733
0
0
null
null
null
null
UTF-8
C++
false
false
2,257
cpp
// // Created by Skipjack Adolph on 2/20/21. // #include "ClapTrap.hpp" #include "print.hpp" ClapTrap::ClapTrap() : hitPoints(), maxHitPoints(), energyPoints(), maxEnergyPoints(), level(), meleeAttackDamage(), rangedAttackDamage(), armorDamageReduction() { std::cout << BLUE "Parent ClapTrap" STD << " has constructed\n"; } ClapTrap::ClapTrap(const ClapTrap &other) { *this = other; } ClapTrap::~ClapTrap() { std::cout << BLUE "Parent ClapTrap" STD << " has destructed\n"; } ClapTrap &ClapTrap::operator=(const ClapTrap &other) { if (this != &other) { this->name = other.name; this->hitPoints = other.hitPoints; this->maxHitPoints = other.maxHitPoints; this->energyPoints = other.energyPoints; this->maxEnergyPoints = other.maxEnergyPoints; this->level = other.level; this->meleeAttackDamage = other.meleeAttackDamage; this->rangedAttackDamage = other.rangedAttackDamage; this->armorDamageReduction = other.armorDamageReduction; } return *this; } void ClapTrap::rangedAttack(const std::string &target) { std::cout << BLUE "<" << this->name << ">" STD << " attacks <" BLUE << target << STD "> at range, causing <" << RED << this->rangedAttackDamage << STD << "> points of damage!" << std::endl; } void ClapTrap::meleeAttack(const std::string &target) { std::cout << BLUE "<" << this->name << ">" STD << " attacks melee <" BLUE << target << STD ">, causing <" << RED << this->meleeAttackDamage << STD << "> points of damage!" << std::endl; } void ClapTrap::takeDamage(unsigned int amount) { if (hitPoints > amount) { if (armorDamageReduction < amount) this->hitPoints -= (amount - armorDamageReduction); std::cout << BLUE "<" << this->name << ">" STD << " still alive with <" << GREEN << this->hitPoints << STD "> hit points" << std::endl; } else { hitPoints = 0; std::cout << BLUE "<" << this->name << ">" STD << RED " is about to die" STD << std::endl; } } void ClapTrap::beRepaired(unsigned int amount) { hitPoints += amount; if (hitPoints > maxHitPoints) hitPoints = maxHitPoints; std::cout << BLUE "<" << this->name << ">" STD << " has been repaired for <" GREEN << amount << STD "> points" << std::endl; } std::string ClapTrap::getName() { return name; }
[ "chaparin.anton@gmail.com" ]
chaparin.anton@gmail.com
58970eff345c450ea0f0fca5bbec7fb5a1fb68f6
2591ae43a809173d223b78207c7638d80d839962
/GFG/searching/1_linear.cpp
9eec098dd26b44436e3b2e4bcebd7068e3e745a7
[]
no_license
DeveshDutt2710/Competitive_Programming
82fc97efcae65b23738d7f4e4ecc880e43bf975c
78a6251e74c8b261c94ebf79408e7c36f9331838
refs/heads/master
2023-07-30T16:05:54.659186
2021-09-22T17:44:08
2021-09-22T17:44:08
300,497,546
0
0
null
null
null
null
UTF-8
C++
false
false
1,404
cpp
#include <iostream> #include <bits/stdc++.h> using namespace std; int search(int arr[], int n, int x) { int i; for(i=0;i<n;i++) { if(arr[i]==x) { return i; } } return -1; } int searchOptimised(vector<int> arr, int search_Element) { int left = 0; int length =arr.size(); int position = -1; int right = length -1; while(left<right) { if(arr[left]== search_Element) { position=left; cout<<search_Element<<" found at : "<<position+1<<" in "<<left+1<<" Attempt"<<endl; } if(arr[right]==search_Element) { position=right; cout<<search_Element<<" found at position : "<<position+1<<" in "<<length-right<<" Attempt"<<endl; } left++; right--; } if(position==-1) { cout<<search_Element<<" not found in the array"<<endl; } } int main() { vector<int> arr{ 1, 2, 3, 4, 5 }; int arr1[] = { 1, 2, 3, 4, 5 }; int search_element = 5; int n = sizeof(arr1) / sizeof(arr1[0]); int result = search(arr1, n, search_element); (result == -1) ? cout << "Element is not present in array"<<endl : cout << "Element is found at position " << result+1<<" in "<<result+1<<"th Attempt"<<endl; searchOptimised(arr, search_element); return 0; }
[ "dd123.ues2017@gmail.com" ]
dd123.ues2017@gmail.com
9543a0b91d1e8d4113d8cea4119dc6ab3edc2b52
1038d0511ab29f6bc2e50c5328823730e49bc4c5
/datacombobox.hxx
249fe1ab3472d2ee95c8d8feb2a24d91addca682
[]
no_license
johanneslochmann/datacollector
9a23f8186ac247d13af50af4a365946259dd228c
77b7d675ef8a15fda0bd6b512026a8f1afffc616
refs/heads/master
2021-01-10T09:52:08.135378
2016-02-19T20:07:38
2016-02-19T20:07:38
45,186,142
1
0
null
null
null
null
UTF-8
C++
false
false
439
hxx
#pragma once #include <QComboBox> #include "storable.hxx" class DataComboBox : public QComboBox { Q_OBJECT public: explicit DataComboBox(QWidget* p); signals: void datasetActivated(const StorableSPtr s); public slots: void onItemActivated(const QString& txt); void reload() { implReload(); } protected: virtual StorableSPtr storableForText(const QString& txt) const = 0; virtual void implReload() = 0; };
[ "johannes.lochmann@gmail.com" ]
johannes.lochmann@gmail.com
ad54c973fe477e9c01d2c20f550dd95517d04913
78db2b7e7c0575bc39e2cbc4c679d13c48fe4aa1
/Source/NZGame/Item/NZDroppedPickup.cpp
a50fa0b7d0833b3b2e22187381680fc38ee104f0
[]
no_license
cloudjiang/NZGame
77641257405dbf4adb564ee5965f3e47c88eadb2
0e637494c49187937683b9ffd063c5db9e97efe7
refs/heads/master
2020-12-01T11:47:01.445948
2016-08-21T08:02:59
2016-08-21T08:02:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,610
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "NZGame.h" #include "NZDroppedPickup.h" #include "NZInventory.h" #include "NZGameMode.h" #include "NZProjectileMovementComponent.h" #include "UnrealNetwork.h" #include "NZRecastNavMesh.h" #include "NZWorldSettings.h" #include "NZPickupMessage.h" // Sets default values ANZDroppedPickup::ANZDroppedPickup() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bStartWithTickEnabled = true; InitialLifeSpan = 15.0f; Collision = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule")); Collision->SetCollisionProfileName(FName(TEXT("Pickup"))); Collision->InitCapsuleSize(64.0f, 30.0f); Collision->OnComponentBeginOverlap.AddDynamic(this, &ANZDroppedPickup::OnOverlapBegin); RootComponent = Collision; Movement = CreateDefaultSubobject<UNZProjectileMovementComponent>(TEXT("Movement")); Movement->HitZStopSimulatingThreshold = 0.7f; Movement->UpdatedComponent = Collision; Movement->OnProjectileStop.AddDynamic(this, &ANZDroppedPickup::PhysicsStopped); SetReplicates(true); bReplicateMovement = true; NetUpdateFrequency = 1.0f; } // Called when the game starts or when spawned void ANZDroppedPickup::BeginPlay() { Super::BeginPlay(); if (!IsPendingKillPending()) { // Don't allow Instigator to touch until a little time has passed so a live player throwing an item doesn't immediately pick it back up again GetWorld()->GetTimerManager().SetTimer(EnableInstigatorTouchHandle, this, &ANZDroppedPickup::EnableInstigatorTouch, 1.0f, false); } } void ANZDroppedPickup::EndPlay(const EEndPlayReason::Type EndPlayReason) { Super::EndPlay(EndPlayReason); // todo: /* ANZRecastNavMesh* NavData = GetNZNavData(GetWorld()); if (NavData != NULL) { NavData->RemoveFromNavigation(false); } if (Inventory != NULL && !Inventory->IsPendingKillPending()) { Inventory->Destroy(); } GetWorldTimerManager().ClearAllTimersForObject(this);*/ } void ANZDroppedPickup::PostNetReceiveVelocity(const FVector& NewVelocity) { Movement->Velocity = NewVelocity; } void ANZDroppedPickup::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const { Super::GetLifetimeReplicatedProps(OutLifetimeProps); DOREPLIFETIME_CONDITION(ANZDroppedPickup, InventoryType, COND_None); //DOREPLIFETIME_CONDITION(ANZDroppedPickup, WeaponSkin, COND_None); } USoundBase* ANZDroppedPickup::GetPickupSound_Implementation() const { if (Inventory != NULL) { return Inventory->PickupSound; } else if (InventoryType != NULL) { return InventoryType.GetDefaultObject()->PickupSound; } else { return NULL; } } void ANZDroppedPickup::SetInventory(ANZInventory* NewInventory) { Inventory = NewInventory; InventoryType = (NewInventory != NULL) ? NewInventory->GetClass() : NULL; InventoryTypeUpdated(); bFullyInitialized = true; CheckTouching(); } void ANZDroppedPickup::InventoryTypeUpdated_Implementation() { //ANZPickupInventory::CreatePickupMesh(this, Mesh, InventoryType, 0.0f, FRotator::ZeroRotator, false); } void ANZDroppedPickup::OnOverlapBegin(UPrimitiveComponent* ThisComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { if (bFullyInitialized && (OtherActor != Instigator || !GetWorld()->GetTimerManager().IsTimerActive(EnableInstigatorTouchHandle))) { APawn* P = Cast<APawn>(OtherActor); if (P != NULL && !P->bTearOff && !GetWorld()->LineTraceTestByChannel(P->GetActorLocation(), GetActorLocation(), ECC_Pawn, FCollisionQueryParams(), WorldResponseParams)) { ProcessTouch(P); } } } void ANZDroppedPickup::PhysicsStopped(const FHitResult& ImpactResult) { // It we landed on a mover, attach to it if (ImpactResult.Component != NULL && ImpactResult.Component->Mobility == EComponentMobility::Movable) { //Collision->AttachTo(ImpactResult.Component.Get(), NAME_None, EAttachLocation::KeepWorldPosition); Collision->AttachToComponent(ImpactResult.Component.Get(), FAttachmentTransformRules::KeepWorldTransform); } ANZRecastNavMesh* NavData = GetNZNavData(GetWorld()); if (NavData != NULL) { NavData->AddToNavigation(this); } } bool ANZDroppedPickup::AllowPickupBy_Implementation(APawn* Other, bool bDefaultAllowPickup) { ANZCharacter* NZC = Cast<ANZCharacter>(Other); bDefaultAllowPickup = bDefaultAllowPickup && NZC != NULL && NZC->bCanPickupItems && !NZC->IsRagdoll(); bool bAllowPickup = bDefaultAllowPickup; ANZGameMode* NZGameMode = GetWorld()->GetAuthGameMode<ANZGameMode>(); return (NZGameMode == NULL || !NZGameMode->OverridePickupQuery(Other, InventoryType, this, bAllowPickup)) ? bDefaultAllowPickup : bAllowPickup; } void ANZDroppedPickup::ProcessTouch_Implementation(APawn* TouchedBy) { if (Role == ROLE_Authority && TouchedBy->Controller != NULL && AllowPickupBy(TouchedBy, true)) { PlayTakenEffects(TouchedBy); // First allows PlayTakenEffects() to work off Inventory instead of InventoryType if it wants GiveTo(TouchedBy); ANZGameMode* NZGame = GetWorld()->GetAuthGameMode<ANZGameMode>(); if (NZGame != NULL && NZGame->NumBots > 0) { float Radius = 0.0f; USoundBase* PickupSound = GetPickupSound(); if (PickupSound) { Radius = PickupSound->GetMaxAudibleDistance(); const FAttenuationSettings* Settings = PickupSound->GetAttenuationSettingsToApply(); if (Settings != NULL) { Radius = FMath::Max<float>(Radius, Settings->GetMaxDimension()); } } // todo: /* for (FConstControllerIterator It = GetWorld()->GetControllerIterator(); It; ++It) { if (It->IsValid()) { ANZBot* B = Cast<ANZBot>(It->Get()); if (B != NULL) { B->NotifyPickup(TouchedBy, this, Radius); } } }*/ } Destroy(); } } void ANZDroppedPickup::GiveTo_Implementation(APawn* Target) { if (Inventory != NULL && !Inventory->IsPendingKillPending()) { ANZCharacter* C = Cast<ANZCharacter>(Target); if (C != NULL) { ANZInventory* Duplicate = C->FindInventoryType<ANZInventory>(Inventory->GetClass(), true); if (Duplicate == NULL || !Duplicate->StackPickup(Inventory)) { C->AddInventory(Inventory, true); /* ANZWeapon* WeaponInv = Cast<ANZWeapon>(Inventory); if (WeaponInv) { if (WeaponSkin) { C->SetSkinForWeapon(WeaponSkin); } else { FString WeaponPathName = WeaponInv->GetPathName(); bool bFoundSkin = false; // Set character's skin back to what the NZPlayerState has ANZPlayerState* PS = Cast<ANZPLayerState>(C->PlayerState); if (PS) { for (int32 i = 0; i < PS->WeaponSkins.Num(); i++) { if (PS->WeaponSkins[i]->WeaponType == WeaponPathName) { C->SetSkinForWeapon(PS->WeaponSkin[i]); bFoundSkin = true; break; } } } if (!bFoundSkin) { for (int32 i = 0; i < C->WeaponSkins.Num(); i++) { if (C->WeaponSkins[i]->WeaponType == WeaponPathName) { C->WeaponSkins.RemoveAt(i); break; } } } } }*/ if (Cast<APlayerController>(Target->GetController()) && (!Cast<ANZWeapon>(Inventory) || !C->GetPendingWeapon() || (C->GetPendingWeapon()->GetClass() != Inventory->GetClass()))) { Cast<APlayerController>(Target->GetController())->ClientReceiveLocalizedMessage(UNZPickupMessage::StaticClass(), 0, NULL, NULL, Inventory->GetClass()); } Inventory = NULL; } else { if (Cast<APlayerController>(Target->GetController())) { Cast<APlayerController>(Target->GetController())->ClientReceiveLocalizedMessage(UNZPickupMessage::StaticClass(), 0, NULL, NULL, Inventory->GetClass()); } Inventory->Destroy(); } } } } void ANZDroppedPickup::PlayTakenEffects_Implementation(APawn* TakenBy) { USoundBase* PickupSound = GetPickupSound(); if (PickupSound != NULL) { UNZGameplayStatics::NZPlaySound(GetWorld(), PickupSound, TakenBy, SRT_All, false, GetActorLocation(), NULL, NULL, false); } if (GetNetMode() != NM_DedicatedServer) { UParticleSystem* ParticleTemplate = NULL; if (Inventory != NULL) { ParticleTemplate = Inventory->PickupEffect; } else if (InventoryType != NULL) { ParticleTemplate = InventoryType.GetDefaultObject()->PickupEffect; } if (ParticleTemplate != NULL) { ANZWorldSettings* WS = Cast<ANZWorldSettings>(GetWorld()->GetWorldSettings()); if (WS == NULL || WS->EffectIsRelevant(this, GetActorLocation(), true, false, 10000.0f, 1000.0f)) { UGameplayStatics::SpawnEmitterAtLocation(this, ParticleTemplate, GetActorLocation(), GetActorRotation()); } } } } void ANZDroppedPickup::EnableInstigatorTouch() { if (Instigator != NULL) { CheckTouching(); } } void ANZDroppedPickup::CheckTouching() { TArray<AActor*> Overlaps; GetOverlappingActors(Overlaps, APawn::StaticClass()); for (AActor* TestActor : Overlaps) { APawn* P = Cast<APawn>(TestActor); if (P != NULL && P->GetMovementComponent() != NULL) { FHitResult UnusedHitResult; OnOverlapBegin(Collision, P, Cast<UPrimitiveComponent>(P->GetMovementComponent()->UpdatedComponent), 0, false, UnusedHitResult); } } } void ANZDroppedPickup::Tick(float DeltaTime) { if (!bFullyInitialized) { bFullyInitialized = true; CheckTouching(); } Super::Tick(DeltaTime); } float ANZDroppedPickup::BotDesireability_Implementation(APawn* Asker, float PathDistance) { return 0.f; } float ANZDroppedPickup::DetourWeight_Implementation(APawn* Asker, float PathDistance) { return 0.f; }
[ "terryzhong@tencent.com" ]
terryzhong@tencent.com
8a3c39af6374a8fc32b985e7aa94969ff2d2ed18
013545d017d2e9d2ff1109385810413366959bf4
/main.cpp
f01dc70d58b87a0c0eeec76425785edd8d1a2d6f
[]
no_license
ahorovit/Chess_AI
9a296fbef7a5dc208dcd6958a12512ea79f4ef3a
d6ea8e37aa68806596622b85ae590450d52933a7
refs/heads/master
2020-12-25T15:19:22.695835
2016-06-14T05:54:14
2016-06-14T05:54:14
61,095,355
0
0
null
null
null
null
UTF-8
C++
false
false
3,048
cpp
/* * File: main.cpp * Author: arit * * Created on March 18, 2015, 6:24 PM */ #include <cstdlib> #include <iostream> #include "chessBoard.h" #include "chessPlayer.h" #include "myPlayer.h" using namespace std; /* * Usage: chess with no arguments makes the player white. * chess with any arguments make the player black. */ int main(int argc, char** argv) { // Declare and initialize variables chessBoard gameBoard; // the official game board // ... player is White, unless an argument is passed chessBoard::colorType playerColor=chessBoard::White; if (argc>1) playerColor=chessBoard::Black; chessPlayer *player = new myPlayer(playerColor); // the computer player chessBoard::square from, to; cout << "Welcome to Homework Six simplified chess." << endl << " Please enter your moves in the format 'e2-e3'." << endl << " You are playing " << (playerColor==chessBoard::White?"White":"Black") << "." << endl << endl; // Make chess moves until the game ends. chessBoard::colorType toMove = chessBoard::White; // the color to move try { for (; !gameBoard.gameOverQ(); toMove = (toMove == chessBoard::White ? chessBoard::Black : chessBoard::White)) { if (playerColor == toMove) { // get a move char spacer; cout << gameBoard.print() << endl; // show the game board // cout << "Valid moves are: " << endl << gameBoard.printMoves() << endl; cout << "Please enter your move: "; cin >> from.col >> from.row >> spacer >> to.col >> to.row; chessBoard::move playerMove = chessBoard::move(from, to); try { gameBoard.makeMove(playerMove); // enact the move player->enemyMove(playerMove); // record the move with the computer player } catch (chessBoard::InvalidMoveException e) { cout << e.badMove.print() << " is an invalid move!" << endl; cout << "Valid moves were: " << endl << gameBoard.printMoves() << endl; // give another chance (skip enemy turn) toMove = (toMove == chessBoard::White ? chessBoard::Black : chessBoard::White); continue; } } else { chessBoard::move computerMove; try { computerMove = player->getMove(); } catch (exception e) { cout << "EXCEPTION2" << endl;} // we ignore the player's exceptions, but you shouldn't cout << "I move: " << computerMove.print() << endl; gameBoard.makeMove(computerMove); // make the computer's move } } } catch (exception e) { cout << "EXCEPTION1" << endl;} // we ignore the player's exceptions, but you shouldn't // We got here because the game is over ... see who wins cout << endl << "Game Over: " << (toMove==chessBoard::White?"Black":"White") << " wins!" << endl; return toMove; }
[ "ahorovit@gmail.com" ]
ahorovit@gmail.com
c7738e67597c88d33a6e68a153141cb1678bf987
7dedb11bd6620b14004d2fead3d0d47daf2b98bf
/CodeForces/cf-653b.cpp
8a77a3eeead9e34ec899ea5485645f3fcd059de7
[]
no_license
nickzuck/Competitive-Programming
2899d6601e2cfeac919276e437a77697ac9be922
5abb02a527dd4cc379bb48061f60501fc22da476
refs/heads/master
2021-01-15T09:19:34.607887
2016-06-01T20:38:45
2016-06-01T20:38:45
65,146,214
1
0
null
2016-08-07T17:44:47
2016-08-07T17:44:44
null
UTF-8
C++
false
false
969
cpp
#include <iostream> #include <cstdio> #include <string> #include <sstream> #include <vector> #include <list> #include <set> #include <map> #include <queue> #include <stack> #include <bitset> #include <numeric> #include <iterator> #include <algorithm> #include <cmath> #include <chrono> #include <cassert> using namespace std; using ll = long long; using ld = long double; using ii = pair<ll, ll>; using vi = vector<ll>; using vb = vector<bool>; using vvi = vector<vi>; using vii = vector<ii>; using vvii = vector<vii>; const int INF = 2000000000; const ll LLINF = 9000000000000000000; ll dfs(int i, vvi &E, int c) { if (c == 0) return 1LL; ll ret = 0; for (int j : E[i]) ret += dfs(j, E, c - 1); return ret; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int N, Q; cin >> N >> Q; vvi E(6, vi()); while (Q--) { string a, b; cin >> a >> b; E[b[0] - 'a'].push_back(a[0] - 'a'); } cout << dfs(0, E, N - 1) << endl; return 0; }
[ "timonknigge@live.nl" ]
timonknigge@live.nl
f1f03fd068acb396217f8c97e4a00a623b35e7cc
79810323367c80f327e639eccbe420680cb9c4c0
/VideoCutting/FfmpegMixer.cpp
c0916324b45526a7c2a04c1caa5b10ae37a7cad8
[]
no_license
4ortyk/Mix
5ee1d88b60b42eb0f3ece17aeeb291cf45acbd85
4ef3cf0b6b5502603db5f0f3b97f7a352d46cdf2
refs/heads/master
2021-01-19T03:16:32.136829
2012-09-07T09:11:14
2012-09-07T09:11:14
5,672,022
1
0
null
null
null
null
UTF-8
C++
false
false
1,425
cpp
#include "stdafx.h" #include "FfmpegMixer.h" #ifdef __cplusplus extern "C" #endif { #include <libavformat\avformat.h> #include <libavutil\avutil.h> #include <libswscale\swscale.h> } CFfmpegMixer::CFfmpegMixer(const CLayout& layout) : CConsumer(layout) { } CFfmpegMixer::CFfmpegMixer(const CFfmpegMixer& obj) : CConsumer(obj) { } CFfmpegMixer::~CFfmpegMixer() { } CFfmpegMixer& CFfmpegMixer::operator=(const CFfmpegMixer& obj) { if (this == &obj) return *this; CConsumer::operator=(obj); return *this; } void CFfmpegMixer::ScaleFrame(Uint8 *srcBuff, size_t originalW, size_t originalH, Uint8 *destBuff, size_t scaledW, size_t scaledH) { if (srcBuff == NULL || destBuff == NULL) return; AVFrame* originalFrame = avcodec_alloc_frame(); AVFrame* rescaledFrame = avcodec_alloc_frame(); avpicture_fill(reinterpret_cast<AVPicture*>(originalFrame), srcBuff, PIX_FMT_YUV420P, originalW, originalH); avpicture_fill(reinterpret_cast<AVPicture*>(rescaledFrame), destBuff, PIX_FMT_YUV420P, scaledW, scaledH); SwsContext* encoderSwsContext = sws_getContext(originalW, originalH, PIX_FMT_YUV420P, scaledW, scaledH, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); sws_scale(encoderSwsContext, originalFrame->data, originalFrame->linesize, 0, originalH, rescaledFrame->data, rescaledFrame->linesize); sws_freeContext(encoderSwsContext); av_free(originalFrame); av_free(rescaledFrame); }
[ "antonina_pelts@bigmir.net" ]
antonina_pelts@bigmir.net
4338c536ffdc6ee00f19a12cd2d8cb61b5938ce5
c6df5d16f8d0d81f8eb10a0d6934567af755aa38
/Sigma/Stations/MachineControl/MachineControl/Class/SigCLib/CTimeLib.cpp
48d16a8e2094b1ddd848baf792f942717ddb5cfe
[]
no_license
Strosel/T4Exjobb
9b6b380ec3b3a9222981b202f9013b52bc7f2335
7257ef722639881660877671b8d87eaefe3512ae
refs/heads/master
2020-05-02T04:27:37.618992
2019-04-23T08:09:26
2019-04-23T08:09:26
177,750,346
0
0
null
null
null
null
UTF-8
C++
false
false
61,998
cpp
//{{LSL_ENCRYPTION 16#800 151A52AEF342212FF2412A957A14F9951AA6DF12D5310040D0233BAA85AFE3D6402A9029FE51EAC05C3321FA075FA164C4C51EA98B4E340364329B110105DCDDC73BF48BD995F7DF7FAD87BB00832C2D002C7AC0D56326E4D39A33562F89A9400367E185 BA374CAD0061F886595D6A64BC74CAB63F012E7529FC3F04CDC0CEC4D00D8F7B1E71669A6B7A579E28F3AAE3B02A38151EA2CCC31F4B7B11F0DA855F8D16F59498A6405C161749F6615D23E8F09B201DA03337E34A2374F223C3423F7A4F9A58D158B4B4 44F8F11E3DB1E6A812F79A36F4C7FF9E2372171C2343FC8CDC4C787878D8B15143CA2CF08BF7817A535FBEE89BFCAA1F4F10279C734C032326D1C1F8DBFC931A30BE5FBD8F1F8BE54225834A67FFE3056D8A16D35BD0C98337BE0412F7BACD9C55B204FF E4E3AF57A2751EA16CBFB4EF324E6CC228704A81D69B042C2A5C9BD7A09BADA73AD203EB198EF017C522CC5E2181D7E9CD63E0F193C394CE7351D33FDC5A28600E92841966A0FEDFB259AADEA8563D2A7B59161377633799C5AE9B220DF1248D4A537665 5719888B09E92120E6392C734598B362E6E718DEBB75CAB81C5B7222AB05056025CAE0449255312C5FF2B8E94315407D5D39574D5CB8B53F839C640EB3AE9B42E9259B37809CEDA72764637164689838D8C6A4C4161AE6890CE1388F92942A1A43CF7115 CBA81E950DA704D32731D66D0820FC54360A93794045B1CFC34D204BA8F01B0FD2AD7321B2AFA15B3F92031FEF8209D8448497C7F80F70C8A4271A6D77FC5BA1A110B9B9CB0D366175E467693D2DD294C142186422D9843385FA94BDF77EBFACD89AEEF3 1907BD95D32A6EC5C70FE0BE10A891C3E4DE8B315CF7813F88948844647AB7281A09D00DC240D916DE8C2D3728FB67E1B215F2A433453ECEA6883FBCDB6CCA70C9CA5B827014D12A2BBFC070D114A0BFD8DB348A93609A6E31A786D87FB4103DBC9CC2C5 8744C19EC51631241B7B139FB7F8F147D3377324B70ED127B7F547E8975715E6F8DB31414E04AB64D18CC12B228E0DF8F598993921A8AB40817DA71BFE311AE39076EB55A221184224E2EF8A41FC0DB7DAEB349E8C76BB4CD66BE54594897062FEF32BC4 B6379E337292BA976ED8122E64A34DEEB654C70695780304C4BA522E2CFE46639F17B06D3D579C786611B3E54516A10CF2AB9A5FAE5224D48A503A167243AC4DEC25AFC9061D671D3DCB418D30063063055CDE0B1922E17C02E0404E341520284C77B497 88EA3AFC41C2C3C8A8BD467ADB558B1F2E3CDABCD01F1A8D9B82CFC090F34DCE7567B01E4CC98F0B6AF3BD59C780A08C3CECE25A8730B6DF89B95F16DB4FF572DC6DD84971A2CE5681736D5443E7158E73826D05D2D6F7E769C8DB999D35CBC3186FEE0D 811D48BAA62705CA16C05453FFE67AEBE17BC2BFAE989A854E2400F8E87CA14FD8FC8B00C5BD96967411AF11E45D7EA03B20C7657A79C238C6CD731AA9F86F4783CBC2A1CC21AAF133808B204EEB18C33315AF49DAFE5BB7E3ADDDC850B9CE33A326D29B 0CDC5ED3EAC592C93980B896F498100A28F972638EAF828C4244F9E2DF9D9FCE62E709CAACF1850784D3548BAE601525B7736FAE83D1045E1E6A65CBCCBBA06EB38A60ADF8A839EB88A6C3FE7644449BDA857457345120409A3E322C8143C881E9FB9F0C B341CBCDEBE65050C39E79D5ED7A971B81692D80C282DE8934384114067D8999D0094229BF968CDC1803710D0A20F6D9A8640603795E7DE422A5CC624446A3F50687EC5B904FB5A845460DBFB894C4E91884DD2A594E1635E0FD3CA9D152899AA093067E FEE7A65D004104547EDB7FEB8672EE4B065228DC1B442DE3C47DE093CA8A73330510F7EE039D099D969ADABEE064CDA0D8D67DB9EAA17AFB36B76D3C4C0E380C3021FB3FC0A1F7DD0F8612A18E0CF2D5DEF402A892ECC3E10A6960E33AAB72F093363246 EEFA9934D0AA0B9E7CF0EDB2E227BEED6A3BB78A570097BA34A222754F715129FBCE03B1B29450A7D5189CAA62D7A87B1C3DF506401341F022DA190E9F6A938B1231DA3D67528B81C9A5F7718C0F79FC0B45CB74FAE88D92D79038357ED6C7F492457F56 87FE8E9B522D97ED00D6856B6451AEAA7C412F6128396CCFB55D7F9C21EE9B599BD62CE4A658D86E230FDE453C18A04C714806DE175BAE3F40AA16A9980DCFE85F5D0598652F2271264A42E5C3FF7FCBDA2AFCB6B6A0FBBE9E0B9BB6D4821880627F973D 23C40EA25005CF1F7037E33F62ED1F94DA5B01270DA3F7F6CDF1749063C84A7A6EE626F46919A567B7DBA228E17B33460799569A0D41ABA216930D953CF54E61C2367DDAD57A0C50F045D58678E8340F9F07894841D6FF45B1005302CBC540EC39C1CD7E 914E71398767409C0CD41A893CE4B725BCB96CAEF58988E58EF3D712AAC66C2FE35DEDFD241DEAC16D9CB0FBA232FFCCB07804D3E79C528F04AF1E4CAAB1DB9E8A27DAF187B0A73CB076E76706B348EA43564F10DF33046C49F3E3C87B3A16FC82D4D71B 67854033752B4E788974AB5597789109DB2EFCFFE9F8FBFDEB19EAEF1BFFA4BEFDBD7084575F9AF0C5299852FB25EF92AA68CD968D98E218E18A9B966CF8609D0A7952CFD82850FBA5D46AEC4457BC45934555486B1E5BCBA2BE82BD97088556B3ECDAB7 AD18471038E68E5F0BE00E062B30B23CA59D8822B84D7716AF24B6C0D5E4B1136ED4C25912755461D3F13518D49C2F796B2F9BA5A2F502C34853F5F074A26D0D51F2733B8B8F263E1A1D76D2DB804DE68C7F60B08258F2512AAF781D86BA0EBC178DD24B CA971357D7C4123F0E99BB93C57F2FA909AB728A85ADEA59BAC372A8D7FFB6196385917111723CB4C5362FD66D6FB240E041A8A107A4DE5C18B2F7B68CA2BACDCE19635975B83FA0530924C42E781721CFAAD77C35707CABE77A084F31405C65A4A90508 D6F0A9F12C7B2A3AD8A6E70CE278C240F9A66D8B3772A9FA62A14A96751C007200004D39554D53BD4BD1EA690D929BE83290DBE6C99507525327962D58146A02C1947A12C7437C34E12BFC29875C51EF72D70D609F8748F9DB811DC14EC6F9DD6DBC4930 BADF97A6A84FE727124A945DE74C5D64F1AF2D39D6DDEF8E4F69A6B2A3A5F20E3B591F743712B7E225CED788A8A3E9256F1AAB30C26C84E40C91C4876C5AE6A55909D607DE2BDA96D50226E7A4953721300133D7A98213EA135E7FBB716C50FED5E0EA58 54F1F223D23E4E5B7304B2E0FC0805692AA4E90699CCB89CDC1E7CBE017E2CB6E79DBAF81A4E27DD07AC568375CE0848688608A4FDC39871202BA646A60E2C41A6F553A47D9E412903FD9D17C3F464BB0A2A854E725F52CFFEAFC048EF571BC79FA3B86A 0214C0A24E404DDDE0CF71C9CCFE63C9020BC2DAC33A6DDF227471F7573D1B8B6E5490A44F8A2B92CE0A63417DE2F9FACB99B0485E05311A02727D0317487CE29687FA90A290F4B38DE8BC0BB58716D11565C1A177272D7AE67DE158C8A2CAE82C7436AE 9BCDDEF5341B55FB0001821D9A3EA263D727181D7A913487B1C6A64A70F91B0CAD60B09DCCB93B3F42863E50B4F0860CAD16DCD82068779A6887CAF3205CBD355EE94D0385B5A157A39B9DC03C06080AD7050287EF89E026271B8612B96D8F81614EACB6 2A1685E113FDCC7030CE93AF845D097A064958EA23711C154BBD2B5A7C9A04CA2E16F21D2E12B401EA2250FC23108F76CA845FC49572F375A60CA8D50E999316AE24088EA0C46309CA68A8556DE3D447A008FED99F29DAACEB56397AD28F61EFB8473B70 CA2B80EEA0048B061FCB6589835BB640FEAC6725E355BA8413F7F482FD99E59EBD564C13C226F3DFC34C61DC5A8E069211C8CC7FD6B5423676BB1C6EA6C5E8D9E822FAB8AA06BAB54C437960237D801D84B238EEE7E7EEA814C9FD8E912ABA366E4BDFBB 547733DFBA2DBF58E3B0BD9DF0F528CC6A59EF7B8B7A64234320399E150843A48061375E3147879BB0F51081AD3D4BAC46A811EAC7B60BB51CC7361350BB04593D8931152334AB17FCB4600107F5685F0F60838AB53F9F03C460115CE2621390A4B49402 66658D8DBB9D5A14C9F32C7110E3985D5A672B114D0D82FC136C807F281E39F8EFE42CA1A2F5E50EBE8D9D1DC6AF717CC1781B9E168EF331F0D51076105E5D62EBB27AB70D87CBBC1AAE9DFE8802DA5B2A10C35751F4F95C2C3358F7DC754CE5D632E145 9605BC93A71189105D350804EB342DE0CF2F2EEAE42E102E3C08B02435C5B0EFEC502254B422E65396A921920347A1CB5204A25535469606482F9EB5B964E6DACF5B33E9BBDADCC3BC8EFDABABB903856F07F1DD2F5385D60224E1EFCE5C65318223B915 57DEAA9923B18484F5EEBAA7180F0DC476B17BBC5386B017212B454DA0C6E228B0CF1E94065749D54AD984FB8ADC39044C8829CBADFD2776B099C21368AB75A90F773C2970BC2D74DD9D3E4BBCA1C86A090D43F8D9DD2297D155BF9B2C2058BE03A6550E 37B694F3170B13F3CF77EF861F30305CB5641671A0144564FE2B559980D92DC55FE3515FAD046906E33F242AAE0A609049E680D95FD451EF45CE98BB38ECEA407AF9BB81A8AA57255F6854F20115F08F5D1B6A5027FC1129261BB3C0E0172E4973A8FA11 459068FBD2EBE67A6F4DCF7F1D1F0DA147EBE4B6C9286F14E119B91FE592BE71B4270CE16289D2BD1067C7DC71976C55DA3D4F353C2DA3AC7671124EF12BE27AE045FC66E2C03B134A583947DB771CB7A9266016BB7D44BD3F7620907ACEC21C3E62FA8D BF54CD7AB8F3E5CCC3439740B654B33CF445B05763C8A3480545B66D83354C80D0FC52F219EA146436EFFAA13FDBB4A165FFE73292DB828D669BB18EB7A3343823CFE919EF8C0CA217604B117189E59D5517AEB3D5212CB7A08E50C752D15C30B8D672F5 3810D54A8AFA987425F6160F3ABDCCD5E96678F04F45D7972F3B9EFD055DB97B6AAA277FF1E7AE1619853393C567C7AAED1F3CB5C9390DCD979B217DE122F3F1916737A0A424D783220D5A30C2B42C84742ADA90E185B685222F0752EC7BFAC7D44A0F47 DF517E8A5B443B524F8325CEE3B4335A3FC8E6C506504FB2F35AFD63BA9798D5360F9C646ED2DC5DE448C6F0383B5C24BAB1B87F9DD35224E9497798243A44E38C60C7326C770FE1ACF0074CFC6266876044E8A10CA81DAADC818235646496199B36C925 7045F6DC3839155BC36A4B9774572FDBBEA22D1AE64CCCC05C3D3B5BFC235B7537D1C674CCDE9080CAA7337B342F7DE4AEFD5EBA75DCA62BD203E24A7E9E3E1E7A73129DEAC6ED950944942C0FF954181FBAEF0677DF443D55BDF8CAB9DCEC717921F3E1 76E288BACFF3D08B34600AE32BB2C7DC0AE00171F2AAADBDC6CC2FD1D675E72B8EEE43CEDF32B885E63FA7200A2BDB6740F59AE96300E88E4284CBAC175DEE7B362CC60F13EFDCAD80802ABF2B2C1C2F3AC70FE6021354B45F67E34B3BCDAF298FCD8FF5 078C68A7D9C629292738D66DCFDCBB8A14ACB4F602AA4565583EC780C79540E4F9EFE8E3FDB91844C93D882C308215B87BBACEAD48D03447CE74D29221F1C27006B93B77B51FD055A48DDD80F6F9C1763C1794174E2B30BA9D0BE29531A12C07EE36BD4B 5D231859800A1621C3AAA090A185348316260EF40D6D765529FEBC68AACD6016E01DC21CBE9B562736AA3FC160CDFDD6BCF9995352608467F9D5EC11C9995A10C2DE8AC47A2789223B8D3EAAE43E10F5703F497AEF548AB77E9B2ED6D6985B9A773A3914 5F941130AB51AB1ECD149E5FCC47A578B247DB378AB76C880477E3E900DB742CCA719DB857025717CE0389DAC4A1328F938262E1FAB2E55FB09554AAD4718E901896A8BDBAC52F9993DFE3EBF0A8A76FEFDA53980B538655E6FE4A433159A9832C24D8C8 5EF4F6318B6BB31CC78CAB2ED8700FA6FD2EA8948135911F768EEA865B54B42972FE152AFE6147ED6CEB1186D2BC00467186E472C048713BD263173D8050C5E042BC59ABA712805F6E04FCDD21D2A094194D4EA0F2AE79BA914EBCDB54DFE9190E136CE1 B512DC42ED3D9B828E894DBE9C0DFCE612A5C42C109FFE52CA49A669FB6FCD0D35ACB3AB5BA0341463D113E9D3D57562088D29277CC963BFAF42CDE3D446C6E5510F367C4C2C19FEBE7F75773F59A71CB35FD81F99B26E0A4D55C53EE3D9229A9D045911 546C71066FC4D88CD3F4B5A7CBF25CD897B297CD925EB0F94FA800EB2693030EF075336C0C046F8DB8587DF97042A151420D692C07BA4C85111FBEEE02C03B1B013FEF05BCBE373A03310AF74BF3AFC670B2A19AD5837148B9691D5FA9BFD4A780EA62ED 3917E197FF01BD85E03CFF149A265FE4C0B684C05B5B2EA9529522CC44312A37E27541747159DEC1211FE1E8C938E03A5E566C5620DC949355C02AD7D57800A652AFC814A8ACD7DBA8DACB55A1951BD4F4991FA13A06D6A9B2F23CCFED90FED1392ED375 095CF3ACF6F6DCBA535EC0B5586C099D1D507A93782C779A68C60777D583E2ECCD9CBB1061382E2AED67D1C71A1D8538BE81BD348BEB919DDD13E9E2F88611BED14C17C72AC2DE9EDBBCC15BA3E6DAAC7C4C44F59ACFAE386D4B3A9D138511B453751591 369451F38A9B36279AC1854B3C0E924AAD61AB135930005036966F4DCB9B034BACCCF13B15F84D734230A97574E7DA234BE9501A607A70027F88AB1CF264EBDE22309E1F384ECD201E8B75671871F2B456E4D459017120E4451E0EB009B7034035259830 3E8C10B1A9368496F900408A83F2FA6FBE09DD5385428C387CAB40F744669908636A8E2DC674935F64203003D81715132272BE6E3C19FBCCBF2119492EBB49C6BE811DEE2CB574E051748C7FBCDAF0AE48A73B52C6EB5BAF98E66CE0DD69220D6ED71913 A45D8B7FF22162875C7FCBEEAC8DF6D496BF9962EB1DDB57534B9C30CCB1384BE28555611171A0563F308E3063647DC4DF7E4CDAEA75160EC489B6E5C03B646FF20C6A331C7E84091FA06A630BE16BE207683A37A13A49A094494A6AAC4244989CC84471 BD68EDD35D157BB8ADDC74D52392795789E6233EE49E09C4826795B9D201E825C4A629EBAD959035D77DEDE959468A8A00BAA13BBC947C2276E3E173C395BB25B00189804ACD77CA800ECAEC05E5F66E7B4D4DC5FB4795B93F075AF6EC4B9B4AEC11CC19 A4A3D579816B48536F0608A0FEDAF5A15501E2E337E3BB799348C2D4B3E4F7B5F9E9638ABAA1BC220F4174663C39AE79717587D4B0BA7E49E5832A50D0DFEA8184656513A9402C72668E867D51C1DB6DCAD3F42564FF02376190259FBE5ACB4B9C371187 F56A038C883272E6A88A8ABD11F673A5A1C39CEF8B1102B389C181CA466189E16CF67316C2AF72AA0AA58870CA55F08F5B880728C86FE4E810CCFBCCDB8B4260DC39FE07B10818A5CA15259B55897DC5D60E319FBAD70BB898F1A9670809A0432129375D E4EB3D7C19E11E5CE305BDC3D3ADC23A7DE3918EEDA1F08E58FD7A9F995291ACE3F0FB228C89066C3BEA0EC7B4B267FA4F5BA8FAED20B8ED00AAE9447DD0A42B9E6B3C3E0005B2F3BBAA8E4308AF419E0E64A732B78C49727A561088EB640EF723E1AA7B BFCB42869B7C2C9B7E523D424FFFD33C935764677E89034E96A4F304C30514FD316A4E5C5E57242C92491105E254E8715D4F530DFB464298BEC729FF9BA5B1CF3C0126FAF3824B8D3350348F189AF103A26075BC2E3ED3264E261F5C6B14D91C44E07F1B BDEAB82156637EE83BE490B24F979462375D2CC2C372D63F6F9A15F466902C9E4771574EAF0AA7973DC5B05C45C0EF86ABACD596EC4D552D0078C086D254ADB06ECD7D946FF89BE4449876B6C5BA0E32DD860DE3D53F732D744D084BB1B80FCE278153D5 63AB0720193B4D2D80AD31EBA2CAF5A77352EA0E9E6B1BE464EC8A423A773B15D7E28C9588F3AED5AA1C1EECDEDCE720C7A3882ECFC1DD47BABF4E35AD47FAEDAF725E9B8CDAF3690EC46C7DA53A2C5052652761DBCD781F4D2EBD963180873698DC2697 8B28AF428E07E9B3D2E126BEC125389184ABD54147577A05394D62E0450F5AD979BE29865F6563C233FD41A7341941FA2048AF533A065B9BEEB7DEC5880E42687C4F452CA8C4D54691C7F7E2671B4726B2EF5421930F22A3F3FB88E4506858A547CE3A16 D27B26EA759F8D1CFAAD085F6B9972120FCD8A7408CE574FA18FC1CB3CB7755BF243E29CFD467779CD6E13F1D4B3D549F3FC399C0322989794930C3D33078CE930D16D2490CE25CE2AE25C0BD21A80B5D38B58E2E407265A5474D18F406B7CEB46F8988A 6FD245DA5A9F8A09916B7B7EA28822B31E26821931A5E3F6B7E4086E8EE4F0647710967BE6F15149FE7F143C07AFE643420660C98A873AFE5DDE528B11DFDD6F024505DA90651C2044267715A9948FA29A1C347EF47DA86FEECEA2F9D192B27C12689DC6 58105AC3DA0950637883ADA5B5848F1B0BBF577890DA6D7CBE40A1FAED324B90CB83F75E33BB938AD25612A8830852E1899D51441C1981B11F6B0704B4DC41B118DE1F86F94DF8C2F497BF10A42E754DBEE9CF48A3C0CE8E9F000C0A3DEF4235016F3AD4 3B1B8021EE83C89620B9CC069AE60B37E2C9CD209D6C69E6B5E90A47185167102019A1A10BBB0187BE522587EAF6F9F4131DAAD6A6528E1217FB8E1B53D0861333D2F5B6A8C7451D22232FFD62D51BD617E25FF2B2C99E5BEECCB6063A5EF11D324D4549 63B8034D87A3BAD52435C8DE2E48A241F7BB5E4E40EA8C2DA1837C2CF260352CBC4A4FB82DF02E4E08393F08647FFAACFAD1C4BBA71346E2D398C9D353E5EB7BAB7E8EA9E27C86AC33A903FAEF8C87FC4A900FA0026F6F6B0FC1FCAC57DAF32E71EE4BAC 4E917000A28563DAC46973CA68927F311A83B52575118B9371DD6DD3E3BB658DC2C1D9F06B079649A1F984D19993A1573445EA4CBFEB398C4BC2B33855723105C886C088E2A70A3CE5EBFB68A91F652A80BFCE15AF4ED7E082EB7A873426BFEFA90FDF27 9DC8518AD2B20582D3A06B008CAC1DBDDBD29A8156CCDB58C43EADB2365042437F7568210DD2729566607086264330BB1E40E3D4218BF473731B512A9DA3DB4A45578E1D7DC11B9DF024405A329A23F862DEEA23151C2FAF21CEFB12A3BD2887F4E2AE9F 44F31136966882A4C60EC1E4A9F46EBC8CA0C4C18CACF1DD3198E8FFCA6C616025A023E4FA1EF311ECE508C73F3CA1ACB8AFC56FCC24AB3E74009FA55751947C0970ADD63AA24E628FFD9DB4E5DFC202AB94FDA7BD1B9833A2B1D0F12B9DDE1E4B8AEB21 EFFBADB906960BE6395EBA00D14ED4FCE6FD0A3FD65DE13E3774413B0D69D074035F5267EEEC105F449BA6B01835DF55C9CAE31AEE6245230C4693879A1EFAAF237448F022AB868BAF62DC2A7C979981A880A42612E580329EC1AC8D6333171F3A1CD802 5D2280D947FFDE6BAD8422BE296BCA33BE0BB3762894E6A9773452CD5625056C0138DFAF723583325FA9AEB0F2ADA171C6D7991F743F0D69D730921D6D820786DFC54398FC12B17CADF52B8005FE20A7D67ED2C00B5C5EA452356CB4F65A295B536B9C56 1135C7BECD038D836006C6B4D4144E4595C245D8844148D063A9F33B29FD5ECFD0610AB8EF578D31C69275FD3257A9556B9ABCA81BE3D7BAE9248A9E1FF88F3EEDE2B3C6C957E61CC3432D6A043A6A6F885680666A2721FC4A0171431B1DF8C456E6B922 D3DB89D5FF05A1870389A7EE5B1E4386B654DF8B6FA6A490D445E6A6D28331DC073B248DBC1C0424346DD5A8D892057849E0F6399F408C3B29AF2771C3F5BF2ABCCCB7B54255D8D6AA11BB94F87A821644907D2A506D8E28049C42FB2732540EEF334EBC B52B9598FC081F8CCAA457967634CFA8F29B494E84062AAAD57D96F61E189D52A19BD6980E8F52BCABF77A3583CBD5A8C664B68765FB69433B616A2ECCF5A775758F9CB9FBA843C6C288B35326771A0E6D92145CAC5A6D59C8EEF10879ACCC799D53FFCE CB01EAC49FB612E102C5CBB535B123E5E009F1080F62AC98A9BFECC72A01F00BBF74C49C1F0BDD119E7120DAE3EC6F7D76E4370183ABC6A8A79B03E6818451F347F6CBDB44E2942050DA750CECB6001139723D6E8DF8471B731B71ECC12486240AD0AA63 31468EA7E506F05E394A77BD19B0BA4A40D9B615A8BF89E3DDBCD0FEAA703E00488B7CBFE35018708DBC44FB86A230D7E2B0BFD87A365448270E110F514C0EC23A3CC3ABADAAE8370C1827D418907BF424F133D98C1C907C5FC347E7B80457CCA50B922E 677EA2215656456AFCC8FEE8174ABCE8576B98DBDA5F15DE25D907080550AEC7C453B97D2EC4C0EE5D2FE54F5C82F84B0B35DAE8BC81803B094BDC1FB70FBB6597BAE0BE05FD83ABAF969C602AA379EC738D0B97D08AF9FA567EA82992393DBD91B6DCD3 924E96B9B3170355468DC6670E47E93253547A8789475CAFAD19166CDD27FC6A7AADF1236FB501D97AB7605331EE8DC0CB37861D6B2C5FBB62B17868DA6A877E4CCFE798729441EC1AE1EE424B487934ADA27F421A43BD5F4256669EBC2CF4C2F2472CD1 ADF866605872DAF57BD3C6B76B061115B6A5AA1182B08A9A3CD882EBFA7FCB165EEF622382E276A4CAC29E25C94BA7B92F96B1168401E22F69A7FE148C9CE2EA95155A097B5F84FDDCAB8F567C8DE8629A98A07AFFD01D3573B7129806BD1E24F10D2160 DF6E9E61F6C275BB9A985C76818F8077769848B3381E4105946BCF1326E553B366CEC23D2B6A1BA81FCE44C18C20A8DC35331040F852ADC1014B9FB83FD5AAA0F8FDD97BCEE093CB5903ABEC3DB525BDE27744557AB63BB6A1F431FD2AD4372B29C10535 D2E642151E00BCBFA978A39D49C40ECA62BF1DDDCEFAFEAD02BDE1C9E577C7877038327603375AE309DD0980EDEA2711F825CEDF231F7D687CC911B3BEC1C030CFBD92850FAD02E3E17CB0F40A6FBED20BC7AC6C885057E977F6275D1A38B75A28C90B3D 20E85E3EE00653BEC0BAC542BD413EDDCC54117B6B37C14EFCF690D41D7BD951DA2021553246246F0BF02B936B42C04EB998C4DF91AEB998541D1C5932ED23A7B637FC9B0CDA4DEE0B3524A2264B3C6325F69008C5A3A74141E1D029F7C829422D06077D 2CEC6A80FC04818C23E4F0229C692F5FA1789B4A179735D82F7F6E5ADC08D22E714C01EDA5981ABC10FBBECC560D63C06FB7B8FE0A4FAAC22532AA0167ECBBD75BD5E63A19793858AD73C91694497CA3D57B97158EA1B7A49F7D06C66ED64F8EEDEC466E 3B4F2D14F82EB3BC9E9CE8153C6C934CF747B1CD6F576847971C1A7187AD51D8749437380FD48CA4D4E0B820DA034BD67E1B0DFE1CB9437C4F3F3D2A616E1007C9DE1155AE02DAFD8D2E10E0DA989F046DA24707EA1ACC744E813B2A6317280CE7271A34 3A6EF6074BE0AA728B2144ADFE00E4AA83168457874E7C361A5951EB8D3D870A062FD8C8EEBF122265EA2545625384B422DDF5B82AC9F1B478ACA4F3D3A333E4629CD11B4D298B22D7E98B2EC54C41FCB11EEA0C5A902BA2A0B30900E22C28EED459042A A3CC4F464357389DF889CED4CB844DDC66E714B90A6C446FF775362036725B8F46824B88E66D858995B1A46DC1C3A4568985E30332ED635C9B425F450478FEEA3A33E7221C162CD5958B4FD44CA9326C551DF83D4510747443B4524FA6B2AD07A5A71A7E 257FD25E7C16D4DAEF90D86983DA254FC0B1A6F215CA6F6504995BAF6979240B15F99FD4BDE6FB568A0C6919B0A165B87AAB2A52CA4393BA7E46660D5960A1EC05509EA044EB4E49937711921D5AB83F4976BD5F8113F409BBB8E48620A6A5B9CB8E73FF 2B76A1529E7865BE8A0E5E53AEDFD77B4694696B5ADA0B35C337331F719920D766392576FC6EE797274805DD419E154E923DB23DF10E43FBB0DA117091785E3CDB6457C9EE5AFC58EB168D7C63C004D0301254ED536B6A5F3FB590BDF301E01780BC470D B2917912880BD9BF3711001D979BFF69A55E114AF7702B3A4A5973D952C2CDFF371313006CE988ABF9D360E90FA624D92544C6D267EC423DC4508743817B381E5B988C84456124665241D6111A177AA6F73FFA858BA15277A582D2518C7E9652A379EDE4 CE25215696362478A82AC93FEA6EE6DE303A7638FBF8D36C1E7C26266497E90AB9AAABA35ACCDC9DF7A11F32C645D861B381321866DD5CDDF01F3002AB66C54994CAEBF205F097078B59550D905146E78BD1FF4844BF8FE0FD52ACA08FB0231C988EDA68 94A37E21E3C1F38C495FAA5EAC3501A27D759F0FA7A8724A4583F834558E0ECACBC79E6E7232201604438AA0EABEC8026D926D8BDC0D834A667F8B18E4DAD6BB6F3B4830E1712865AB9802CF85D4A04F62862FE660189BEF17DA08DCA9E163C369ECA62F EB7EC8B5196F2E36CCD27FD5E67953664EF09B609B8AD06F43C4465E755B1A2CAC6064EB8BF2E5C1447CF7E3AE5DE689C968C7AD36B657A2B04BB21A27AFFC54467D2665C2D41DD3BE49924FF7E67F846F007D42428525D3E3025841E65D55AB75900DC0 A92CB13F15D0027F353490EBF898E1570CFC11AFF7AE863342700B8059494D668F409F2DBB1A45E301ADF1F8D247FE847A75DEC40BB5D04F093B05B58CA6057346F1E73704ADF0AC9D5D5DEBD7FD61C283E840E464423B3F2F748DBD798668BA05568F48 150BC04D38092E3B841851FD257712C2C2BF890FD4FC8048922358586CF85A5AD754533DF4B27524D51467C5D2E2273B3AA5D1185DC9D882D98AB8987434CF4945EE6E93520EE67901EAEA00F5DC7F0B854D9CAC51772133AC699C923141BC48B298090A A2D7537C0F52EBD803361166EE78737F466EDCBDC4AC9BEE4BC14A76253E16E41D9BE806DAA3DDD0E6D680384BE140E9DE095ADF9B8EA61E796BFCB67457BA91452167F5059CB4B4B418793EC940E0C8F991805512C48A2A81DCB1CF6C2BCAAADE2ECBCD 1254F1CADDD14F538FF2BAEDDF1C0C2F0234C2D8D1614227C2DA4428199119C18785A16CD412E633091758A9D84BCD20E8DB73B6681D592618C2BB109AA67FAD6B592DBF3D8077444B90D9791AC2347331D5DDAB3CC732F232E6D872610585E18EA61B6D 848A3BB0594E6F17F68BEC78097A338F7E2DA4C12E2196BBA619CD378049256DD00EB524279FADDA4F2507D8965946FB31C85C192E86BBD5CA281EEF56283950BE41BEE88E520FE6A60C5838EC846AACE658019D0665F2555BC0FF02DE8B18657D6C364B 9073BD8C0DABB8EE06770FA2CA9CA793367BC5FFE10074AC4AB95EA9F75C10A9B5D9B77829CFE8B7B9C089337BB882D08F34FFEBB3501980E50BA6C59F5705F9F2B7A3641AE058D200E9F8F80EC1E2D601D1FEC0A9F3F29BA4C903EEC51047102353F198 37CD8BA3B38CFD2C40558F98C4311D79F340565CD41F2B1855A66AEAB8BAB8F23371859EDEFA14ADDAB1C048DC9706192B4A975DFF9D07C6187EA67599DB377CB37DF44A11CB4FD516214F1DC71E1CB1B042B9ED199A8BBA0A184EF409083F88AE4CD552 BFFAEA56F6B449B82637917823A77E58DB14EE7090D8F20993CCDBCC48EE30E9929EA746D92B7A0D1322C456D4AFFA1138CDD2462A8EBCA13819E0EA82757B0ADDE62A3069DCACD884144EBE0BC2AFB6653BCDC381B8F88CD1BECC22B8DE0A708619E194 0D34CB39643FCB280C168EFD8C47A3C7E5AFE83D200A909661BADB072054BFE55CDE85B7CE485A3A422EB83F46B611DD278C1BCCE130771855AB857A3791A46B892DE32F7A584FD0DFCC23CE7547C12F1E45DD41D6E9F45C0CFFDFA4732DEC0D162EFCB6 36649D67EA659D785233D352A722F9523138DE3ACEC8A5BC19166404679FFF399CCF660BCFCEA15580876C83ED6F55CCA3374F4CE3D8B18FE81626CF1BB6EC3F0CD9ABB7CC6FB72DAC46FD530DA53680940329CBD84AF167A2CC74BDA02409069ACE3B14 1E61C5B3DCD3B2293A67AAAA1EE21B3FE77767F39B8F5A4E0AD3AA191FBB07F1CB001C2D492A5E6F49F892922EE6AFEA3362F49686B2BAB8DA8087EDC33E712640DA253B5D20F25FBEC1FE70E77A0552DFF276E4007E4209C2CEAC9AA749B8DCDEAD3F82 7509D5F0D748A07A9C84E63BF72EDB13AC9333E101620947F051516324AE4C957086370FCF450CD528CD63A8BE9EFCE5A022A59EBB49D543356649F58C590D853673F7C27ED453236880612B51B4C15990FFE4E4F13AFA1280EDBC18F6853004AC45EC3D 0AA37FFBA3DFF3B47B44E887EE97691006B33E16316A367FBA440CCDF97F64DC738F458551153D19D616BC20D64BC44BFB8A9E823D42ECD5C4B63914E777BF9198F4A6AD289CC52FC771820BDA2056D2A616E6A5D48DA53C0240B226ED454D2EA072E24C FCE4E4E9C295B7A79ED017288B17F6B1F57EC7A4809E7C8EEA769BCFA07931B4B27D9861F56D46D9CF624161FD1DC60DFB897BBBA85262F4BCB7C44E0BC39499EB7C6212FCA0487A3EC4FFFA25B49910172664D1A0F4F15ECE7294C84A13403B30741158 0160010C556A8C679C19927436EC295110AE7CFAF94493512BFC3EEC4E23A6CF212D167F5750B8BA8DFA771C60D2D6CA9FA3A2893EA2C59F500DAA39DF6B09A09F2EAC7B8833F4D7029258B5694E146F6BEA54A53C8626784638B34DF8294971C0D01F4B 9E61ACCFA05531B755416F5A9A8EE86CBDA74F3A1EB9BC1CF4D44138887800B764B0A018327EF34EC7EB6D664968F1C6848A252C4C9DDAD22D988ABF41996F5AFC76859BDFE0846BF8C35B17F1F221FB57967C003A2833748B9F043FAFE0D50F46020779 3BA8CCA51B65D33A73D4056B1186A049459545A0731024066F49C2EEF5C9830839692802433C3C2A42F58E42A4D2EC540852528E829137E005EA73D5CD110F8AF1DEF325F9003BD87545B3E85990A372C9D003562E01329FD6D301E0AC473CD4DA2A5E26 6552C208211411ECAE1CEBD1A991C9CF734D7CCB013F5862EF8E192F7C11A94026C57622904D38804548AE6F5086CBCA89505A6427C44C0DCC78C0EBC4E40037A1ABDC15DF7C2A7BB13BEF262E2895393B32F173176550D829C2C72102FB9D4CFD852A01 085CA98FF45F0652CE74464699B88E337D290801F3E733B893DCEEF9BF2AAD9B6F08300D8548B915C7381FDEA49066DD211585541F9C71AC6C0D1DF9C3698D6FFE57115306CB0D9FC482EF67524008B853083E21EED3177F0C10CE0F3CC4AAB4D9132950 874EDDAE27B0A4CA1D48C97E50DFEDD9C68F111C58F82DFD731105417B41898DAFBB1CC6385B838AA47386BDD7AE5A5A885E44C8ACF23D5E21149A9CAA6D9D3D845233EA2E6D2A7DBB29418A16443DC02D98A9ABB30BFE33FBB28642BE6DBBFF6EE56B12 C7E379AA4DD02A92C58F5F4EAE9AB2F010DFA63A43EE21532F7D24945DBFDC2B7D1281B88129A35D8B41321CE46D937D7A57C612E60F42B51F06610CF35447EA905114617D5614D732AB633CFEC958516E5E45734C4FF09BBD27ECF7B3A2F8FC24F6CB18 6249E66B101A3F9598DC02872B24A7F5A2B4741A90644BDEBE46015181549C5009492AAAB77E5FCB1AFBBC5968FDA9CE7345F949C423098134114773F89FF6FC8AE99A5284D2CD3C267ECF24E4501BA733CDBE1B76038F30DC2E57617E43BD2EAF3852B7 79F67E71D81E2ECBFB5679A5542AEFB937A04060A4760CFA1A035256108482E14763BFF92213B0241141D5796D836590D124DA189D44AEC97D83CF26428C6CCFF3AF9357ED2AEA5FFB61B117BE2E3B869A5F0A4C788117E6B0CBC753D0583B233798021C CE22667F5BED8BCC3E1997631DFA0B9CE9BDF977264D8E8A4E8CD8374C110B26FB2B85F30CBCCCAE2BA70A8D31C8E8AB726287CD4405453C2652033432189F080323C401A09EEBA72899ACCAF27EEDF5B87A31506E46FB3D5B8F4727415317EBE36842AB 99415BDE7D74CA6383EA24B45A81A7E5AA6D2E28140E78873064B0161F30DB4C8CBA565D1FA4B3519AE56D9D9458293BB011778D5BA312603F9ABA3F8D80FD1531F11579F2E6C815D2E284504042E4CFD498DD32437E6A19158102E7890490AECC5C7C7C F9E119D77DDF4E29E9BD8C50B6F0BF078F09A11D3C4CC8589C4D9CAB6AAB35AC231AE044B0DA06173715270C09BC5E2DE95E7851D98E7858626C52E70B0AFF0294E248C9F2FABBE7FCEE0E12974689901743DDBD141541E4BFCCAE1D3183BCE28EF1F6E2 B427EEEC3163888E06AAEE7C25A964EE95BA153F7E719ED62C47B1BC0E947DE59FEDFD0918A5919685463168BAFA945857A2D0007608BD9687198A3564E0C27C41556F394063BFEAD5526C0BDC63AC3A7DA06A125B765145EBDFFCA22FB717404DC1001B 063D9FB3C5567038390278CD6AEA336BEFCC2F7219F1F9DE3BCECD7A4EBFD642F54D7D8C6DBBCDAE7C3E1E95EAA969BB651538974B4CFC9A4FEAA268A935EA5718BB36B80124639E4265310760E9ADB3FA5F23433DCE4314DCFA2E0B656E50AB1E8E9187 F663997ADA433267C3BF7DCB06552C19D56A0E8331AE36EEFAEF2F1BF1ACA5594ACF21BC56AA544DD1D8C1E10F4B019B561A449F0E41385199DA2D172AFB5E2DF1BA8EC6F280E6EBEDA33A0223871046E8B0EFCE613DB8DF5E68A3EE48F14455EDA6B551 7E9F84D4394D8C5CD6C92B4D3FC5EA5FC56A02D24803DC626B13EFD824B657B08D9F77579FD3FB13344EFEAA0407B07804A5F5086F631E81E35C743AEF8A49E2DF3188D213FA861F7B32FF1E9808C2B49B893A98F7B7C25826528A8109B90D75BFB377EF BEDB0E473F9D6F9ECA4A1122C43FFA9A686092A4A37500B544CCE4C3A95695D9E5C2ED14FFF462CD0D07177FF53A240637177C7C87E2CD003AC8F05782BE307C8651078DE8B13DA0DA24E39A39926AF96098BD7625E26890179A036E518D53532AA861AB 9FDEA1737B34D9009CC71343FE1F865BD5DAB6D34D9AD87D378BC44144D165C2989CFA3F3B0584BCFBDC471A80E91B20E47E433A97C19A748BD448A2AC93BF0048FAE398F357ABA261DF0149DE9DB25B179C7FA0C042AA3313F69E6D54B5D2601467E76A C0A0476034E88725B0515D65BDE79C31B6501EF8824EDBBF32BBDE5C6B50748651E11608DD5CF619A09A0507B54161538B1F42D2D885A475D16A68CAA79C32DDD218BA37F5A82D875D76AC1D8021A14EDFE79F28DD9526783A8E56C77F7590390DFE0D14 759BEEC24A31668063C36C7F58C2AFE65AC5D5331BDE623F80B66974F8F841F920B864E09F38F2479E750A900A566C7BDC72957B9E1911AB93C5F2B847AB815D02E41B1D93CEB529C28AD7403D1225FE664FCF1244D206B85330D982C0DEF842C55850B2 2BC16934373914ADB4DFFFAA77CBDA487647884A98A1AD01251E5F9A0C898772F5069E7D37300F4D2EC00B52C0A50F0FA7CD1A47F116FD63FD19312DF308B59B84BE916A3B879528C14976D61CA52D981974034491F2ACDDBE9DEBFA12A8D2AA94C24881 044199CCF2668C063A754DBE57652FE6FB49D397678633F05517E14867948E29468699047CE70B7C27F2F68343D07CD784A5708883A320FE8C1AD6CAB62E3112AB8EB0179D53A42DF88DB078995271063FD6F2D96FCAD56A7D3FAE137CB7ADD7F76310A6 E4A7B2C4E8AB6EBA53E24035644C56B31A7E20BF349AA163FADF3C7DD1A2D1DDE7CDF2A39E59D52110C9A1A812B2854AAE2F197B7C7C2091EB5F50EC61C686BA10FDF06EE6785C06FB412FDD52C7D742EAC59E826CA3850C258C0E39BCCDEDA987D3A489 540127564A744F90AB74715AEA9B44BFB05C9D4CD534F27D4473E6478580C891FA7093253A0034C66B25F358A27C3FB48233363AFFEE3271AC168C49D6E0058187F27377AEB87D8D9D4EB73A8036FD2A503AFA3F5E030D409355EE12578046DDACB111FB 28E6BB5883889F0B6658B1E7A01A203DCB29A54780FCC88F45625380BA50E838403E7CB01272718867E8B9CEF1DA9DB0CD42FC8D85398B71BC710D88D438A940126AE2A3E2D157EFE9CE357048B8314A79B7DFA8DA55F0C921FF9576CBD9BE657BF3F1B2 2B8649F354839CACC6C3FD666CD12E68A3F9CB1A30079399685555E8EE8E7FD80360C6AF041A0EC4F0CCBAC8E8833EB3FC4D668260D2C5C3B17EA1F807515A42267871AE6CC8D4E15C935899A39D926063FCCCC7D21DF5D679D82A8DDD6DA952A55F9080 EE3B1884D554C10A9588824192117D401813F91AB750456205A6D48EA5CB0789134F3BC8D3198F727933C13D88F178EF57292250DB480B4DC27650294FAD7BA89C79B5D10B386BE4B0C9A2230590CB8C95499F02E690618241364D2D0AC4EE4A16C80DE3 225DF5F9BFE9EA27C2859C4CA7B7DB2CB18A9398155B08A3C8C5665C9A0AADF85F8DDD5044B746F527BB351540AF0D1B3023FEBCC1EBA276827FCD40DD0211C387B62D70F3EA25B360FE6D70D6BAF6C8E7FC76B45ACEEB335696301CE20D14DE2037A93C 351611940FFBB28F561EC3F41273B1090398934CBADD5BBD4EBD428642928D6899A3EED5A61E5FC6F0E2F76729DF6CA8095E718BFCE45D9D33CE24C3FEB0DE5567123EC91BEED094C1269FEA260D9F63D2F4834EF16306A4EE0195B0E6F97F2634725DC5 D01602983E04BA27B5C1E5364282725CF4CD184659BCD8EA7CD08BA0CEB50210C60B258D632FE6A4A6397E73096BD2F75396518AD6AC346A9C35CA2F0DE23EC1E5055E9F0415EB2327EDDD5F43E6F1A703186941B9520A5B138325D54DE5977AF4DEB387 6490F12EA02A56239277A279DCA589ACAEF642D8AF687F557F6FCCF6151E8A1BD11FD22FAFB554B673660262F798C64481A9DC2933408873E6CB49A031F543FA1C528EBF9D8A0F7BD50443E1252053C22479E0B82952C3CA94D900741CD6460A2020BE04 D7B3317B697365F0C639E26CA0B4800D2D30F2517E384AD5B812388C8C6E61C6AF8A7FCCF1295313FAD79950B4F194B033E1A013C91910CDF6E1E1906989AA2848D8E9738C0B2F88F932011D6668E7543038EEEA76979F17E967B6CD25BB71399B5B4158 7728AB83D189E967C94001D57DEC30FBAFBDDE4E9396800FE9874A510A602F2B41BCC152CB2AF5D320B8B63B9DFDF2E2F344A033DFB2DD6614C91ADC2FBFF031BB1E6CCB85750A26B47A8A2EE01ED587E281AC378FF23264DAE9EF49E2208C3932DE03C1 51ECDA9CA2F945D9F9BB663F5847D5AE9227214FA8149ABC92FEE080B0E4DB7C006F34162192D212FE1F0FF3F653D4483B2141FBEAE16A664B25BCE07BF7FECD3F6ACD1736202E00F43658450E9560FC9087CAF206D5061ED5357F7FF744F9ECECA1B15A 086F2EE31D4CF608883CC86ECC485FC8131E4A1CADE132D563E947C9C471FE9B45A7CEBF9F2ED549E33BAF267ECB90A313DF20EA903E1DA6CB5F70644B30A21AE4F26C525FA2C6EEB7E5E3C28F310E515B3A7D1CCE95337E8E058CA3391BE75FD5E17E84 41905B075B15F121AECDC45185135496996AFD6A842326A7768FEF16AB63DD9C966C642F81962A97442782521CFE467DF191E2F81B84DA0E07A2CB280EFB84B87C9A465786B74CDA8045D135F3E2638EFBF65485AD1941ADE1717910B589B5D89E2FFE6B 3994AC95B63F0A8F46ED267DBA7BB5FEE23E987FF381C3D15CCE5F5F4C0B0649E09BE7AEE10280158D46E3F93CA66F1A3CC1751108FE320C850D04DE6209A5245BC691922ED563A9B5400515354C4B437F3E16D0FBCFBE407F3F9BA346F79A751BA1A569 B4AD7631997E352AA65A38FD4D4A4026DB839490E8409A4454CDFE41DF8C797FA21BCF715B5C78C11CFE7381D34BB40E21CBDF2C02B6956A852C3C3E6ADFD187C76D505922F93E6ADF1EB1E29C393D26C36EEED3992649D73A9629B2CB827055BAB27397 C9C63F0FFC1D44606CDF373363590048052E754F0A15A3DF1BBE7FA4FD6907C883A6EF794F4FE0E190DCEF2F33B073ABDBBC9B4547A9D1127BFC9E72B81BB21D06F5E55B09BA6B2DD07526F58341F016CEDBCC3F98378DD85053D107E910A2A3CC489622 190E9BD8BD02784638EA2BD4F937E068A6916857419AFAD1E7F4A538AC8B47F0FE2A0DC094427C5842F522623A30CC19C728439FC0C41C8D31F763E7716E752FFCF98C81CF4FE9CE8A94F733929E130FF691BAFEEB027418E56DB4FC08D8F6E5457CE34E C4BEC9A08FD1A514D194C96013E3156ABEFF4C279FE153557BF76BF1BFB45A144B0398390AA3BE286AF984BC22B41BF1AACCBCDA618F0AD42DD14F00C3C549686E9F7A04CD709999C8A420CE3FA6CF6A4B12059F3AAA8B6D501B5592DA2AB5144619CF12 0EDE210B9B8BE9E0BBFCCC15C9C779CB7604AE50B3C21BA116168408107335F0AC63D78BC83D178A0374E575E7444B78562B85CFEE1B2B14A44AB3EA4BDDC985294B3ADF7CB1D8B1CC1C79C2F472A0872D4C6C06FB7726444F1835D853AF64D9593346BC A7F3A0755E59429FE8380A3DCB150F2F2AFECC6EF106C5E2903F5C79237C661A770D69F8C23DBE6B919718B784284B75007A45A3DC6CC597C68BAB48CE938D74C18476F0B7130280B9CE5243F9452E65AFB3FAD4524D086F2DD4D319896F932C583C9E64 5EBDAD53DE4CFD6374A4965ECCCF4EF29AF0282286F068627DE06727DCDDD0EF0A79311509F61BCD139722E585985A392175353281F2CF85B8459535EE37FB26DEB05F7FC34E28509EB3BF7E0A75E8C7836478756F5495CBC99A14AB5459DC8B8A5CCAF3 1ECAA9C75F1D3446784463DF724CEB3F5A47D848900E248F573753A2FCA93719B2778957F32D3CA937248A30350D069387C9E4075107D5FB83F354DD5B2DE6D05B6A8FAAB1AAFE2B9206F3D2E7F2800FD8E702AA92C7E0666F9593F8459F5615559CFE30 2DEA467DB07FFCD6110E01898EF68A63608AB3E72A9DEF92A190F950463FE6BB3495332CC8148DCD037AEE5A158E50C5AC077E1BD0455B9D12892A31CCE0E86C9B0E16A38B198CCD5320B52692CC9FE9F23762715501FE5182432AABDDEC8631E5635D56 75AA8C3287A1D25BA1B562FFACC9C48DE24BCBED7FA37477825C591CA1CF4E117ED774AB36EA3FF09936351F6081AAB8EF481AC42C2F59AD123EFA9258942FFC2F2BD9D09449247A828762BDF038DE222ADB8DF33EC9A99B5E4CF97A6B233CD5283CD287 562D3633ED21FAAA7EADAA1D445B8F011E655F2659F0AF7BE702A1BAFB94C4FF9C4CB1F24788DBC44439AFA383F9C6D719BEE93312A3F4606E23AC2EC2CB62F76EDFB8E0077F165CE4E8471B7E6D1316D2F3F3710D5145B5184588EB3BF75B4D8D80C64C F085B303D254B34F8ADE6A9F5D6A9BAB4AE70BDC392371227F3EF14F95414CB6D345A205274F6CA636D50CF248EB8DFCA970C9DDB83A9CDA562800A4240A5069E2F5C093E03D4FE58DC04A654375117E0BFB3E728456DE8518E39BB014597662C95DBD90 B1633F43A843FB7E89947AEC455D513ECDBE5E537D561B407DB5F2C146F36B880DC1542769F366BB709B7D645209614274FF7DC6BD87AEC17D9B19054A330883615F8E0F9E3EEAFCDCD79527519E54D1CE079FD11B7B92A2C9044AEB6BCE2BC08DAC8F0A 3FAC8091EAAADF838DC75FFE236E4E21B0A9D0A454595912E74E98DD7F9FC519A5E2C7CE2BF771A12B5AFC8E1441DB07DF271A885464A45871287F38F65CF34A65CE58D8A19771744B2CF2F850279F3C3D51A900FF0A3061916FA82FBCC2C5EBA73DD3CA D1EF8CBDCF308DC0A826A318CF569D17D522A1B2C251402B2AB2DD87A74939CA3C1FF198BDF5026E512E0E0C8F5AAB6C6B88F91BCEB07DF9A0CDF09041C51FCAC70DC895AA9264D69A50D884CE79644CA96592FE77D12DE8B8B1E30384366FB00177A726 49AE14A14DEF8658056BDD9170F41AAF2395C9B50DE107A2D1C2B4D2D5EB521A41671DCF6E945C8E5BBE238A57B5D82A913DAB3FB04117C5B4E8A4775C8A696FDC84B29526358119A2BEFDB7AEF969F3DCB25F91DF081C383766E69DD964F2AC4B04970B ABE417E360EBAB4875CA61FBC8440A56D76679B4DC1D7AACDA90274064D2C667EFA9B70DB393185E0F7B9DFEEB0C499829914C6B3384C85B6CE94105BB5EE6BD6A9E159C6DCC1205838157D986DD5BD119DD3A8E9583A34536BC9FF1A2CF946BAB082D5C FBEF5C00736226573AE39355E98F5D8D16217ABB0C9D6D640B93BCF0A51758CB198B90EDC93884E6C06FF73209A9C48181D877B5FBFA73CD3AE38F7ACF5BD07169C6F091D8981C943C7B10E9F8C3EFD4A2D1F4C28D873D22A63B56505C44A899057BA8DC 34C2F19EF38F7E246BB7506DE8702D2E6A08572988F6835D8827369CA198D4C54A95224BE6DB3F039392913FEC6D376E00E42DC778897D9E80CC6A2264BC8009F8DD63AA5E8B8CDEE0CA64FA82AB67BB68E28AAE8BF000AD42DBD747D01070A6AB7E7B85 49447E6829F1EA4CCEA35F06FF59D6C4E6243505D2AB0B3C9D450EB24FA6412CB3E7B093D0B2D29CB7FDC14EA31D180EF10AAFE32648F85B5829490283DC2108F08FC34EFE1615C7EFCC25D2592A68981B7372FA15F5A56062A52598F9FFF7D4FF6A7EE0 88961332301478CA049A92B5A2DAC02899F8E2DEEFBEA914AA2C225F538B1DC2752B16052CD31E66A67DF1D688B21430C38C7D19CB4B4312EE4EE9E59DBFE3D4B2754E468A4DA18C868718ABC10A1A83837C71FB0EBD7C2B720A1C3D27F821EB6D129200 5D1C38F8902C23DAB4A4096452365038E3102AECD3F50845631947758909B0D9404D0CBA2F9445D48A2E7FF2D3C8AE0CC425FB740FEC0116ECA9C4CC36D1A2A6402BE793A09F9144F1BA003B43FB41937ADD9F5D7BB48365A4A12C0FE45CA5CAEAFCC975 1414CD5CB296795BF80403A5161D87EAB1AFADD23EAF5C5A54B3A5A2981E4CB1CC03973A0C39F71BC920B165F100F7DBD3A25767173861D3F9412BDB437F8FEE69FEEBCF0EB00616C0D96F6B9809B0117FF95ACC24B2B0230152DBC1308C6B28FB3F9462 2EED3A8288CFFF0BB000D9B19328C35C450DD0F9B1D8C1A3FB4160035EC63E753D94356C542D49568F71D780C286362CB48FFDAAF07037388D578EDED6EDCBF3FEC41D3BE60CC739AC8B0744C2C4C180FEEE8C398CB8396C3B8050C681635B5A48C83421 CDF811EF78402A45525F42A42EF41DC1ABA7DD42F7323E314B088DBFC6A009A70D5D8E8610FB8263F336505BAFDABF79618858238E11E1FE3ACCDFC2849212D86D03A4A621B2451DF70F2BF3246F6A8A93FC41E16CDFD0C26F910A5BC3BAC48BFB72E735 98B74E00905DE31447602FE8724A835D9865C8C8E611AA903102ECB6862DF0DA24361E3BD8FA845796F73F56B16CDB5CED43712394DA1D3CDAA5BD32FE0296BCE7BAADD86607DC16B7696E4A4D8E2192F9EF268645CE09F87D19CE364039335B2F8E4883 86A99610942799B8D8D421AD05C68F51BBD079859D0C0BA348B1ACA6DA7569C5217253FD1368959FA3B6367D081A666EC40461836EDC9E830C5A1C305743733E837EEB60F22902DB4355E7E5A08B7E9E6F61F7031DFBF2D0AB070419FBC5141B8ED039CF EBE5B207DE74AF0487FA90271E209D92DB9893C8BCF525B548CAA3EE30381DCFFC4981FCBC3C66A1B01B462EB06D65C7F0F8E9EF7492FB079746ADB9EDC0886202EAB6C00A6CDCC02FAA0B5E8B7D119E4C3DFF02818FD21ECBC69753E0183230497A2517 AFFCC0E618BA6450D27498F0F3EA4A557AB817AA89CF5E2021AF1423A5BEFF48D52D27A29562233CDF319BE848D9E31938825360921CEF41E18BE9F2EB7F78E8EFE0992795305CDAC1A70DD05F5CAA0A78A72A1AFC6C6444A1E0546577CCC4D12E4A6542 2AD821A7A7C9D5547A5B9A80AAB9E1A84C058D11C814388438FEF50284E6CA3CCCBFDC371A707496E5435DE193201054122FC6763563E2EA739D80A6D1DE137DF7A66C6460313666DE96F357A068FB1F916EAB0852F3D1362841F4F3CEC5589341541EAE 60F0CEEE1C9F3F9100F880E203B27B56863F56CA633B71B789C15523C52DC0E1CB801480E3FE837BA2BB9AA759D5F6C601EAB9E89FD1612E7911628994630EF91F1B65065235F38775DB3E7A77D0A699F63F0ABC8EE018EB96625EE0066B624118AEF3C9 B1CA0067FAE3BAE4DF38BBBFE186C98C8E17D3050A38332DA7660659794E41F9FB1EF0BACE0ABE061AF29DBA6E7645C1EF14422026491049B29478BA746829EACD50C0332F36AC90A28CB82A93752A6451A49CFB4FF766F9769A97259C9DBF603FBE46ED FDB28701EAC8F9B63F2EE7B2C665545AF2BB1930CC6EE7163FC7092603CFC8CF08FAB6DD5603C8F04C1EFE350C0DAA63D9C2C2CB91619AB48033A24CB38D75345FAA23133683E0675FD5EB63EB37290B957BF9A4CEDE15702FDC270DBF47487FE9951026 903274B82F973710E6DEF5F68EDFE00FDE4A00C52A7587B07DFE1D196FDCDBE852992AFC71A6701C0F7B050653736891CAC06B27CA462F4D418E129285F4F4EE0CABF503D921D2EC810F2C0AA685F789A99FFDB5F9E3E3BB248DF048F89E51157BF82306 25B5D617625F73C55CA6C59600EBFB9DF5C942630134070ADB9310A57E4F0C1778ED96EA979E7EF01815E3535F3192E47ED7EBA13E9590CCE631E13E2C8BBBB4F95687237E81F754CC100D4117B7DDFAEB08464ACE9292C1538AFC84A40DA0EB96EBFA7F 5F52C6E42DB37C05A871436CFE277FDACA1BF830BEF92337247F46109ABACB68E12B436D8412909A199EB68D0FE8476D75C8BC6939221D13454527FE4F8EFEE4DB663E1C9E1462CDB13326CFBDD684CB34BC643D96B124F0B2C89B0B51C7DB59B3622357 570F9F4FC3E85DB29D63DBE55D0BF722F4E024E232D83806241A3CA0A963F57E794C9778E5CFD278A677F11FBFCD61B9F8AEF5081CBD4763D0F84CF49FDBCC9D49C2413BBEA90A120B553CC943419E7BE4CB52F498EA6CC65019EEE12D79D95A067CEDB2 023BD3DD441CD64F204EAA826680FFDA47FB93FBD864637FBF53988B5D65C43F6F69E5262783B3EFC133F9B5198DDB29B0C6A5DDC5AFF585F200CB37C12EC466073F82059C2CC22CA8BB382A36669E3969E683049FE365CA67E902BBF28FE6F7564B0BAE 45B43918845148DB4640474DD7AEF8746A87AC1155D9E2B54044D678E30977A6005B75095EF933FE0813DB416A116560D798FB3826F46AD2E44F63E133F1FC73F06B6851F17914BF6338D970C17EDB49E7CE2B85D494F1BFEB62F7225B4A2383FD981A1E EAAE23409B20CDBDA3711D10BA694B02682C86947AEC4909BF787A199F018567E3967FD5D4A4411845CDD42756F6D7C88197D40443973550D0830C7EDB99D8951ABF87A6FF5C2EDDBEC636B2232D51D59135A7F53730AAD39DC76B8258E48971895CF0C2 FFCE5DFDB3E8A5FDD75FAB57A2936FE9B5853DD0EEF6C37CAF0F7B40EA7088BF667B0FDEFD24FE0E4FC096FDC3C3DF37A6BB98433482823D3583B0A88EE6E8487D99D95A3C8692BB1D1D072F4745314256D157ACDCF0C47B9F59937291D8BE0CF09E9989 7790AE7C6EC403BF2DC1A19097A9DA7D7EBABCD6E7D29E756A992AC868F63F35D53F971ECF44CAEBAEF7DA1EC612DA50B16955EA7B01869DBE993E5C8E0659A0BBC78CAF982010F9F3B6175DB5E0B1955E4E8302857F08A56D2A93E5164A9198245998CE 985713808BE8F7AE8C4FEA50D2B31D4544073DB08F9D2986C877B6023EA3550CB643A57E2B4172FE29AAECD45F5EE5F859A0472B2A0D2CC9DEE7E43766994B7000E0F1FBF0957CE4E590E9DE195283E072C62E0B7EFE0ADBE9138222FAB72E9DB13A5B83 080F19F14BB52BA742D82BD8ECC8B667972AEAAD44B06F093D19D1E15AB55EDCF7A89EC256436E524241269624364BD4E9B8D01CA79D9A4EAEF7375AB717B035E37B105E31A9E394D3A3E940D88E08E8E78468AA855CE6570D47DE5C93E9D2377D96E41A 4C094E545034DCE7028B0048E966FA4B9EF87D879F76B46BCD0FDD73F03C03B068E6C18FED9CAF7F02B3223807B97B7FC1439FF5B6AC1BDC453F43C88CAA3BF7793823CF7C19F57593BD4B782AB3678D760F824B6EAA0B595F5336587F36A542C5040F98 E5A238513458582FC205531C56D0B3A8D955136CE8633B34556A9746500C81E0BEC9A8A40E419F87225657E747B03ECDBF8DCDC3AADE5FE0E0B0BA6095F7C4C3BD5BFD9535C2517E9D2BBF747B8A1ABEDA5FE603424C21EABC07D17AD57873F15A1C9730 142350DD3AA8BA67A578B8D09A3CF0DDAE156411FF71F8367DFA6502E71E5C022B529C1E653CAB2F7B591DAB7CB1680B9A143374624625406915D3112376C97972A157ACF55CAB414D190582F7C6B6BC4AC04222416B5D17DA8EE23BEBCADDDD2165E97D C12B5093B2C81A2753467D8593207398FAD96A03993DF367A04700A80832AC28FCF7FA03B5560C4E8B8DB68F3F9EF0B2669FAF9B7A9BF46ED1B1BA6A0D71A3357E4E047290A0D936FA88CAC6A2A900F3562BDC28AE3C67AE3FD621BEEBDD726BABF531CA 3D4A3F94F5FF0184D155961F35EE239DC0B4ADD43BCF422EE1D93094CB0B5111CB52C354A5AA53A0A0CF584F77096CF07B98E35E3DFCE9E2137E418D60EFE0E40566FFF1B41F2BAEDE77F47D8F7EFB10E2371A8D14E383B15FC2EE0A7693DAFF572D4653 6D8D4AA179D2AEAEBDAC559832BD00A3DA4BEB6422119365CD09F8CBB0EDB107BC8FD73229324679DC2795C31B2F53684E85965BBED5154995F9938177D61B15C23CE8FBAFFA3180EA95BB440731429071F376E6603A7D5052A9EBAFD1AD16453C1F40A4 E6F8E310022BC7493445C7818CF430DB80928B9107DCD6AC350D3AEFEC1A7F9351BF62F49FA442DAFFEB942B71E63FB6064C8F87D748588E62C764E7AE7520D57A4783C7633F4B920B4DD36CA48FB725F5BE587C6F76816F99F1686A371366F95CE204E2 3571EE7CB0C45010EE292783A5A0AA35EABC4688E3944FADA05AE4C6B1361110A5E897821FD93E5C26F5020472DCA58B0EC02AAB68B8469311C46B436B0897D0D8B9CB54BE2D7A2170AC1516DC78A237DED62C8D78D6532E808958D028D847F77D4348B0 BF6A315EC5D22AF7CD71F7CBB6FC3E35CFBA1AE636A860786A0152CA336C68BCBD0AAB3C5F3CD60A208017914D39788DE413A03BFDFC5A1C6F85F834838FF4CBF04C5ED3CA645B4087DD4106A9C8F97C21628DFB19F09B3EE52FBFE36256D435A45F192E 2F3A768CAA3AE20DFE626499C892D77C5CE6C6791544CDF76D0899514BD9C3876D506B85C61945B14A27C18F31EB23EBA8B3EBCB3A0DF10021479C4FC8289CE80CBA8C885F55312E882F5D642F4F15D0433F7ACDA4AA059CD4FA6BE88A023F740A7094A6 7216D145FFF7540B51229971F7231A5630F278530D56FB1E7FA2D9724230B58915BFF2D573018335F50CD72439EE175A92983EC046F269177A9C916F7DF61439912791921F5FC894E965A4ED794A5433E7F67753B19C32B1009E5A2C19045C923E3E542D 9159DF96E54258BF3384ECC1FC7E7BA704E454B382DB2AD74ACC7E853F650848E42B97B64CCE353041D7A849B07AC8EBE1F10B463F42B405684334B9201299DC73BB6EE925D400DA4172428FFE960BDE2A7FE22A86221B9858C7E38ED1622FF84183E3A2 94B33891C560E01F749DA7520035EB77E78A85BE7ABB37B2810962DE199EA32F9DCE7D1B9EC6EF66610EB27C97146999A23C756EF6084C344A20220E53DD41E0A734B03191A408CF3D6E448575DFEB5B35FD7F8AF8F92F315CEB1FCFC56066859B5F4328 E89FE3A91FAB1967DFE60031B47F8DB4B0EDB8EFD4D7A9904BA6F4D1F572AC75123A141761102B59C24D59DAA6D89B026D5EBACB63E68BE266AB2A77D9CE28349529F760BA7A0789F8E3174F86E9327AD62B4EAFD406F16035B030B52357CD0D291DC5D9 15A02E9EB21983798BA385405A75F992819E42EEE8E15AE530C0A813282DE9F8853F8C7A53BD75DAEBD127B991F10D38BAB3797135C00DF8F0C0CF7DD2E419CCFCA856BEDF1CC7C5509378918B23D5F6FC0B7F5F811FF5EC2E35E7924D363570DE43D236 3D39EFB7F8E0ED7D19D8DBC29A65C11166FE0BF2D971BF26A67083B174FA1450175C819035D5E0D31C2A53898D5B3DE476250DCDB24A7D2DAE577F2F4BA6BB7E55EB86DE229EFB87518D9A81D595EFD76D43ABA9EB5FE4A5FDBD7200A56E3B3BE56A70DF 680867DE6293CA4E8BF3CB69B37ADAB6E88B9D280B8974C9DC70C24F83493E56551A39351E2EB9A2A9E0DB8EABBC4A9775DCB8F40C08E7926D3976F9C1FA22D0A3E5A53D24E2883BD7BA435AC8575FEB2902870D0457C31C6567F6D7B570DFF49B0F7543 4907166E12F715D654B392D25DFD095B30CD9EF1D4D510F893D2DA51C2E5D4ED867F6E004781A12877FA745002247843CE3C6BE25D863FD00FC55C5E15A86CF80C87F04FDD5AFEF0A51C681455ABC505C975E6443E0ECE43F4479587C81F4002970D04FD 1B1D6CBF2A61A916E767CB942C0EA66C8CBC6FDB692C0AEC8466BE3F68EA62681BCA0F982F2EBB6DD283DEC4E17F7B5C445E91CC77AE9A296AE99EE9376034DAB54F26B36338276EF428C34F28C289809EC6C2EB41124E055FE0482D586117CCEF9AFE03 061C7F5FFC1F5765343F977C0D6CF2B637EB71BA467FFE8B820FCCE7421229995179472F11B2DFCF3217D72688DAA2EB1B71526767FACA8D7CD2BEEDCEC9AB2D8DFFA169B3F9EA704BFDB8353F682F46481101E1B246DABBF78A6A6585A9E66B3C14A9A9 27D9A951CA9FE6B0A7D0506CEDE63B38736577B26A296F50EBB16FD8335F5686CEA973A2D118DF30C05CA81CB9E21D35800B77DE04C132EBE6E2E5378C4D608C3E6520ACBF1C1EA10D403E0121E58115C95E888193B2EF52232B8012708E1924BE9D3F8F 543C34A388DA50FDDBC09632E6CB5D484FDCEAF2E59167FAF7AEA44800142256E73D900485E14FCF84FF03277CE46684CFCF71D372B498288FB1D5CB5D4A8C8D47AB835944E82E076E3A57F35744D1751F8F995BAC687378E8EB662F4A63DE596A27E265 3FCAEBE9495C1A40194C4EDA3B8575C1E7147AC4561011764A5E09E1E7D6EFF78AA66221878ADF6F63B43A93A1D3DABDE73557A778412E44547FE65081D4E8A4D26FA1AEC96261A507E12D4A1A1C1BBD8E86D6319B97E56D56AA68618686A3CBA0F818D8 116CDCF2AB22EBE0E9BB47A0E7108BA7AA3C1037CF4EBD7CAABEF56CBEAD91B74C5BE5A7679834CA8594DF9CD61517907B74947C3CF05340FC495CAF93194335FEBDCF6B6882E25535A6DDD28AED5107BBEFE59183DB907E0E2641CDB312E9FC49E6DF76 C701718D25C6B69A55CEA9DB8F3313E66EDC4825D6A4C4E6739D995D7A7BD6DD4F9FA68DE4895C4B4FC38E4C6A090A62D0A22586CD491E7AE70D3AB8C65000B4D39A1AD876757BCE1B05B0CC36A659ED28E6AFAE44F04B460BB1F5C4ED26E965FA9F1705 9EC09C5131954589284D67C28DA726035359332B1C8362A87605C4640A7A7D7DA33D291FB01E189F88285B79AEA41E7DDD13BF76F814F15E57D087D811492216EAAF531EB16351FAD0059CDC560859164377655A20A7DD9E3A3076A66CC36C28D42CEE6A 53DD2C4068FBC315714B14FEA3A80A5CDD8B67BCD44DAED0732B56EFAD40CDD7107B067686681367C3E7573204A4E1CCC92D460B9DF710DB28B754848AE2749405F66C8C729C2500B82A3A869F6A6E619F5759532917379D135AA551D2B616F8507D5A9A 351C1F22E0FE4557F85F8982247FFD65084AAA202F9C4062473746048AAE3D5F296CF0BA7462A55F242F514896E2B88FBCEB1DA00A61B8CE2A94D190AD1AD70AEE50F22F310AFFB0FD367D37BB63EF6D2AFD60AE7FB12416DF30A272E3F12A11BC84C416 78ED665C43EE123BD149458ABEA0FD8AF0AF68BACA18F2BA362E283664E231284DC891C7E3A336F02FD0D6EB11ED096CF3B918E9F12E57896ACCAE4444F99A3DFE4BA461FDC7556F30BEBF588745B39AAD2351FD4B953164375CBC2EF5F45ED26F024217 A9FC5075FE72E479A6402D7AC79C784B2FB98FEAB8404DBD69E28DD12CB70695FD5D40DBA9FDF371E4E29EE6B74D47C1C3F1E9E5A65E30EFA6326DD0A5B13858FAF86FB168CE5B4A03783D92E82A242D8EB355C5A272A8BF1BF2580842E1101D3D9121B3 47E173766BB04969AAD0C44143ED2F1BB1D9AF544736A7F0C766DE9DC59B9D0AEDEB7D96A1D5EE7973968EBF7CF433AF40632A3AC38A04808A6BB4F6C02EF9A8EDFD669B1564A5DF87C6B7593ED855D5FC574F3E5A45BCC89BA267A45A184FDABB274DC3 F1BDB18E31FBFD33604FA016B742D49D551CBFC40B95C35D6D299ACB18CAF6C231331EFE8F20AA198122027F7EC92A3F9C6C0B0BD6D99BC5665034910DE7A0BBD8D88095940C958420939CF015F3DE7E0B2B7DC553567CEBE25D6D9D87976AE78B0940C3 0A31DC2CCDBAD4561B32F984C24C31C6F97D3F6DF9CC78248CABE5B4CE73053E4212717EEF7E0BA119C92FD5AEAB23F295825850128CA5023CD1DE73BBA8157E4CF02A37C8AA7E854DAB0C323DA6231D2B9615DB93714EA3AD1A53618FEBF49443AD9523 F27B557EB3B985CC5A806FB6D09D0DFE224F4DEAC11B115D27BB55122CBADF1DB4E9D289ECE4FF9A9283593E208DDA9448CCCA375D9CA4AE7FD0A8A0767018F53C97E177C066EC2DFC482CE0631DEA760AB074F8092E662F7343447A267538E3356D9ED2 8B39995D39FE8A64D3698FB2734C320F31D0C096E422BC8E38AE0DF227A6D1CD3A3497703A6CFB8DD9868AEA5DB0F0D826583920909409D311305904794C3E0B7B37A4FF1522FFA64DCA6B4ED1F9F2C6B9BDE6809ACDDA2DED7DB4441F827809AB698D76 0A24D4B1AF5DCC199AD3EA616F195FF61910EB24509385E294EE15B1AC3F993F16D0050263E4A1F3AB4A5A3AEDCA66A00BDF21352C3B90AD630C5C22EA54AFB37D60A6A872CA8E920B9740894A325E278DD4371E4580F8C5456874B5A9F767486EE6EB9E 8F5DC4A037DB65D3EFC3CFAADBA5A397B7886D143B615F6BD3278FB06FC91EFFB9EE175547B8DAB8416B392DB413C57E900E08E478D37ACCD971FCFDF75D6ED93EA7E4C0602AAADBB19DDF1AFB18B2738C5BA94E48F366C889BDB81582FD1BEABC486AC9 7D58D4E2FEAB28135D7ED749E5CB7B1F7EBAC80F1F1D435F688F6B416258F3DDDC76E4CC591BBE3E9CD1DA956127EA4687EB2ED58F0DE7E313C515F086F9078A186CD4E94B98847F9A802C73245B1CE99141248C88536A95C74545BD5DA68B16849FDF2C 3A30608470E9155745F772BC6AED34C8F1431073C842F0AD94A02BAB1C32E986DDBDA1D48EEC9DFB15E1A4D7143D0A9A91D7DFB874EC1F714DD4D1A5CBF88CE57FD2D23DEBEDEC24F4592D5597D14770B462345445784A2DBE7640A85DC96E05E082B56D 3939699FA29EB87B16926EB708D7C8C7BF0B9257462B5CB8FE1E973ECA163AD1ED6D649B1BAFF6CC1B705068FB0D76A03675179873A899E0F89B480D162F99FF4E1C9F07A8A1E594AB2BF2A914364ADE93BB2A15D4311A01EE4B5D3341044A89D175C23D C29E8ECF10F65CE27512FFC240589D723934FB661F1370E28A8EA18E15A631BB954643D235AD7810F8E6AD27A525CEB456B295F9817027887AE3FBD99C3BD44E290C99C6B309702C9299D4E62C8C169451701D01D473E84E1DC881298AB69A17B3DC0462 EB489FBE569E21EFA4BA0A6CDA070537BC99AFC0040CC310D2F94B1CB6228957EAE5A29C3DFCBF2E6103C8521C674E3D7D40774784D753CC79FCC9B30B849C3CF0423EA266BB670F52925ABD7B71263B3B8FE84B5F1D96A217B2926E77988B428BB96265 B221B677366E91A3B8EBCE1A9E7E98A21E901D402E40E79D69A06EF3182AAA47ACCBDBA61C1D0EF275040F360D3DE0FBA12ECB9FDA2AA58B87281A9399004A14CB5CAE70752C47598D8921967647CA34766B5FF2E8A1EE6587AF1359FDCAFE0F7D6A139C FE92A9548B447BA9680A4A8537B8A83545CE03A3A5CB6846F876509DADF682065048402CA48737386533CC85F3A1DBDB8009F2B40355D01A3BFF567F2F8D555EDCAF0A144DD72B0665FB44B1BBEDAB7F78F70B7C656B13BB3475DB632AF73CE6D5635C6E 302BC09BFD20613218641BACDC92EA16C192FFEBFC8C9F7FFA3C3A1BD3D30FA4734C4CEC5F92161F45F4077C72DBE69DE349B340FE0A79CB56CADD75AC10AD4AB72CE7CB30CE0665CA10434ED09CF4AF2E49E133B77590293EAFD0DEACE65E2FAE34A91F 34F497006C426968E6AD66B06A27EC201BF2C40D2DF44B14C82360D74D703F8444C373FC05EE0ED7C9124C5F7E6AF34376264C54042461B883776FD749D244A0B4013E070B2201C7E28A23DDCD560CF05B5E931AB19E17558707EFEA9545D78FEFB24212 2D91D55EDF15DC0756F8E05B5E9798596DD8543EFC0C37F8E82B3E02706C641CA0616A44784679FAF5CF12D39499CD9C263B544C23CBE50BA3E7A9B0031E5F3196E7467B1CFEDEFD7D80BF782673A8C69F39F9AD76D523DECB4E59C8EBE93F1CFDDFAAA5 B6D05518CAD8FB4009BC569D5FBA1419A0DF1D6B1BA6EC93E7523925D97CB0B533DE1608F4C60CAE4907D46FEF0DBCB6C9C7E19CA5A5C059E424E7791D407BD76D6D09521ACCCCEA59C35DD8F2AFE289B6CDADFCA90F345110119FD2EFAE217CAAF87591 2E46078E6FB2A8FB9B97FC80FAA4FE42CAC5EE1F4C1029A8719940F03BF03E43AF83C2E7245B6FC86F42126ECACCC93B2DFFAAA7F85264719E13BDE696E8A9D641E72CA863DD0F42F3A9EB90C9B29CF0682423F0409D3602B6FFC5F766A94D831BEA5692 8811E8C29991702B86027B225BCA1F5699993757AF10CA8DD80DF762935766EA61421701000A9B253DFB40FA6CF7BB42D2DAFF330FD9E1CC709A84DE6483F69F14334C8EE4D1CFD783505F1E43AB0AECC216357FD37C7DB5B4B775BAD848E4E5DE2E2A54 A41EB0A8E9525BEB0F4886BDFBFFC99A7E5A786280B8F21038E95E910362D3666AE90C24C223BF9443492C0370292CCECB0EBFBA8C2ECA6390A47C587FB9B5C49472B0D6E3C90B495887AE8EDA1DC6C00859E913E69F0C6309CD1A7FCAD8AF3EE13F374A FAB203C6E6ACEA617198F4CD69F3C30CD1F9AFA501B05875E274BC2745B7CE760F9BE82A4C899300C66E20D7FCC63E1CEAA3644CABB82B247219B0D4FE1FFF44F91FB567D8190012675A7202C852AA722834D2EA34CC5B9007EF2B488E571E41492CFD10 8F1CE99B82CDF4A06320EF922EE37F1B9C9A7567F789D6E23B3A9DC6B6FD335D05E6CF66D5B9D28B68002E7C83DFA5674DBF7E8224C642A3AAA03C845F1757EA7DBAAC389A31731CB7D7861DABB2EDE8542F692299A15D5FEAAF7147A57E1D5FA654A1DF EDE2AD3653C1C05F7AA8681480082B3CC4AC069C168CE5E1EDE5AB58DCEDC5F84B80DA84DFC34D5A15F171BC583AD58381E4027082A073856A7EACF6F5B315520CCA07AC01D20011B34DB5B4D4B1A08BD5BF0DDE57381740D794E6BA278B21F6A453D78C 3E6E3BFB9D8D8270A104644AAC1AF5A067BE39051C3AB7631A043B85DD454D4E7B4593E73B5819167B96BDD426819CA3E8BCA77CA97473BB7A815C3869BB55D81198B89B6F0A461AD464C88B10F71AFDE2BB6BA046F8B1D61615D0988C2BF5CE1064C212 A7C7EABFD6B0FA290971F9C0FDD73A612A0EB80966866BB3C25DC4EA6F46AAFEB11C30FDE72C0AA6057A304A75A2F0A988F0EC543B900C14BE17140BCBB52FE8593231344EEC18FBE84432F0F2F326512FD3339CC24751E55AAA2331F24D3B1F706B5E0B 43FA0C1C32E52928F2EEBB7A15783D8B9783FFA5E892975AE75665390FB3D3C779390FDA7560E83065715D9EE40B9EA2A4350EA379E3D44F4714D3787DEB2D11E4CE178C5E6EF4FD3EBF4A0B4688D7B095D0F160EC87C9620C5BB4881268C0231662F56F AEAED70F249AA4F9B2C8789E487F7E0EFC1482242A7AEE26FD8AEDC93D9EECDCF7580DBC2FB97F5FF3848A3C83FBF7CF207BD465D588E991F3CB869388116BE8733C0CC3AFF2F0208AB3966397A41719A7F474ABEF32043D8567697653A86C80FC39F47B 737D8485CA4104153D69FBD5D9CDC3F5F3F0068840C03FFE987BAF09577E2AEE2AA001C186319895E18DFA8CA135B476510998F08CA8F89559A16C4C1A3E102C865CE12D7CAD32E78C4C6AFC413438E18572B912A88080BC5BA8F59F6F54D26BBFB8F883 64A5B32087820D2E2AE5374C4CCD47EAD7332004B2B6584F44D7F20EF75C6804618E7912694CBB2EA5C7A812BABFDED5CACFD6FE457C216FE73335B577F0DBEE94788E90B1FEC62DD1B3C9D863AC83DF8FAECDA2AA1D7DCFC4AD5CE0DE892C500722A82D 0CF5E06D8D9ACEEF3505057CA1CE967AB640FB183161FA269FA9B9B70903FFD374AB9D1016D1C5B15A7261EEBE924C4302B455E01597953D26FCAAC07E4172CCB20EAF5A2F2C1C0EDBDC9DDAF526F876AEB6AAB43B79744CC575E7108A257CC390BA456A 941C6F69ED00EE0C00E6FB017901329E63C96B6E095A5948990EF3A2A3D5AD240D56B0C00F46A44D62A226E465E7176A5D0A605F02493EFAC21F096FD25E4593602985E6FC0F631F4EE4405089726AF0B84B251BBC49D09491CEF64B6D79A0F59964DD4D 7EC2AB431D916C77075AB266FE4832CD26B4A6188BA3C16694CD934B53085FFECCCD12E161B44C26299945118F814F4DBFDD7DD0954F4524F4C9056642EBD3DE96FEB8368E826BE94B2C5DC90258F9D5D3240310FBE247570FA8AC12B1CE21B4FCF68B60 0BBADCC3A56D2F89E98658F18A57FF550A3FDEDCA200EA9EBB9E4B37A9002CDDBB9775E5A62E1DEC63A52660383D63983A5C7A72F73B87C7BB5FB10A9AD8E65E4461C040662452F1EE861E70BC713A1F00099F459B11C7DE4657ED45492ECC1B856DE80C 801F0B4E3223ECAED2BD8ECBD798BBAFBA8B82F2738CCEC85F9C624BBBEAD0653A5808E21EDFC34FE1BB46A21B794B6FB6297EA1078A40981DBD27A5B2122B584AB7062088EDF41DE82D743EEE559D7208C0EE70C7A58049C7DA01BD2B51F2BB50041C74 9C41E2D6BF2BC1DDD062C1A48DE802F9305B30FEDB5CF4C28428A5B3CB954155C6F09C5B86BCDF2460ACD968CB1D8EA9D857BE752CD6421F385E0E46C6E06AAA530B638D69C84F4AEA2962D09ACDBB7DF00AB69DFDA826C2D3F741EFF57C5BA7367EB32C 22FB39D6F99CF6AE894575AA3BCA6C34A055DC081A12034D2AFB8B4CABDE40F77CB95FFFF02ECD2FB91C4C3A67D52C1C4848D5CB2F1BAE4500DCA25F2C380A8552AFEC176B7218E3D42B969987BB901BA136A0F9028FF9255071AD83439AFC48CBBCB7DF C3A0143F1DF27552E227D4CC623D1BE2B46E3588A766F9F98CEEE93155646C51A23339873519B4A67BF71F24CE2F9F67631DDE7E43D120E5D1D7D2AF04920051AC414C2C9A7E45E6B8F5D58C754DD3D248D82DE2AA473F1E53D1493941CD931AEA1C2441 E4DAA14345477920F397E99CCC2F5D4CFBFC392AE6DC34F9514459F0078D57DD7212983E3336D64B6D0FDCC21941B571A6CCA7F3653DB022F190268BCB1AF01CB2EC13AC76C8DD66C9AC8C6AAFC58AC4D4FFF17A105D4FE6ECB92910DA1885E5B0627E5A 9674D1D3A262EFDEE33AD9610BD27B38F87BADD3417CBA969FCDBFB0E455BCC1BED423B03824BAD876B5CCF50ECB99F44A1B0F72709CF313EDCAAD090DFDD813C75357D7F5499E4D6872AF7B88415B2A5C987CF73FFDD7164B2FD60A54FE4BB262C6C246 A31DD263D989B00FB88FC60FE6754C3F8C48896FB53FED8F027ED119AD679EF40BBF1C1139C8731EA943F5B5E7E82EF083DFFBD71FF77D76475E99D48B8DABA9F4180BA9946BCA52C4E0DAFB4F74D32282BA14A349231C45E378502D721236C24526E964 3DDF13EDFE11C0BE1CE9AED1848CC9EFDD0AA8FB380B93F763F7F76765B1A1364203682E1BE6901E81F25D7A9779C9CA5D28E27C39D4BF7059DDA7009C9064B9D5C80A6C7C923D833C8302B26075B81F9BC93D39162533DD1525D6CF28FDFD6CB5F02A38 B78B3A9375245A758AF4D4DB024A2D57567993A0C31A1772C33649C9C8BDD543B58A0CC1E309AB4780FCE5801F458C21B766BC08A5354F0BD6E8CDC1EB5E6CA7D2DDF108DDA3ACD22194AF0BAB500FB1318A9DABEC6DA363845A6934C1AF7BE9DA249D3F 1E89170C11838E26E0E17C0214E446965C4AAC25F5593E7B57CBA960041E2BEADF9B23138D2CAC540B04E5F1EF0C68CB3D68C406B65BD9273726EE2FB4066B5D38857B85DCD3311DC652AA6AFD3A7D8CCBEAFAB2C882867FBBB8C09446F25E55AE9B6E52 9CBA8E463301C893FDFF4C61DE6A6E65835A29FA510742058B6302F3FCF00E9F64FC5621DB63B478D9951084C37E881380E755C37F350632561328574F1C90C911A8C4F00C46664DDFD074F4E9360C91704B1264967295559E08B4EFBE6BF0940AED253A 41CF3A7932D533C4356F7003793983BA93A377D749CB81F5970DBB7FCBA40AC42D78E2BA951A4E14CD57D26E405D9BDFEAB59FDE9E7E2A366DC2383DEFDAE32E0A6F1DC526B5283E6F436F4E5F1419A617BCC63C8964ED2DEE23DD66A61C641C3DEAB6AC FD4ED21E84C4D549BFE5A620C0BFC832AF599BBAEEE51EC31FF2E3E79DCA06661DBD4386CF032E71894687FC22D7E3BC571BA6307778B6432FCF50E99092A3C05048193F89F9C813157533B3A4D50DEB678A3D8078620B48FFDC490B6F12A51C94606E0B 2F8C9F829E843A5338890B82587C6DAFE461551B0A361A73DCA971B564496E3B0155A1B85CFF69EA9CE86FDE9FFD81C63C46FD6166FA1FF6318DDC7648DC1EFDD21A17A47045B3544473ED124BFD7E47A6FC95B1D46AA9842DC19CCE75675B0E190FC20B F0E7A6B66001C7FB8F015DE0AB752BEC701F90499A8D6A4B068E377E4968F84632FBA3F5685E609AD93DB283C8491FEFF6D182FF1FDF9D7D7BC2898F5C06D627C4CEC17AA01890EBEDAD7D14A578527D78C673B7A02DEF11A4B586E8F4E5F9F9B6950ECF 6A3AC6734F90C59F7642F1996988B94A31F2A18CF0D651FCD767D3D230F77EA81021A6088D1FE8E464DE5D62DD54E8F9E86BEB219661887F5468A7F2FF42F690B4BC1A3A7C78EED9F0CBF43B706EF479CBD426681ABF7A59A005E87DEFE4ACEAE246A2E2 8B29E947F537C74E7BAC7B800D3BE85559075562D4CB86F6837ED0E3D8565760B4A45D26D173CDB39248C9727CFBA7E7E46C97F150D63714387C4894B3B291DEA8BC0593D5E691FE5D854F299A69115888721664373E69D3CF70AD0C7CFF5163E5E34A8E C9E949268C6907CA63792737F183CD2AEA5AE86EC1FBA08421D2636A32D2D531D42F9E28CD1A9F88DB7F7CC8B77C1A28FDAFAED1C28B055360EA55516E94E3CF0017AC0305F46E8F82061CEE71D9F33ABA2454BDCDDA87D720D2AB76CEC786AA91FC97F7 CCDCAB247589D9B5BA31E4F0C6B0FEB50A064554D7EB75AC668066E50EFD6D17B1C37AFF8B1E337616B32CFC311C87A3D7BBD130D179575E6BFAB5313E8D6901D2FE45ECD86D5B22904EE64F928B735FCCE409F76891256A5E3CB29A0D6C5A4D62889557 748E6BBB6FF5E9B6BF78432DB41F13CDA7761072A0091681C4F1DCDC8E2172D3398210A4F51D1B27CDFEC9999862EEFDADEDFBDC459866BD2A031A07EC20FE89734C35C83B2983322C020559C2899B1D1443C0785D38DA2AAE55E8054979004B48438CFE AF9873C42CF33FF63693E7C9EB110BED409246CAA8D76910A3EDFD3B3DA1A519CDD47EAA237FD53DA08EE97D2E783339BF94E60E3A3A1A80C7B2A0E294D9B25664FA885A5324A1F6929BFD5BEB5D5A2F67972C9F247A4DE05D1140125B42DEE1A6434B93 C16CDEED1D203295C38087EF8A0845FB37221104E39C7BF2BDE5A0EBCE6924D15BBCA6B03CF7805E33F02FC0BCB7C62ABB82422C9E837B9A58BF121CF066362D5ACAD86D80635C74F040693ACC5416D4E6456812A48BFFD3CDCDB1F4FBD574F1F955D2AC 7799C65BDDE8BBB265A598DC0660413F3D73D832F1F3CDC5F7DBF1BC867948AA78B7ECD2F5206FE454A108F7D16215FE2E0CC93FA5BE0D919A7D76FED5C1CD646F3630DFF91649BD47D5FD3E4A12BBD15F19C8383FCF716C7428F43F75C5F88D1BD53901 338F2313E44D5EEF142FD09C2EF0A936EAF179DFB961E54CA8DE64F41538DC031F6EE5DCE1CA36B226F6E145089F13A76796C1202CEB44A2AEAAC91CE274F49B81325B19A6B37696F8FE5CAAF16DBFCEF838BCA34519CE6A530310D1FE2D9628D2CE1853 B82F69E1CD5222CBA5B948D9937425712BC97B0728BA8FA411A5A7B585BA7D3EF2E864DDD6B20580D82407961F0AF771D6555EFB388EBCB476474A8A9256C85875AD1D0B073E81BDD0AD610E2462C7E716FD316A5679CF2816E1588CD2383048483B9319 C38F5ACFFEAA41C185D500F68A2E8EA1FF47B5D7DC49FEF2CC253FC58BA98DFDA6CD013C94A28BFDAEC5629280DF08EE4DAFEAC5C94F5A08BD3BC5857CBBE3FFBCE212975500128CF38CA9DC8C4E3DA572F67BD6C7C8349D1FAC7A4E82816BBDB03A1D78 261EA1FD5DDA4F317AEDAD4AEFB72FC04EA02790276190F835CE619D28D4A31E6D30F87C87A87DC8835C4B0E98677AE318B08FB8A27F30FF717D2FA40B306EF66083AE6C9DA8F255BEBF4023FC319AE74BC8C7D198EC218C63EB1F2BD985CDC2A9DC907F FF9431E9EA821441D988B8C05BB09D38C072C76A0F90D343BF84F15933ADC4ECAB171F759041DEF4EF0AC22167318A53FE258C41A21D6D32308386137954873589155E13AEC1B1F81B0CD531E379B2D601229B946440B0C5ED91B9F5D70622BB5C02867A 096D5668C87B56BA976ADB523BB93E60F05DAD32F2EDC9F2AA7486D827B66F9A1B39CEFB57ACEE303CD187D7D8AE15A9041F15ADA80A972948A28A38690C98C14697DB2EAF7B658586F319391BAE6F762AB49C1C0EDCDF880CBCB78AFB15D06A5BE8BB15 DB17D940C5FD5FB948CBC2476B3BD91C8BEE5C194A265AD3EA39017125E2E07754172BDCE7FEEABAB26235C380642CDD8AFB5273F6EF44B2F1AD5E73F816135C7D552BD12D02A8D6E27A2F81DBB134A4856205A827C3FD3E6DFE32A23142CEA75D415087 64D6EA17ED6CA04A504FABD96DE718BC1CD7CBCDABD75FC97FA059A252EB0B4CBED8A29D2AC7AC10520294BB31478D5EB640D6E9CAA54A03F3746BE0FA10316C76BA632AD8C5A183B23CF2483FDDA7DCACA05E8EC83C5AD0CA2C2487C0D6FD7443105A67 A13B33ECBABA20E3ECDB4E4AA762547DB11531578BF6D769C558E131F309447A6C90BEC79CA04AA35618265EBB4273E4F8A48071DA76FF8D6ED499029607D3457094D27F465D1F3391A160330118F42516B6D4A59A05BC5B3C47AF75ABB96DB3ACB114AC FF6855A09C73B382CEBECAF6AF438EBD59F2F5D1292B2001AC88B72B4C465FBA213CAC5BA561E675509F5C5E2CD09219C2095989C1BDE8046F40BA5103C5E653170E2B4D660F93602A288A774A6E944350D373F074510AD8EA7F2EF4A39D118D018FEC44 0093C631DBB51CBE434BD2FF6A0E5EC999ADF30A0E49EB32A52FBD626E8A29A28CCF00B15A861493912A018D8B12F17C4BF528DA56B56D413F4A1312A539EEFA000EBEE7E9CA904414AD777FB0A6C8C486519BC8D6CA1EB9DCF0E8A152537FE3EA3A0AFD 16F19AC923D257268D65152A71FBE4618E237FE84159E9CEDB97F071C16631E769CB5F8DBFE316D57E6974A3DD3AF13DD9A61A159D6BC8D0C66D24089D1352FC5B52DB5ABF50E73F198B5177261ECB953165B62F894A9BD8E4B4677C8A35AA9EB384EFB3 37163BEC6DF8AE5C2D20355A3E188EA1D49C55B53C75A86C9A5703E39C691153E66B3BAE47F6EA576B9DF2D5B3E88C32EC097C9A06D19E3C309094DB862656C8EA4BC5BA67443FC2FD600B7BA7C3E09FB35AD9E7A310B25D754C49A770650565282B9763 B91565C68C2559C45EE849771D0C6CD9A1AB93DA28F0EE5B77A11975AE40DBDF5AB1E982268FCED577180FF2287041038412CD22FBE9D2B24FF4608F469193C6160AFE7C0D2D3673407DA0D3EE32E45407E04C32834278C716BFAD8C8894D357C3757CEF 6668806BB326E05DCC781473775CA30565794E31989AF7139A7563085EB2DE30855E12B439C547D0AED718711508A86922C46FC681674D6D73412F6765BAE1347CD6F888C84EF2FE64AFEFA348FA3532FD08E43C9794467A12BD2D69201CC56F699FD69D BB72E8C8CBC432AFB6A63D6A93A7FD256952244C14BBE715DC42BF0FCDE9AE0567B844A474A0F9302AC3FBEE6051C7D7A67764900829F1489419028C880E66E22770F5BBC800F204268A975CD7B07B833DDAF00F12397E19F25F6BC122216B51909976DE 4E36C3542793E7DA34AE35B1AAFDA6DAF6B9526F5D484BD63EED4F534970D42B7259867CA700CAA0F2C7B14775B02EE542249C3391B1DD9E3F051C5A3779FDB9E62DEC30BB0693EC3D59AAB1EE05A52D8B86631E2EBBB66B3ED2A826B080CC913BA30975 03EE94E2EF57FABBD025824C807B71431FE9980BEDA407302A028BFED92181D952E58795CE463FA579FB0D14E54B325B0E1B81089CEADA77E0EA7CDF082929CCA8C6C9C4759ED6397743E646285426D4493C4818CC5CD3F5DFCA5916EA1CED572B7726F7 64FCEC6339EA738E42715DC21C710308665C0585798CAC9F052502AB2442DA302C43EF8FDB105A2875B0658FB1CAC0E7C8D09DB4611076399DD836FFB3477CDBCA4F5C29E0290899D419AB3044DBB787991ABAB6472FF4CE4813DFD3E947F5BEF449611B BADCDFDC933766AEF18859FFAC92F5652372AC84A369FD40C9C30CC4B2F870511880986B2ED5C514A2CC27895FDD92324DE799F29215462CD8661E2BFA4E8D51C0C004F56F34DEBEB3406A9E7242B628B0AE8FA7004F1BAC09AA080290D5D226974AF2DE 3CB57EA4DDEE1141E4A93FAE7A1445C4FD3BC1BEABD75CC42892EE3CE3A124982ABC327CFBCA113487328D6DAD55AC6334FE03D0B9ED5D73527E2446C3EB5E6388156F97853A25A387A888E364704264012924F962E2F4169770E9B32CBF7DFA60E18862 18A1E4C02E43D778E583FBB265159DADB64284CCD8ACC6C72A534CB5E644DDF0D6CEDD8B0F715801FC20535AAE42F263F51D443F793D0E2BF3BA0CC5AF4F2ADE959E97AB699BA28EC9FF7F7E71E8F9092C1465534320AE9B8B16FF7FD5CDF28EA5FBB32A B2589DDDB21FCE1A2F7BE3E8BF3B2DB9C7E5F371321F9DE98102A9602F23D445FE9FF92AFA496957EAA3D9190755640D92B6F3302E26CF1AACE16BC0313714196F4F26B2B95ABDF48125086ADE6432FAAE103A68066A16D4A87FF3648C74ECDFD01D58E7 7D6125E62DB87C67812724D8B82BEF311E2D563CB4475213DAEE7F935AE5B66A8C44B4741E24EFED7D51F2244E7796C9029429EBC4E85DFBBE21CB4000A4AD51A1CDCCE08312FF938069275BAD1E909923C977FCA5466FF25EC1FE4C5C437D569AEBCE6C 73A29E02F239C89703736FB0F43E34F97DBBA4EA2052AD8161C012CFB09F3A8343779CB133AD5494F99E7F2EAE3DA0BC11C2A817690890AED2BA695E84FF9A889E946C774520F966B8E8301057A4DBD218CB0C2BA496308BF923CDEE66AEB7511DB7A69E F1CB8201062049137EFD8E87725A80C6CDC8F533BFE919EBDC859E557EB31496A970D74EFFCB8037F7DB1AA626CD972A32A8FF70782FCFDDF6907D944C570F7A0ECC5862AA5FBEDEBA590E701EE002F16435DDD7E43E6AB96AF5EC09D1E0E4AA5AE0D110 90237981168D111E0463065ABA40FC1742CD87B52E5C7C47E6D41CE800865DFE2DE2AF8F7220A9CCEF085218BD036D8C587B0280E1AACF7FC4F2E08C8B7D2ECA4915009584E80DC4DF51F423CDB9C316D85CC1703C589A5418E5454FFAB94A4DC29A6839 850AB4125B57A2A67F8C0025C8AD9D4B33ABC9C7E035F8CFB0FAFD0916D0C255197BBBB94B6EF2B8F19CF6F9D86A2B9CF8E5ABEC2E003CA184633FEA3B6440330038228337703D711523C7975EF7994ACE4C2990E4432EB02892DB14936D8B0AC881AB56 0426750B3959A261452C1868765A26810747D8C4F42B7D15BCAE2629069BB1AB959A27ED3A16E122D672B1F047A99062D28385C624220ECB8A9381F31EBB9FC5650594C7E32E9DF09959F68396AAB4A9E65AEE336E168DD2B919B23A40958D0C0C84B757 B223EE7C74C6D91FE8D7C70506E5295A77FD6BBE9900EE79C6C56C5896043B31A112EDF00944A4995FA16E2E4B350BAC1E59E5F96CA22A3E75AA723B28C1616ECC18340BB9D0B24E20B1F40667D642851187446A1325C2EC341B71F6FA5066C103D6AEC9 950AD5DEBE78784DA80CC753AF11B7B4BCD3E167695B5C11478F881ADC107BD70103BA6D905096C191A0EEA3E47B28061B8EB18C33823CC95EDF96C5D789B19914B76C753C7D3BCF7DBFDFAF25077FD29374F24E6E3408C26A4DB56E7FFFDDC26238976E 78C0162F4DDAA39C1D5655540EACE0EFC4DBCF786F4F768A58200A6A295ECF52B269FC60B098E76FD4460DA21AE00F9D3880F9732D37F3CD084E4FE1955E2C404D32851850A0A500882961E5AAD22D72B891FF3B1B26AECA5CAD54253D2F5A90F3511BDB 3D68D3B80A2ADBFAFAEEE26E5509B7098D39F9AEF962E913F801642FAFAD04816F7B23DCC31A87F701EF88A127EBC8D69E06133D043780A44AF4B7C0270ED1E0F540D2F40C183AF2F670F3A06705938513D879BB36F6CBA54BE9EAFCB5442BBC303BE093 3BF5BF5AB2BFD4416B6F9E2D1C6F641C467C0DF82847B469605279DD4D48799C27ADB70DF85062E989A3C8260CB6F7E2B6A1A6D56DB22A704D5F6B94640BA64A03F6732048F312CCD3973B5BBA12686E3273422CFB56CAF358E07C56125AA044FE762169 7841CFF95C33E8C3FA290BADE720BC63126042F7855AAF56D786FE7F66B4039EA2386441F9C04FAFB6B53701FEE00D5A88E06A9D561B456FE8DBC152865399FA4DAB77746144CF8BA7B8D178D61F0BEF04CB5770A8E8DFBA9404F313E43359E2AC611667 0F7FE520B1AB3ED168210477F28E034FF7D2E563E016F2A4CB605137E182DA6FC045D6C7830E941573E246FBE8CB10C9955B5B3D1E93389282FA6BE4230EF9A2AB256EB22F82B6E61237FFF14B2C51DE787BB705CC2AD81B8F484CE93195BCA9E33FE59B F1A2EC7AB6B5A86B3DD370D835BBAAC6C5492BB8DBD5597A9595ABF63BE9F70A8ACBC28EC87640076A48206E3A2905D6C69E736C378064664F365A8884D7A824CD18956D042A0FDB15FD402D622484AF9D777436F47C9002208C93CC19B57F6CD9DEC228 59E54564FD4A0061BEA86A2551C4236CDB20E3801F98C6842468B5E1E1A56CC1
[ "axel.paulander@gmail.com" ]
axel.paulander@gmail.com
93d3814d967a5a3e9c1dbd8cfa6662e97b32fd5a
534cd3948c3bc665363e04826e1a42200e81cb1b
/code/baseDiscrete.h
98e72db5781a90b9db05ffe41f7191b2d254c04e
[]
no_license
yunpeng5/UpdateRandom
191a27e7e5619133e9c2d86da93dbc2855e212f7
d7a6f6260ab908bb4767617beebfc0e7e8eddcd0
refs/heads/master
2020-09-25T06:28:43.712826
2019-12-05T04:48:28
2019-12-05T04:48:28
225,938,093
0
0
null
null
null
null
UTF-8
C++
false
false
385
h
#ifndef MbaseDiscrete #define MbaseDiscrete class baseDiscrete { public: //using for starting generating method virtual ~baseDiscrete()=0; //using for giving the generating result virtual int ransample()=0; //using for change the distribution virtual void change(int index,double weight)=0; }; inline baseDiscrete::~baseDiscrete(){}; #endif // MbaseDiscrete
[ "yunpeng5@ualberta.ca" ]
yunpeng5@ualberta.ca
ee5f6605484155c42e0eb941a5b761a83beee623
217807dd255fa7a2df1535dc6844b39317573f60
/src/Eclipse.cpp
a519eaaa8f128fad5211ba41bf29c064aaa771ea
[]
no_license
jkleiber/EclipseR
e287a98d49fc0e896960ba241062492761c1d5c9
a2e7ff1cdf601dc008a4ceec9c6f387880496609
refs/heads/master
2021-08-24T02:47:00.523675
2017-12-07T18:25:07
2017-12-07T18:25:07
106,234,285
0
0
null
null
null
null
UTF-8
C++
false
false
3,762
cpp
/* * Eclipse.cpp * * Created on: Sep 17, 2017 * Author: justin */ #include "Eclipse.h" #include <iostream> Eclipse::Eclipse() { this->catalogNum = "0"; this->eclipseType = " "; this->numCells = 24; this->numColumns = 0; this->rawInput = ""; this->numErrors = 0; this->row = 0; for(int i = 0; i < 24; ++i) { this->columnErrors[i] = false; } } Eclipse::Eclipse(Eclipse &eclipse) { this->catalogNum = eclipse.catalogNum; this->eclipseType = eclipse.eclipseType; this->numCells = eclipse.numCells; this->numColumns = eclipse.numColumns; this->rawInput = eclipse.rawInput; this->numErrors = eclipse.numErrors; this->row = eclipse.row; for(int i = 0; i < 24; ++i) { this->cells[i] = eclipse.cells[i]; } for(int i = 0; i < 24; ++i) { this->columnErrors[i] = eclipse.columnErrors[i]; } } void Eclipse::operator=(const Eclipse & eclipse) { this->catalogNum = eclipse.catalogNum; this->eclipseType = eclipse.eclipseType; this->numCells = eclipse.numCells; this->numColumns = eclipse.numColumns; this->rawInput = eclipse.rawInput; this->numErrors = eclipse.numErrors; this->row = eclipse.row; for(int i = 0; i < 24; ++i) { this->cells[i] = eclipse.cells[i]; } for(int i = 0; i < 24; ++i) { this->columnErrors[i] = eclipse.columnErrors[i]; } } Eclipse::~Eclipse() { } bool Eclipse::equals(Eclipse Eclipse) { if(this->catalogNum == Eclipse.catalogNum && this->eclipseType == Eclipse.eclipseType && this->numCells == Eclipse.numCells && this->numColumns == Eclipse.numColumns) { bool areCellsSame = true; for(int i = 0; i < this->numColumns; ++i) { if(this->cells[i] != Eclipse.cells[i]) { areCellsSame = false; break; } } if(areCellsSame) { return true; } } return false; } std::string Eclipse::getCatalogNum() const { return catalogNum; } void Eclipse::setCatalogNum(const std::string catalogNum) { this->catalogNum = catalogNum; } Cell Eclipse::getCell(int index) const { return cells[index]; } void Eclipse::addCell(Cell cell, int index) { this->cells[index] = cell; numColumns++; } std::string Eclipse::getEclipseType() const { return eclipseType; } void Eclipse::setEclipseType(std::string eclipseType) { this->eclipseType = eclipseType; } int Eclipse::getNumColumns() const { return this->numColumns; } void Eclipse::setNumColumns(int numColumns) { this->numColumns = numColumns; } std::string Eclipse::getRawInput() const { return rawInput; } void Eclipse::setRawInput(std::string rawInput) { this->rawInput = rawInput; } void Eclipse::addError(int col) { this->columnErrors[col] = true; numErrors++; } void Eclipse::printAllErrors() { for(int i = 0; i < numColumns; ++i) { if(columnErrors[i] && (i == 10 || i == 11)) { std::cerr << "Error in data row " << this->row << ": Column " << (i + 1) << " is not a decimal number.\n"; } else if(columnErrors[i]) { std::cerr << "Error in data row " << this->row << ": Column " << (i + 1) << " is not a whole number.\n"; } } } int Eclipse::getNumErrors() { return this->numErrors; } void Eclipse::setRow(int row) { this->row = row; } int Eclipse::getRow() { return this->row; } bool Eclipse::operator<(const Eclipse& eclipse) { return this->cells[0] < eclipse.cells[0]; } bool Eclipse::operator>(const Eclipse& eclipse) { return this->cells[0] > eclipse.cells[0]; } bool Eclipse::operator==(const Eclipse& eclipse) { return this->cells[0] == eclipse.cells[0]; } bool Eclipse::operator==(const int& catalogNum) { return this->cells[0] == catalogNum; } bool Eclipse::operator!=(const Eclipse& eclipse) { return this->cells[0] != eclipse.cells[0]; } std::ostream& operator<<(std::ostream& os, Eclipse &eclipse) { os << eclipse.rawInput; return os; }
[ "jkleiber8@gmail.com" ]
jkleiber8@gmail.com
830684dcde0d6ab8ce421350975e178b5fe291d6
ef97d8c9d304180803fac6c90695a0df240cbbab
/Hough_Transform_on_FPGAs_Using_oneAPI/01_FPGA_Emulation_Using_Intel_oneAPI_Base_Toolkit/src/split/hough_transform_kernel.hpp
c398f9347fee88c6b6cb8240b0fa072ede2d2e81
[ "MIT" ]
permissive
deepikagoel1/intel-ai
ec3b6e528b72866c948240ba06a807af6bd079d3
96504dcd7b3e73708eeefbcd5e8bace08dcfece5
refs/heads/main
2023-06-02T19:56:00.093291
2021-06-24T19:06:48
2021-06-24T19:06:48
380,021,530
0
0
null
null
null
null
UTF-8
C++
false
false
628
hpp
//============================================================== // Copyright © 2020 Intel Corporation // // SPDX-License-Identifier: MIT // ============================================================= #include <vector> #include <CL/sycl.hpp> #include <CL/sycl/INTEL/fpga_extensions.hpp> #include "../../util/sin_cos_values.h" #define WIDTH 180 #define HEIGHT 120 #define IMAGE_SIZE WIDTH*HEIGHT #define THETAS 180 #define RHOS 217 //Size of the image diagonally: (sqrt(180^2+120^2)) #define NS (1000000000.0) // number of nanoseconds in a second using namespace sycl; void RunKernel(char pixels[], short accumulators[]);
[ "u78986@s001-n001.aidevcloud" ]
u78986@s001-n001.aidevcloud
870dfda88ec680676877b445cd001002f333e8b7
0aa76b60b43fcef208c372fd72900936b39266ea
/mainwindow.cpp
9b46a9afca7045ec0b1f8448de77d3fdc39404c8
[]
no_license
jac132/custom-tcp-passthrough
2351114e1d64e31ea9ffa236cf3020b1af07f576
71db08f86b8a7e53782ef397cebb41c7259943f8
refs/heads/master
2021-01-10T10:27:04.990783
2012-11-05T19:46:56
2012-11-05T19:46:56
51,627,377
0
0
null
null
null
null
UTF-8
C++
false
false
11,669
cpp
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); defHost = "109.234.78.19"; defPort = "10001"; reachedServer = false; loopActEd = false; connect(ui->textBr_1, SIGNAL(anchorClicked(QUrl)), this, SLOT(processLink(QUrl))); connect(ui->textBr_2, SIGNAL(anchorClicked(QUrl)), this, SLOT(processLink(QUrl))); connect(ui->textBr_3a, SIGNAL(anchorClicked(QUrl)), this, SLOT(processLink(QUrl))); connect(ui->textBr_3b, SIGNAL(anchorClicked(QUrl)), this, SLOT(processLink(QUrl))); ui->stackedWidget->setCurrentIndex(0); //ui->lineEditHost->setText("109.234.74.22");109.234.78.19 ui->lineEditHost->setText(defHost); ui->lineEditPort->setText(defPort); LogFile = new QFile("ctp_log.txt"); LogFile->open(QIODevice::WriteOnly | QIODevice::Text); log("", "started"); } MainWindow::~MainWindow() { log("", "shutting down"); if (loopActEd) setupLoopback(false); //false != activate -> false == deactivate LogFile->close(); delete ui; } void MainWindow::manageInQuery() { log("textBr_3a", "<span>It seems to work.</span>"); Server->blockSignals(true); //disconnect(Server,SIGNAL(newConnection())); log("textBr_3b", "a client connected"); internalSocket = Server->nextPendingConnection(); internalSocket->blockSignals(false); connect(internalSocket, SIGNAL(disconnected()), this, SLOT(manageDisco())); connect(externalSocket, SIGNAL(connected()), this, SLOT(connectedToExt())); externalSocket->connectToHost(ui->lineEditHost->text(), ui->lineEditPort->text().toInt()); if (internalSocket->isWritable()) internalSocket->write(externalSocket->readAll()); connect(internalSocket, SIGNAL(readyRead()), this, SLOT(readIntSocket())); } void MainWindow::connectedToExt() { if (externalSocket->isWritable()) externalSocket->write(internalSocket->readAll()); connect(externalSocket, SIGNAL(readyRead()), this, SLOT(readExtSocket())); } void MainWindow::manageDisco() { internalSocket->blockSignals(true); //disconnect(internalSocket, SIGNAL(disconnected())); internalSocket->abort(); //internalSocket = new QTcpSocket(); externalSocket->abort(); //externalSocket = new QTcpSocket(); log("textBr_3b", "a client disconnected"); log("textBr_3a", "<span><b>You can now close this application.</b></span>"); ui->pushB_exit->setText("Exit"); ui->pushB_exit->setEnabled(true); if (Server->hasPendingConnections()) { qDebug() << "jawohl"; manageInQuery(); } else { Server->blockSignals(false); } } void MainWindow::readIntSocket() { if (!externalSocket->isWritable()) return; qDebug() << "readIntSocket()"; externalSocket->write(internalSocket->readAll()); } void MainWindow::readExtSocket() { if (!internalSocket->isWritable()) return; qDebug() << "readExtSocket()"; internalSocket->write(externalSocket->readAll()); } void MainWindow::on_pushB_startNetAnal_clicked() // :) { ui->pushB_startNetAnal->setEnabled(false); ui->pushB_startNetAnal->setText("Testing. Please wait .."); ui->centralWidget->setCursor(Qt::BusyCursor); log("textBr_0", "Testing connection to CAE version server .. "); QTcpSocket* TestSocket = new QTcpSocket(); connect(TestSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(processNasState(QAbstractSocket::SocketState))); connect(TestSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(processNasError(QAbstractSocket::SocketError))); TestSocket->connectToHost(QHostAddress(defHost), 10001); } void MainWindow::processNasState(QAbstractSocket::SocketState state) { QString msg = ""; QTcpSocket* socket = qobject_cast<QTcpSocket*>(QObject::sender()); switch(state) { case QAbstractSocket::UnconnectedState: if (socket->error() == -1) { msg = "Not connected."; } else { msg = ("\n\nCould not connect to the server! There propably is a maintenance.\n"); ui->centralWidget->setCursor(Qt::ArrowCursor); ui->pushB_startNetAnal->setEnabled(true); ui->pushB_startNetAnal->setText("Start network analysis"); ui->stackedWidget->setCurrentIndex(1); } break; case QAbstractSocket::HostLookupState: msg = "Looking up host .."; break; case QAbstractSocket::ConnectingState: msg = "Connecting to server .."; break; case QAbstractSocket::ConnectedState: msg = "Successfully connected to server!"; reachedServer = true; socket->disconnectFromHost(); socket->deleteLater(); ui->centralWidget->setCursor(Qt::ArrowCursor); ui->stackedWidget->setCurrentIndex(2); break; case QAbstractSocket::BoundState: msg = "BoundState: if you see this, something went wrong"; break; case QAbstractSocket::ClosingState: msg = "Closing connection .."; break; case QAbstractSocket::ListeningState: msg = "ListeningState. if you see this, something went wrong"; break; default: msg = "Trying to connect .."; } msg.append(QString(reachedServer?" (1)":" (0)")); if (socket->error() != -1) msg.append(" | error: " + QString::number(socket->error()) + " = " + socket->errorString() + "\n\n\n"); log("textBr_0", msg); } void MainWindow::processNasError(QAbstractSocket::SocketError error) { QString msg = ""; switch(error) { case QAbstractSocket::ConnectionRefusedError: msg= "ConnectionRefused" ; break; case QAbstractSocket::RemoteHostClosedError: msg= "RemoteHostClosed" ; break; case QAbstractSocket::HostNotFoundError: msg= "HostNotFound" ; break; case QAbstractSocket::SocketAccessError: msg= "SocketAccess" ; break; case QAbstractSocket::SocketResourceError: msg= "SocketResource" ; break; case QAbstractSocket::SocketTimeoutError: msg= "SocketTimeout" ; break; case QAbstractSocket::DatagramTooLargeError: msg= "DatagramTooLarge" ; break; case QAbstractSocket::NetworkError: msg= "Network" ; break; case QAbstractSocket::AddressInUseError: msg= "AddressInUse" ; break; case QAbstractSocket::SocketAddressNotAvailableError: msg= "SocketAddressNotAvailable" ; break; case QAbstractSocket::UnsupportedSocketOperationError: msg= "UnsupportedSocketOperation" ; break; case QAbstractSocket::ProxyAuthenticationRequiredError: msg= "ProxyAuthenticationRequired" ; break; case QAbstractSocket::SslHandshakeFailedError: msg= "SslHandshakeFailed" ; break; case QAbstractSocket::UnfinishedSocketOperationError: msg= "UnfinishedSocketOperation" ; break; case QAbstractSocket::ProxyConnectionRefusedError: msg= "ProxyConnectionRefused" ; break; case QAbstractSocket::ProxyConnectionClosedError: msg= "ProxyConnectionClosed" ; break; case QAbstractSocket::ProxyConnectionTimeoutError: msg= "ProxyConnectionTimeout" ; break; case QAbstractSocket::ProxyNotFoundError: msg= "ProxyNotFound" ; break; case QAbstractSocket::ProxyProtocolError: msg= "ProxyProtocol" ; break; case QAbstractSocket::UnknownSocketError: msg= "UnknownSocket" ; break; } msg.prepend("Error encountered while connecting: "); } void MainWindow::processLink(QUrl url) { if (url.toString().left(5) == "goto:") { ui->stackedWidget->setCurrentIndex(url.toString().remove(0, 5).toInt()); } else { QDesktopServices::openUrl(url); } } void MainWindow::on_pushB_fixError_clicked() { ui->pushB_fixError->setEnabled(false); runLocalServer(); } void MainWindow::runLocalServer() { Server = new QTcpServer(this); if (Server->listen(QHostAddress::Any, 10001)) { log("textBr_3b", "server now listening on port 10001"); internalSocket = new QTcpSocket(); externalSocket = new QTcpSocket(); connect(Server, SIGNAL(newConnection()), this, SLOT(manageInQuery())); connect(internalSocket, SIGNAL(disconnected()), this, SLOT(manageDisco())); setupLoopback(true); } else { log("textBr_3b", "Error: server can't listen on port 10001, probably another programme is already listening on that port."); log("textBr_3b", "Try restarting this programme."); log("textBr_3b", "If that doesn't help, perform a clean boot and start this programme again."); } } void MainWindow::setupLoopback(bool install) { if (install) { // add addr "Loop" 109.234.74.22/32 store=active // (/32 means MASK 255.255.255.255) log("textBr_3a", "Adding 109.234.74.22 to loopback device."); QProcess* SetupProcess = new QProcess(this); SetupProcess->start("netsh", QStringList() << "int" << "ip" << "add" << "address" << "\"Loop\"" << "109.234.74.22/32" << "store=active"); log("textBr_3a", "Running netsh int ip add addr \"Loop\" 109.234.74.22/32 store=active"); connect(SetupProcess, SIGNAL(finished(int)), this, SLOT(finishLoopbackAct(int))); } else { // delete address "Loop" addr=109.234.74.22 log("textBr_3a", "Removing 109.234.74.22 from loopback device."); QProcess* SetupProcess = new QProcess(0); // 0 as parent so process will continue running after this prog is closed SetupProcess->start("netsh", QStringList() << "int" << "ip" << "delete" << "address" << "\"Loop\"" << "addr=109.234.74.22"); log("textBr_3a", "Running netsh int ip delete address \"Loop\" addr=109.234.74.22"); connect(SetupProcess, SIGNAL(finished(int)), this, SLOT(finishLoopbackDeAct(int))); } } void MainWindow::finishLoopbackAct(int status) { log("textBr_3a", "Act: " + QString::number(status)); loopActEd = true; if (status == 0) { log("textBr_3a", "<span><b>Try launching CAE now.</b></span>"); } else { log("textBr_3a", "<span><b>Sorry. Could not fix error automatically. Consider reinstalling CAE: <a href=\"http://download.nexoneu.com/cba/fullversion/Combatarms_eu.exe\">download.nexoneu.com/cba/fullversion/Combatarms_eu.exe</a></b></span>"); } } void MainWindow::finishLoopbackDeAct(int status) { log("textBr_3a", "DeAct: " + QString::number(status)); } void MainWindow::on_pushB_exit_clicked() { this->close(); } void MainWindow::log(QString loc, QString msg) { if (loc == "textBr_0") { ui->textBr_0->append(msg); } else if (loc == "textBr_1") { ui->textBr_1->append(msg); } else if (loc == "textBr_2") { ui->textBr_2->append(msg); } else if (loc == "textBr_3a") { ui->textBr_3a->append(msg); } else if (loc == "textBr_3b") { ui->textBr_3b->append(msg); } QDate date = QDate::currentDate(); QTime time = QTime::currentTime(); LogFile->write(QString(date.toString("yyyy-MM-dd") + " " + time.toString("hh-mm-ss") + " " + loc + ": " + msg + "\n").toUtf8()); qDebug() << QString(date.toString("yyyy-MM-dd") + " " + time.toString("hh-mm-ss") + " " + loc + ": " + msg); }
[ "asisit@hotmail.com" ]
asisit@hotmail.com
947c15559da3e7539dd1ac740521379275f5d172
73d648a072775d64db7a4c4711b9da32c69fbece
/poj/2100.cpp
4a755b6c54dd3da32834fe7fbf948198afacf275
[]
no_license
12Dong/acm
e209605c57e8a2d0247ef5c86f50aec1d43e86b3
4f0c98fd4649f730db2ab8300ce45d04dd31e766
refs/heads/master
2020-12-30T17:51:18.751827
2017-10-21T07:30:56
2017-10-21T07:30:56
90,933,913
0
0
null
null
null
null
UTF-8
C++
false
false
592
cpp
#include<iostream> #include<cmath> typedef long long ll; using namespace std; ll Ans[10000005][2]; int main() { ll n; while(cin >> n) { ll times; ll l=1,r=1; ll el,er; ll ans=0; ll sum=0; while(1) { while(r<=sqrt(n)&& sum < n) { sum=sum+r*r; r++; } if(sum < n) break; if(sum==n) { Ans[ans][0]=l; Ans[ans++][1]=r; } sum=sum-l*l; l++; } cout << ans <<endl; for(ll i=0;i<ans;i++) { cout << Ans[i][1]-Ans[i][0]<<" "; for(ll j=Ans[i][0];j<Ans[i][1];j++) { j==Ans[i][1]-1?cout <<j<<endl:cout <<j<<" "; } } } }
[ "289663639@qq.com" ]
289663639@qq.com
bd0bd8a4fc8576c6962e696f4a6d945aa928d04f
c03dc1a10fcb3875798308bc5937d4ba10e2386e
/Test_Proc/Procedural.h
f5e58a4de3d2febe45efb1dd1b0ef5efe022552f
[]
no_license
Le2o/TecProg_ProcVersion
ef472c49bdc6952bc06a11e4e874e7cb46a5bfbf
6596139879bc719ccd1f08abcb3f0d145531e98f
refs/heads/master
2020-04-21T18:33:00.862138
2019-03-26T12:08:26
2019-03-26T12:08:26
169,773,817
0
1
null
null
null
null
UTF-8
C++
false
false
416
h
#ifndef PROCEDURAL_H #define PROCEDURAL_H #include <fstream> using namespace std; namespace Filippov { struct Procedural { enum lang { PROCEDURAL, OOP, FUNCTIONAL } key; unsigned short int year_of_development; int reference; bool abstract_type; }; void Procedural_Input(Procedural &obj, ifstream &fin); void Procedural_Output(Procedural &obj, ofstream &fout); } #endif // !PROCEDURAL_H
[ "le2o1995@gmail.com" ]
le2o1995@gmail.com
f6ecdf4d44213482d1085671421e1fff46e78d77
abca9e32e4fb97c9433ce50720049e0a8f18d9d4
/src/support/cleanse.cpp
bece96ae3d3c0de3119e6c388970ac67928636dc
[ "MIT" ]
permissive
nikolake/minerium
b0829475f24033b81b184781308dbaef1db182d1
aa014119a70ba4997df1ab4ab05570a0b01f1590
refs/heads/master
2022-07-18T13:33:04.536700
2020-05-17T19:03:20
2020-05-17T19:03:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
424
cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2015 The Bitcoin Core developers // Copyright (c) 2014-2020 The Minerium Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "cleanse.h" #include <openssl/crypto.h> void memory_cleanse(void *ptr, size_t len) { OPENSSL_cleanse(ptr, len); }
[ "46746362+bunbunbunbunbunny@users.noreply.github.com" ]
46746362+bunbunbunbunbunny@users.noreply.github.com
120c5ccae2bafb5d304c4952ceac8e56506cd961
b3960efcf7b3d22b1f175e642e0a672166d88eb1
/MiniOpocio.cpp
e1c9d75f8e6188f342727351af9f542458478ced
[]
no_license
LucaPizzagalli/chemotaxis-pathfinding
170c03e67276f4a116310e4c12cedc13c11a8630
462bed4192f22eb2f1fe1a4330d7b8aed64f0557
refs/heads/master
2020-05-03T04:27:42.872482
2019-03-29T16:32:05
2019-03-29T16:32:05
178,422,128
3
0
null
null
null
null
UTF-8
C++
false
false
3,900
cpp
#include <math.h> #include <algorithm> #include <stdio.h> #include "functions.h" #include "Mappa.h" #include "Opocio.h" #include "MiniOpocio.h" #define VITA_INIZIALE 1 #define INFANZIA 2000 #define SMELL 0.4 MiniOpocio::MiniOpocio(Mappa *in_mappa, float in_posx, float in_posy) { dim = 0.4; speed = 0.2; vita = VITA_INIZIALE; infanzia = INFANZIA; color[0] = 0; color[1] = 0; color[2] = 155; mappa = in_mappa; posx = in_posx; posy = in_posy; calpestato = mappa->get_space(int(posx), int(posy)); left_steps = 0; extra_step = false; last_smell = 0.0; mappa->set_space(int(posx), int(posy), this); generate_meta(); } Oggetto* MiniOpocio::live() { ///physiological stuff if (vita <= 0) return this; infanzia--; if (infanzia <= 0) { mappa->set_space(int(posx), int(posy), calpestato); calpestato = new Opocio(mappa, posx, posy); return calpestato; } mappa->add_smell(posx, posy, SMELL); ///act according to the situation if (left_steps <= 0) { if (extra_step) generate_meta(); else { ///////////////tune value float new_smell = mappa->get_smell(posx, posy); if (new_smell > last_smell) left_steps = 8; else left_steps = 1; //left_steps = rand()%std::max(1,3+int((new_smell-last_smell)/new_smell)); extra_step = true; } } if(!move()) generate_meta(); return nullptr; } void MiniOpocio::generate_meta() { float angle = rand()*2*M_PI/RAND_MAX; velx = speed*cos(angle); vely = speed*sin(angle); left_steps = 10;///////////////tune value last_smell = mappa->get_smell(posx, posy); extra_step = false; } bool MiniOpocio::move() { mappa->set_space(int(posx), int(posy), calpestato); Oggetto *vicino = mappa->get_space(int(posx+velx), int(posy+vely)); if (vicino && vicino->get_type() != cibo_type) { mappa->set_space(int(posx), int(posy), this); return false; } calpestato = vicino; posx += velx; posy += vely; left_steps--; mappa->set_space(int(posx), int(posy), this); return true; } void MiniOpocio::injured(Oggetto *in_enemy, int damage) { vita -= damage; } void MiniOpocio::draw_1(unsigned char screen_color[SCREEN_HEIGHT][SCREEN_WIDTH][4], int player_posx, int player_posy) { int x = int(posx) - player_posx; int y = int(posy) - player_posy; screen_color[y][x][2] = color[0]; screen_color[y][x][1] = color[1]; screen_color[y][x][0] = color[2]; } void MiniOpocio::draw(unsigned char screen_color[SCREEN_HEIGHT][SCREEN_WIDTH][4], float zoom_level, float player_posx, float player_posy) { if(calpestato) calpestato->draw(screen_color, zoom_level, player_posx, player_posy); int screenx = int((posx - player_posx) * zoom_level); int screeny = int((posy - player_posy) * zoom_level); int x_min = int_max(0,screenx-int(zoom_level/2+0.55)); int x_max = int_min(SCREEN_WIDTH-1,screenx+int(zoom_level/2+0.55)); int y_min = int_max(0,screeny-int(zoom_level/2+0.55)); int y_max = int_min(SCREEN_HEIGHT-1,screeny+int(zoom_level/2+0.55)); for (int x = x_min; x <= x_max; x++) for (int y = y_min; y <= y_max; y++) if ((x-screenx) * (x-screenx) + (y-screeny) * (y-screeny) <= dim * dim * zoom_level * zoom_level) { screen_color[y][x][2] = color[0]; screen_color[y][x][1] = color[1]; screen_color[y][x][0] = color[2]; } } Object_type MiniOpocio::get_type() { return miniopocio_type; } MiniOpocio::~MiniOpocio() { if(mappa->get_space(posx, posy) == this) mappa->set_space(int(posx), int(posy), calpestato); }
[ "lucapizzagalli@gmail.com" ]
lucapizzagalli@gmail.com
c5f45768652650881b3845208185c56412da3c17
d20b517c520a441cd4c2dbbbbcd7c204dc654f61
/Base Station/src/LilyGO-SIM7000-Cayenne.ino
c54b35f6ec43b45a666f45f46e37269bdc89119d
[]
no_license
izzet-kalinsazlioglu/Monitoring-System
f27f9741b51679c3c62b5de44cd3ec8e496fbb81
925ab7a248d04d66095f1eb9e0f745e293d64c5e
refs/heads/main
2022-12-25T19:59:21.621800
2020-10-05T14:50:08
2020-10-05T14:50:08
301,428,757
0
0
null
null
null
null
UTF-8
C++
false
false
7,426
ino
#define TINY_GSM_DEBUG Serial #define CAYENNE_PRINT Serial #define TINY_GSM_MODEM_SIM7000 #define USE_GSM //! Uncomment will use SIM7000 for GSM communication #ifdef USE_GSM #include <CayenneMQTTGSM.h> #else #include <CayenneMQTTESP32.h> #endif #include <Arduino.h> #include <Wire.h> #include <Adafruit_BMP085.h> #define TEMPERATURE_VIRTUAL_CHANNEL 1 #define BAROMETER_VIRTUAL_CHANNEL 2 #define ALTITUDE_VIRTUAL_CHANNEL 3 #define BATTERY_VIRTUAL_CHANNEL 4 #define SOLAR_VIRTUAL_CHANNEL 5 #define LIGHTSENSOR_VIRTUAL_CHANNEL 6 #define PIN_TX 27 #define PIN_RX 26 #define UART_BAUD 115200 #define PWR_PIN 4 #define BAT_ADC 35 #define SOLAR_ADC 36 //for google script Things to change //const char * ssid = ""; //const char * password = ""; //https://script.google.com/macros/s/AKfycbylrRpSX7SUPJzZfElazwG_BRp7yafTgLRy5vwXbtqaCNFSXGg/exec String GOOGLE_SCRIPT_ID = "AKfycbylrRpSX7SUPJzZfElazwG_BRp7yafTgLRy5vwXbtqaCNFSXGg"; // Replace by your GAS service id const int sendInterval = 996 *5; // in millis, 996 instead of 1000 is adjustment, with 1000 it jumps ahead a minute every 3-4 hours //------------- //updated 04.12.2019 const char * root_ca=\ "-----BEGIN CERTIFICATE-----\n" \ "MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G\n" \ "A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp\n" \ "Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1\n" \ "MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG\n" \ "A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI\n" \ "hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL\n" \ "v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8\n" \ "eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq\n" \ "tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd\n" \ "C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa\n" \ "zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB\n" \ "mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH\n" \ "V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n\n" \ "bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG\n" \ "3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs\n" \ "J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO\n" \ "291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS\n" \ "ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd\n" \ "AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7\n" \ "TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==\n" \ "-----END CERTIFICATE-----\n"; Adafruit_BMP085 bmp; HardwareSerial gsmSerial(1); #ifdef USE_GSM // GSM connection info. char apn[] = ""; // Access point name. Leave empty if it is not needed. char gprsLogin[] = ""; // GPRS username. Leave empty if it is not needed. char gprsPassword[] = ""; // GPRS password. Leave empty if it is not needed. char pin[] = ""; // SIM pin number. Leave empty if it is not needed. #else // WiFi network info. char ssid[] = "your wifi ssid"; char wifiPassword[] = "your wifi password"; #endif // Cayenne authentication info. This should be obtained from the Cayenne Dashboard. char username[] = "dbd718c0-0afd-11e7-a044-09cb7c7beef1"; char password[] = "b311142229b601732d6cda7fdef1f2e9be49c185"; char clientID[] = "b313b040-fbf6-11ea-93bf-d33a96695544"; bool bmpSensorDetected = true; void setup() { Serial.begin(UART_BAUD); gsmSerial.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX); pinMode(PWR_PIN, OUTPUT); //Launch SIM7000 digitalWrite(PWR_PIN, HIGH); delay(300); digitalWrite(PWR_PIN, LOW); // Launch BMP085 // if (!bmp.begin()) // { // bmpSensorDetected = false; // Serial.println("Could not find a valid BMP085 sensor, check wiring!"); // while (1) // { // } // } //Wait for the SIM7000 communication to be normal, and will quit when receiving any byte int i = 6; delay(200); while (i) { Serial.println("Send AT"); gsmSerial.println("AT"); if (gsmSerial.available()) { String r = gsmSerial.readString(); Serial.println(r); break; } delay(1000); i--; } #ifdef USE_GSM Cayenne.begin(username, password, clientID, gsmSerial, apn, gprsLogin, gprsPassword, pin); #else Cayenne.begin(username, password, clientID, ssid, wifiPassword); #endif Serial.println("Ready to go"); } float getFakeTemperature() { return micros()%20; } String fakeFunc1() { return "somedata"; } float fakeFunc2() { return millis()%100; } void loop() { Cayenne.loop(); } // Default function for processing actuator commands from the Cayenne Dashboard. // You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands. CAYENNE_IN_DEFAULT() { CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString()); //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message"); } CAYENNE_IN(1) { CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString()); } // This function is called at intervals to send temperature sensor data to Cayenne. CAYENNE_OUT(TEMPERATURE_VIRTUAL_CHANNEL) { if (bmpSensorDetected) { float temperature = random(100) ;// bmp.readTemperature(); Serial.print("Temperature = "); Serial.print(temperature); Serial.println(" *C"); Cayenne.celsiusWrite(TEMPERATURE_VIRTUAL_CHANNEL, temperature); } //delay(2000); // sendData("info1=" + fakeFunc1()+"&info2="+String(fakeFunc2())+"&temp="+String(getFakeTemperature())); } // This function is called at intervals to send barometer sensor data to Cayenne. CAYENNE_OUT(BAROMETER_VIRTUAL_CHANNEL) { if (bmpSensorDetected) { float pressure = random(100) ;// bmp.readPressure() / 1000; Serial.print("Pressure = "); Serial.print(pressure); Serial.println(" hPa"); Cayenne.hectoPascalWrite(BAROMETER_VIRTUAL_CHANNEL, pressure); } } CAYENNE_OUT(ALTITUDE_VIRTUAL_CHANNEL) { if (bmpSensorDetected) { float altitude = random(100) ;// bmp.readAltitude(); Serial.print("Altitude = "); Serial.print(altitude); Serial.println(" meters"); Cayenne.virtualWrite(ALTITUDE_VIRTUAL_CHANNEL, altitude, "meters", UNIT_METER); } } float readBattery(uint8_t pin) { int vref = 1100; uint16_t volt = analogRead(pin); float battery_voltage = ((float)volt / 4095.0) * 2.0 * 3.3 * (vref); return battery_voltage; } CAYENNE_OUT(BATTERY_VIRTUAL_CHANNEL) { float mv = readBattery(BAT_ADC); Serial.printf("batter : %f\n", mv); Cayenne.virtualWrite(BATTERY_VIRTUAL_CHANNEL, mv, TYPE_VOLTAGE, UNIT_MILLIVOLTS); } CAYENNE_OUT(SOLAR_VIRTUAL_CHANNEL) { float mv = readBattery(SOLAR_ADC); Serial.printf("solar : %f\n", mv); Cayenne.virtualWrite(SOLAR_VIRTUAL_CHANNEL, mv, TYPE_VOLTAGE, UNIT_MILLIVOLTS); }
[ "izzet@idealyazilim.net" ]
izzet@idealyazilim.net
19f15076a6f5789ae2f271998739b32ea526b37b
9948574a4fac74809488b37d7cd1ea12ca77833b
/PRO1.CPP
080b2edb260a8e517095d8488acd2c42ce22c8ad
[]
no_license
vishprivenkat/food_ordering_app
6e51b33c843fad4b58f339bd4488971bb73c3f6f
a2042653838df0fd9a6535fde5cba8be3a74c98b
refs/heads/master
2021-01-04T18:57:42.795506
2020-02-15T13:44:53
2020-02-15T13:44:53
240,719,534
0
0
null
null
null
null
UTF-8
C++
false
false
31,452
cpp
#include<fstream.h> #include<conio.h> #include<iomanip.h> #include<stdio.h> #include<graphics.h> #include<string.h> int i,d; int choice,n,p,gr,exitvar=0;char ch1,ch2,ch3,ch4; struct administrator { int aid,aip;}OBJ; struct menu {char item[10][70];float price[10];}; struct hotel {char name[20],address[50];char phone[12];menu y;}x,modobj,dispobj; struct bill {char name[10],address[50];char phone[15];int mop,order[10][2];float tp;}z; void admin_mode(); void firstpage() { u1: int g_dr=DETECT,mode; initgraph(&g_dr,&mode,"c:\\TC\\BGI"); int x,y; x=getmaxx()/2; y=getmaxy()/2; setbkcolor(YELLOW); setcolor(BLUE); setlinestyle(SOLID_LINE,0,NORM_WIDTH); setfillstyle(XHATCH_FILL,2); floodfill(50,50,RED); settextstyle(SLASH_FILL,HORIZ_DIR,3); floodfill(x,y,BLUE); settextstyle(TRIPLEX_FONT,HORIZ_DIR,11); outtextxy(165,10,"FOOD"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,11); outtextxy(120,100,"PANDA"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,3); outtextxy(45,250,"DEVELOPED BY S.SHREYA AND P.VISHNU PRIYA"); setcolor(MAGENTA); settextstyle(TRIPLEX_FONT,HORIZ_DIR,4); outtextxy(50,300,"1.ADMIN"); outtextxy(350,300,"2.CUSTOMER"); outtextxy(50,350,"3.EXIT"); outtextxy(50,400,"ENTER YOUR CHOICE 1 OR 2 or 3:"); char c,s[5]; c=getch(); s[0]=c; s[1]='\0'; outtextxy(600,400,s); getch(); cleardevice(); closegraph(); if(strcmpi(s,"1")==0) { admin_mode();goto u1;} else if(strcmpi(s,"3")==0) { exitvar=1; return; } } void admin_mode() { clrscr(); fstream f; f.open("dummy.dat",ios::in|ios::binary); int counter1=0,counter2=0; char newname[20],newaddress[50],newphone[9]; int intnewphone[8],adminid,adminpass; int menucount=0,flag1=0,flag2=0; int choosecat, chooseoutlet; cout<<"\t ()()() ()()() ()()() ()() ()()() () () () ()() () \n"; cout<<"\t () () () () () () () () () () () ()()() () () () ()\n"; cout<<"\t ()()() () () () () () () ()()() ()()() () (() () () ()()()\n"; cout<<"\t () () () () () () () () () () () () () () () ()\n"; cout<<"\t () ()()() ()()() ()() () () () () () ()() () ()\n"; cout<<"\t\t\t\t\t\t\t-YOUR FOOD EXPERT\n"; cout<<"\t\tWELCOME TO ADMINISTRATOR MODE"; fstream ADMIN( "admin.dat",ios::binary|ios::in); while((counter1<3)&&(flag1!=1)) { if(counter1==0) cout<<"\nENTER YOUR ADMIN ID "; else cout<<"ADMIN ID NOT FOUND.ENTER AGAIN "; cin>>adminid; fstream ADMIN( "admin.dat",ios::binary|ios::in); while(ADMIN.read((char*)&OBJ,sizeof(OBJ))) { if(OBJ.aid==adminid) {flag1=1;break;} if(!ADMIN) break; } counter1++; } if (counter1==3) { cout<<"THREE CHANCES EXCEEDED! GOING BACK TO PAGE 1"; getch(); return;} while((counter2<3)&&(!flag2)) {if(counter2==0) cout<<"\nENTER YOUR PASSWORD "; else cout<<"WRONG PASSWORD.ENTER AGAIN "; cin>>adminpass; if(OBJ.aip==adminpass) {flag2=3;break;} counter2++; } if (counter2==3) { cout<<"THREE CHANCES EXCEEDED! GOING BACK TO PAGE 1"; getch(); return;} ADMIN.close(); wp1: getch(); clrscr(); cout<<"\t\t\t\t WORK PAGE 1\nSelect the category to work with:"; cout<<"\n\t\t1.Chat\n\t\t2.Pizzas and Burgers\n\t\t3.South Indian snacks"; cout<<"\n\t\t4.Coffee and drinks\n\t\t5.Bread and cakes\n\t\t6.Icecreams"; cout<<"\n\t\t7.Indian sweets\n\t\t8.Go back to main page"; cout<<"\nEnter your choice: "; cin>>choosecat; while(!(choosecat>=1&&choosecat<=8)) { cout<<"ENTER AGAIN FROM 1-7"; cin>>choosecat;} if(choosecat==8) { firstpage(); if(exitvar==1 ) return;} wp2: getch(); clrscr(); cout<<"\t\t\t\tWORK PAGE 2\nChoose the operation on the file:"; cout<<"\n1.MODIFY DETAILS OF FOOD OUTLETS"; cout<<"\n2.DELETE FOOD OUTLETS"; cout<<"\n3.ADD FOOD OUTLETS"; cout<<"\n4.MODIFY THE CONTENTS OF THE FOOD OUTLETS\nenter your choice:"; int choicefn; cin>>choicefn; while(!(choicefn>=1&&choicefn<=4)) {cout<<"Enter again from 1 to 4"; cin>>choicefn;} getch(); f.close(); if(choicefn==1) {clrscr(); fstream f1,f2,f3,f4; fstream buffer("buffer.dat",ios::binary|ios::out); switch(choosecat) {case 1: f1.open("chat1.dat",ios::binary|ios::in); break; case 2: f1.open("pizza1.dat",ios::binary|ios::in); break; case 3: f1.open("south1.dat",ios::binary|ios::in); break; case 4: f1.open("coffee1.dat",ios::binary|ios::in);break; case 5: f1.open("bakery1.dat",ios::binary|ios::in);break; case 6: f1.open("ice1.dat",ios::binary|ios::in); break; case 7: f1.open("sweet1.dat",ios::binary|ios::in); break; } menucount=0; while(f1.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<"."<<modobj.name<<"\n"<<modobj.address; cout<<"\n"<<modobj.phone<<"\n"; if(!f1)break; } cout<<"ENTER THE NUMBER OF THE FOOD OUTLET YOU WANT TO MODIFY"; cin>>chooseoutlet; cout<<"\nENTER NEW NAME:"; gets(newname); cout<<"ENTER NEW ADDRESS:"; gets(newaddress); cout<<"ENTER THE EIGHT DIGIT PHONE NUMBER:"; gets(newphone); char extractname[20]; f1.close(); switch(choosecat) {case 1: f2.open("chat1.dat",ios::binary|ios::in); break; case 2: f2.open("pizza1.dat",ios::binary|ios::in); break; case 3: f2.open("south1.dat",ios::binary|ios::in); break; case 4: f2.open("coffee1.dat",ios::binary|ios::in);break; case 5: f2.open("bakery1.dat",ios::binary|ios::in);break; case 6: f2.open("ice1.dat",ios::binary|ios::in); break; case 7: f2.open("sweet1.dat",ios::binary|ios::in); break; } f2.seekg(((chooseoutlet-1)*(sizeof(modobj))),ios::beg); f2.read((char*)&modobj,sizeof(modobj)); strcpy(extractname,modobj.name); strcpy(modobj.name,newname); strcpy(modobj.address,newaddress); strcpy(modobj.phone,newphone); f2.seekg(0); while(f2.read((char*)&dispobj,sizeof(dispobj))) {if(strcmpi(extractname,dispobj.name)) buffer.write((char*)&dispobj,sizeof(dispobj)); else break; if(!f2) break; } buffer.write((char*)&modobj,sizeof(modobj)); while(f2.read((char*)&dispobj,sizeof(dispobj))) { buffer.write((char*)&dispobj,sizeof(dispobj)); if(!f2) break;} f2.close(); buffer.close(); switch(choosecat) {case 1: f3.open("chat1.dat",ios::binary|ios::out|ios::trunc); break; case 2: f3.open("pizza1.dat",ios::binary|ios::out|ios::trunc); break; case 3: f3.open("south1.dat",ios::binary|ios::out|ios::trunc); break; case 4: f3.open("coffee1.dat",ios::binary|ios::out|ios::trunc);break; case 5: f3.open("bakery1.dat",ios::binary|ios::out|ios::trunc);break; case 6: f3.open("ice1.dat",ios::binary|ios::out|ios::trunc); break; case 7: f3.open("sweet1.dat",ios::binary|ios::out|ios::trunc); break; } fstream buffer2("buffer.dat",ios::binary|ios::in); while(buffer2.read((char*)&modobj,sizeof(modobj))) { f3.write((char*)&modobj,sizeof(modobj)); if(!buffer2) break; } f3.close(); buffer2.close(); switch(choosecat) {case 1: f4.open("chat1.dat",ios::binary|ios::in); break; case 2: f4.open("pizza1.dat",ios::binary|ios::in); break; case 3: f4.open("south1.dat",ios::binary|ios::in); break; case 4: f4.open("coffee1.dat",ios::binary|ios::in);break; case 5: f4.open("bakery1.dat",ios::binary|ios::in);break; case 6: f4.open("ice1.dat",ios::binary|ios::in); break; case 7: f4.open("sweet1.dat",ios::binary|ios::in); break; } clrscr(); menucount=0; cout<<"Modification successfully done!Current status\n"; while(f4.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<"."<<modobj.name<<"\n"<<modobj.address; cout<<"\n"<<modobj.phone<<"\n"; if(!f4)break; } f4.close(); } else if(choicefn==2) { clrscr(); fstream f1,f2,f3,f4; fstream buffer("buffer.dat",ios::binary|ios::out); switch(choosecat) {case 1: f1.open("chat1.dat",ios::binary|ios::in); break; case 2: f1.open("pizza1.dat",ios::binary|ios::in); break; case 3: f1.open("south1.dat",ios::binary|ios::in); break; case 4: f1.open("coffee1.dat",ios::binary|ios::in);break; case 5: f1.open("bakery1.dat",ios::binary|ios::in);break; case 6: f1.open("ice1.dat",ios::binary|ios::in); break; case 7: f1.open("sweet1.dat",ios::binary|ios::in); break; } menucount=0; while(f1.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<"."<<modobj.name<<"\n"<<modobj.address; cout<<"\n"<<modobj.phone<<"\n"; if(!f1)break; } cout<<"ENTER THE NUMBER OF THE FOOD OUTLET YOU WANT TO DELETE"; cin>>chooseoutlet; char extractname[20]; f1.close(); switch(choosecat) {case 1: f2.open("chat1.dat",ios::binary|ios::in); break; case 2: f2.open("pizza1.dat",ios::binary|ios::in); break; case 3: f2.open("south1.dat",ios::binary|ios::in); break; case 4: f2.open("coffee1.dat",ios::binary|ios::in);break; case 5: f2.open("bakery1.dat",ios::binary|ios::in);break; case 6: f2.open("ice1.dat",ios::binary|ios::in); break; case 7: f2.open("sweet1.dat",ios::binary|ios::in); break; } f2.seekg(((chooseoutlet-1)*(sizeof(modobj))),ios::beg); f2.read((char*)&modobj,sizeof(modobj)); strcpy(extractname,modobj.name); f2.seekg(0); while(f2.read((char*)&modobj,sizeof(modobj))) {if(strcmpi(extractname,modobj.name)) buffer.write((char*)&modobj,sizeof(modobj)); if(!f2) break; } f2.close(); buffer.close(); switch(choosecat) {case 1: f3.open("chat1.dat",ios::binary|ios::out|ios::trunc); break; case 2: f3.open("pizza1.dat",ios::binary|ios::out|ios::trunc); break; case 3: f3.open("south1.dat",ios::binary|ios::out|ios::trunc); break; case 4: f3.open("coffee1.dat",ios::binary|ios::out|ios::trunc);break; case 5: f3.open("bakery1.dat",ios::binary|ios::out|ios::trunc);break; case 6: f3.open("ice1.dat",ios::binary|ios::out|ios::trunc); break; case 7: f3.open("sweet1.dat",ios::binary|ios::out|ios::trunc); break; } fstream buffer2("buffer.dat",ios::binary|ios::in); while(buffer2.read((char*)&modobj,sizeof(modobj))) { f3.write((char*)&modobj,sizeof(modobj)); if(!buffer2) break; } f3.close(); buffer2.close(); switch(choosecat) {case 1: f4.open("chat1.dat",ios::binary|ios::in); break; case 2: f4.open("pizza1.dat",ios::binary|ios::in); break; case 3: f4.open("south1.dat",ios::binary|ios::in); break; case 4: f4.open("coffee1.dat",ios::binary|ios::in);break; case 5: f4.open("bakery1.dat",ios::binary|ios::in);break; case 6: f4.open("ice1.dat",ios::binary|ios::in); break; case 7: f4.open("sweet1.dat",ios::binary|ios::in); break; } clrscr(); menucount=0; cout<<"Deletion successfully done!Current status\n"; while(f4.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<"."<<modobj.name<<"\n"<<modobj.address; cout<<"\n"<<modobj.phone<<"\n"; if(!f4)break; } f4.close(); } else if (choicefn==3) {clrscr(); f.close(); switch(choosecat) {case 1: f.open("chat1.dat",ios::binary|ios::app|ios::in); break; case 2: f.open("pizza1.dat",ios::binary|ios::app|ios::in); break; case 3: f.open("south1.dat",ios::binary|ios::app|ios::in); break; case 4: f.open("coffee1.dat",ios::binary|ios::app|ios::in);break; case 5: f.open("bakery1.dat",ios::binary|ios::app|ios::in);break; case 6: f.open("ice1.dat",ios::binary|ios::app|ios::in); break; case 7: f.open("sweet1.dat",ios::binary|ios::app|ios::in); break; } cout<<"\nENTER THE NAME OF THE HOTEL:"; gets(modobj.name); cout<<"ENTER THE PHONE NUMBER:"; gets(modobj.phone); cout<<"ENTER ADDRESS OF THE HOTEL:"; gets(modobj.address); cout<<"ENTER ITEMS AND THEIR PRICE INTO THE MENU:"; for(int i=0;i<10;i++) { cout<<"ENTER ITEM"<<i+1<<":"; gets(modobj.y.item[i]); if(choosecat==2) cout<<"ENTER PRICE OF PERSONAL PIZZA"; else cout<<"ENTER THE PRICE FOR ITEM"; cout<<i+1<<":"; cin>>modobj.y.price[i]; } f.write((char*)&modobj,sizeof(modobj)); getch(); clrscr(); cout<<"\nData Added Successfully!. Current Status:"; menucount=0; f.seekg(0,ios::beg); while(f.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<"."<<modobj.name<<"\n"; cout<<modobj.address<<"\n"<<modobj.phone<<"\n"; if(f.eof()) break; } f.close(); } else { clrscr(); fstream f1,f,f3,f4; fstream buffer("buffer.dat",ios::binary|ios::out); switch(choosecat) {case 1: f1.open("chat1.dat",ios::binary|ios::in); break; case 2: f1.open("pizza1.dat",ios::binary|ios::in); break; case 3: f1.open("south1.dat",ios::binary|ios::in); break; case 4: f1.open("coffee1.dat",ios::binary|ios::in);break; case 5: f1.open("bakery1.dat",ios::binary|ios::in);break; case 6: f1.open("ice1.dat",ios::binary|ios::in); break; case 7: f1.open("sweet1.dat",ios::binary|ios::in); break; } menucount=0; while(f1.read((char*)&modobj,sizeof(modobj))) { cout<<++menucount<<modobj.name<<"\n"<<modobj.address; cout<<"\n"<<modobj.phone<<"\n"; if(f1.eof()) break; } f1.close(); cout<<"\nENTER THE NUMBER OF THE FOOD OUTLET "; cout<<"WHOSE DETAILS YOU WANT TO MODIFY"; cin>>chooseoutlet; switch(choosecat) {case 1: f.open("chat1.dat",ios::binary|ios::in); break; case 2: f.open("pizza1.dat",ios::binary|ios::in); break; case 3: f.open("south1.dat",ios::binary|ios::in); break; case 4: f.open("coffee1.dat",ios::binary|ios::in);break; case 5: f.open("bakery1.dat",ios::binary|ios::in);break; case 6: f.open("ice1.dat",ios::binary|ios::in); break; case 7: f.open("sweet1.dat",ios::binary|ios::in); break; } f.seekg((chooseoutlet-1)*sizeof(modobj),ios::beg); f.read((char*)&modobj,sizeof(modobj)); clrscr(); cout<<"\n"<<modobj.name<<"\n"<<modobj.address<<"\n"<<modobj.phone; cout<<"\n"; if(choosecat==1||choosecat==3||choosecat==4) {cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<modobj.y.item[i]<<setw(20)<<modobj.y.price[i]<<"\n"; } } else if(choosecat==5||choosecat==6||choosecat==7) {cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE/kg"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<modobj.y.item[i]<<setw(20); cout<<modobj.y.price[i]<<"\n";}} else {cout<<setw(15)<<"ITEM"<<setw(40)<<"PRICE\n"; cout<<setw(35)<<"PERSONAL"<<setw(19)<<"MEDIUM"<<setw(19)<<"LARGE\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(23)<<modobj.y.item[i]<<setw(7); cout<<modobj.y.price[i]<<setw(20); cout<<modobj.y.price[i]+100<<setw(20)<<modobj.y.price[i]+200<<"\n"; } } cout<<"\nENTER FUNCTION\n1.MODIFY THE NAME AND PRICE OF ITEM"; cout<<"\n2.CHANGE THE PRICE OF AN ITEM\n Enter Choice:"; int random; cin>>random; cout<<"\nEnter the item number you want to change:"; int changechoice;float changedprice; cin>>changechoice; if (random ==1) { char changeitem[20]; cout<<"\nEnter New Name"; gets(changeitem); cout<<"Enter the New Price"; cin>>changedprice; strcpy(modobj.y.item[changechoice-1],changeitem); modobj.y.price[changechoice-1]=changedprice; } else if(random==2) { cout<<"Enter the New Price"; cin>>changedprice; modobj.y.price[changechoice-1]=changedprice; } char extractname[20]; strcpy(extractname,modobj.name); f.seekg(0); while(f.read((char*)&dispobj,sizeof(dispobj))) {if(strcmpi(extractname,dispobj.name)) buffer.write((char*)&dispobj,sizeof(dispobj)); else break; if(!f) break; } buffer.write((char*)&modobj,sizeof(modobj)); while(f.read((char*)&dispobj,sizeof(dispobj))) { buffer.write((char*)&dispobj,sizeof(dispobj)); if(!f) break;} f.close(); buffer.close(); switch(choosecat) {case 1: f3.open("chat1.dat",ios::binary|ios::out|ios::trunc); break; case 2: f3.open("pizza1.dat",ios::binary|ios::out|ios::trunc); break; case 3: f3.open("south1.dat",ios::binary|ios::out|ios::trunc); break; case 4: f3.open("coffee1.dat",ios::binary|ios::out|ios::trunc);break; case 5: f3.open("bakery1.dat",ios::binary|ios::out|ios::trunc);break; case 6: f3.open("ice1.dat",ios::binary|ios::out|ios::trunc); break; case 7: f3.open("sweet1.dat",ios::binary|ios::out|ios::trunc); break; } fstream buffer2("buffer.dat",ios::binary|ios::in); while(buffer2.read((char*)&modobj,sizeof(modobj))) { f3.write((char*)&modobj,sizeof(modobj)); if(!buffer2) break; } f3.close(); buffer2.close(); switch(choosecat) {case 1: f4.open("chat1.dat",ios::binary|ios::in); break; case 2: f4.open("pizza1.dat",ios::binary|ios::in); break; case 3: f4.open("south1.dat",ios::binary|ios::in); break; case 4: f4.open("coffee1.dat",ios::binary|ios::in);break; case 5: f4.open("bakery1.dat",ios::binary|ios::in);break; case 6: f4.open("ice1.dat",ios::binary|ios::in); break; case 7: f4.open("sweet1.dat",ios::binary|ios::in); break; } clrscr(); cout<<"Modification successfully done!Current status\n"; cout<<"\n"<<modobj.name<<"\n"<<modobj.address<<"\n"<<modobj.phone; cout<<"\n"; if(choosecat==1||choosecat==3||choosecat==4) {cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<modobj.y.item[i]<<setw(20)<<modobj.y.price[i]<<"\n"; } } else if(choosecat==5||choosecat==6||choosecat==7) {cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE/kg"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<modobj.y.item[i]<<setw(20); cout<<modobj.y.price[i]<<"\n";}} else {cout<<setw(15)<<"ITEM"<<setw(40)<<"PRICE\n"; cout<<setw(35)<<"PERSONAL"<<setw(19)<<"MEDIUM"<<setw(19)<<"LARGE\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(23)<<modobj.y.item[i]<<setw(7); cout<<modobj.y.price[i]<<setw(20); cout<<modobj.y.price[i]+100<<setw(20)<<modobj.y.price[i]+200<<"\n"; } } f4.close(); getch(); } int finalevar; cout<<"press\n1 to go to FRONT PAGE\n2 to WORK PAGE 1\n3 to WORKPAGE 2"; cin>>finalevar; switch(finalevar) { case 1: firstpage(); break; case 2: goto wp1; case 3: goto wp2; } } void billp() {int c,o,u,n=0;char pzz; z.tp=0;char a[10]; do {cout<<"enter item no. "; cin>>o; while(!(o>=1&&o<=10)) {cout<<"enter from 1 to 10"; cin>>o;} z.order[n][0]=o; cout<<"enter units "; cin>>u; z.order[n][1]=u; cout<<"Press 'p' for personal,'m'for medium,'l' for large "; cin>>pzz; while(!(pzz=='p'||pzz=='m'||pzz=='l')) {cout<<"enter 'p' or 'm' or 'l' "; cin>>pzz;} a[n++]=pzz; cout<<"press 1 to order more,2 to proceed further "; cin>>c; while(!(c==1||c==2)) {cout<<"Enter again (1/2)"; cin>>c;} } while(c!=2); cout<<"Enter your name\n"; gets(z.name); cout<<"Enter your address\n"; gets(z.address); cout<<"Enter your phone no.\n"; gets(z.phone); cout<<"Press 1 for CASH ON DELIVERY,2 for CARD payment "; cin>>z.mop; while(!(z.mop==1||z.mop==2)) {cout<<"Enter 1 or 2 "; cin>>z.mop;} char bz[20],cz[30]; int iz=0,jz;char dz[4]; if(z.mop==2) { int cccounter=0; while(cccounter!=16) {cout<<"Enter 16 digit credit card number: "; gets(bz); cccounter=strlen(bz); } cout<<"Enter name in the credit card(in caps): "; gets(cz); cout<<"Enter 4 digit pin: "; while(iz<4) {dz[iz]=getch(); cout<<"*"; iz++; } getch() ; cout<<"\nCustomer Name: "<<cz; cout<<"\nCustomer credit card number: "; cout<<"**** **** ****"; for(jz=12;jz<16;jz++) cout<<bz[jz]; cout<<"\nAmount credited successfully!"; } for(int i=0;i<n;i++) {if(a[i]=='p') z.tp+=x.y.price[z.order[i][0]-1]*(z.order[i][1]); else if(a[i]=='m') z.tp+=(x.y.price[z.order[i][0]-1]+100)*(z.order[i][1]); else z.tp+=(x.y.price[z.order[i][0]-1]+200)*(z.order[i][1]);} clrscr(); cout<<"\n\t\t\tBILL\n\t\t\t____"; cout<<"\nFood outlet details:\n"; cout<<"Name: "<<x.name<<"\nAddress: "<<x.address<<"\nPhone: "<<x.phone; cout<<"\n"; cout<<"Customer details:\n"; cout<<"Name: "<<z.name<<"\nAddress: "<<z.address<<"\nPhone: "; cout<<z.phone<<"\nMode of payment: "; if(z.mop==1) cout<<"Cash on delivery\n"; else {cout<<"Card payment\nCustomer credit card number: "; cout<<"**** **** ****"; for(jz=12;jz<16;jz++) cout<<bz[jz];} cout<<"\n\t\t\t\t ORDER:\n"; cout<<setw(20)<<"ITEM"<<setw(20)<<"P/M/L"<<setw(20); cout<<"PRICE"<<setw(20)<<"UNITS\n"; for(i=0;i<n;i++) {cout<<setw(22)<<x.y.item[z.order[i][0]-1]<<setw(18); if(a[i]=='p') cout<<"Personal"; else if(a[i]=='m') cout<<"Medium"; else cout<<"Large"; cout<<setw(19); if(a[i]=='p') cout<<x.y.price[z.order[i][0]-1]; else if(a[i]=='m') cout<<x.y.price[z.order[i][0]-1]+100; else cout<<x.y.price[z.order[i][0]-1]+200; cout<<setw(20)<<z.order[i][1]<<"\n";} cout<<"TRP:Rs."<<z.tp; cout<<"\nTAX:Rs.50"; cout<<"\nNET BILL AMOUNT:Rs."<<z.tp+50; cout<<"\nYour order will arrive within an hour"; cout<<"\n\t\t\tTHANK YOU!!!"; getch(); } void bill() {int c,o,u,n=0; z.tp=0; do {cout<<"enter item no. "; cin>>o; while(!(o>=1&&o<=10)) {cout<<"enter from 1 to 10"; cin>>o;} z.order[n][0]=o; cout<<"enter units "; cin>>u; z.order[n++][1]=u; cout<<"press 1 to order more,2 to proceed further "; cin>>c; while(!(c==1||c==2)) {cout<<"Enter again (1/2)"; cin>>c;} } while(c!=2); cout<<"Enter your name\n"; gets(z.name); cout<<"Enter your address\n"; gets(z.address); cout<<"Enter your phone no.\n"; gets(z.phone); cout<<"Press 1 for CASH ON DELIVERY,2 for CARD payment "; cin>>z.mop; while(!(z.mop==1||z.mop==2)) {cout<<"Enter 1 or 2 "; cin>>z.mop;} char bz[20],cz[30]; int iz=0,jz;char dz[4]; if(z.mop==2) { int cccounter=0; while(cccounter!=16) { cout<<"Enter the 16 digit credit card number: "; gets(bz); cccounter=strlen(bz); } cout<<"Enter name in the credit card(in caps): "; gets(cz); cout<<"Enter 4 digit pin: "; while(iz<4) {dz[iz]=getch(); cout<<"*"; iz++; } getch() ; cout<<"\nCustomer Name: "<<cz; cout<<"\nCustomer credit card number: "; cout<<"**** **** ****"; for(jz=12;jz<16;jz++) cout<<bz[jz]; cout<<"\nAmount credited successfully!"; } for(int i=0;i<n;i++) z.tp+=x.y.price[z.order[i][0]-1]*(z.order[i][1]); clrscr(); cout<<"\n\t\t\tBILL\n\t\t\t----"; cout<<"\nFOOD OUTLET DETAILS:\n"; cout<<"Name: "<<x.name<<"\nAddress: "<<x.address<<"\nPhone: "<<x.phone; cout<<"\n"; cout<<"CUSTOMER DETAILS:\n"; cout<<"Name: "<<z.name<<"\nAddress: "<<z.address<<"\nPhone "; cout<<z.phone<<"\nMode of payment: "; if(z.mop==1) cout<<"Cash on delivery\n"; else {cout<<"Card payment\nCustomer credit card number: "; cout<<"**** **** ****"; for(jz=12;jz<=15;jz++) cout<<bz[jz];} cout<<"\n\t\t\t\t ORDER\n"; cout<<setw(20)<<"ITEM"<<setw(20)<<"PRICE"<<setw(20)<<"UNITS\n"; for(i=0;i<n;i++) {cout<<setw(20)<<x.y.item[z.order[i][0]-1]<<setw(20); cout<<x.y.price[z.order[i][0]-1]<<setw(20)<<z.order[i][1]<<"\n";} cout<<"TRP:Rs."<<z.tp; cout<<"\nTAX:Rs.10"; cout<<"\nTOTAL BILL AMOUNT:Rs."<<z.tp+10; cout<<"\nYour order will arrive within an hour"; cout<<"\n\t\t\t\tTHANK YOU!!!"; getch(); } void main() { clrscr(); firstpage(); g1: if(exitvar==1) return; fstream f1,f2,f3,f4,f5,f6,f7; do {l1: clrscr(); cout<<"\t ()()() ()()() ()()() ()() ()()() () () () ()() () \n"; cout<<"\t () () () () () () () () () () () ()()() () () () ()\n"; cout<<"\t ()()() () () () () () () ()()() ()()() () (() () () ()()()\n"; cout<<"\t () () () () () () () () () () () () () () () ()\n"; cout<<"\t () ()()() ()()() ()() () () () () () ()() () ()\n"; cout<<"\t\t\t\t\t\t\t-YOUR FOOD EXPERT\n"; cout<<"\n\t\t\tWhat's your choice today?\n"; cout<<"\n\t\t1.Chat\n\t\t2.Pizzas and Burgers\n\t\t3.South Indian snacks"; cout<<"\n\t\t4.Coffee and drinks\n\t\t5.Bread and cakes\n\t\t6.Icecreams"; cout<<"\n\t\t7.Indian sweets\n\t\t8.No thanks,I'm full"; cout<<"\nI want to binge on (press you choice no.) or press 9 to go to main"; cout<<"page "; cin>>choice; while(!(choice>=1&&choice<=9)) {cout<<"Enter choice again from 1-9"; cin>>choice;} if(choice==9) {firstpage();goto g1;} l2: d=0; //printing food outlets switch(choice) {case 1: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f1.open("chat.dat",ios::binary|ios::in); while( f1.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f1.eof()) break;} f1.close();} break; case 2: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f2.open("pizza.dat",ios::binary|ios::in); while( f2.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f2.eof()) break;} f2.close(); } break; case 3: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f3.open("south.dat",ios::binary|ios::in); while( f3.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f3.eof()) break;} f3.close();} break; case 4: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f4.open("coffee.dat",ios::binary|ios::in); while( f4.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f4.eof()) break;} f4.close();}break; case 5:{ clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f5.open("bakery.dat",ios::binary|ios::in); while( f5.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f5.eof()) break;} f5.close();}break; case 6: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f6.open("ice.dat",ios::binary|ios::in); while( f6.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f6.eof()) break;} f6.close();} break; case 7: { clrscr(); cout<<"\t\t\tYOUR FOOD OUTLETS\n"; f7.open("sweet.dat",ios::binary|ios::in); while( f7.read((char*)&x,sizeof(x))) { cout<<++d<<". "<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; if(f7.eof()) break;} f7.close();}break; case 8: cout<<"Goodbye.Visit again.";goto e; } cout<<"\nProceed?press y ,otherwise n to go back to main page "; cin>>ch1; while(!(ch1=='y'||ch1=='n')) {cout<<"Enter y or n"; cin>>ch1;} if(ch1=='y') {cout<<"\nPress your choice no. "; cin>>n; switch(choice) {case 1: f1.open("chat1.dat",ios::binary|ios::in); break; case 2: f2.open("pizza1.dat",ios::binary|ios::in); break; case 3: f3.open("south1.dat",ios::binary|ios::in); break; case 4: f4.open("coffee1.dat",ios::binary|ios::in);break; case 5: f5.open("bakery1.dat",ios::binary|ios::in);break; case 6: f6.open("ice1.dat",ios::binary|ios::in); break; case 7: f7.open("sweet1.dat",ios::binary|ios::in); break; } if(choice==1) {clrscr(); f1.seekg((n-1)*sizeof(x),ios::beg); f1.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f1.close(); } else if(choice==3) {clrscr(); f3.seekg((n-1)*sizeof(x),ios::beg); f3.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f3.close(); } else if (choice==4) {clrscr(); f4.seekg((n-1)*sizeof(x),ios::beg); f4.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f4.close(); } else if(choice==5) {clrscr(); f5.seekg((n-1)*sizeof(x),ios::beg); f5.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE/kg"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f5.close(); } else if(choice==6) {clrscr(); f6.seekg((n-1)*sizeof(x),ios::beg); f6.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE/kg"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f6.close(); } else if(choice==7) {clrscr(); f7.seekg((n-1)*sizeof(x),ios::beg); f7.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(20)<<"ITEM"<<setw(25)<<"PRICE/kg"<<"\n"; for(int i=0;i<10;i++) {cout<<setw(2)<<i+1; cout<<setw(25)<<x.y.item[i]<<setw(20)<<x.y.price[i]<<"\n";} f7.close(); } else if(choice==2) {clrscr(); f2.seekg((n-1)*sizeof(x),ios::beg); f2.read((char*)&x,sizeof(x)); cout<<"\n"<<x.name<<"\n"<<x.address<<"\n"<<x.phone; cout<<"\n"; cout<<setw(15)<<"ITEM"<<setw(30)<<"PRICE\n"; cout<<"\n"; cout<<setw(40)<<"PERSONAL"<<setw(10)<<"MEDIUM"<<setw(10)<<"LARGE\n"; for(int i=0;i<10;i++) {cout<<i+1<<"."; cout<<setw(25)<<x.y.item[i]<<setw(10)<<x.y.price[i]<<setw(10); cout<<x.y.price[i]+100<<setw(10)<<x.y.price[i]+200<<"\n"; f2.close(); } cout<<"\nProceed to ordering?\nPress y/n to go back to food outlets "; cin>>ch4; while(!(ch4=='y'||ch4=='n')) {cout<<"Enter y or n"; cin>>ch4;} if(ch4=='y') {billp(); goto l1;} else if(ch4=='n') { goto l2; } } cout<<"\nProceed to ordering?\nPress y or n to go back to food outlets "; cin>>ch2; while(!(ch2=='y'||ch2=='n')) {cout<<"Enter y or n"; cin>>ch2;} if(ch2=='y') {bill(); goto l1; } else if(ch2=='n') goto l2;} else if (ch1=='n') goto l1; e: }while (choice!=8); r1: getch();}
[ "noreply@github.com" ]
vishprivenkat.noreply@github.com
dfd0a650c29e821b4d2be6b11554789074d5adda
f81749de4aad3955433ef183dba9813cd54af57f
/instance/problem/continuous/large_scale/CEC2013/N7S1_SR_Ackley_F6.h
c46b168ae5d6137228eb9dec185658e8e752ae45
[]
no_license
Strawberry9583/OFEC_Alpha
bc27208143647e91f5acd7cfc86b666c8a59aac4
f251f02d8d63544f49d832efa8acb06da5cd028a
refs/heads/master
2021-08-22T11:00:32.068132
2017-11-28T02:04:36
2017-11-28T02:04:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,179
h
/************************************************************************* * Project:Open Frameworks for Evolutionary Computation (OFEC) ************************************************************************* * Author: Li Zhou * Email: 441837060@qq.com * Language: C++ ************************************************************************* * This file is part of OFEC. This library is free software; * you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software * Foundation; either version 2, or (at your option) any later version. *************************************************************************/ #ifndef N7S1_SR_ACKLEY_F6_H #define N7S1_SR_ACKLEY_F6_H #include "function_CEC2013.h" namespace OFEC { namespace CEC2013 { class N7S1_SR_Ackley_F6 final:public function_CEC2013 { public: N7S1_SR_Ackley_F6(param_map &v); N7S1_SR_Ackley_F6(const std::string &name, size_t size_var, size_t size_obj); void evaluate__(real *x, std::vector<real>& obj); ~N7S1_SR_Ackley_F6(); protected: void initialize(); }; } using CEC2013_LSOP_F6 = CEC2013::N7S1_SR_Ackley_F6; } #endif
[ "changhe.lw@gmail.com" ]
changhe.lw@gmail.com
4fc896c815a72d4a064218c74869bf318fdf72e6
9ef30b4ab3a440aec544936370e12fc5362ef455
/9_timBoiSo.cpp
09d094fe2c107d285b02986c45fd2b283d54f493
[]
no_license
kimchicaithao/kimchi
cd3ae8e5fa2d09500d07a54c14875c2431082455
678ffb5e01b01d21ba8d89e451c7d72bcaeea84a
refs/heads/master
2020-06-04T18:32:59.458366
2019-06-16T03:37:12
2019-06-16T03:37:12
192,145,784
0
0
null
null
null
null
UTF-8
C++
false
false
487
cpp
/* NEWPTIT */ #include<bits/stdc++.h> using namespace std; int res[505]; bool visited[505]; void Init(){ int dem=0; queue<int> q; q.push(9); while(dem<500){ int t=q.front();q.pop(); for(int i=1;i<=500 && i<=t;i++) if(t%i==0 && !visited[i]){ visited[i]=true; res[i]=t; dem++; } q.push(t*10); q.push(t*10+9); } } int main(){ int t; cin>>t; Init(); while(t--){ int n; cin>>n; cout<<res[n]<<endl; } return 0; }
[ "noreply@github.com" ]
kimchicaithao.noreply@github.com
32e571fabfb8fb3e32576a977ae3538399daee17
349fe789ab1e4e46aae6812cf60ada9423c0b632
/Program/FIBPlus/DBServ20/DocReal/UDMDocReal.h
0177ef4c4e4ab4d7486f8d6e4fd7626338b50fe9
[]
no_license
presscad/ERP
a6acdaeb97b3a53f776677c3a585ca860d4de980
18ecc6c8664ed7fc3f01397d587cce91fc3ac78b
refs/heads/master
2020-08-22T05:24:15.449666
2019-07-12T12:59:13
2019-07-12T12:59:13
216,326,440
1
0
null
2019-10-20T07:52:26
2019-10-20T07:52:26
null
WINDOWS-1251
C++
false
false
5,074
h
//--------------------------------------------------------------------------- #ifndef UDMDocRealH #define UDMDocRealH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <DB.hpp> #include <IBCustomDataSet.hpp> #include <IBDatabase.hpp> #include <IBQuery.hpp> #include "FIBDatabase.hpp" #include "FIBDataSet.hpp" #include "pFIBDatabase.hpp" #include "pFIBDataSet.hpp" #include "FIBQuery.hpp" #include "pFIBQuery.hpp" //--------------------------------------------------------------------------- class TDMDocReal : public TDataModule { __published: // IDE-managed Components TDataSource *DataSourceDoc; TDataSource *DataSourceDocT; TDataSource *DataSourceDocAll; TpFIBTransaction *IBTr; TpFIBTransaction *IBTrUpdate; TpFIBDataSet *DocAll; TpFIBDataSet *Doc; TpFIBDataSet *DocT; TFIBDateTimeField *DocAllPOSDOC; TFIBSmallIntField *DocAllPRDOC; TFIBStringField *DocAllTDOC; TFIBIntegerField *DocAllNUMDOC; TFIBBCDField *DocAllSUMDOC; TFIBStringField *DocAllNAME_SINFBASE_OBMEN; TFIBStringField *DocAllNAMEFIRM; TFIBStringField *DocAllNAMESKLAD; TFIBStringField *DocAllNAMEKLIENT; TFIBStringField *DocAllFNAME_USER; TFIBStringField *DocPRIMREA; TFIBStringField *DocNAME_TPRICE; TFIBStringField *DocNAMEKLIENT; TFIBStringField *DocNAMEBSCHET; TFIBBCDField *DocTKOLREAT; TFIBBCDField *DocTKFREAT; TFIBBCDField *DocTPRICEREAT; TFIBBCDField *DocTSUMREAT; TFIBStringField *DocTNAMENOM; TFIBStringField *DocTNAMEED; TFIBIntegerField *DocTTNOM; TpFIBTransaction *IBTrDvReg; TpFIBQuery *pFIBQ; TIntegerField *DocTRECNO; TpFIBQuery *QueryCancelDvReg; TpFIBQuery *QueryDvReg; TpFIBDataSet *NumDoc; TFIBBCDField *DocAllIDDOC; TFIBBCDField *DocAllIDFIRMDOC; TFIBBCDField *DocAllIDSKLDOC; TFIBBCDField *DocAllIDKLDOC; TFIBBCDField *DocAllIDDOGDOC; TFIBBCDField *DocAllIDUSERDOC; TFIBBCDField *DocAllIDDOCOSNDOC; TFIBIntegerField *DocAllTYPEEXTDOC; TFIBBCDField *DocIDREA; TFIBBCDField *DocIDDOCREA; TFIBBCDField *DocIDTPRICEREA; TFIBBCDField *DocIDGRPOLREA; TFIBBCDField *DocIDBSCHETREA; TFIBBCDField *DocTIDREAT; TFIBBCDField *DocTIDDOCREAT; TFIBBCDField *DocTIDNOMREAT; TFIBBCDField *DocTIDEDREAT; TFIBBCDField *DocAllIDEXTDOC; TFIBStringField *DocAllGID_DOC; TFIBStringField *DocGID_DREA; TFIBStringField *DocTGID_DREAT; TFIBBCDField *DocIDBASE_DREA; TFIBBCDField *DocTIDBASE_DREAT; TFIBBCDField *DocAllIDBASE_GALLDOC; void __fastcall DataModuleDestroy(TObject *Sender); void __fastcall DocTCalcFields(TDataSet *DataSet); void __fastcall DataModuleCreate(TObject *Sender); void __fastcall DocTBeforeDelete(TDataSet *DataSet); void __fastcall DocTAfterDelete(TDataSet *DataSet); void __fastcall DocTKOLREATChange(TField *Sender); void __fastcall DocTPRICEREATChange(TField *Sender); void __fastcall DocNewRecord(TDataSet *DataSet); void __fastcall DocTNewRecord(TDataSet *DataSet); void __fastcall DocAllPOSDOCChange(TField *Sender); void __fastcall DocAllNAME_SINFBASE_OBMENGetText(TField *Sender, AnsiString &Text, bool DisplayText); void __fastcall DocAllIDBASE_GALLDOCChange(TField *Sender); private: // User declarations public: // User declarations __fastcall TDMDocReal(TComponent* Owner); void NewDoc(void); void OpenDoc(__int64 IdDoc); bool SaveDoc(void); bool DvRegDoc(void); bool CancelDvRegDoc(void); void AddDocNewString(void); void DeleteStringDoc(void); void CloseDoc(void); bool DeleteDoc(__int64 id); double Summa(void); __int64 GetIDDocPoNomeruDoc(int number_doc, TDate date_doc); bool NewElement; // новый элемент bool Prosmotr; //только просмотр bool NoEdit; bool Vibor; //для выбора __int64 IdDoc; //идентификатор текущей записи __int64 IdGrp; // идетификатор группы __int64 IdElementaMaster; //идентификатор внешенго справочника-владельца double SummaDoc; double OldSummaStr; double NewSummaStr; bool Error; AnsiString TextError; int Operation; //1-реализация, 2-перемещение, 3-на выпуск продукции, 4-списание int IdSklad; double SebReal; double SebProd; double SebNom; double KolOtrSpisNom; double KolSpisNom; double KolBasEdinic; double KolBasEdinic2; double KFEd; bool AutoRaschet; bool EnableDvReg; __int64 GetIDDocSchetFact(void); bool SkladRozn; bool NoOtrOstatok; }; //--------------------------------------------------------------------------- extern PACKAGE TDMDocReal *DMDocReal; //--------------------------------------------------------------------------- #endif
[ "sasha@kaserv.ru" ]
sasha@kaserv.ru
630e33a2d541108ab08bb6b8a85b0c005ed8fa7d
d6cf7e3a1a58fd3185e2619419f6aa66e8e9a9da
/3.6.7 Cyclic process. Working with numbers in number/4/main.cpp
0d09dcdca2ebf818a13208e9bae77ec1f2d9ddf9
[]
no_license
Nkeyka/Qt-Creator-Cpp-Book
6ba92cdb0eda0b844c83815266756c7e18d285e1
dcbfaf86bd0ece7c0e5642e03ab5796e2a68c916
refs/heads/main
2023-02-23T08:52:16.902547
2021-02-02T05:21:36
2021-02-02T05:21:36
319,847,831
0
0
null
null
null
null
UTF-8
C++
false
false
304
cpp
#include <iostream> using namespace std; int main() { int N, even = 0, odd = 0; cout << "N = "; cin >> N; do { if (N % 10 % 2 == 0) even++; else odd++; N /= 10; } while (N > 0); cout << "even " << even << " odd " << odd; return 0; }
[ "nkeyka@gmail.com" ]
nkeyka@gmail.com
b2e1cbcebd1d92f848008e00f66085c11a7f2d3e
ff64500dbd41735f267ab5d1f0124425edc8f2ce
/ESP32-drone/src/Drone.h
06f03698b025b6e3d4f31c8210cd9bbfe85c097b
[]
no_license
MarziehJ/IDS_ESP32_Drone_1
0ee9c2e9037fa10c03e79b9e0dfcad4944d60315
5a1a6ee1585dbeb3421e001cf0d51b5c3ad94284
refs/heads/main
2022-12-29T23:34:30.879103
2020-10-14T11:31:17
2020-10-14T11:31:17
303,991,929
1
0
null
null
null
null
UTF-8
C++
false
false
2,185
h
#ifndef Drone_h #define Drone_h #include "Arduino.h" #include "Joystick.h" #include "Button.h" #include "Lcd.h" #include "led.h" #include "AsyncUDP.h" class Drone { public: Drone(int xJoyPin, int yJoyPin, int buttonPin, int ledPin, uint8_t lcd_addr) { this->joystick = new Joystick(xJoyPin, xJoyPin); this->button = new Button(buttonPin); this->lcd = new Lcd(lcd_addr); this->led = new Led(ledPin); } bool droneIsOn() { return this->led->state; } void sendCommand(String msg) { ////PixelEmulator udp.writeTo((const uint8_t *)msg.c_str(), msg.length(), IPAddress(192, 168, 1, 39), 7000); //Real Drone // udp.writeTo((const uint8_t *)msg.c_str(), // msg.length(), // IPAddress(192, 168, 10, 1), // 7000); this->lcd->WriteMessage(msg); Serial.println(msg); } void ChangeStatus() { if (droneIsOn()) { StopDrone(); } else { InitDrone(); } } void Move(std::pair<int, int> xy) { bool isMoving = this->joystick->isInDeadzone() == false; if (isMoving) { Serial.println("Joystick Moving"); MoveDrone(xy); } } Joystick *joystick; Button *button; private: Lcd *lcd; Led *led; AsyncUDP udp; void StopDrone() { //PixelEmulator sendCommand("stop"); //Real Drone //sendCommand("land"); this->led->off(); Serial.println(led->status()); } void InitDrone() { //PixelEmulator sendCommand("init 100 100"); //Real Drone //sendCommand("command"); //sendCommand("takeoff"); this->led->on(); Serial.println(led->status()); } void MoveDrone(std::pair<int, int> xy) { //PixelEmulator Serial.print("X: "); Serial.println(xy.first); Serial.print("Y: "); Serial.println(xy.second); if (xy.first + xy.second <= 3500) { //PixelEmulator sendCommand("moveleft"); //Real Drone //sendCommand("left 1"); } else { //PixelEmulator sendCommand("moveright"); //Real Drone //sendCommand("right 1"); } } }; #endif
[ "MarziJoukar@gmail.com" ]
MarziJoukar@gmail.com
72d526ce13be34b75079281542f8adae940e7f53
b2628ff5e11120549620d31d0f03b82452e6dacb
/Demo.cpp
945226437f3d0fd46d120055e6f3324f23b6cd0f
[]
no_license
ZviMints/BullAndPgia
999aa7a95878389f23b2ea146aa1136a1f3bba7d
1189c97cfd929e028cf90bbd20ca0dd97d7b2501
refs/heads/master
2020-05-19T00:59:35.124068
2019-05-06T11:14:09
2019-05-06T11:14:09
184,747,250
1
1
null
null
null
null
UTF-8
C++
false
false
1,551
cpp
/** * A demo program for bull-pgia. * * @author Erel Segal-Halevi * @since 2019-04 */ #include <iostream> using namespace std; #include "play.hpp" #include "DummyChoosers.hpp" #include "DummyGuessers.hpp" #include "SmartGuesser.hpp" #include <chrono> #include <thread> // For Sleep using namespace bullpgia; int main() { ConstantChooser c1234{"1234"}, c12345{"12345"}, c9999{"9999"}; ConstantGuesser g1234{"1234"}, g12345{"12345"}, g9999{"9999"}; RandomChooser randy; RandomGuesser guessy; // for (uint i=0; i<100; ++i) { // cout << play(randy, guessy, 2, 100) << endl; // guesser should often win but sometimes lose. // } SmartGuesser smarty; for (uint i=0; i<200; ++i) { int len = rand()%12 + 1 ; // [1,12] auto t_start = std::chrono::high_resolution_clock::now(); cout << "(" << len << ","; uint number_of_guesses; if( len < 7 ) { number_of_guesses = play(randy, smarty, len , 100); // smarty should always win in at most 10 turns! } else { //std::this_thread::sleep_for(std::chrono::milliseconds(2000)); // Sleep number_of_guesses = play(randy, smarty, len , 100); // smarty should always win in at most 50 turns! } auto t_end = std::chrono::high_resolution_clock::now(); double elaspedTimeMs = std::chrono::duration<double, std::milli>(t_end-t_start).count(); cout << number_of_guesses << " ," << elaspedTimeMs << ") for (Len,# Guesses,Time (mills))" << endl; //cout << "******************************* END ***********************" << endl; } return 0; }
[ "ZviMints@gmail.com" ]
ZviMints@gmail.com
450892e7c366246b82e26c1a57515ef8c56c1b78
aaa31215193aeae549a553c58f278891e9b67e1c
/source/CompilerGlsl/GlslExprConfigFiller.hpp
3dcde36eec9b20ba29a9a2e7cd5c51cc9a1df5f2
[ "MIT" ]
permissive
lethep/ShaderWriter
b14d5308bf9ab64e24afeceaf6a9d79b91223a5a
4cbf830435e33a70bf8dc77386f00a3c910be274
refs/heads/master
2023-03-10T06:09:58.842691
2021-02-18T19:37:07
2021-02-18T19:37:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,653
hpp
/* See LICENSE file in root folder */ #ifndef ___SDW_GlslExprConfigFiller_H___ #define ___SDW_GlslExprConfigFiller_H___ #pragma once #include "GlslHelpers.hpp" #include <ShaderAST/Expr/ExprVisitor.hpp> namespace glsl { class ExprConfigFiller : public ast::expr::SimpleVisitor { public: static void submit( ast::expr::Expr * expr , IntrinsicsConfig & config ); static void submit( ast::expr::ExprPtr const & expr , IntrinsicsConfig & config ); private: ExprConfigFiller( IntrinsicsConfig & config ); void visitUnaryExpr( ast::expr::Unary * expr )override; void visitBinaryExpr( ast::expr::Binary * expr )override; void visitAggrInitExpr( ast::expr::AggrInit * expr )override; void visitCompositeConstructExpr( ast::expr::CompositeConstruct * expr )override; void visitMbrSelectExpr( ast::expr::MbrSelect * expr )override; void visitFnCallExpr( ast::expr::FnCall * expr )override; void visitIntrinsicCallExpr( ast::expr::IntrinsicCall * expr )override; void visitTextureAccessCallExpr( ast::expr::TextureAccessCall * expr )override; void visitImageAccessCallExpr( ast::expr::ImageAccessCall * expr )override; void visitIdentifierExpr( ast::expr::Identifier * expr )override; void visitInitExpr( ast::expr::Init * expr )override; void visitLiteralExpr( ast::expr::Literal * expr )override; void visitQuestionExpr( ast::expr::Question * expr )override; void visitSwitchCaseExpr( ast::expr::SwitchCase * expr )override; void visitSwitchTestExpr( ast::expr::SwitchTest * expr )override; void visitSwizzleExpr( ast::expr::Swizzle * expr )override; private: IntrinsicsConfig & m_config; }; } #endif
[ "dragonjoker59@hotmail.com" ]
dragonjoker59@hotmail.com
0e4eaf1e492c47d724cb6d4ba251036380a7ade8
da1b99cb8f45186085339ea8043ffb335bcd733c
/UvaOnlineJudge/11661.cpp
982cd4ac0831126111c73c7252e82d605fa88c6d
[]
no_license
Intiser/ProblemSolvingAndContest
2dff8470fe109701d2e3e407d757f8859691dbd1
de5431261ac675f323e1d8c19008b0523ba6455e
refs/heads/master
2020-03-28T04:33:15.934870
2019-02-12T09:43:54
2019-02-12T09:43:54
147,721,990
0
0
null
null
null
null
UTF-8
C++
false
false
655
cpp
#include<iostream> #include<stdio.h> using namespace std; int main(){ char c; int n,fr,fd,r,d,mn,tmp; while(cin>>n){ cin.ignore(); if(n==0) break; mn=2000001; fr=0; fd=0; for(int i=0;i<n;i++){ c=getchar(); if(c=='Z'){ mn=0; } else if(c=='R'){ r=i; fr=1; } else if(c=='D'){ d=i; fd=1; } if(fd==1&&fr==1){ if(r>d) tmp=r-d; else tmp=d-r; if(tmp<mn) mn=tmp; } } cout<<mn<<endl; } }
[ "Intiser@users.noreply.github.com" ]
Intiser@users.noreply.github.com
7430f700bbc63dca6e6fb017bbdb3d19c040c296
61804cb6c5a947bd89a5d3bedb45fae7dd09480f
/vecteur.cpp
86ba73ab5d9a01dfb690411fb9fffc5b2f803d1f
[]
no_license
Nageat/VecteurMatrice
213eedfc9152c1ee229668c99f19dd51eff61c43
022263e583f9d06c0aac6aa9ebc345f978ad639c
refs/heads/master
2020-12-07T23:06:00.147687
2020-01-09T14:14:31
2020-01-09T14:14:31
232,822,484
0
0
null
null
null
null
UTF-8
C++
false
false
411
cpp
#include "vecteur.h" vecteur::vecteur() { for (int i = 0; i < 3; i++) nTab[i] = 0; } void vecteur::display(int nTab[]) { cout << "(" << nTab[0] << "," << nTab[1] << "," << nTab[2] << ")" << endl; } vecteur::~vecteur() { } vecteur rodeMembre(Matrice, vecteur) { vecteur vect; for (int i = 0; i < 3; i++) { vect.nTab[i] = 0; for (int j = 0; j < 3; j++) { vect.nTab[i] ++; } } return vect; }
[ "skyfulle68@gmail.com" ]
skyfulle68@gmail.com
74ab5b6078f772974de3f4da851af9d7ff12066c
b84e96b6645bd444b27d727af396a46ec387cff3
/LearnOpenGLPart3/LearnOpenGLPart3/test2.cpp
92d4d81141a43aa40dbf261dc6a9ca4a2eb537aa
[]
no_license
AverJing/LearnOpenGL
485f4fa7efb3d4c94d890e4b5d5f3ffdc09c02d9
54211ebaf5f04919d7b87231fb3dac0aadb61798
refs/heads/master
2020-03-09T10:09:44.739149
2019-07-14T15:12:13
2019-07-14T15:12:13
128,730,277
0
0
null
null
null
null
UTF-8
C++
false
false
6,472
cpp
#include <glad/glad.h> #include <GLFW/glfw3.h> #include <stb_image.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <Shader.h> #include <iostream> void framebuffer_size_callback(GLFWwindow* window, int width, int height); void processInput(GLFWwindow *window); // settings const unsigned int SCR_WIDTH = 800; const unsigned int SCR_HEIGHT = 600; int main() { // glfw: initialize and configure // ------------------------------ glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); #ifdef __APPLE__ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // uncomment this statement to fix compilation on OS X #endif // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); if (window == NULL) { std::cout << "Failed to create GLFW window" << std::endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); // glad: load all OpenGL function pointers // --------------------------------------- if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return -1; } // configure global opengl state // ----------------------------- glEnable(GL_DEPTH_TEST); // build and compile our shader zprogram // ------------------------------------ Shader ourShader("lightColor.vs", "lightColor.fs"); // set up vertex data (and buffer(s)) and configure vertex attributes // ------------------------------------------------------------------ float vertices[] = { -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, 0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, -0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, 1.0f, 1.0f, -0.5f, 0.5f, 0.5f, 0.0f, 1.0f, -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, -0.5f, 0.5f, -0.5f, 1.0f, 1.0f, -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, -0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, 0.5f, -0.5f, -0.5f, 0.0f, 1.0f, 0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, 0.5f, -0.5f, -0.5f, 1.0f, 1.0f, 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, -0.5f, -0.5f, 0.5f, 0.0f, 0.0f, -0.5f, -0.5f, -0.5f, 0.0f, 1.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.5f, 0.5f, -0.5f, 1.0f, 1.0f, 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, -0.5f, 0.5f, 0.5f, 0.0f, 0.0f, -0.5f, 0.5f, -0.5f, 0.0f, 1.0f }; unsigned int VBO, VAO; glGenVertexArrays(1, &VAO); glGenBuffers(1, &VBO); glBindVertexArray(VAO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); // position attribute glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0); glEnableVertexAttribArray(0); // tell opengl for each sampler to which texture unit it belongs to (only has to be done once) // ------------------------------------------------------------------------------------------- ourShader.use(); // render loop // ----------- while (!glfwWindowShouldClose(window)) { // input // ----- processInput(window); // render // ------ glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // also clear the depth buffer now! // bind textures on corresponding texture units // activate shader ourShader.use(); // create transformations glm::mat4 model; glm::mat4 view; glm::mat4 projection; model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(0.5f, 1.0f, 0.0f)); view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f)); projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); // retrieve the matrix uniform locations unsigned int modelLoc = glGetUniformLocation(ourShader.ID, "model"); unsigned int viewLoc = glGetUniformLocation(ourShader.ID, "view"); // pass them to the shaders (3 different ways) glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]); // note: currently we set the projection matrix each frame, but since the projection matrix rarely changes it's often best practice to set it outside the main loop only once. ourShader.setMat4("projection", projection); // render box glBindVertexArray(VAO); glDrawArrays(GL_TRIANGLES, 0, 36); // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) // ------------------------------------------------------------------------------- glfwSwapBuffers(window); glfwPollEvents(); } // optional: de-allocate all resources once they've outlived their purpose: // ------------------------------------------------------------------------ glDeleteVertexArrays(1, &VAO); glDeleteBuffers(1, &VBO); // glfw: terminate, clearing all previously allocated GLFW resources. // ------------------------------------------------------------------ glfwTerminate(); return 0; } // process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly // --------------------------------------------------------------------------------------------------------- void processInput(GLFWwindow *window) { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); } // glfw: whenever the window size changed (by OS or user resize) this callback function executes // --------------------------------------------------------------------------------------------- void framebuffer_size_callback(GLFWwindow* window, int width, int height) { // make sure the viewport matches the new window dimensions; note that width and // height will be significantly larger than specified on retina displays. glViewport(0, 0, width, height); }
[ "panda12396@163.com" ]
panda12396@163.com
25062c0e94da53e6a6bc8c79be5107afbf405006
d4c720f93631097ee048940d669e0859e85eabcf
/chrome/browser/web_applications/web_app_logging.h
2a4c6af6391e111cc9095f6a94ffc899c88cc2bf
[ "BSD-3-Clause" ]
permissive
otcshare/chromium-src
26a7372773b53b236784c51677c566dc0ad839e4
3b920d87437d9293f654de1f22d3ea341e7a8b55
refs/heads/webnn
2023-03-21T03:20:15.377034
2023-01-25T21:19:44
2023-01-25T21:19:44
209,262,645
18
21
BSD-3-Clause
2023-03-23T06:20:07
2019-09-18T08:52:07
null
UTF-8
C++
false
false
2,385
h
// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_LOGGING_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_LOGGING_H_ #include <memory> #include <string> #include "base/values.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_url_loader.h" #include "components/webapps/browser/installable/installable_metrics.h" namespace web_app { // This class is used to accumulate a single log entry class InstallErrorLogEntry { public: explicit InstallErrorLogEntry(bool background_installation, webapps::WebappInstallSource install_surface); ~InstallErrorLogEntry(); // The InstallWebAppTask determines this after construction, so a setter is // required. void set_background_installation(bool background_installation) { background_installation_ = background_installation; } bool HasErrorDict() const { return !!error_dict_; } // Collects install errors (unbounded) if the |kRecordWebAppDebugInfo| // flag is enabled to be used by: chrome://web-app-internals base::Value TakeErrorDict(); void LogUrlLoaderError(const char* stage, const std::string& url, WebAppUrlLoader::Result result); void LogExpectedAppIdError(const char* stage, const std::string& url, const AppId& app_id, const AppId& expected_app_id); void LogDownloadedIconsErrors( const WebAppInstallInfo& web_app_info, IconsDownloadedResult icons_downloaded_result, const IconsMap& icons_map, const DownloadedIconsHttpResults& icons_http_results); private: void LogHeaderIfLogEmpty(const std::string& url); void LogErrorObject(const char* stage, const std::string& url, base::Value::Dict object); std::unique_ptr<base::Value::Dict> error_dict_; bool background_installation_; webapps::WebappInstallSource install_surface_; }; } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_LOGGING_H_
[ "chromium-scoped@luci-project-accounts.iam.gserviceaccount.com" ]
chromium-scoped@luci-project-accounts.iam.gserviceaccount.com
b18a4505f447fb39f38d64dda1c8059d8673ec04
06c0b8471fd49970752e9e77f58e454194ec5b10
/DirectX_3D_v9_Framework_JCS/DirectX SDK/utilities/Source/Sas/Effect10.h
5a5b45999540ae0f2c02f74b174c60752901ac53
[ "MIT" ]
permissive
jcs090218/JCSCC_Engine
fd93b630b70c9fb8ead719bb474eef0b69a915d1
eac6c55203bd804acb439305ff977cfca9365e1e
refs/heads/master
2021-06-04T01:01:46.893887
2020-06-14T05:37:38
2020-06-14T05:37:38
102,942,649
4
2
null
null
null
null
UTF-8
C++
false
false
1,633
h
#pragma once #include "stdafx.h" #include "D3D10_1.h" #include "d3d10.h" #include "d3dx10.h" #include "Parameter.h" #include "Effect.h" namespace Sas { class Effect10 : public Effect { public: virtual ~Effect10(); static HRESULT FromD3DEffect( ID3D10Effect* pD3DEffect, const SourceInfo& sf, Effect10** ppEffectOut ); static HRESULT FromSource( ID3D10Device* pDevice, const SourceInfo& sf, const D3D10_SHADER_MACRO* pDefines, ID3D10Include* pInclude, DWORD HlslFlags, DWORD FxFlags, Effect10** ppEffectOut ); virtual HRESULT LoadTexture( const WCHAR* file, IUnknown** texture); ID3D10Effect* GetD3DEffect(){ return m_pD3DEffect; } protected: // Private constructor Effect10() : Effect() { m_pD3DEffect = NULL; } ID3D10Effect* m_pD3DEffect; }; class Variable10 : public Variable { public: Variable10( ID3D10EffectVariable* pD3DEffectVariable, Effect* effect, Variable* parent = NULL, UINT index = 0); protected: virtual HRESULT GetScalar_Internal( Scalar* pScalar ) const; virtual HRESULT GetVector_Internal( Vector* pVector ) const; virtual HRESULT GetMatrix_Internal( Matrix* pMatrix ) const; virtual HRESULT GetObject_Internal( Object* pObject ) const; virtual HRESULT SetScalar_Internal( Scalar* pScalar ); virtual HRESULT SetVector_Internal( Vector* pVector ); virtual HRESULT SetMatrix_Internal( Matrix* pMatrix ); virtual HRESULT SetObject_Internal( Object* pObject ); virtual HRESULT SpecializedCasts( Value* pCached, const Value& value ); ID3D10EffectVariable* m_pD3DEffectVariable; }; }
[ "lkk440456@gmail.com" ]
lkk440456@gmail.com
8518cf93aad2e98a2025578d31d87cbed6349673
5abed44fbdb0532980b2c850a8e7fad20ef96078
/libredex/IRTypeChecker.cpp
56926ba0825fbcc02bf6ea1d4a577ecab2aee174
[ "MIT" ]
permissive
chmodawk/redex
8b42f33c71cffb58db49aa9613e3060d88de2116
c1d2fdd2fdb14c2c3e7adafe827c458c4a1a56ec
refs/heads/master
2023-03-18T21:45:10.287719
2021-03-08T17:45:47
2021-03-08T17:48:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
41,922
cpp
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "IRTypeChecker.h" #include <boost/optional/optional.hpp> #include "DexUtil.h" #include "Match.h" #include "Resolver.h" #include "Show.h" #include "Trace.h" using namespace sparta; using namespace type_inference; namespace { using namespace ir_analyzer; // We abort the type checking process at the first error encountered. class TypeCheckingException final : public std::runtime_error { public: explicit TypeCheckingException(const std::string& what_arg) : std::runtime_error(what_arg) {} }; std::ostringstream& print_register(std::ostringstream& out, reg_t reg) { if (reg == RESULT_REGISTER) { out << "result"; } else { out << "register v" << reg; } return out; } void check_type_match(reg_t reg, IRType actual, IRType expected) { if (actual == BOTTOM) { // There's nothing to do for unreachable code. return; } if (actual == SCALAR && expected != REFERENCE) { // If the type is SCALAR and we're checking compatibility with an integer // or float type, we just bail out. return; } if (!TypeDomain(actual).leq(TypeDomain(expected))) { std::ostringstream out; print_register(out, reg) << ": expected type " << expected << ", but found " << actual << " instead"; throw TypeCheckingException(out.str()); } } /* * There are cases where we cannot precisely infer the exception type for * MOVE_EXCEPTION. In these cases, we use Ljava/lang/Throwable; as a fallback * type. */ bool is_inference_fallback_type(const DexType* type) { return type == type::java_lang_Throwable(); } /* * We might not have the external DexClass to fully determine the hierarchy. * Therefore, be more lenient when assigning from or to external DexType. */ bool check_cast_helper(const DexType* from, const DexType* to) { // We can always cast to Object if (to == type::java_lang_Object()) { return true; } // We can never cast from Object to anything besides Object if (from == type::java_lang_Object() && from != to) { // TODO(T66567547) sanity check that type::check_cast would have agreed always_assert(!type::check_cast(from, to)); return false; } // If we have any external types (aside from Object), allow it if (!type_class_internal(from) || !type_class_internal(to)) { return true; } return type::check_cast(from, to); } // Type assignment check between two reference types. We assume that both `from` // and `to` are reference types. // Took reference from: // http://androidxref.com/6.0.1_r10/xref/art/runtime/verifier/reg_type-inl.h#88 // // Note: the expectation is that `from` and `to` are reference types, otherwise // the check fails. bool check_is_assignable_from(const DexType* from, const DexType* to, bool strict) { always_assert(from && to); always_assert_log(!type::is_primitive(from), "%s", SHOW(from)); if (type::is_primitive(from) || type::is_primitive(to)) { return false; // Expect types be a reference type. } if (from == to) { return true; // Fast path if the two are equal. } if (to == type::java_lang_Object()) { return true; // All reference types can be assigned to Object. } if (type::is_java_lang_object_array(to)) { // All reference arrays may be assigned to Object[] return type::is_reference_array(from); } if (type::is_array(from) && type::is_array(to)) { if (type::get_array_level(from) != type::get_array_level(to)) { return false; } auto efrom = type::get_array_element_type(from); auto eto = type::get_array_element_type(to); return check_cast_helper(efrom, eto); } if (!strict) { // If `to` is an interface, allow any assignment when non-strict. // This behavior is copied from AOSP. auto to_cls = type_class(to); if (to_cls != nullptr && is_interface(to_cls)) { return true; } } return check_cast_helper(from, to); } void check_wide_type_match(reg_t reg, IRType actual1, IRType actual2, IRType expected1, IRType expected2) { if (actual1 == BOTTOM) { // There's nothing to do for unreachable code. return; } if (actual1 == SCALAR1 && actual2 == SCALAR2) { // If type of the pair of registers is (SCALAR1, SCALAR2), we just bail // out. return; } if (!(TypeDomain(actual1).leq(TypeDomain(expected1)) && TypeDomain(actual2).leq(TypeDomain(expected2)))) { std::ostringstream out; print_register(out, reg) << ": expected type (" << expected1 << ", " << expected2 << "), but found (" << actual1 << ", " << actual2 << ") instead"; throw TypeCheckingException(out.str()); } } void assume_type(TypeEnvironment* state, reg_t reg, IRType expected, bool ignore_top = false) { if (state->is_bottom()) { // There's nothing to do for unreachable code. return; } IRType actual = state->get_type(reg).element(); if (ignore_top && actual == TOP) { return; } check_type_match(reg, actual, /* expected */ expected); } void assume_wide_type(TypeEnvironment* state, reg_t reg, IRType expected1, IRType expected2) { if (state->is_bottom()) { // There's nothing to do for unreachable code. return; } IRType actual1 = state->get_type(reg).element(); IRType actual2 = state->get_type(reg + 1).element(); check_wide_type_match(reg, actual1, actual2, /* expected1 */ expected1, /* expected2 */ expected2); } // This is used for the operand of a comparison operation with zero. The // complexity here is that this operation may be performed on either an // integer or a reference. void assume_comparable_with_zero(TypeEnvironment* state, reg_t reg) { if (state->is_bottom()) { // There's nothing to do for unreachable code. return; } IRType t = state->get_type(reg).element(); if (t == SCALAR) { // We can't say anything conclusive about a register that has SCALAR type, // so we just bail out. return; } if (!(TypeDomain(t).leq(TypeDomain(REFERENCE)) || TypeDomain(t).leq(TypeDomain(INT)))) { std::ostringstream out; print_register(out, reg) << ": expected integer or reference type, but found " << t << " instead"; throw TypeCheckingException(out.str()); } } // This is used for the operands of a comparison operation between two // registers. The complexity here is that this operation may be performed on // either two integers or two references. void assume_comparable(TypeEnvironment* state, reg_t reg1, reg_t reg2) { if (state->is_bottom()) { // There's nothing to do for unreachable code. return; } IRType t1 = state->get_type(reg1).element(); IRType t2 = state->get_type(reg2).element(); if (!((TypeDomain(t1).leq(TypeDomain(REFERENCE)) && TypeDomain(t2).leq(TypeDomain(REFERENCE))) || (TypeDomain(t1).leq(TypeDomain(SCALAR)) && TypeDomain(t2).leq(TypeDomain(SCALAR)) && (t1 != FLOAT) && (t2 != FLOAT)))) { // Two values can be used in a comparison operation if they either both // have the REFERENCE type or have non-float scalar types. Note that in // the case where one or both types have the SCALAR type, we can't // definitely rule out the absence of a type error. std::ostringstream out; print_register(out, reg1) << " and "; print_register(out, reg2) << ": incompatible types in comparison " << t1 << " and " << t2; throw TypeCheckingException(out.str()); } } void assume_integer(TypeEnvironment* state, reg_t reg) { assume_type(state, reg, /* expected */ INT); } void assume_float(TypeEnvironment* state, reg_t reg) { assume_type(state, reg, /* expected */ FLOAT); } void assume_long(TypeEnvironment* state, reg_t reg) { assume_wide_type(state, reg, /* expected1 */ LONG1, /* expected2 */ LONG2); } void assume_double(TypeEnvironment* state, reg_t reg) { assume_wide_type( state, reg, /* expected1 */ DOUBLE1, /* expected2 */ DOUBLE2); } void assume_wide_scalar(TypeEnvironment* state, reg_t reg) { assume_wide_type( state, reg, /* expected1 */ SCALAR1, /* expected2 */ SCALAR2); } class Result final { public: static Result Ok() { return Result(); } static Result make_error(const std::string& s) { return Result(s); } const std::string& error_message() const { always_assert(!is_ok); return m_error_message; } bool operator==(const Result& that) const { return is_ok == that.is_ok && m_error_message == that.m_error_message; } bool operator!=(const Result& that) const { return !(*this == that); } private: bool is_ok{true}; std::string m_error_message; explicit Result(const std::string& s) : is_ok(false), m_error_message(s) {} Result() = default; }; static bool has_move_result_pseudo(const MethodItemEntry& mie) { return mie.type == MFLOW_OPCODE && mie.insn->has_move_result_pseudo(); } static bool is_move_result_pseudo(const MethodItemEntry& mie) { return mie.type == MFLOW_OPCODE && opcode::is_a_move_result_pseudo(mie.insn->opcode()); } Result check_load_params(const DexMethod* method) { bool is_static_method = is_static(method); const auto& signature = method->get_proto()->get_args()->get_type_list(); auto sig_it = signature.begin(); size_t load_insns_cnt = 0; auto handle_instance = [&](IRInstruction* insn) -> boost::optional<std::string> { // Must be a param-object. if (insn->opcode() != IOPCODE_LOAD_PARAM_OBJECT) { return std::string( "First parameter must be loaded with load-param-object: ") + show(insn); } return boost::none; }; auto handle_other = [&](IRInstruction* insn) -> boost::optional<std::string> { if (sig_it == signature.end()) { return std::string("Not enough argument types for ") + show(insn); } bool ok = false; switch (insn->opcode()) { case IOPCODE_LOAD_PARAM_OBJECT: ok = type::is_object(*sig_it); break; case IOPCODE_LOAD_PARAM: ok = type::is_primitive(*sig_it) && !type::is_wide_type(*sig_it); break; case IOPCODE_LOAD_PARAM_WIDE: ok = type::is_primitive(*sig_it) && type::is_wide_type(*sig_it); break; default: not_reached(); } if (!ok) { return std::string("Incompatible load-param ") + show(insn) + " for " + type::type_shorty(*sig_it); } ++sig_it; return boost::none; }; bool non_load_param_seen = false; using handler_t = std::function<boost::optional<std::string>(IRInstruction*)>; handler_t handler = is_static_method ? handler_t(handle_other) : handler_t(handle_instance); for (const auto& mie : InstructionIterable(method->get_code()->cfg().entry_block())) { IRInstruction* insn = mie.insn; if (!opcode::is_a_load_param(insn->opcode())) { non_load_param_seen = true; continue; } ++load_insns_cnt; if (non_load_param_seen) { return Result::make_error("Saw non-load-param instruction before " + show(insn)); } auto res = handler(insn); if (res) { return Result::make_error(res.get()); } // Instance methods have an extra 'load-param' at the beginning for the // instance object. // Once we've checked that, though, the rest is the same so move on to // using 'handle_other' in all cases. handler = handler_t(handle_other); } size_t expected_load_params_cnt = method->get_proto()->get_args()->size() + !is_static_method; if (load_insns_cnt != expected_load_params_cnt) { return Result::make_error( "Number of existing load-param instructions (" + show(load_insns_cnt) + ") is lower than expected (" + show(expected_load_params_cnt) + ")"); } return Result::Ok(); } // Every variable created by a new-instance call should be initialized by a // proper invoke-direct <init>. Here, we perform simple check to find some // missing calls resulting in use of uninitialized variables. We correctly track // variables in a basic block, the most common form of allocation+init. Result check_uninitialized(const DexMethod* method) { auto* code = method->get_code(); std::map<uint16_t, IRInstruction*> uninitialized_regs; std::map<IRInstruction*, std::set<uint16_t>> uninitialized_regs_rev; auto remove_from_uninitialized_list = [&](uint16_t reg) { auto it = uninitialized_regs.find(reg); if (it != uninitialized_regs.end()) { uninitialized_regs_rev[it->second].erase(reg); uninitialized_regs.erase(reg); } }; for (auto it = code->begin(); it != code->end(); ++it) { if (it->type != MFLOW_OPCODE) { continue; } auto* insn = it->insn; auto op = insn->opcode(); if (op == OPCODE_NEW_INSTANCE) { ++it; while (it != code->end() && it->type != MFLOW_OPCODE) ++it; if (it == code->end() || it->insn->opcode() != IOPCODE_MOVE_RESULT_PSEUDO_OBJECT) { auto prev = it; prev--; return Result::make_error("No opcode-move-result after new-instance " + show(*prev) + " in \n" + show(code->cfg())); } auto reg_dest = it->insn->dest(); remove_from_uninitialized_list(reg_dest); uninitialized_regs[reg_dest] = insn; uninitialized_regs_rev[insn].insert(reg_dest); continue; } if (opcode::is_a_move(op) && !opcode::is_move_result_any(op)) { assert(insn->srcs().size() > 0); auto src = insn->srcs()[0]; auto dest = insn->dest(); if (src == dest) continue; auto it_src = uninitialized_regs.find(src); // We no longer care about the old dest remove_from_uninitialized_list(dest); // But if src was uninitialized, dest is now too if (it_src != uninitialized_regs.end()) { uninitialized_regs[dest] = it_src->second; uninitialized_regs_rev[it_src->second].insert(dest); } continue; } auto create_error = [&](const IRInstruction* instruction, const IRCode* code) { return Result::make_error("Use of uninitialized variable " + show(instruction) + " detected at " + show(*it) + " in \n" + show(code->cfg())); }; if (op == OPCODE_INVOKE_DIRECT) { auto const& sources = insn->srcs(); auto object = sources[0]; auto object_it = uninitialized_regs.find(object); if (object_it != uninitialized_regs.end()) { auto* object_ir = object_it->second; if (insn->get_method()->get_name()->str() != "<init>") { return create_error(object_ir, code); } if (insn->get_method()->get_class()->str() != object_ir->get_type()->str()) { return Result::make_error("Variable " + show(object_ir) + "initialized with the wrong type at " + show(*it) + " in \n" + show(code->cfg())); } for (auto reg : uninitialized_regs_rev[object_ir]) { uninitialized_regs.erase(reg); } uninitialized_regs_rev.erase(object_ir); } for (unsigned int i = 1; i < sources.size(); i++) { auto u_it = uninitialized_regs.find(sources[i]); if (u_it != uninitialized_regs.end()) return create_error(u_it->second, code); } continue; } auto const& sources = insn->srcs(); for (auto reg : sources) { auto u_it = uninitialized_regs.find(reg); if (u_it != uninitialized_regs.end()) return create_error(u_it->second, code); } if (insn->has_dest()) remove_from_uninitialized_list(insn->dest()); // We clear the structures after any branch, this doesn't cover all the // possible issues, but is simple auto branchingness = opcode::branchingness(op); if (op == OPCODE_THROW || (branchingness != opcode::Branchingness::BRANCH_NONE && branchingness != opcode::Branchingness::BRANCH_THROW)) { uninitialized_regs.clear(); uninitialized_regs_rev.clear(); } } return Result::Ok(); } /* * Do a linear pass to sanity-check the structure of the bytecode. */ Result check_structure(const DexMethod* method, bool check_no_overwrite_this) { check_no_overwrite_this &= !is_static(method); auto* code = method->get_code(); IRInstruction* this_insn = nullptr; bool has_seen_non_load_param_opcode{false}; for (auto it = code->begin(); it != code->end(); ++it) { // XXX we are using IRList::iterator instead of InstructionIterator here // because the latter does not support reverse iteration if (it->type != MFLOW_OPCODE) { continue; } auto* insn = it->insn; auto op = insn->opcode(); if (has_seen_non_load_param_opcode && opcode::is_a_load_param(op)) { return Result::make_error("Encountered " + show(*it) + " not at the start of the method"); } has_seen_non_load_param_opcode = !opcode::is_a_load_param(op); if (check_no_overwrite_this) { if (op == IOPCODE_LOAD_PARAM_OBJECT && this_insn == nullptr) { this_insn = insn; } else if (insn->has_dest() && insn->dest() == this_insn->dest()) { return Result::make_error( "Encountered overwrite of `this` register by " + show(insn)); } } // The instruction immediately before a move-result instruction must be // either an invoke-* or a filled-new-array instruction. if (opcode::is_a_move_result(op)) { auto prev = it; while (prev != code->begin()) { --prev; if (prev->type == MFLOW_OPCODE) { break; } } if (it == code->begin() || prev->type != MFLOW_OPCODE) { return Result::make_error("Encountered " + show(*it) + " at start of the method"); } auto prev_op = prev->insn->opcode(); if (!(opcode::is_an_invoke(prev_op) || opcode::is_filled_new_array(prev_op))) { return Result::make_error( "Encountered " + show(*it) + " without appropriate prefix " "instruction. Expected invoke or filled-new-array, got " + show(prev->insn)); } } else if (opcode::is_a_move_result_pseudo(insn->opcode()) && (it == code->begin() || !has_move_result_pseudo(*std::prev(it)))) { return Result::make_error("Encountered " + show(*it) + " without appropriate prefix " "instruction"); } else if (insn->has_move_result_pseudo() && (it == code->end() || std::next(it) == code->end() || !is_move_result_pseudo(*std::next(it)))) { return Result::make_error("Did not find move-result-pseudo after " + show(*it) + " in \n" + show(code)); } } return check_uninitialized(method); } /** * Validate if the caller has the permit to call a method or access a field. * * +-------------------------+--------+----------+-----------+-------+ * | Access Levels Modifier | Class | Package | Subclass | World | * +-------------------------+--------+----------+-----------+-------+ * | public | Y | Y | Y | Y | * | protected | Y | Y | Y | N | * | no modifier | Y | Y | N | N | * | private | Y | N | N | N | * +-------------------------+--------+----------+-----------+-------+ */ template <typename DexMember> void validate_access(const DexMethod* accessor, const DexMember* accessee) { auto accessor_class = accessor->get_class(); if (accessee == nullptr || is_public(accessee) || accessor_class == accessee->get_class()) { return; } if (!is_private(accessee)) { auto accessee_class = accessee->get_class(); auto from_same_package = type::same_package(accessor_class, accessee_class); if (is_package_private(accessee) && from_same_package) { return; } else if (is_protected(accessee) && (from_same_package || type::check_cast(accessor_class, accessee_class))) { return; } } std::ostringstream out; out << "\nillegal access to " << (is_private(accessee) ? "private " : (is_package_private(accessee) ? "package-private " : "protected ")) << show_deobfuscated(accessee) << "\n from " << show_deobfuscated(accessor); // If the accessee is external, we don't report the error, just log it. // TODO(fengliu): We should enforce the correctness when visiting external dex // members. if (accessee->is_external()) { TRACE(TYPE, 2, out.str().c_str()); return; } throw TypeCheckingException(out.str()); } } // namespace IRTypeChecker::~IRTypeChecker() {} IRTypeChecker::IRTypeChecker(DexMethod* dex_method, bool validate_access) : m_dex_method(dex_method), m_validate_access(validate_access), m_complete(false), m_verify_moves(false), m_check_no_overwrite_this(false), m_good(true), m_what("OK") {} void IRTypeChecker::run() { IRCode* code = m_dex_method->get_code(); if (m_complete) { // The type checker can only be run once on any given method. return; } if (code == nullptr) { // If the method has no associated code, the type checking trivially // succeeds. m_complete = true; return; } code->build_cfg(/* editable */ false); auto result = check_structure(m_dex_method, m_check_no_overwrite_this); if (result != Result::Ok()) { m_complete = true; m_good = false; m_what = result.error_message(); return; } // We then infer types for all the registers used in the method. const cfg::ControlFlowGraph& cfg = code->cfg(); // Check that the load-params match the signature. auto params_result = check_load_params(m_dex_method); if (params_result != Result::Ok()) { m_complete = true; m_good = false; m_what = params_result.error_message(); return; } m_type_inference = std::make_unique<TypeInference>(cfg); m_type_inference->run(m_dex_method); // Finally, we use the inferred types to type-check each instruction in the // method. We stop at the first type error encountered. auto& type_envs = m_type_inference->get_type_environments(); for (const MethodItemEntry& mie : InstructionIterable(code)) { IRInstruction* insn = mie.insn; try { auto it = type_envs.find(insn); always_assert_log( it != type_envs.end(), "%s in:\n%s", SHOW(mie), SHOW(code)); check_instruction(insn, &it->second); } catch (const TypeCheckingException& e) { m_good = false; std::ostringstream out; out << "Type error in method " << m_dex_method->get_deobfuscated_name() << " at instruction '" << SHOW(insn) << "' @ " << std::hex << static_cast<const void*>(&mie) << " for " << e.what(); m_what = out.str(); m_complete = true; return; } } m_complete = true; if (traceEnabled(TYPE, 9)) { std::ostringstream out; m_type_inference->print(out); TRACE(TYPE, 9, "%s", out.str().c_str()); } } void IRTypeChecker::assume_scalar(TypeEnvironment* state, reg_t reg, bool in_move) const { assume_type(state, reg, /* expected */ SCALAR, /* ignore_top */ in_move && !m_verify_moves); } void IRTypeChecker::assume_reference(TypeEnvironment* state, reg_t reg, bool in_move) const { assume_type(state, reg, /* expected */ REFERENCE, /* ignore_top */ in_move && !m_verify_moves); } void IRTypeChecker::assume_assignable(boost::optional<const DexType*> from, DexType* to) const { // There are some cases in type inference where we have to give up // and claim we don't know anything about a dex type. See // IRTypeCheckerTest.joinCommonBaseWithConflictingInterface, for // example - the last invoke of 'base.foo()' after the blocks join - // we no longer know anything about the type of the reference. It's // in such a case as that that we have to bail out here when the from // optional is empty. if (from && !check_is_assignable_from(*from, to, false)) { std::ostringstream out; out << ": " << *from << " is not assignable to " << to << std::endl; throw TypeCheckingException(out.str()); } } // This method performs type checking only: the type environment is not updated // and the source registers of the instruction are checked against their // expected types. // // Similarly, the various assume_* functions used throughout the code to check // that the inferred type of a register matches with its expected type, as // derived from the context. void IRTypeChecker::check_instruction(IRInstruction* insn, TypeEnvironment* current_state) const { switch (insn->opcode()) { case IOPCODE_LOAD_PARAM: case IOPCODE_LOAD_PARAM_OBJECT: case IOPCODE_LOAD_PARAM_WIDE: { // IOPCODE_LOAD_PARAM_* instructions have been processed before the // analysis. break; } case OPCODE_NOP: { break; } case OPCODE_MOVE: { assume_scalar(current_state, insn->src(0), /* in_move */ true); break; } case OPCODE_MOVE_OBJECT: { assume_reference(current_state, insn->src(0), /* in_move */ true); break; } case OPCODE_MOVE_WIDE: { assume_wide_scalar(current_state, insn->src(0)); break; } case IOPCODE_MOVE_RESULT_PSEUDO: case OPCODE_MOVE_RESULT: { assume_scalar(current_state, RESULT_REGISTER); break; } case IOPCODE_MOVE_RESULT_PSEUDO_OBJECT: case OPCODE_MOVE_RESULT_OBJECT: { assume_reference(current_state, RESULT_REGISTER); break; } case IOPCODE_MOVE_RESULT_PSEUDO_WIDE: case OPCODE_MOVE_RESULT_WIDE: { assume_wide_scalar(current_state, RESULT_REGISTER); break; } case OPCODE_MOVE_EXCEPTION: { // We don't know where to grab the type of the just-caught exception. // Simply set to j.l.Throwable here. break; } case OPCODE_RETURN_VOID: { break; } case OPCODE_RETURN: { assume_scalar(current_state, insn->src(0)); break; } case OPCODE_RETURN_WIDE: { assume_wide_scalar(current_state, insn->src(0)); break; } case OPCODE_RETURN_OBJECT: { assume_reference(current_state, insn->src(0)); auto dtype = current_state->get_dex_type(insn->src(0)); auto rtype = m_dex_method->get_proto()->get_rtype(); // If the inferred type is a fallback, there's no point performing the // accurate type assignment checking. if (dtype && !is_inference_fallback_type(*dtype)) { // Return type checking is non-strict: it is allowed to return any // reference type when `rtype` is an interface. if (!check_is_assignable_from(*dtype, rtype, /*strict=*/false)) { std::ostringstream out; out << "Returning " << dtype << ", but expected from declaration " << rtype << std::endl; throw TypeCheckingException(out.str()); } } break; } case OPCODE_CONST: { break; } case OPCODE_CONST_WIDE: { break; } case OPCODE_CONST_STRING: { break; } case OPCODE_CONST_CLASS: { break; } case OPCODE_MONITOR_ENTER: case OPCODE_MONITOR_EXIT: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_CHECK_CAST: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_INSTANCE_OF: case OPCODE_ARRAY_LENGTH: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_NEW_INSTANCE: { break; } case OPCODE_NEW_ARRAY: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_FILLED_NEW_ARRAY: { const DexType* element_type = type::get_array_component_type(insn->get_type()); // We assume that structural constraints on the bytecode are satisfied, // i.e., the type is indeed an array type. always_assert(element_type != nullptr); bool is_array_of_references = type::is_object(element_type); for (size_t i = 0; i < insn->srcs_size(); ++i) { if (is_array_of_references) { assume_reference(current_state, insn->src(i)); } else { assume_scalar(current_state, insn->src(i)); } } break; } case OPCODE_FILL_ARRAY_DATA: { break; } case OPCODE_THROW: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_GOTO: { break; } case OPCODE_SWITCH: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_CMPL_FLOAT: case OPCODE_CMPG_FLOAT: { assume_float(current_state, insn->src(0)); assume_float(current_state, insn->src(1)); break; } case OPCODE_CMPL_DOUBLE: case OPCODE_CMPG_DOUBLE: { assume_double(current_state, insn->src(0)); assume_double(current_state, insn->src(1)); break; } case OPCODE_CMP_LONG: { assume_long(current_state, insn->src(0)); assume_long(current_state, insn->src(1)); break; } case OPCODE_IF_EQ: case OPCODE_IF_NE: { assume_comparable(current_state, insn->src(0), insn->src(1)); break; } case OPCODE_IF_LT: case OPCODE_IF_GE: case OPCODE_IF_GT: case OPCODE_IF_LE: { assume_integer(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_IF_EQZ: case OPCODE_IF_NEZ: { assume_comparable_with_zero(current_state, insn->src(0)); break; } case OPCODE_IF_LTZ: case OPCODE_IF_GEZ: case OPCODE_IF_GTZ: case OPCODE_IF_LEZ: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_AGET: { assume_reference(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_AGET_BOOLEAN: case OPCODE_AGET_BYTE: case OPCODE_AGET_CHAR: case OPCODE_AGET_SHORT: { assume_reference(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_AGET_WIDE: { assume_reference(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_AGET_OBJECT: { assume_reference(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_APUT: { assume_scalar(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); assume_integer(current_state, insn->src(2)); break; } case OPCODE_APUT_BOOLEAN: case OPCODE_APUT_BYTE: case OPCODE_APUT_CHAR: case OPCODE_APUT_SHORT: { assume_integer(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); assume_integer(current_state, insn->src(2)); break; } case OPCODE_APUT_WIDE: { assume_wide_scalar(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); assume_integer(current_state, insn->src(2)); break; } case OPCODE_APUT_OBJECT: { assume_reference(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); assume_integer(current_state, insn->src(2)); break; } case OPCODE_IGET: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_IGET_BOOLEAN: case OPCODE_IGET_BYTE: case OPCODE_IGET_CHAR: case OPCODE_IGET_SHORT: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_IGET_WIDE: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_IGET_OBJECT: { assume_reference(current_state, insn->src(0)); always_assert(insn->has_field()); const auto f_cls = insn->get_field()->get_class(); assume_assignable(current_state->get_dex_type(insn->src(0)), f_cls); break; } case OPCODE_IPUT: { const DexType* type = insn->get_field()->get_type(); if (type::is_float(type)) { assume_float(current_state, insn->src(0)); } else { assume_integer(current_state, insn->src(0)); } assume_reference(current_state, insn->src(1)); break; } case OPCODE_IPUT_BOOLEAN: case OPCODE_IPUT_BYTE: case OPCODE_IPUT_CHAR: case OPCODE_IPUT_SHORT: { assume_integer(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); break; } case OPCODE_IPUT_WIDE: { assume_wide_scalar(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); break; } case OPCODE_IPUT_OBJECT: { assume_reference(current_state, insn->src(0)); assume_reference(current_state, insn->src(1)); always_assert(insn->has_field()); const auto f_type = insn->get_field()->get_type(); assume_assignable(current_state->get_dex_type(insn->src(0)), f_type); const auto f_cls = insn->get_field()->get_class(); assume_assignable(current_state->get_dex_type(insn->src(1)), f_cls); break; } case OPCODE_SGET: { break; } case OPCODE_SGET_BOOLEAN: case OPCODE_SGET_BYTE: case OPCODE_SGET_CHAR: case OPCODE_SGET_SHORT: { break; } case OPCODE_SGET_WIDE: { break; } case OPCODE_SGET_OBJECT: { break; } case OPCODE_SPUT: { const DexType* type = insn->get_field()->get_type(); if (type::is_float(type)) { assume_float(current_state, insn->src(0)); } else { assume_integer(current_state, insn->src(0)); } break; } case OPCODE_SPUT_BOOLEAN: case OPCODE_SPUT_BYTE: case OPCODE_SPUT_CHAR: case OPCODE_SPUT_SHORT: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_SPUT_WIDE: { assume_wide_scalar(current_state, insn->src(0)); break; } case OPCODE_SPUT_OBJECT: { assume_reference(current_state, insn->src(0)); break; } case OPCODE_INVOKE_CUSTOM: case OPCODE_INVOKE_POLYMORPHIC: case OPCODE_INVOKE_VIRTUAL: case OPCODE_INVOKE_SUPER: case OPCODE_INVOKE_DIRECT: case OPCODE_INVOKE_STATIC: case OPCODE_INVOKE_INTERFACE: { DexMethodRef* dex_method = insn->get_method(); const auto& arg_types = dex_method->get_proto()->get_args()->get_type_list(); size_t expected_args = (insn->opcode() != OPCODE_INVOKE_STATIC ? 1 : 0) + arg_types.size(); if (insn->srcs_size() != expected_args) { std::ostringstream out; out << SHOW(insn) << ": argument count mismatch; " << "expected " << expected_args << ", " << "but found " << insn->srcs_size() << " instead"; throw TypeCheckingException(out.str()); } size_t src_idx{0}; if (insn->opcode() != OPCODE_INVOKE_STATIC) { // The first argument is a reference to the object instance on which the // method is invoked. auto src = insn->src(src_idx++); assume_reference(current_state, src); assume_assignable(current_state->get_dex_type(src), dex_method->get_class()); } for (DexType* arg_type : arg_types) { if (type::is_object(arg_type)) { auto src = insn->src(src_idx++); assume_reference(current_state, src); assume_assignable(current_state->get_dex_type(src), arg_type); continue; } if (type::is_integer(arg_type)) { assume_integer(current_state, insn->src(src_idx++)); continue; } if (type::is_long(arg_type)) { assume_long(current_state, insn->src(src_idx++)); continue; } if (type::is_float(arg_type)) { assume_float(current_state, insn->src(src_idx++)); continue; } always_assert(type::is_double(arg_type)); assume_double(current_state, insn->src(src_idx++)); } if (m_validate_access) { auto resolved = resolve_method(dex_method, opcode_to_search(insn), m_dex_method); validate_access(m_dex_method, resolved); } break; } case OPCODE_NEG_INT: case OPCODE_NOT_INT: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_NEG_LONG: case OPCODE_NOT_LONG: { assume_long(current_state, insn->src(0)); break; } case OPCODE_NEG_FLOAT: { assume_float(current_state, insn->src(0)); break; } case OPCODE_NEG_DOUBLE: { assume_double(current_state, insn->src(0)); break; } case OPCODE_INT_TO_BYTE: case OPCODE_INT_TO_CHAR: case OPCODE_INT_TO_SHORT: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_LONG_TO_INT: { assume_long(current_state, insn->src(0)); break; } case OPCODE_FLOAT_TO_INT: { assume_float(current_state, insn->src(0)); break; } case OPCODE_DOUBLE_TO_INT: { assume_double(current_state, insn->src(0)); break; } case OPCODE_INT_TO_LONG: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_FLOAT_TO_LONG: { assume_float(current_state, insn->src(0)); break; } case OPCODE_DOUBLE_TO_LONG: { assume_double(current_state, insn->src(0)); break; } case OPCODE_INT_TO_FLOAT: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_LONG_TO_FLOAT: { assume_long(current_state, insn->src(0)); break; } case OPCODE_DOUBLE_TO_FLOAT: { assume_double(current_state, insn->src(0)); break; } case OPCODE_INT_TO_DOUBLE: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_LONG_TO_DOUBLE: { assume_long(current_state, insn->src(0)); break; } case OPCODE_FLOAT_TO_DOUBLE: { assume_float(current_state, insn->src(0)); break; } case OPCODE_ADD_INT: case OPCODE_SUB_INT: case OPCODE_MUL_INT: case OPCODE_AND_INT: case OPCODE_OR_INT: case OPCODE_XOR_INT: case OPCODE_SHL_INT: case OPCODE_SHR_INT: case OPCODE_USHR_INT: { assume_integer(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_DIV_INT: case OPCODE_REM_INT: { assume_integer(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_ADD_LONG: case OPCODE_SUB_LONG: case OPCODE_MUL_LONG: case OPCODE_AND_LONG: case OPCODE_OR_LONG: case OPCODE_XOR_LONG: { assume_long(current_state, insn->src(0)); assume_long(current_state, insn->src(1)); break; } case OPCODE_DIV_LONG: case OPCODE_REM_LONG: { assume_long(current_state, insn->src(0)); assume_long(current_state, insn->src(1)); break; } case OPCODE_SHL_LONG: case OPCODE_SHR_LONG: case OPCODE_USHR_LONG: { assume_long(current_state, insn->src(0)); assume_integer(current_state, insn->src(1)); break; } case OPCODE_ADD_FLOAT: case OPCODE_SUB_FLOAT: case OPCODE_MUL_FLOAT: case OPCODE_DIV_FLOAT: case OPCODE_REM_FLOAT: { assume_float(current_state, insn->src(0)); assume_float(current_state, insn->src(1)); break; } case OPCODE_ADD_DOUBLE: case OPCODE_SUB_DOUBLE: case OPCODE_MUL_DOUBLE: case OPCODE_DIV_DOUBLE: case OPCODE_REM_DOUBLE: { assume_double(current_state, insn->src(0)); assume_double(current_state, insn->src(1)); break; } case OPCODE_ADD_INT_LIT16: case OPCODE_RSUB_INT: case OPCODE_MUL_INT_LIT16: case OPCODE_AND_INT_LIT16: case OPCODE_OR_INT_LIT16: case OPCODE_XOR_INT_LIT16: case OPCODE_ADD_INT_LIT8: case OPCODE_RSUB_INT_LIT8: case OPCODE_MUL_INT_LIT8: case OPCODE_AND_INT_LIT8: case OPCODE_OR_INT_LIT8: case OPCODE_XOR_INT_LIT8: case OPCODE_SHL_INT_LIT8: case OPCODE_SHR_INT_LIT8: case OPCODE_USHR_INT_LIT8: { assume_integer(current_state, insn->src(0)); break; } case OPCODE_DIV_INT_LIT16: case OPCODE_REM_INT_LIT16: case OPCODE_DIV_INT_LIT8: case OPCODE_REM_INT_LIT8: { assume_integer(current_state, insn->src(0)); break; } } if (insn->has_field() && m_validate_access) { auto search = opcode::is_an_sfield_op(insn->opcode()) ? FieldSearch::Static : FieldSearch::Instance; auto resolved = resolve_field(insn->get_field(), search); validate_access(m_dex_method, resolved); } } IRType IRTypeChecker::get_type(IRInstruction* insn, reg_t reg) const { check_completion(); auto& type_envs = m_type_inference->get_type_environments(); auto it = type_envs.find(insn); if (it == type_envs.end()) { // The instruction doesn't belong to this method. We treat this as // unreachable code and return BOTTOM. return BOTTOM; } return it->second.get_type(reg).element(); } boost::optional<const DexType*> IRTypeChecker::get_dex_type(IRInstruction* insn, reg_t reg) const { check_completion(); auto& type_envs = m_type_inference->get_type_environments(); auto it = type_envs.find(insn); if (it == type_envs.end()) { // The instruction doesn't belong to this method. We treat this as // unreachable code and return BOTTOM. return nullptr; } return it->second.get_dex_type(reg); } std::ostream& operator<<(std::ostream& output, const IRTypeChecker& checker) { checker.m_type_inference->print(output); return output; }
[ "facebook-github-bot@users.noreply.github.com" ]
facebook-github-bot@users.noreply.github.com
7375005514b407d40d56dd71cef2d46c0fdb3bc9
d4d9779e1f476921fbec4b43b115d24bf394f513
/MyProject/Private/BTPatrolPointSelect.cpp
00c172e224ba02e4bffee7da7431431cdcb11b05
[]
no_license
RastBerryHI/UnrealEngineMed-
2a1c604a9ba50f5ce595c0d02aef6247757d38e8
8e092d687606ef402bcd02583aae52f813045784
refs/heads/main
2023-03-03T07:20:09.234775
2021-02-16T19:27:11
2021-02-16T19:27:11
339,506,147
2
0
null
null
null
null
UTF-8
C++
false
false
1,210
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "PatrolPoint.h" #include "AIPatrolController.h" #include "BehaviorTree/BlackboardComponent.h" #include "BTPatrolPointSelect.h" EBTNodeResult::Type UBTPatrolPointSelect::ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) { AAIPatrolController* AAICon = Cast<AAIPatrolController>(OwnerComp.GetAIOwner()); if (AAICon) { /* Get blackboard coponent */ UBlackboardComponent* BlackboardComp = AAICon->GetBlackboardComponent(); APatrolPoint* CurrentPoint = Cast<APatrolPoint>(BlackboardComp->GetValueAsObject("LocationToGo")); TArray<AActor*> AvaliablePatrolPoints = AAICon->GetPatrolPoints(); APatrolPoint* NextPatrolPoint = nullptr; if(AAICon->CurrentPatroPoint != AvaliablePatrolPoints.Num() - 1) { NextPatrolPoint = Cast<APatrolPoint>(AvaliablePatrolPoints[++AAICon->CurrentPatroPoint]); } else // if there no points to go to { NextPatrolPoint = Cast<APatrolPoint>(AvaliablePatrolPoints[0]); AAICon->CurrentPatroPoint = 0; } BlackboardComp->SetValueAsObject("LocationToGo", NextPatrolPoint); return EBTNodeResult::Succeeded; } return EBTNodeResult::Failed; }
[ "musaev.pasha@gmail.com" ]
musaev.pasha@gmail.com
0c2100c10f4494c9a931f302981aeb94a72e6e70
977f76a33d3d7391373178ebdde59a5e4452e523
/Framework/PVRCore/IndexedArray.h
254641f5c5ce1d2d1754b268c305dc1b0de438bf
[ "MIT" ]
permissive
rcdailey/Native_SDK
7562f44d3254f5099c8e466759bae91fe531d50f
dfb214db150f67c59ae24123e46a0f5e5149eaea
refs/heads/master
2020-04-14T21:19:01.847213
2019-05-24T13:55:37
2019-05-24T13:55:37
164,124,382
0
0
null
2019-01-04T15:34:46
2019-01-04T15:34:46
null
UTF-8
C++
false
false
25,896
h
/*!********************************************************************************************************************* \file PVRCore\IndexedArray.h \author PowerVR by Imagination, Developer Technology Team. \copyright Copyright (c) Imagination Technologies Limited. \brief Implementation of a special kind of map that stores the data in a linear, contiguous store (std::vector interface), but additionally contains an Index to them (std::map interface). Supports custom association of names with values, and retrieval of indexes by name or values by index. ***********************************************************************************************************************/ #pragma once #include <vector> #include <map> #include <list> #include <algorithm> namespace pvr { /*!********************************************************************************************************************* \brief A combination of array (std::vector) with associative container (std::map). Supports association of names with values, and retrieval by index. \description An std::vector style array class with the additional feature of associating "names" (IndexType_, std::string by default) with the values stored. Keys are of type IndexType_, correspond to vector position 1:1, so that each vector position ("index") is associated with a "key", and only one key. Use: Add pairs of values with insert(key, value). Retrieve indices by key, using getIndex(key) -- O(logn) Retrieve values by index, using indexing operator [] -- O(1) The remove() function destroys the items on which it was called, but a default-constructed object will still exist. Performing insert() after removing an item will use the place of a previously deleted item, if it exists. CAUTION: If remove() has been called, the vector no longer guarantees contiguousness until compact() is called. CAUTION: To manually reclaim all memory and guarantee contiguous allocation, call compact(). Calling compact invalidates all indexes, which must then be retrieved anew by "getInxdex". Calling getIndex on an unknown key returns (size_t)(-1) Accessing an unknown item by index is undefined. Accessing an index not retrieved by getIndex since the last compact() operation is undefined. ***********************************************************************************************************************/ template<typename ValueType_, typename IndexType_ = std::string> class IndexedArray { private: struct DictionaryEntry { ValueType_ value; IndexType_ key; DictionaryEntry() {} DictionaryEntry(const IndexType_& key, const ValueType_& value) : key(key), value(value) { } }; struct StorageItem_ : DictionaryEntry { bool isUnused; StorageItem_() {} StorageItem_(const IndexType_& key, const ValueType_& value) : DictionaryEntry(key, value), isUnused(false) { } }; typedef std::vector<StorageItem_> vectortype_; typedef typename std::map<IndexType_, size_t> maptype_; typedef std::list<size_t> deleteditemlisttype_; vectortype_ mystorage; maptype_ myindex; deleteditemlisttype_ myDeletedItems; public: /*!********************************************************************************************************************* \brief An (modifiable) Linear iterator of the IndexedArray class. Will linearly iterate the backing store skipping empy spots. Unordered. ***********************************************************************************************************************/ class iterator { friend class IndexedArray<ValueType_, IndexType_>; class const_iterator; StorageItem_* start; size_t current; size_t size; // required for out-of-bounds checks when skipping empty... iterator(StorageItem_* start, size_t size, size_t current = 0) : start(start), current(current), size(size){ } public: iterator(const const_iterator& rhs) : start(rhs.start), size(rhs.size), current(rhs.current){ } /*! \brief operator * \return Return this */ DictionaryEntry& operator*() { return *(start + current); } /*! \brief operator -> \return Return this */ DictionaryEntry* operator->(){ return (start + current); } /*! \brief Get current index */ size_t getItemIndex() { return current; } /*! \brief operator ++ \return */ iterator& operator++() { while ((start + (++current))->isUnused && current != size) {} //skip empty values return *this; } /*! \brief operator ++ \return */ iterator operator++(int) { iterator ret = *this; while ((start + (++current))->isUnused && current != size) {} //skip empty values ++(*this); return ret; } /*! \brief operator -- \return */ iterator& operator--() { while ((start + (--current))->isUnused && current != static_cast<size_t>(-1)) {} //CAREFUL! this is a size_t, which means it WILL eventually overflow. return *this; } /*! \brief operator -- \return */ iterator operator--(int) { iterator ret = *this; --(*this); return ret; } /*! \brief operator != \param rhs \return */ bool operator!=(const iterator& rhs) { return this->current != rhs.current; } /*! \brief operator == \param rhs \return */ bool operator==(const iterator& rhs) { return !((*this) != rhs); } }; /*!********************************************************************************************************************* \brief An (constant) Linear iterator of the IndexedArray class. Will linearly iterate the backing store skipping empy spots. Unordered. ***********************************************************************************************************************/ class const_iterator { friend class IndexedArray<ValueType_, IndexType_>; const StorageItem_* start; size_t current; size_t size; // required for out-of-bounds checks when skipping empty... const_iterator(const StorageItem_* start, size_t size, size_t current = 0) : start(start), size(size), current(current) { } public: const DictionaryEntry& operator*() { return *(start + current); } const DictionaryEntry* operator->() { return (start + current); } size_t getItemIndex() { return current; } const_iterator& operator++() { while (++current < size && (start + current)->isUnused) {} //skip empty values return *this; } const_iterator operator++(int) { const_iterator ret = *this; ++(*this); return ret; } const_iterator& operator--() { while (--current != static_cast<size_t>(-1) && (start + current)->isUnused) {} //CAREFUL! this is a size_t, which means it WILL eventually overflow. return *this; } const_iterator operator--(int) { iterator ret = *this; --(*this); return ret; } bool operator!=(const const_iterator& rhs) { return this->current != rhs.current; } bool operator==(const const_iterator& rhs) { return !((*this) != rhs); } }; /*!********************************************************************************************************************* \brief An Indexed iterator of the IndexedArray class. Will follow the indexing map of the IndexedArray iterating items in their Indexing order. ***********************************************************************************************************************/ typedef typename maptype_::iterator index_iterator; /*!********************************************************************************************************************* \brief An Indexed (Constant) iterator of the IndexedArray class. Will follow the indexing map of the IndexedArray iterating items in their Indexing order. ***********************************************************************************************************************/ typedef typename maptype_::const_iterator const_index_iterator; /*!********************************************************************************************************************* \brief Return a Linear iterator to the first non-deleted item in the backing store. ***********************************************************************************************************************/ iterator begin() { if (!mystorage.empty()) { iterator ret(&mystorage.front(), mystorage.size()); while ((ret.start + ret.current)->isUnused && (ret.current != ret.size)) { ++ret.current; } //skip empty values return ret; } else { return iterator(NULL, 0); } } /*!********************************************************************************************************************* \brief Return a Linear const_iterator to the first non-deleted item in the backing store. ***********************************************************************************************************************/ const_iterator begin() const { if (!mystorage.empty()) { const_iterator ret(&mystorage.front(), mystorage.size()); while ((ret.start + ret.current)->isUnused && ret.current != ret.size) { ++ret.current; } //skip empty values return ret; } else { return const_iterator(NULL, 0); } } /*!********************************************************************************************************************* \brief Return an indexed_iterator by finding the provided key Indexing map. ***********************************************************************************************************************/ typename maptype_::iterator indexed_find(const IndexType_& key) { return myindex.find(key); } /*!********************************************************************************************************************* \brief Return an indexed_iterator by finding the provided key Indexing map. ***********************************************************************************************************************/ typename maptype_::const_iterator indexed_find(const IndexType_& key)const { return myindex.find(key); } /*!********************************************************************************************************************* \brief Return an indexed_const_iterator to the first item in the map. ***********************************************************************************************************************/ typename maptype_::iterator indexed_begin() { return myindex.begin(); } /*!********************************************************************************************************************* \brief Return a indexed_const_iterator to the first item in the map. ***********************************************************************************************************************/ typename maptype_::const_iterator indexed_begin() const { return myindex.begin(); } /*!********************************************************************************************************************* \brief Return an indexed_iterator pointing one item past the last item in the map. ***********************************************************************************************************************/ typename maptype_::iterator indexed_end() { return myindex.begin(); } /*!********************************************************************************************************************* \brief Return an indexed_const_iterator pointing one item past the last item in the map. ***********************************************************************************************************************/ typename maptype_::const_iterator indexed_end() const { return myindex.end(); } /*!********************************************************************************************************************* \brief Return an iterator pointing one item past the last item in the backing array. ***********************************************************************************************************************/ iterator end() { return mystorage.empty() ? iterator(NULL, 0) : iterator(&mystorage.front(), mystorage.size(), mystorage.size()); } /*!********************************************************************************************************************* \brief Return a const_iterator pointing one item past the last item in the backing array. ***********************************************************************************************************************/ const_iterator end() const { return mystorage.empty() ? const_iterator(NULL, 0) : const_iterator(&mystorage.front(), mystorage.size(), mystorage.size()); } /*!********************************************************************************************************************* \brief Insert an item at a specific point in the backing array. \param where The index where to insert the new item \param key The Key of the new item \param val The Value of the new item ***********************************************************************************************************************/ void insertAt(size_t where, const IndexType_& key, const ValueType_ & val) { if (insert(key, val) != where) { relocate(key, where); } } /*!********************************************************************************************************************* \brief Insert an item at the first possible spot in the backing array. \param key The Key of the new item \param val The Value of the new item ***********************************************************************************************************************/ size_t insert(const IndexType_& key, const ValueType_ & val) { std::pair<typename maptype_::iterator, bool> found = myindex.insert(std::make_pair(key, 0)); if (!found.second) // Element already existed! { mystorage[found.first->second].value = val; } else { found.first->second = insertinvector(key, val); } return found.first->second; } /*!********************************************************************************************************************* \brief Get the index of a specific key in the backing array. Valid until a reshuffling of the array is done via insert, compact or similar operation. ***********************************************************************************************************************/ size_t getIndex(const IndexType_& key) const { typename maptype_::const_iterator found = myindex.find(key); if (found != myindex.end()) // Element already existed! { return found->second; } return static_cast<size_t>(-1);// == static_cast<size_t>(-1) } /*!********************************************************************************************************************* \brief Removes the item with the specified key from the IndexedArray. \description This method will find the entry with specified key and remove it. It will not invalidata existing indices, but it will voids the contiguousness guarantee the backing array normally has. Call compact() afterwards to make the vector contiguous again (but invalidate existing indices). ***********************************************************************************************************************/ void erase(const IndexType_& key) { typename maptype_::iterator where = myindex.find(key); if (where != myindex.end()) { removefromvector(where->second); myindex.erase(where); //SPECIAL CASE: If no more items are left, there is absolutely no point in NOT compacting, as no iterators or indices exist to be invalidated, so we can clean up //even though "deferred" was asked. Additionally, this is essentially free, except maybe for the list... if (myindex.empty()) { mystorage.clear(); myDeletedItems.clear(); } } } /*!********************************************************************************************************************* \brief Array indexing operator. Use getIndex to get the indexes of specific items. If idx points to a deleted item or past the last item, the behaviour is undefined. ***********************************************************************************************************************/ ValueType_& operator[](size_t idx) { return mystorage[idx].value; } /*!********************************************************************************************************************* \brief Const array indexing operator. Use getIndex to get the indexes of specific items. If idx points to a deleted item or past the last item, the behaviour is undefined. ***********************************************************************************************************************/ const ValueType_& operator[](size_t idx)const { return mystorage[idx].value; } /*!********************************************************************************************************************* \brief Indexed indexing operator. Uses std::map binary search to find and retrieve the specified value. If the key does not exist, behaviour is undefined. ***********************************************************************************************************************/ ValueType_& operator[](const IndexType_& key) { return mystorage[myindex.find(key)->second].value; } /*!********************************************************************************************************************* \brief Const Indexed indexing operator. Uses std::map binary search to find and retrieve the specified value. If the key does not exist, behaviour is undefined. ***********************************************************************************************************************/ const ValueType_& operator[](const IndexType_& key)const { return mystorage[myindex.find(key)->second].value; } /*!********************************************************************************************************************* \brief Compacts the backing array by removing existing items from the end of the vector and putting them in the place of deleted items, and then updating their index, until no more positions marked as deleted are left. Will ensure the contiguousness of the backing vector, but will invalidate previously gotten item indexes. ***********************************************************************************************************************/ void compact() { //We can do that because the last remove() tears down all datastructures used. if (!myindex.size()) { return; } //First, make sure there is something to compact... deleteditemlisttype_::iterator unused_spot = myDeletedItems.begin(); while (myDeletedItems.size() && unused_spot != myDeletedItems.end()) { //Last item in the storage vector. size_t last = mystorage.size(); //1) Trim the end of the vector... while (last-- && mystorage[last].isUnused) { mystorage.pop_back(); //Rinse, repeat. If size is zero, there is nothing to do. } //Either the storage is empty if (mystorage.empty()) { myDeletedItems.clear(); //the rest should already be cleared... //the loop will exit naturally } else //Or we can have find its last item! { //2)Trim any items from the end of the unused spots list that may have been trimmed off by the vector... while (unused_spot != myDeletedItems.end() && *unused_spot >= last) { myDeletedItems.erase(unused_spot++); } //Any spots left? if (unused_spot != myDeletedItems.end()) { //Do the actual data movement. After all we've been through, we know that //i. The last item of the vector is a valid item (guaranteed by 1) //ii. The unused spot is not out of bounds of the vector //iii. //Copy by hand(as we have not defined a move assignment operator for compatibility reasons. //Also, since the string does not throw, this makes easier to reason about exceptions. #ifdef PVR_SUPPORT_MOVE_SEMANTICS mystorage[*unused_spot].value = std::move(mystorage[last].value); mystorage[*unused_spot].key = std::move(mystorage[last].key); #else mystorage[*unused_spot].value = mystorage[last].value; mystorage[last].value.ValueType_::~ValueType_(); new(&mystorage[last].value) ValueType_(); mystorage[*unused_spot].key = mystorage[last].key; mystorage[last].key.clear(); #endif mystorage[*unused_spot].isUnused = false; myindex[mystorage[*unused_spot].key] = *unused_spot; mystorage.pop_back(); myDeletedItems.erase(unused_spot++); }//else : No action needed - unused spots has been trimmed off completely, so no movement is possible, or necessary... } } } /*!********************************************************************************************************************* \brief Empties the IndexedArray. ***********************************************************************************************************************/ void clear() { myindex.clear(); mystorage.clear(); myDeletedItems.clear(); } /*!********************************************************************************************************************* \brief Gets the number of items in the IndexedArray. \return The number of items in the IndexedArray. ***********************************************************************************************************************/ size_t size() const { return myindex.size(); } /*!********************************************************************************************************************* \brief Gets the number of items in the IndexedArray, including items that have been deleted. \return The number of items in the IndexedArray, including items that have been deleted. ***********************************************************************************************************************/ size_t sizeWithDeleted() const { return mystorage.size(); } /*!********************************************************************************************************************* \brief Gets the current capacity of the backing array of the IndexedArray. \return The current capacity of the backing array of the IndexedArray. ***********************************************************************************************************************/ size_t capacity() const { return mystorage.size(); } /*!********************************************************************************************************************* \brief Gets the number of deleted items. \return The number of deleted items. ***********************************************************************************************************************/ size_t deletedItemsCount() const { return myDeletedItems.size(); } /*!********************************************************************************************************************* \brief Move a specific item (identified by a key) to a specific index in the list. If an item is already in this spot in the list, their positions are swapped. \return False if the specified key was not found in the index. ***********************************************************************************************************************/ bool relocate(const IndexType_& key, size_t index) { typename maptype_::iterator found = myindex.find(key); if (found == myindex.end()) { return false; } size_t old_index = myindex[key]; if (index == old_index) { return true; } //No-op if (index + 1 > mystorage.size()) // Storage not big enough. { //Grow, and mark unused all required items. Need to add all spots (But the last) to unusedspots. size_t oldsize = mystorage.size(); mystorage.resize(index + 1); for (size_t i = oldsize; i < index; ++i) { myDeletedItems.push_front(i); mystorage[i].isUnused = 1; } mystorage.back() = mystorage[old_index]; removefromvector(old_index); } else if (mystorage[index].isUnused) // Lucky! Storage is big enough, and the item is not used! { deleteditemlisttype_::iterator place = std::find(myDeletedItems.begin(), myDeletedItems.end(), index); assert(place != myDeletedItems.end()); // Shouldn't happen! Ever! myDeletedItems.erase(place); mystorage[index] = mystorage[old_index]; removefromvector(old_index); } else // Whoops! Space is already occupied. Swap with the old item! { myindex[mystorage[index].key] = old_index; std::swap(mystorage[index], mystorage[old_index]); } myindex[key] = index; return true; } private: size_t insertinvector(const IndexType_& key, const ValueType_ & val) { size_t retval; if (myDeletedItems.empty()) { retval = mystorage.size(); mystorage.push_back(StorageItem_()); mystorage.back().isUnused = false; mystorage.back().key = key; mystorage.back().value = val; } else { retval = myDeletedItems.back(); myDeletedItems.pop_back(); mystorage[retval].value = val; mystorage[retval].key = key; mystorage[retval].isUnused = false; } return retval; } void removefromvector(size_t index) { if (index == (mystorage.size() - 1)) { //Removing the last item from the vector -- just pop it. mystorage.pop_back(); } else { //NOT the last item, so we just destruct it (to free any potential expensive resources), //and then default-construct it (to have the spot destructible). We keep the reference to //the key as we will need it. myDeletedItems.push_front(index); mystorage[index].isUnused = true; mystorage[index].value.ValueType_::~ValueType_(); new(&mystorage[index].value) ValueType_; } } }; }
[ "rcdailey@gmail.com" ]
rcdailey@gmail.com
f23fe929ab9afd2445c5be61c572093dcc4cd6f2
f1d0ea36f07c2ef126dec93208bd025aa78eceb7
/Zen/plugins/ZPhysX/src/PhysicsJoint.cpp
2ff3e009f79047de8ac25ff78fcc328352501291
[]
no_license
SgtFlame/indiezen
b7d6f87143b2f33abf977095755b6af77e9e7dab
5513d5a05dc1425591ab7b9ba1b16d11b6a74354
refs/heads/master
2020-05-17T23:57:21.063997
2016-09-05T15:28:28
2016-09-05T15:28:28
33,279,102
3
0
null
null
null
null
UTF-8
C++
false
false
2,548
cpp
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ // IndieZen Game Engine Framework // // Copyright (C) 2001 - 2007 Tony Richards // Copyright (C) 2008 Walt Collins // // 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. // // Tony Richards trichards@indiezen.com // Walt Collins (Arcanor) - wcollins@indiezen.com //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ #include "PhysicsJoint.hpp" #include <Zen/Engine/Physics/I_PhysicsWorld.hpp> #include <Zen/Engine/Physics/I_PhysicsShape.hpp> #include <Zen/Core/Math/Vector3.hpp> //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ namespace Zen { namespace ZPhysX { //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ PhysicsJoint::PhysicsJoint(wpPhysicsZone_type _zone) : m_pZone(_zone) { } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ PhysicsJoint::~PhysicsJoint() { } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void PhysicsJoint::attachShape(PhysicsJoint::pCollisionShape_type _shape) { m_pShape = _shape; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void PhysicsJoint::initUpVectorJoint(const Math::Vector3& _upVector) { NewtonConstraintCreateUpVector((NewtonWorld*)m_pZone->getZonePtr(), _upVector.m_array, (NewtonBody*)m_pShape->getBodyPtr()); } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ } // namespace ZNewton } // namespace Zen //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
[ "mgray@wintermute" ]
mgray@wintermute
6e4db4db9ed7a6d11a6a78c20538e226ca22af35
9b553bbfc8b0807d7f860964d6044d6ccf6d1342
/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2.cpp
e98217a9ef441491e249f7cef91f778e5df53fa6
[]
no_license
DedoGamingONE/tp
5e2e668f7120b154cf6ef6b002c2b4b51ae07ee5
5020395dfd34d4dc846e3ea228f6271bfca1c72a
refs/heads/master
2023-09-03T06:55:25.773029
2021-10-24T21:35:00
2021-10-24T21:35:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,273
cpp
// // Generated By: dol2asm // Translation Unit: d_a_obj_tornado2 // #include "rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2.h" #include "dol2asm.h" #include "dolphin/types.h" // // Types: // struct csXyz {}; struct cXyz { /* 80266EF4 */ void normalize(); /* 802670AC */ void isZero() const; static f32 Zero[3]; }; struct mDoMtx_stack_c { /* 8000CD64 */ void transS(cXyz const&); /* 8000CF44 */ void ZXYrotM(csXyz const&); static u8 now[48]; }; struct fopAc_ac_c { /* 80018B64 */ fopAc_ac_c(); }; struct daObjTrnd2_c { /* 80D1C4D8 */ void setPntWind(); /* 80D1C54C */ void cutPntWind(); /* 80D1C570 */ void movePntWind(); /* 80D1C780 */ void setCpsInfo(); /* 80D1C924 */ void initBaseMtx(); /* 80D1C944 */ void setBaseMtx(); /* 80D1C98C */ void Create(); /* 80D1CC80 */ void create(); /* 80D1CDC0 */ void execute(); /* 80D1D0AC */ void setParticle(); /* 80D1D214 */ void endParticle(); /* 80D1D278 */ void startParticle(); /* 80D1D2AC */ void stopParticle(); /* 80D1D2E0 */ bool draw(); /* 80D1D2E8 */ void _delete(); }; struct dSv_info_c { /* 80035360 */ void isSwitch(int, int) const; }; struct dPa_levelEcallBack {}; struct dKy_tevstr_c {}; struct _GXColor {}; struct dPa_control_c { /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, cXyz const*, f32); }; struct dCcD_Stts { /* 80083860 */ void Init(int, int, fopAc_ac_c*); }; struct dCcD_SrcCps {}; struct dCcD_GStts { /* 80083760 */ dCcD_GStts(); }; struct dCcD_GObjInf { /* 80083A28 */ dCcD_GObjInf(); }; struct dCcD_Cps { /* 800847D0 */ void Set(dCcD_SrcCps const&); }; struct cM3dGCpsS {}; struct cM3dGCps { /* 8026EF88 */ cM3dGCps(); /* 8026F03C */ void Set(cM3dGCpsS const&); }; struct cM3dGAab { /* 80D1CD78 */ ~cM3dGAab(); }; struct cCcD_Obj {}; struct cCcS { /* 80264BA8 */ void Set(cCcD_Obj*); }; struct WIND_INFLUENCE {}; // // Forward References: // extern "C" void setPntWind__12daObjTrnd2_cFv(); extern "C" void cutPntWind__12daObjTrnd2_cFv(); extern "C" void movePntWind__12daObjTrnd2_cFv(); extern "C" void setCpsInfo__12daObjTrnd2_cFv(); extern "C" void initBaseMtx__12daObjTrnd2_cFv(); extern "C" void setBaseMtx__12daObjTrnd2_cFv(); extern "C" void Create__12daObjTrnd2_cFv(); extern "C" void create__12daObjTrnd2_cFv(); extern "C" void __dt__8cM3dGAabFv(); extern "C" void execute__12daObjTrnd2_cFv(); extern "C" void setParticle__12daObjTrnd2_cFv(); extern "C" void endParticle__12daObjTrnd2_cFv(); extern "C" void startParticle__12daObjTrnd2_cFv(); extern "C" void stopParticle__12daObjTrnd2_cFv(); extern "C" bool draw__12daObjTrnd2_cFv(); extern "C" void _delete__12daObjTrnd2_cFv(); extern "C" static void daObjTrnd2_Draw__FP12daObjTrnd2_c(); extern "C" static void daObjTrnd2_Execute__FP12daObjTrnd2_c(); extern "C" static void daObjTrnd2_Delete__FP12daObjTrnd2_c(); extern "C" static void daObjTrnd2_Create__FP12daObjTrnd2_c(); extern "C" void func_80D1D3B0(void* _this, s32*); // // External References: // extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); extern "C" void __ct__10fopAc_ac_cFv(); extern "C" void fopAcM_setCullSizeBox__FP10fopAc_ac_cffffff(); extern "C" void isSwitch__10dSv_info_cCFii(); extern "C" void set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); extern "C" void dKyw_pntwind_set__FP14WIND_INFLUENCE(); extern "C" void dKyw_pntwind_cut__FP14WIND_INFLUENCE(); extern "C" void dKyw_custom_windpower__Ff(); extern "C" void dKyw_evt_wind_set__Fss(); extern "C" void dKyr_get_vectle_calc__FP4cXyzP4cXyzP4cXyz(); extern "C" void __ct__10dCcD_GSttsFv(); extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); extern "C" void __ct__12dCcD_GObjInfFv(); extern "C" void Set__8dCcD_CpsFRC11dCcD_SrcCps(); extern "C" void Set__4cCcSFP8cCcD_Obj(); extern "C" void normalize__4cXyzFv(); extern "C" void isZero__4cXyzCFv(); extern "C" void cM_rndF__Ff(); extern "C" void __ct__8cM3dGCpsFv(); extern "C" void Set__8cM3dGCpsFRC9cM3dGCpsS(); extern "C" void cLib_addCalc__FPfffff(); extern "C" void cLib_chaseF__FPfff(); extern "C" void __dl__FPv(); extern "C" void PSMTXCopy(); extern "C" void PSMTXMultVec(); extern "C" void PSVECScale(); extern "C" void PSVECSquareDistance(); extern "C" void _savegpr_26(); extern "C" void _savegpr_28(); extern "C" void _savegpr_29(); extern "C" void _restgpr_26(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); extern "C" extern void* g_fopAc_Method[8]; extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__8dCcD_Cps[36]; extern "C" extern void* __vt__9dCcD_Stts[11]; extern "C" extern void* __vt__12cCcD_CpsAttr[25]; extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" u8 now__14mDoMtx_stack_c[48]; extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" extern u8 g_env_light[4880]; extern "C" f32 Zero__4cXyz[3]; extern "C" extern u32 __float_nan; // // Declarations: // /* ############################################################################################## */ /* 80D1D3D4-80D1D3DC 000000 0006+02 6/6 0/0 0/0 .rodata l_R02_eff_id */ SECTION_RODATA static u8 const l_R02_eff_id[6 + 2 /* padding */] = { 0x8B, 0x5E, 0x8B, 0x5F, 0xFF, 0xFF, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3D4, &l_R02_eff_id); /* 80D1D3DC-80D1D3E4 000008 0006+02 0/1 0/0 0/0 .rodata l_R04_eff_id */ #pragma push #pragma force_active on SECTION_RODATA static u8 const l_R04_eff_id[6 + 2 /* padding */] = { 0x8B, 0x60, 0x8B, 0x61, 0xFF, 0xFF, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3DC, &l_R04_eff_id); #pragma pop /* 80D1D3E4-80D1D3EC 000010 0006+02 0/1 0/0 0/0 .rodata l_R05_eff_id */ #pragma push #pragma force_active on SECTION_RODATA static u8 const l_R05_eff_id[6 + 2 /* padding */] = { 0x8B, 0x6B, 0x8B, 0x6C, 0xFF, 0xFF, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3E4, &l_R05_eff_id); #pragma pop /* 80D1D3EC-80D1D3F4 000018 0006+02 0/1 0/0 0/0 .rodata l_R07_eff_id */ #pragma push #pragma force_active on SECTION_RODATA static u8 const l_R07_eff_id[6 + 2 /* padding */] = { 0x8B, 0x6D, 0x8B, 0x6E, 0xFF, 0xFF, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3EC, &l_R07_eff_id); #pragma pop /* 80D1D3F4-80D1D3FC 000020 0006+02 0/1 0/0 0/0 .rodata l_R14_eff_id */ #pragma push #pragma force_active on SECTION_RODATA static u8 const l_R14_eff_id[6 + 2 /* padding */] = { 0x8B, 0x66, 0x8B, 0x67, 0x8B, 0x68, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3F4, &l_R14_eff_id); #pragma pop /* 80D1D3FC-80D1D404 000028 0006+02 0/1 0/0 0/0 .rodata l_R51_eff_id */ #pragma push #pragma force_active on SECTION_RODATA static u8 const l_R51_eff_id[6 + 2 /* padding */] = { 0x8B, 0x69, 0x8B, 0x6A, 0xFF, 0xFF, /* padding */ 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D3FC, &l_R51_eff_id); #pragma pop /* 80D1D404-80D1D408 000030 0004+00 0/5 0/0 0/0 .rodata @3631 */ #pragma push #pragma force_active on SECTION_RODATA static u8 const lit_3631[4] = { 0x00, 0x00, 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D404, &lit_3631); #pragma pop /* 80D1D408-80D1D40C 000034 0004+00 0/3 0/0 0/0 .rodata @3632 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3632 = 1.0f; COMPILER_STRIP_GATE(0x80D1D408, &lit_3632); #pragma pop /* 80D1D40C-80D1D410 000038 0004+00 0/2 0/0 0/0 .rodata @3633 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3633 = 1.0f / 5.0f; COMPILER_STRIP_GATE(0x80D1D40C, &lit_3633); #pragma pop /* 80D1C4D8-80D1C54C 000078 0074+00 1/1 0/0 0/0 .text setPntWind__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::setPntWind() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/setPntWind__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1C54C-80D1C570 0000EC 0024+00 1/1 0/0 0/0 .text cutPntWind__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::cutPntWind() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/cutPntWind__12daObjTrnd2_cFv.s" } #pragma pop /* ############################################################################################## */ /* 80D1D410-80D1D414 00003C 0004+00 0/1 0/0 0/0 .rodata @3681 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3681 = 2.0f; COMPILER_STRIP_GATE(0x80D1D410, &lit_3681); #pragma pop /* 80D1D414-80D1D418 000040 0004+00 0/2 0/0 0/0 .rodata @3682 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3682 = 1.0f / 10.0f; COMPILER_STRIP_GATE(0x80D1D414, &lit_3682); #pragma pop /* 80D1D418-80D1D41C 000044 0004+00 0/3 0/0 0/0 .rodata @3683 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3683 = 0.5f; COMPILER_STRIP_GATE(0x80D1D418, &lit_3683); #pragma pop /* 80D1D41C-80D1D424 000048 0008+00 0/1 0/0 0/0 .rodata @3684 */ #pragma push #pragma force_active on SECTION_RODATA static u8 const lit_3684[8] = { 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D41C, &lit_3684); #pragma pop /* 80D1D424-80D1D42C 000050 0008+00 0/1 0/0 0/0 .rodata @3685 */ #pragma push #pragma force_active on SECTION_RODATA static u8 const lit_3685[8] = { 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D424, &lit_3685); #pragma pop /* 80D1D42C-80D1D434 000058 0008+00 0/1 0/0 0/0 .rodata @3686 */ #pragma push #pragma force_active on SECTION_RODATA static u8 const lit_3686[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D42C, &lit_3686); #pragma pop /* 80D1C570-80D1C780 000110 0210+00 1/1 0/0 0/0 .text movePntWind__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::movePntWind() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/movePntWind__12daObjTrnd2_cFv.s" } #pragma pop /* ############################################################################################## */ /* 80D1D434-80D1D438 000060 0004+00 0/1 0/0 0/0 .rodata @3730 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3730 = 1.0f / 20.0f; COMPILER_STRIP_GATE(0x80D1D434, &lit_3730); #pragma pop /* 80D1D438-80D1D43C 000064 0004+00 0/2 0/0 0/0 .rodata @3731 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3731 = 10.0f; COMPILER_STRIP_GATE(0x80D1D438, &lit_3731); #pragma pop /* 80D1D43C-80D1D444 000068 0008+00 0/1 0/0 0/0 .rodata @3733 */ #pragma push #pragma force_active on SECTION_RODATA static u8 const lit_3733[8] = { 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; COMPILER_STRIP_GATE(0x80D1D43C, &lit_3733); #pragma pop /* 80D1C780-80D1C924 000320 01A4+00 1/1 0/0 0/0 .text setCpsInfo__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::setCpsInfo() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/setCpsInfo__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1C924-80D1C944 0004C4 0020+00 1/1 0/0 0/0 .text initBaseMtx__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::initBaseMtx() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/initBaseMtx__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1C944-80D1C98C 0004E4 0048+00 2/2 0/0 0/0 .text setBaseMtx__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::setBaseMtx() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/setBaseMtx__12daObjTrnd2_cFv.s" } #pragma pop /* ############################################################################################## */ /* 80D1D444-80D1D448 000070 0004+00 0/1 0/0 0/0 .rodata @3819 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3819 = 150.0f; COMPILER_STRIP_GATE(0x80D1D444, &lit_3819); #pragma pop /* 80D1D448-80D1D44C 000074 0004+00 0/1 0/0 0/0 .rodata @3820 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_3820 = 1000.0f; COMPILER_STRIP_GATE(0x80D1D448, &lit_3820); #pragma pop /* 80D1D458-80D1D4A4 000000 004C+00 1/1 0/0 0/0 .data l_cps_src */ SECTION_DATA static u8 l_cps_src[76] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x3B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x16, 0x00, 0x00, }; /* 80D1C98C-80D1CC80 00052C 02F4+00 1/1 0/0 0/0 .text Create__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::Create() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/Create__12daObjTrnd2_cFv.s" } #pragma pop /* ############################################################################################## */ /* 80D1D4A4-80D1D4C4 -00001 0020+00 1/0 0/0 0/0 .data l_daObjTrnd2_Method */ SECTION_DATA static void* l_daObjTrnd2_Method[8] = { (void*)daObjTrnd2_Create__FP12daObjTrnd2_c, (void*)daObjTrnd2_Delete__FP12daObjTrnd2_c, (void*)daObjTrnd2_Execute__FP12daObjTrnd2_c, (void*)NULL, (void*)daObjTrnd2_Draw__FP12daObjTrnd2_c, (void*)NULL, (void*)NULL, (void*)NULL, }; /* 80D1D4C4-80D1D4F4 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_Tornado2 */ SECTION_DATA extern void* g_profile_Obj_Tornado2[12] = { (void*)0xFFFFFFFD, (void*)0x0007FFFD, (void*)0x015C0000, (void*)&g_fpcLf_Method, (void*)0x00000788, (void*)NULL, (void*)NULL, (void*)&g_fopAc_Method, (void*)0x01BD0000, (void*)&l_daObjTrnd2_Method, (void*)0x00040000, (void*)0x000E0000, }; /* 80D1D4F4-80D1D500 00009C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ SECTION_DATA extern void* __vt__8cM3dGAab[3] = { (void*)NULL /* RTTI */, (void*)NULL, (void*)__dt__8cM3dGAabFv, }; /* 80D1CC80-80D1CD78 000820 00F8+00 1/1 0/0 0/0 .text create__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::create() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/func_80D1CC80.s" } #pragma pop /* 80D1CD78-80D1CDC0 000918 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm cM3dGAab::~cM3dGAab() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/__dt__8cM3dGAabFv.s" } #pragma pop /* ############################################################################################## */ /* 80D1D44C-80D1D450 000078 0004+00 0/1 0/0 0/0 .rodata @4012 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_4012 = 3.0f / 10.0f; COMPILER_STRIP_GATE(0x80D1D44C, &lit_4012); #pragma pop /* 80D1D450-80D1D454 00007C 0004+00 0/1 0/0 0/0 .rodata @4013 */ #pragma push #pragma force_active on SECTION_RODATA static u32 const lit_4013 = 0x3A83126F; COMPILER_STRIP_GATE(0x80D1D450, &lit_4013); #pragma pop /* 80D1D454-80D1D458 000080 0004+00 0/1 0/0 0/0 .rodata @4014 */ #pragma push #pragma force_active on SECTION_RODATA static f32 const lit_4014 = 9.0f / 10.0f; COMPILER_STRIP_GATE(0x80D1D454, &lit_4014); #pragma pop /* 80D1CDC0-80D1D0AC 000960 02EC+00 1/1 0/0 0/0 .text execute__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::execute() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/execute__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D0AC-80D1D214 000C4C 0168+00 1/1 0/0 0/0 .text setParticle__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::setParticle() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/setParticle__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D214-80D1D278 000DB4 0064+00 1/1 0/0 0/0 .text endParticle__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::endParticle() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/endParticle__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D278-80D1D2AC 000E18 0034+00 2/2 0/0 0/0 .text startParticle__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::startParticle() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/startParticle__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D2AC-80D1D2E0 000E4C 0034+00 2/2 0/0 0/0 .text stopParticle__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::stopParticle() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/stopParticle__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D2E0-80D1D2E8 000E80 0008+00 1/1 0/0 0/0 .text draw__12daObjTrnd2_cFv */ bool daObjTrnd2_c::draw() { return true; } /* 80D1D2E8-80D1D330 000E88 0048+00 1/1 0/0 0/0 .text _delete__12daObjTrnd2_cFv */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off asm void daObjTrnd2_c::_delete() { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/_delete__12daObjTrnd2_cFv.s" } #pragma pop /* 80D1D330-80D1D350 000ED0 0020+00 1/0 0/0 0/0 .text daObjTrnd2_Draw__FP12daObjTrnd2_c */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off static asm void daObjTrnd2_Draw(daObjTrnd2_c* param_0) { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/daObjTrnd2_Draw__FP12daObjTrnd2_c.s" } #pragma pop /* 80D1D350-80D1D370 000EF0 0020+00 1/0 0/0 0/0 .text daObjTrnd2_Execute__FP12daObjTrnd2_c */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off static asm void daObjTrnd2_Execute(daObjTrnd2_c* param_0) { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/daObjTrnd2_Execute__FP12daObjTrnd2_c.s" } #pragma pop /* 80D1D370-80D1D390 000F10 0020+00 1/0 0/0 0/0 .text daObjTrnd2_Delete__FP12daObjTrnd2_c */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off static asm void daObjTrnd2_Delete(daObjTrnd2_c* param_0) { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/daObjTrnd2_Delete__FP12daObjTrnd2_c.s" } #pragma pop /* 80D1D390-80D1D3B0 000F30 0020+00 1/0 0/0 0/0 .text daObjTrnd2_Create__FP12daObjTrnd2_c */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off static asm void daObjTrnd2_Create(daObjTrnd2_c* param_0) { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/daObjTrnd2_Create__FP12daObjTrnd2_c.s" } #pragma pop /* 80D1D3B0-80D1D3CC 000F50 001C+00 1/1 0/0 0/0 .text cLib_calcTimer<l>__FPl */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off extern "C" asm void func_80D1D3B0(void* _this, s32* param_0) { nofralloc #include "asm/rel/d/a/obj/d_a_obj_tornado2/d_a_obj_tornado2/func_80D1D3B0.s" } #pragma pop
[ "" ]
bb031d21dc9208ae30b921b636039a30ff3937fe
88c0e520e2389e676fea559f944109e1ee7e157b
/include/Windows.Graphics.Display.1_4bc8ceb3.h
d904161cf29b02455127dc360dba71b8437cdbd2
[]
no_license
jchoi2022/NtFuzz-HeaderData
fb4ecbd5399f4fac6a4982a0fb516dd7f9368118
6adc3d339e6cac072cde6cfef07eccafbc6b204c
refs/heads/main
2023-08-03T02:26:10.666986
2021-09-17T13:35:26
2021-09-17T13:35:26
407,547,359
4
0
null
null
null
null
UTF-8
C++
false
false
4,022
h
#include "winrt/impl/Windows.Storage.Streams.0.h" #include "winrt/impl/Windows.Graphics.Display.0.h" WINRT_EXPORT namespace winrt::Windows::Graphics::Display { struct WINRT_EBO IAdvancedColorInfo : Windows::Foundation::IInspectable, impl::consume_t<IAdvancedColorInfo> { IAdvancedColorInfo(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IBrightnessOverride : Windows::Foundation::IInspectable, impl::consume_t<IBrightnessOverride> { IBrightnessOverride(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IBrightnessOverrideSettings : Windows::Foundation::IInspectable, impl::consume_t<IBrightnessOverrideSettings> { IBrightnessOverrideSettings(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IBrightnessOverrideSettingsStatics : Windows::Foundation::IInspectable, impl::consume_t<IBrightnessOverrideSettingsStatics> { IBrightnessOverrideSettingsStatics(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IBrightnessOverrideStatics : Windows::Foundation::IInspectable, impl::consume_t<IBrightnessOverrideStatics> { IBrightnessOverrideStatics(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IColorOverrideSettings : Windows::Foundation::IInspectable, impl::consume_t<IColorOverrideSettings> { IColorOverrideSettings(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IColorOverrideSettingsStatics : Windows::Foundation::IInspectable, impl::consume_t<IColorOverrideSettingsStatics> { IColorOverrideSettingsStatics(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayEnhancementOverride : Windows::Foundation::IInspectable, impl::consume_t<IDisplayEnhancementOverride> { IDisplayEnhancementOverride(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayEnhancementOverrideCapabilities : Windows::Foundation::IInspectable, impl::consume_t<IDisplayEnhancementOverrideCapabilities> { IDisplayEnhancementOverrideCapabilities(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayEnhancementOverrideCapabilitiesChangedEventArgs : Windows::Foundation::IInspectable, impl::consume_t<IDisplayEnhancementOverrideCapabilitiesChangedEventArgs> { IDisplayEnhancementOverrideCapabilitiesChangedEventArgs(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayEnhancementOverrideStatics : Windows::Foundation::IInspectable, impl::consume_t<IDisplayEnhancementOverrideStatics> { IDisplayEnhancementOverrideStatics(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformation : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformation> { IDisplayInformation(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformation2 : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformation2>, impl::require<IDisplayInformation2, Windows::Graphics::Display::IDisplayInformation> { IDisplayInformation2(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformation3 : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformation3> { IDisplayInformation3(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformation4 : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformation4> { IDisplayInformation4(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformation5 : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformation5> { IDisplayInformation5(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayInformationStatics : Windows::Foundation::IInspectable, impl::consume_t<IDisplayInformationStatics> { IDisplayInformationStatics(std::nullptr_t = nullptr) noexcept {} }; struct WINRT_EBO IDisplayPropertiesStatics : Windows::Foundation::IInspectable, impl::consume_t<IDisplayPropertiesStatics> { IDisplayPropertiesStatics(std::nullptr_t = nullptr) noexcept {} }; }
[ "jschoi.2022@gmail.com" ]
jschoi.2022@gmail.com
805e8a909b218318e739125f88945a86dd0f509b
428a92cfce93ab163180586b3cce7dd126034141
/src/modul_3/Actions/BadContent.h
892cc7146efced2f56ceebf9408f769e0caf2b95
[]
no_license
FilosGabriel/Conti_Project
26750771eb1f21709d710a71de081b20f7ee2b9a
2d5f682779d5a42951d15c2aab3f25c66ff6bfa6
refs/heads/master
2020-07-23T10:06:18.616275
2019-09-10T09:54:24
2019-09-10T09:54:24
207,523,068
0
0
null
null
null
null
UTF-8
C++
false
false
348
h
// // Created by root on 8/5/19. // #ifndef IDPS_NEW_BLOCKIP_H #define IDPS_NEW_BLOCKIP_H #include <search.h> #include "Actions.h" namespace idps{ class BadContent: public Action { public: void launch(std::string &details) override ; explicit BadContent(const Notify *notify1); }; } #endif //IDPS_NEW_BLOCKIP_H
[ "noreply@github.com" ]
FilosGabriel.noreply@github.com
476a45e1d395f41d9e2910c042a0b5694c452777
382efc4bb390811b3317652097f80b5def9a963d
/src/rpc/blockchain.cpp
d8d6783b484b5c933dd81c00e71f234cc0df7ec9
[ "MIT" ]
permissive
maniacoin/maniacoin
dcfc3ea77afdcaa73bcf82e5eefc1b92f81f0de8
cfc0ee57ddff4e05d363298725c91727c6d27ddf
refs/heads/master
2023-02-28T11:16:05.730596
2021-02-04T20:20:51
2021-02-04T20:20:51
335,065,954
0
0
null
null
null
null
UTF-8
C++
false
false
68,175
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "rpc/blockchain.h" #include "amount.h" #include "chain.h" #include "chainparams.h" #include "checkpoints.h" #include "coins.h" #include "consensus/validation.h" #include "validation.h" #include "core_io.h" #include "policy/feerate.h" #include "policy/policy.h" #include "primitives/transaction.h" #include "rpc/server.h" #include "streams.h" #include "sync.h" #include "txdb.h" #include "txmempool.h" #include "util.h" #include "utilstrencodings.h" #include "hash.h" #include <stdint.h> #include <univalue.h> #include <boost/thread/thread.hpp> // boost::thread::interrupt #include <mutex> #include <condition_variable> struct CUpdatedBlock { uint256 hash; int height; }; static std::mutex cs_blockchange; static std::condition_variable cond_blockchange; static CUpdatedBlock latestblock; extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry); double GetDifficulty(const CBlockIndex* blockindex) { if (blockindex == nullptr) { if (chainActive.Tip() == nullptr) return 1.0; else blockindex = chainActive.Tip(); } int nShift = (blockindex->nBits >> 24) & 0xff; double dDiff = (double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff); while (nShift < 29) { dDiff *= 256.0; nShift++; } while (nShift > 29) { dDiff /= 256.0; nShift--; } return dDiff; } UniValue blockheaderToJSON(const CBlockIndex* blockindex) { UniValue result(UniValue::VOBJ); result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex())); int confirmations = -1; // Only report confirmations if the block is on the main chain if (chainActive.Contains(blockindex)) confirmations = chainActive.Height() - blockindex->nHeight + 1; result.push_back(Pair("confirmations", confirmations)); result.push_back(Pair("height", blockindex->nHeight)); result.push_back(Pair("version", blockindex->nVersion)); result.push_back(Pair("versionHex", strprintf("%08x", blockindex->nVersion))); result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex())); result.push_back(Pair("time", (int64_t)blockindex->nTime)); result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast())); result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce)); result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); CBlockIndex *pnext = chainActive.Next(blockindex); if (pnext) result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex())); return result; } UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails) { UniValue result(UniValue::VOBJ); result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex())); int confirmations = -1; // Only report confirmations if the block is on the main chain if (chainActive.Contains(blockindex)) confirmations = chainActive.Height() - blockindex->nHeight + 1; result.push_back(Pair("confirmations", confirmations)); result.push_back(Pair("strippedsize", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS))); result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION))); result.push_back(Pair("weight", (int)::GetBlockWeight(block))); result.push_back(Pair("height", blockindex->nHeight)); result.push_back(Pair("version", block.nVersion)); result.push_back(Pair("versionHex", strprintf("%08x", block.nVersion))); result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex())); UniValue txs(UniValue::VARR); for(const auto& tx : block.vtx) { if(txDetails) { UniValue objTx(UniValue::VOBJ); TxToUniv(*tx, uint256(), objTx, true, RPCSerializationFlags()); txs.push_back(objTx); } else txs.push_back(tx->GetHash().GetHex()); } result.push_back(Pair("tx", txs)); result.push_back(Pair("time", block.GetBlockTime())); result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast())); result.push_back(Pair("nonce", (uint64_t)block.nNonce)); result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); CBlockIndex *pnext = chainActive.Next(blockindex); if (pnext) result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex())); return result; } UniValue getblockcount(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getblockcount\n" "\nReturns the number of blocks in the longest blockchain.\n" "\nResult:\n" "n (numeric) The current block count\n" "\nExamples:\n" + HelpExampleCli("getblockcount", "") + HelpExampleRpc("getblockcount", "") ); LOCK(cs_main); return chainActive.Height(); } UniValue getbestblockhash(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getbestblockhash\n" "\nReturns the hash of the best (tip) block in the longest blockchain.\n" "\nResult:\n" "\"hex\" (string) the block hash hex encoded\n" "\nExamples:\n" + HelpExampleCli("getbestblockhash", "") + HelpExampleRpc("getbestblockhash", "") ); LOCK(cs_main); return chainActive.Tip()->GetBlockHash().GetHex(); } void RPCNotifyBlockChange(bool ibd, const CBlockIndex * pindex) { if(pindex) { std::lock_guard<std::mutex> lock(cs_blockchange); latestblock.hash = pindex->GetBlockHash(); latestblock.height = pindex->nHeight; } cond_blockchange.notify_all(); } UniValue waitfornewblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "waitfornewblock (timeout)\n" "\nWaits for a specific new block and returns useful info about it.\n" "\nReturns the current block on timeout or exit.\n" "\nArguments:\n" "1. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "\nResult:\n" "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" " \"height\" : { (int) Block height\n" "}\n" "\nExamples:\n" + HelpExampleCli("waitfornewblock", "1000") + HelpExampleRpc("waitfornewblock", "1000") ); int timeout = 0; if (!request.params[0].isNull()) timeout = request.params[0].get_int(); CUpdatedBlock block; { std::unique_lock<std::mutex> lock(cs_blockchange); block = latestblock; if(timeout) cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); }); else cond_blockchange.wait(lock, [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); }); block = latestblock; } UniValue ret(UniValue::VOBJ); ret.push_back(Pair("hash", block.hash.GetHex())); ret.push_back(Pair("height", block.height)); return ret; } UniValue waitforblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "waitforblock <blockhash> (timeout)\n" "\nWaits for a specific new block and returns useful info about it.\n" "\nReturns the current block on timeout or exit.\n" "\nArguments:\n" "1. \"blockhash\" (required, string) Block hash to wait for.\n" "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "\nResult:\n" "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" " \"height\" : { (int) Block height\n" "}\n" "\nExamples:\n" + HelpExampleCli("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000") + HelpExampleRpc("waitforblock", "\"0000000000079f8ef3d2c688c244eb7a4570b24c9ed7b4a8c619eb02596f8862\", 1000") ); int timeout = 0; uint256 hash = uint256S(request.params[0].get_str()); if (!request.params[1].isNull()) timeout = request.params[1].get_int(); CUpdatedBlock block; { std::unique_lock<std::mutex> lock(cs_blockchange); if(timeout) cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&hash]{return latestblock.hash == hash || !IsRPCRunning();}); else cond_blockchange.wait(lock, [&hash]{return latestblock.hash == hash || !IsRPCRunning(); }); block = latestblock; } UniValue ret(UniValue::VOBJ); ret.push_back(Pair("hash", block.hash.GetHex())); ret.push_back(Pair("height", block.height)); return ret; } UniValue waitforblockheight(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "waitforblockheight <height> (timeout)\n" "\nWaits for (at least) block height and returns the height and hash\n" "of the current tip.\n" "\nReturns the current block on timeout or exit.\n" "\nArguments:\n" "1. height (required, int) Block height to wait for (int)\n" "2. timeout (int, optional, default=0) Time in milliseconds to wait for a response. 0 indicates no timeout.\n" "\nResult:\n" "{ (json object)\n" " \"hash\" : { (string) The blockhash\n" " \"height\" : { (int) Block height\n" "}\n" "\nExamples:\n" + HelpExampleCli("waitforblockheight", "\"100\", 1000") + HelpExampleRpc("waitforblockheight", "\"100\", 1000") ); int timeout = 0; int height = request.params[0].get_int(); if (!request.params[1].isNull()) timeout = request.params[1].get_int(); CUpdatedBlock block; { std::unique_lock<std::mutex> lock(cs_blockchange); if(timeout) cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&height]{return latestblock.height >= height || !IsRPCRunning();}); else cond_blockchange.wait(lock, [&height]{return latestblock.height >= height || !IsRPCRunning(); }); block = latestblock; } UniValue ret(UniValue::VOBJ); ret.push_back(Pair("hash", block.hash.GetHex())); ret.push_back(Pair("height", block.height)); return ret; } UniValue getdifficulty(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getdifficulty\n" "\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nResult:\n" "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n" "\nExamples:\n" + HelpExampleCli("getdifficulty", "") + HelpExampleRpc("getdifficulty", "") ); LOCK(cs_main); return GetDifficulty(); } std::string EntryDescriptionString() { return " \"size\" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.\n" " \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n" " \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority\n" " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n" " \"height\" : n, (numeric) block height when transaction entered pool\n" " \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n" " \"descendantsize\" : n, (numeric) virtual transaction size of in-mempool descendants (including this one)\n" " \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n" " \"ancestorcount\" : n, (numeric) number of in-mempool ancestor transactions (including this one)\n" " \"ancestorsize\" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one)\n" " \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n" " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n" " \"transactionid\", (string) parent transaction id\n" " ... ]\n"; } void entryToJSON(UniValue &info, const CTxMemPoolEntry &e) { AssertLockHeld(mempool.cs); info.push_back(Pair("size", (int)e.GetTxSize())); info.push_back(Pair("fee", ValueFromAmount(e.GetFee()))); info.push_back(Pair("modifiedfee", ValueFromAmount(e.GetModifiedFee()))); info.push_back(Pair("time", e.GetTime())); info.push_back(Pair("height", (int)e.GetHeight())); info.push_back(Pair("descendantcount", e.GetCountWithDescendants())); info.push_back(Pair("descendantsize", e.GetSizeWithDescendants())); info.push_back(Pair("descendantfees", e.GetModFeesWithDescendants())); info.push_back(Pair("ancestorcount", e.GetCountWithAncestors())); info.push_back(Pair("ancestorsize", e.GetSizeWithAncestors())); info.push_back(Pair("ancestorfees", e.GetModFeesWithAncestors())); const CTransaction& tx = e.GetTx(); std::set<std::string> setDepends; for (const CTxIn& txin : tx.vin) { if (mempool.exists(txin.prevout.hash)) setDepends.insert(txin.prevout.hash.ToString()); } UniValue depends(UniValue::VARR); for (const std::string& dep : setDepends) { depends.push_back(dep); } info.push_back(Pair("depends", depends)); } UniValue mempoolToJSON(bool fVerbose) { if (fVerbose) { LOCK(mempool.cs); UniValue o(UniValue::VOBJ); for (const CTxMemPoolEntry& e : mempool.mapTx) { const uint256& hash = e.GetTx().GetHash(); UniValue info(UniValue::VOBJ); entryToJSON(info, e); o.push_back(Pair(hash.ToString(), info)); } return o; } else { std::vector<uint256> vtxid; mempool.queryHashes(vtxid); UniValue a(UniValue::VARR); for (const uint256& hash : vtxid) a.push_back(hash.ToString()); return a; } } UniValue getrawmempool(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() > 1) throw std::runtime_error( "getrawmempool ( verbose )\n" "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n" "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n" "\nArguments:\n" "1. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "\nResult: (for verbose = false):\n" "[ (json array of string)\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" "]\n" "\nResult: (for verbose = true):\n" "{ (json object)\n" " \"transactionid\" : { (json object)\n" + EntryDescriptionString() + " }, ...\n" "}\n" "\nExamples:\n" + HelpExampleCli("getrawmempool", "true") + HelpExampleRpc("getrawmempool", "true") ); bool fVerbose = false; if (!request.params[0].isNull()) fVerbose = request.params[0].get_bool(); return mempoolToJSON(fVerbose); } UniValue getmempoolancestors(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { throw std::runtime_error( "getmempoolancestors txid (verbose)\n" "\nIf txid is in the mempool, returns all in-mempool ancestors.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "\nResult (for verbose=false):\n" "[ (json array of strings)\n" " \"transactionid\" (string) The transaction id of an in-mempool ancestor transaction\n" " ,...\n" "]\n" "\nResult (for verbose=true):\n" "{ (json object)\n" " \"transactionid\" : { (json object)\n" + EntryDescriptionString() + " }, ...\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolancestors", "\"mytxid\"") + HelpExampleRpc("getmempoolancestors", "\"mytxid\"") ); } bool fVerbose = false; if (!request.params[1].isNull()) fVerbose = request.params[1].get_bool(); uint256 hash = ParseHashV(request.params[0], "parameter 1"); LOCK(mempool.cs); CTxMemPool::txiter it = mempool.mapTx.find(hash); if (it == mempool.mapTx.end()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool"); } CTxMemPool::setEntries setAncestors; uint64_t noLimit = std::numeric_limits<uint64_t>::max(); std::string dummy; mempool.CalculateMemPoolAncestors(*it, setAncestors, noLimit, noLimit, noLimit, noLimit, dummy, false); if (!fVerbose) { UniValue o(UniValue::VARR); for (CTxMemPool::txiter ancestorIt : setAncestors) { o.push_back(ancestorIt->GetTx().GetHash().ToString()); } return o; } else { UniValue o(UniValue::VOBJ); for (CTxMemPool::txiter ancestorIt : setAncestors) { const CTxMemPoolEntry &e = *ancestorIt; const uint256& _hash = e.GetTx().GetHash(); UniValue info(UniValue::VOBJ); entryToJSON(info, e); o.push_back(Pair(_hash.ToString(), info)); } return o; } } UniValue getmempooldescendants(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) { throw std::runtime_error( "getmempooldescendants txid (verbose)\n" "\nIf txid is in the mempool, returns all in-mempool descendants.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "2. verbose (boolean, optional, default=false) True for a json object, false for array of transaction ids\n" "\nResult (for verbose=false):\n" "[ (json array of strings)\n" " \"transactionid\" (string) The transaction id of an in-mempool descendant transaction\n" " ,...\n" "]\n" "\nResult (for verbose=true):\n" "{ (json object)\n" " \"transactionid\" : { (json object)\n" + EntryDescriptionString() + " }, ...\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempooldescendants", "\"mytxid\"") + HelpExampleRpc("getmempooldescendants", "\"mytxid\"") ); } bool fVerbose = false; if (!request.params[1].isNull()) fVerbose = request.params[1].get_bool(); uint256 hash = ParseHashV(request.params[0], "parameter 1"); LOCK(mempool.cs); CTxMemPool::txiter it = mempool.mapTx.find(hash); if (it == mempool.mapTx.end()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool"); } CTxMemPool::setEntries setDescendants; mempool.CalculateDescendants(it, setDescendants); // CTxMemPool::CalculateDescendants will include the given tx setDescendants.erase(it); if (!fVerbose) { UniValue o(UniValue::VARR); for (CTxMemPool::txiter descendantIt : setDescendants) { o.push_back(descendantIt->GetTx().GetHash().ToString()); } return o; } else { UniValue o(UniValue::VOBJ); for (CTxMemPool::txiter descendantIt : setDescendants) { const CTxMemPoolEntry &e = *descendantIt; const uint256& _hash = e.GetTx().GetHash(); UniValue info(UniValue::VOBJ); entryToJSON(info, e); o.push_back(Pair(_hash.ToString(), info)); } return o; } } UniValue getmempoolentry(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) { throw std::runtime_error( "getmempoolentry txid\n" "\nReturns mempool data for given transaction\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id (must be in mempool)\n" "\nResult:\n" "{ (json object)\n" + EntryDescriptionString() + "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolentry", "\"mytxid\"") + HelpExampleRpc("getmempoolentry", "\"mytxid\"") ); } uint256 hash = ParseHashV(request.params[0], "parameter 1"); LOCK(mempool.cs); CTxMemPool::txiter it = mempool.mapTx.find(hash); if (it == mempool.mapTx.end()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool"); } const CTxMemPoolEntry &e = *it; UniValue info(UniValue::VOBJ); entryToJSON(info, e); return info; } UniValue getblockhash(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "getblockhash height\n" "\nReturns hash of block in best-block-chain at height provided.\n" "\nArguments:\n" "1. height (numeric, required) The height index\n" "\nResult:\n" "\"hash\" (string) The block hash\n" "\nExamples:\n" + HelpExampleCli("getblockhash", "1000") + HelpExampleRpc("getblockhash", "1000") ); LOCK(cs_main); int nHeight = request.params[0].get_int(); if (nHeight < 0 || nHeight > chainActive.Height()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); CBlockIndex* pblockindex = chainActive[nHeight]; return pblockindex->GetBlockHash().GetHex(); } UniValue getblockheader(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "getblockheader \"hash\" ( verbose )\n" "\nIf verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.\n" "If verbose is true, returns an Object with information about blockheader <hash>.\n" "\nArguments:\n" "1. \"hash\" (string, required) The block hash\n" "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n" "\nResult (for verbose = true):\n" "{\n" " \"hash\" : \"hash\", (string) the block hash (same as provided)\n" " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n" " \"height\" : n, (numeric) The block height or index\n" " \"version\" : n, (numeric) The block version\n" " \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"nonce\" : n, (numeric) The nonce\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"difficulty\" : x.xxx, (numeric) The difficulty\n" " \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"nextblockhash\" : \"hash\", (string) The hash of the next block\n" "}\n" "\nResult (for verbose=false):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" "\nExamples:\n" + HelpExampleCli("getblockheader", "\"e2acdf2dd19a702e5d12a925f1e984b01e47a933562ca893656d4afb38b44ee3\"") + HelpExampleRpc("getblockheader", "\"e2acdf2dd19a702e5d12a925f1e984b01e47a933562ca893656d4afb38b44ee3\"") ); LOCK(cs_main); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); bool fVerbose = true; if (!request.params[1].isNull()) fVerbose = request.params[1].get_bool(); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; if (!fVerbose) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION); ssBlock << pblockindex->GetBlockHeader(); std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockheaderToJSON(pblockindex); } UniValue getblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) throw std::runtime_error( "getblock \"blockhash\" ( verbosity ) \n" "\nIf verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.\n" "If verbosity is 1, returns an Object with information about block <hash>.\n" "If verbosity is 2, returns an Object with information about block <hash> and information about each transaction. \n" "\nArguments:\n" "1. \"blockhash\" (string, required) The block hash\n" "2. verbosity (numeric, optional, default=1) 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data\n" "\nResult (for verbosity = 0):\n" "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n" "\nResult (for verbosity = 1):\n" "{\n" " \"hash\" : \"hash\", (string) the block hash (same as provided)\n" " \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n" " \"size\" : n, (numeric) The block size\n" " \"strippedsize\" : n, (numeric) The block size excluding witness data\n" " \"weight\" : n (numeric) The block weight as defined in BIP 141\n" " \"height\" : n, (numeric) The block height or index\n" " \"version\" : n, (numeric) The block version\n" " \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n" " \"merkleroot\" : \"xxxx\", (string) The merkle root\n" " \"tx\" : [ (array of string) The transaction ids\n" " \"transactionid\" (string) The transaction id\n" " ,...\n" " ],\n" " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n" " \"nonce\" : n, (numeric) The nonce\n" " \"bits\" : \"1d00ffff\", (string) The bits\n" " \"difficulty\" : x.xxx, (numeric) The difficulty\n" " \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n" " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n" " \"nextblockhash\" : \"hash\" (string) The hash of the next block\n" "}\n" "\nResult (for verbosity = 2):\n" "{\n" " ..., Same output as verbosity = 1.\n" " \"tx\" : [ (array of Objects) The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 \"tx\" result.\n" " ,...\n" " ],\n" " ,... Same output as verbosity = 1.\n" "}\n" "\nExamples:\n" + HelpExampleCli("getblock", "\"e2acdf2dd19a702e5d12a925f1e984b01e47a933562ca893656d4afb38b44ee3\"") + HelpExampleRpc("getblock", "\"e2acdf2dd19a702e5d12a925f1e984b01e47a933562ca893656d4afb38b44ee3\"") ); LOCK(cs_main); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); int verbosity = 1; if (!request.params[1].isNull()) { if(request.params[1].isNum()) verbosity = request.params[1].get_int(); else verbosity = request.params[1].get_bool() ? 1 : 0; } if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlock block; CBlockIndex* pblockindex = mapBlockIndex[hash]; if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0) throw JSONRPCError(RPC_MISC_ERROR, "Block not available (pruned data)"); if (!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus())) // Block not found on disk. This could be because we have the block // header in our index but don't have the block (for example if a // non-whitelisted node sends us an unrequested long chain of valid // blocks, we add the headers to our index, but don't accept the // block). throw JSONRPCError(RPC_MISC_ERROR, "Block not found on disk"); if (verbosity <= 0) { CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); ssBlock << block; std::string strHex = HexStr(ssBlock.begin(), ssBlock.end()); return strHex; } return blockToJSON(block, pblockindex, verbosity >= 2); } struct CCoinsStats { int nHeight; uint256 hashBlock; uint64_t nTransactions; uint64_t nTransactionOutputs; uint64_t nBogoSize; uint256 hashSerialized; uint64_t nDiskSize; CAmount nTotalAmount; CCoinsStats() : nHeight(0), nTransactions(0), nTransactionOutputs(0), nBogoSize(0), nDiskSize(0), nTotalAmount(0) {} }; static void ApplyStats(CCoinsStats &stats, CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs) { assert(!outputs.empty()); ss << hash; ss << VARINT(outputs.begin()->second.nHeight * 2 + outputs.begin()->second.fCoinBase); stats.nTransactions++; for (const auto output : outputs) { ss << VARINT(output.first + 1); ss << output.second.out.scriptPubKey; ss << VARINT(output.second.out.nValue); stats.nTransactionOutputs++; stats.nTotalAmount += output.second.out.nValue; stats.nBogoSize += 32 /* txid */ + 4 /* vout index */ + 4 /* height + coinbase */ + 8 /* amount */ + 2 /* scriptPubKey len */ + output.second.out.scriptPubKey.size() /* scriptPubKey */; } ss << VARINT(0); } //! Calculate statistics about the unspent transaction output set static bool GetUTXOStats(CCoinsView *view, CCoinsStats &stats) { std::unique_ptr<CCoinsViewCursor> pcursor(view->Cursor()); CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION); stats.hashBlock = pcursor->GetBestBlock(); { LOCK(cs_main); stats.nHeight = mapBlockIndex.find(stats.hashBlock)->second->nHeight; } ss << stats.hashBlock; uint256 prevkey; std::map<uint32_t, Coin> outputs; while (pcursor->Valid()) { boost::this_thread::interruption_point(); COutPoint key; Coin coin; if (pcursor->GetKey(key) && pcursor->GetValue(coin)) { if (!outputs.empty() && key.hash != prevkey) { ApplyStats(stats, ss, prevkey, outputs); outputs.clear(); } prevkey = key.hash; outputs[key.n] = std::move(coin); } else { return error("%s: unable to read value", __func__); } pcursor->Next(); } if (!outputs.empty()) { ApplyStats(stats, ss, prevkey, outputs); } stats.hashSerialized = ss.GetHash(); stats.nDiskSize = view->EstimateSize(); return true; } UniValue pruneblockchain(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "pruneblockchain\n" "\nArguments:\n" "1. \"height\" (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp\n" " to prune blocks whose block time is at least 2 hours older than the provided timestamp.\n" "\nResult:\n" "n (numeric) Height of the last block pruned.\n" "\nExamples:\n" + HelpExampleCli("pruneblockchain", "1000") + HelpExampleRpc("pruneblockchain", "1000")); if (!fPruneMode) throw JSONRPCError(RPC_MISC_ERROR, "Cannot prune blocks because node is not in prune mode."); LOCK(cs_main); int heightParam = request.params[0].get_int(); if (heightParam < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative block height."); // Height value more than a billion is too high to be a block height, and // too low to be a block time (corresponds to timestamp from Sep 2001). if (heightParam > 1000000000) { // Add a 2 hour buffer to include blocks which might have had old timestamps CBlockIndex* pindex = chainActive.FindEarliestAtLeast(heightParam - TIMESTAMP_WINDOW); if (!pindex) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find block with at least the specified timestamp."); } heightParam = pindex->nHeight; } unsigned int height = (unsigned int) heightParam; unsigned int chainHeight = (unsigned int) chainActive.Height(); if (chainHeight < Params().PruneAfterHeight()) throw JSONRPCError(RPC_MISC_ERROR, "Blockchain is too short for pruning."); else if (height > chainHeight) throw JSONRPCError(RPC_INVALID_PARAMETER, "Blockchain is shorter than the attempted prune height."); else if (height > chainHeight - MIN_BLOCKS_TO_KEEP) { LogPrint(BCLog::RPC, "Attempt to prune blocks close to the tip. Retaining the minimum number of blocks."); height = chainHeight - MIN_BLOCKS_TO_KEEP; } PruneBlockFilesManual(height); return uint64_t(height); } UniValue gettxoutsetinfo(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "gettxoutsetinfo\n" "\nReturns statistics about the unspent transaction output set.\n" "Note this call may take some time.\n" "\nResult:\n" "{\n" " \"height\":n, (numeric) The current block height (index)\n" " \"bestblock\": \"hex\", (string) the best block hash hex\n" " \"transactions\": n, (numeric) The number of transactions\n" " \"txouts\": n, (numeric) The number of output transactions\n" " \"bogosize\": n, (numeric) A meaningless metric for UTXO set size\n" " \"hash_serialized_2\": \"hash\", (string) The serialized hash\n" " \"disk_size\": n, (numeric) The estimated size of the chainstate on disk\n" " \"total_amount\": x.xxx (numeric) The total amount\n" "}\n" "\nExamples:\n" + HelpExampleCli("gettxoutsetinfo", "") + HelpExampleRpc("gettxoutsetinfo", "") ); UniValue ret(UniValue::VOBJ); CCoinsStats stats; FlushStateToDisk(); if (GetUTXOStats(pcoinsdbview, stats)) { ret.push_back(Pair("height", (int64_t)stats.nHeight)); ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); ret.push_back(Pair("transactions", (int64_t)stats.nTransactions)); ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs)); ret.push_back(Pair("bogosize", (int64_t)stats.nBogoSize)); ret.push_back(Pair("hash_serialized_2", stats.hashSerialized.GetHex())); ret.push_back(Pair("disk_size", stats.nDiskSize)); ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount))); } else { throw JSONRPCError(RPC_INTERNAL_ERROR, "Unable to read UTXO set"); } return ret; } UniValue gettxout(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 2 || request.params.size() > 3) throw std::runtime_error( "gettxout \"txid\" n ( include_mempool )\n" "\nReturns details about an unspent transaction output.\n" "\nArguments:\n" "1. \"txid\" (string, required) The transaction id\n" "2. \"n\" (numeric, required) vout number\n" "3. \"include_mempool\" (boolean, optional) Whether to include the mempool. Default: true." " Note that an unspent output that is spent in the mempool won't appear.\n" "\nResult:\n" "{\n" " \"bestblock\" : \"hash\", (string) the block hash\n" " \"confirmations\" : n, (numeric) The number of confirmations\n" " \"value\" : x.xxx, (numeric) The transaction value in " + CURRENCY_UNIT + "\n" " \"scriptPubKey\" : { (json object)\n" " \"asm\" : \"code\", (string) \n" " \"hex\" : \"hex\", (string) \n" " \"reqSigs\" : n, (numeric) Number of required signatures\n" " \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n" " \"addresses\" : [ (array of string) array of maniacoin addresses\n" " \"address\" (string) maniacoin address\n" " ,...\n" " ]\n" " },\n" " \"coinbase\" : true|false (boolean) Coinbase or not\n" "}\n" "\nExamples:\n" "\nGet unspent transactions\n" + HelpExampleCli("listunspent", "") + "\nView the details\n" + HelpExampleCli("gettxout", "\"txid\" 1") + "\nAs a json rpc call\n" + HelpExampleRpc("gettxout", "\"txid\", 1") ); LOCK(cs_main); UniValue ret(UniValue::VOBJ); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); int n = request.params[1].get_int(); COutPoint out(hash, n); bool fMempool = true; if (!request.params[2].isNull()) fMempool = request.params[2].get_bool(); Coin coin; if (fMempool) { LOCK(mempool.cs); CCoinsViewMemPool view(pcoinsTip, mempool); if (!view.GetCoin(out, coin) || mempool.isSpent(out)) { return NullUniValue; } } else { if (!pcoinsTip->GetCoin(out, coin)) { return NullUniValue; } } BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CBlockIndex *pindex = it->second; ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex())); if (coin.nHeight == MEMPOOL_HEIGHT) { ret.push_back(Pair("confirmations", 0)); } else { ret.push_back(Pair("confirmations", (int64_t)(pindex->nHeight - coin.nHeight + 1))); } ret.push_back(Pair("value", ValueFromAmount(coin.out.nValue))); UniValue o(UniValue::VOBJ); ScriptPubKeyToUniv(coin.out.scriptPubKey, o, true); ret.push_back(Pair("scriptPubKey", o)); ret.push_back(Pair("coinbase", (bool)coin.fCoinBase)); return ret; } UniValue verifychain(const JSONRPCRequest& request) { int nCheckLevel = gArgs.GetArg("-checklevel", DEFAULT_CHECKLEVEL); int nCheckDepth = gArgs.GetArg("-checkblocks", DEFAULT_CHECKBLOCKS); if (request.fHelp || request.params.size() > 2) throw std::runtime_error( "verifychain ( checklevel nblocks )\n" "\nVerifies blockchain database.\n" "\nArguments:\n" "1. checklevel (numeric, optional, 0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is.\n" "2. nblocks (numeric, optional, default=" + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check.\n" "\nResult:\n" "true|false (boolean) Verified or not\n" "\nExamples:\n" + HelpExampleCli("verifychain", "") + HelpExampleRpc("verifychain", "") ); LOCK(cs_main); if (!request.params[0].isNull()) nCheckLevel = request.params[0].get_int(); if (!request.params[1].isNull()) nCheckDepth = request.params[1].get_int(); return CVerifyDB().VerifyDB(Params(), pcoinsTip, nCheckLevel, nCheckDepth); } /** Implementation of IsSuperMajority with better feedback */ static UniValue SoftForkMajorityDesc(int version, CBlockIndex* pindex, const Consensus::Params& consensusParams) { UniValue rv(UniValue::VOBJ); bool activated = false; switch(version) { case 2: activated = pindex->nHeight >= consensusParams.BIP34Height; break; case 3: activated = pindex->nHeight >= consensusParams.BIP66Height; break; case 4: activated = pindex->nHeight >= consensusParams.BIP65Height; break; } rv.push_back(Pair("status", activated)); return rv; } static UniValue SoftForkDesc(const std::string &name, int version, CBlockIndex* pindex, const Consensus::Params& consensusParams) { UniValue rv(UniValue::VOBJ); rv.push_back(Pair("id", name)); rv.push_back(Pair("version", version)); rv.push_back(Pair("reject", SoftForkMajorityDesc(version, pindex, consensusParams))); return rv; } static UniValue BIP9SoftForkDesc(const Consensus::Params& consensusParams, Consensus::DeploymentPos id) { UniValue rv(UniValue::VOBJ); const ThresholdState thresholdState = VersionBitsTipState(consensusParams, id); switch (thresholdState) { case THRESHOLD_DEFINED: rv.push_back(Pair("status", "defined")); break; case THRESHOLD_STARTED: rv.push_back(Pair("status", "started")); break; case THRESHOLD_LOCKED_IN: rv.push_back(Pair("status", "locked_in")); break; case THRESHOLD_ACTIVE: rv.push_back(Pair("status", "active")); break; case THRESHOLD_FAILED: rv.push_back(Pair("status", "failed")); break; } if (THRESHOLD_STARTED == thresholdState) { rv.push_back(Pair("bit", consensusParams.vDeployments[id].bit)); } rv.push_back(Pair("startTime", consensusParams.vDeployments[id].nStartTime)); rv.push_back(Pair("timeout", consensusParams.vDeployments[id].nTimeout)); rv.push_back(Pair("since", VersionBitsTipStateSinceHeight(consensusParams, id))); if (THRESHOLD_STARTED == thresholdState) { UniValue statsUV(UniValue::VOBJ); BIP9Stats statsStruct = VersionBitsTipStatistics(consensusParams, id); statsUV.push_back(Pair("period", statsStruct.period)); statsUV.push_back(Pair("threshold", statsStruct.threshold)); statsUV.push_back(Pair("elapsed", statsStruct.elapsed)); statsUV.push_back(Pair("count", statsStruct.count)); statsUV.push_back(Pair("possible", statsStruct.possible)); rv.push_back(Pair("statistics", statsUV)); } return rv; } void BIP9SoftForkDescPushBack(UniValue& bip9_softforks, const std::string &name, const Consensus::Params& consensusParams, Consensus::DeploymentPos id) { // Deployments with timeout value of 0 are hidden. // A timeout value of 0 guarantees a softfork will never be activated. // This is used when softfork codes are merged without specifying the deployment schedule. if (consensusParams.vDeployments[id].nTimeout > 0) bip9_softforks.push_back(Pair(name, BIP9SoftForkDesc(consensusParams, id))); } UniValue getblockchaininfo(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getblockchaininfo\n" "Returns an object containing various state info regarding blockchain processing.\n" "\nResult:\n" "{\n" " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n" " \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n" " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n" " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" " \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n" " \"pruned\": xx, (boolean) if the blocks are subject to pruning\n" " \"pruneheight\": xxxxxx, (numeric) lowest-height complete block stored\n" " \"softforks\": [ (array) status of softforks in progress\n" " {\n" " \"id\": \"xxxx\", (string) name of softfork\n" " \"version\": xx, (numeric) block version\n" " \"reject\": { (object) progress toward rejecting pre-softfork blocks\n" " \"status\": xx, (boolean) true if threshold reached\n" " },\n" " }, ...\n" " ],\n" " \"bip9_softforks\": { (object) status of BIP9 softforks in progress\n" " \"xxxx\" : { (string) name of the softfork\n" " \"status\": \"xxxx\", (string) one of \"defined\", \"started\", \"locked_in\", \"active\", \"failed\"\n" " \"bit\": xx, (numeric) the bit (0-28) in the block version field used to signal this softfork (only for \"started\" status)\n" " \"startTime\": xx, (numeric) the minimum median time past of a block at which the bit gains its meaning\n" " \"timeout\": xx, (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in\n" " \"since\": xx, (numeric) height of the first block to which the status applies\n" " \"statistics\": { (object) numeric statistics about BIP9 signalling for a softfork (only for \"started\" status)\n" " \"period\": xx, (numeric) the length in blocks of the BIP9 signalling period \n" " \"threshold\": xx, (numeric) the number of blocks with the version bit set required to activate the feature \n" " \"elapsed\": xx, (numeric) the number of blocks elapsed since the beginning of the current period \n" " \"count\": xx, (numeric) the number of blocks with the version bit set in the current period \n" " \"possible\": xx (boolean) returns false if there are not enough blocks left in this period to pass activation threshold \n" " }\n" " }\n" " }\n" "}\n" "\nExamples:\n" + HelpExampleCli("getblockchaininfo", "") + HelpExampleRpc("getblockchaininfo", "") ); LOCK(cs_main); UniValue obj(UniValue::VOBJ); obj.push_back(Pair("chain", Params().NetworkIDString())); obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1)); obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex())); obj.push_back(Pair("difficulty", (double)GetDifficulty())); obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast())); obj.push_back(Pair("verificationprogress", GuessVerificationProgress(Params().TxData(), chainActive.Tip()))); obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex())); obj.push_back(Pair("pruned", fPruneMode)); const Consensus::Params& consensusParams = Params().GetConsensus(); CBlockIndex* tip = chainActive.Tip(); UniValue softforks(UniValue::VARR); UniValue bip9_softforks(UniValue::VOBJ); softforks.push_back(SoftForkDesc("bip34", 2, tip, consensusParams)); softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); BIP9SoftForkDescPushBack(bip9_softforks, "csv", consensusParams, Consensus::DEPLOYMENT_CSV); BIP9SoftForkDescPushBack(bip9_softforks, "segwit", consensusParams, Consensus::DEPLOYMENT_SEGWIT); obj.push_back(Pair("softforks", softforks)); obj.push_back(Pair("bip9_softforks", bip9_softforks)); if (fPruneMode) { CBlockIndex *block = chainActive.Tip(); while (block && block->pprev && (block->pprev->nStatus & BLOCK_HAVE_DATA)) block = block->pprev; obj.push_back(Pair("pruneheight", block->nHeight)); } return obj; } /** Comparison function for sorting the getchaintips heads. */ struct CompareBlocksByHeight { bool operator()(const CBlockIndex* a, const CBlockIndex* b) const { /* Make sure that unequal blocks with the same height do not compare equal. Use the pointers themselves to make a distinction. */ if (a->nHeight != b->nHeight) return (a->nHeight > b->nHeight); return a < b; } }; UniValue getchaintips(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getchaintips\n" "Return information about all known tips in the block tree," " including the main chain as well as orphaned branches.\n" "\nResult:\n" "[\n" " {\n" " \"height\": xxxx, (numeric) height of the chain tip\n" " \"hash\": \"xxxx\", (string) block hash of the tip\n" " \"branchlen\": 0 (numeric) zero for main chain\n" " \"status\": \"active\" (string) \"active\" for the main chain\n" " },\n" " {\n" " \"height\": xxxx,\n" " \"hash\": \"xxxx\",\n" " \"branchlen\": 1 (numeric) length of branch connecting the tip to the main chain\n" " \"status\": \"xxxx\" (string) status of the chain (active, valid-fork, valid-headers, headers-only, invalid)\n" " }\n" "]\n" "Possible values for status:\n" "1. \"invalid\" This branch contains at least one invalid block\n" "2. \"headers-only\" Not all blocks for this branch are available, but the headers are valid\n" "3. \"valid-headers\" All blocks are available for this branch, but they were never fully validated\n" "4. \"valid-fork\" This branch is not part of the active chain, but is fully validated\n" "5. \"active\" This is the tip of the active main chain, which is certainly valid\n" "\nExamples:\n" + HelpExampleCli("getchaintips", "") + HelpExampleRpc("getchaintips", "") ); LOCK(cs_main); /* * Idea: the set of chain tips is chainActive.tip, plus orphan blocks which do not have another orphan building off of them. * Algorithm: * - Make one pass through mapBlockIndex, picking out the orphan blocks, and also storing a set of the orphan block's pprev pointers. * - Iterate through the orphan blocks. If the block isn't pointed to by another orphan, it is a chain tip. * - add chainActive.Tip() */ std::set<const CBlockIndex*, CompareBlocksByHeight> setTips; std::set<const CBlockIndex*> setOrphans; std::set<const CBlockIndex*> setPrevs; for (const std::pair<const uint256, CBlockIndex*>& item : mapBlockIndex) { if (!chainActive.Contains(item.second)) { setOrphans.insert(item.second); setPrevs.insert(item.second->pprev); } } for (std::set<const CBlockIndex*>::iterator it = setOrphans.begin(); it != setOrphans.end(); ++it) { if (setPrevs.erase(*it) == 0) { setTips.insert(*it); } } // Always report the currently active tip. setTips.insert(chainActive.Tip()); /* Construct the output array. */ UniValue res(UniValue::VARR); for (const CBlockIndex* block : setTips) { UniValue obj(UniValue::VOBJ); obj.push_back(Pair("height", block->nHeight)); obj.push_back(Pair("hash", block->phashBlock->GetHex())); const int branchLen = block->nHeight - chainActive.FindFork(block)->nHeight; obj.push_back(Pair("branchlen", branchLen)); std::string status; if (chainActive.Contains(block)) { // This block is part of the currently active chain. status = "active"; } else if (block->nStatus & BLOCK_FAILED_MASK) { // This block or one of its ancestors is invalid. status = "invalid"; } else if (block->nChainTx == 0) { // This block cannot be connected because full block data for it or one of its parents is missing. status = "headers-only"; } else if (block->IsValid(BLOCK_VALID_SCRIPTS)) { // This block is fully validated, but no longer part of the active chain. It was probably the active block once, but was reorganized. status = "valid-fork"; } else if (block->IsValid(BLOCK_VALID_TREE)) { // The headers for this block are valid, but it has not been validated. It was probably never part of the most-work chain. status = "valid-headers"; } else { // No clue. status = "unknown"; } obj.push_back(Pair("status", status)); res.push_back(obj); } return res; } UniValue mempoolInfoToJSON() { UniValue ret(UniValue::VOBJ); ret.push_back(Pair("size", (int64_t) mempool.size())); ret.push_back(Pair("bytes", (int64_t) mempool.GetTotalTxSize())); ret.push_back(Pair("usage", (int64_t) mempool.DynamicMemoryUsage())); size_t maxmempool = gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; ret.push_back(Pair("maxmempool", (int64_t) maxmempool)); ret.push_back(Pair("mempoolminfee", ValueFromAmount(mempool.GetMinFee(maxmempool).GetFeePerK()))); return ret; } UniValue getmempoolinfo(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 0) throw std::runtime_error( "getmempoolinfo\n" "\nReturns details on the active state of the TX memory pool.\n" "\nResult:\n" "{\n" " \"size\": xxxxx, (numeric) Current tx count\n" " \"bytes\": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n" " \"usage\": xxxxx, (numeric) Total memory usage for the mempool\n" " \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n" " \"mempoolminfee\": xxxxx (numeric) Minimum feerate (" + CURRENCY_UNIT + " per KB) for tx to be accepted\n" "}\n" "\nExamples:\n" + HelpExampleCli("getmempoolinfo", "") + HelpExampleRpc("getmempoolinfo", "") ); return mempoolInfoToJSON(); } UniValue preciousblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "preciousblock \"blockhash\"\n" "\nTreats a block as if it were received before others with the same work.\n" "\nA later preciousblock call can override the effect of an earlier one.\n" "\nThe effects of preciousblock are not retained across restarts.\n" "\nArguments:\n" "1. \"blockhash\" (string, required) the hash of the block to mark as precious\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("preciousblock", "\"blockhash\"") + HelpExampleRpc("preciousblock", "\"blockhash\"") ); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); CBlockIndex* pblockindex; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); pblockindex = mapBlockIndex[hash]; } CValidationState state; PreciousBlock(state, Params(), pblockindex); if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return NullUniValue; } UniValue invalidateblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "invalidateblock \"blockhash\"\n" "\nPermanently marks a block as invalid, as if it violated a consensus rule.\n" "\nArguments:\n" "1. \"blockhash\" (string, required) the hash of the block to mark as invalid\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("invalidateblock", "\"blockhash\"") + HelpExampleRpc("invalidateblock", "\"blockhash\"") ); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); CValidationState state; { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; InvalidateBlock(state, Params(), pblockindex); } if (state.IsValid()) { ActivateBestChain(state, Params()); } if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return NullUniValue; } UniValue reconsiderblock(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() != 1) throw std::runtime_error( "reconsiderblock \"blockhash\"\n" "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n" "This can be used to undo the effects of invalidateblock.\n" "\nArguments:\n" "1. \"blockhash\" (string, required) the hash of the block to reconsider\n" "\nResult:\n" "\nExamples:\n" + HelpExampleCli("reconsiderblock", "\"blockhash\"") + HelpExampleRpc("reconsiderblock", "\"blockhash\"") ); std::string strHash = request.params[0].get_str(); uint256 hash(uint256S(strHash)); { LOCK(cs_main); if (mapBlockIndex.count(hash) == 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; ResetBlockFailureFlags(pblockindex); } CValidationState state; ActivateBestChain(state, Params()); if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); } return NullUniValue; } UniValue getchaintxstats(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() > 2) throw std::runtime_error( "getchaintxstats ( nblocks blockhash )\n" "\nCompute statistics about the total number and rate of transactions in the chain.\n" "\nArguments:\n" "1. nblocks (numeric, optional) Size of the window in number of blocks (default: one month).\n" "2. \"blockhash\" (string, optional) The hash of the block that ends the window.\n" "\nResult:\n" "{\n" " \"time\": xxxxx, (numeric) The timestamp for the statistics in UNIX format.\n" " \"txcount\": xxxxx, (numeric) The total number of transactions in the chain up to that point.\n" " \"txrate\": x.xx, (numeric) The average rate of transactions per second in the window.\n" "}\n" "\nExamples:\n" + HelpExampleCli("getchaintxstats", "") + HelpExampleRpc("getchaintxstats", "2016") ); const CBlockIndex* pindex; int blockcount = 30 * 24 * 60 * 60 / Params().GetConsensus().nPowTargetSpacing; // By default: 1 month if (request.params.size() > 0 && !request.params[0].isNull()) { blockcount = request.params[0].get_int(); } bool havehash = request.params.size() > 1 && !request.params[1].isNull(); uint256 hash; if (havehash) { hash = uint256S(request.params[1].get_str()); } { LOCK(cs_main); if (havehash) { auto it = mapBlockIndex.find(hash); if (it == mapBlockIndex.end()) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); } pindex = it->second; if (!chainActive.Contains(pindex)) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Block is not in main chain"); } } else { pindex = chainActive.Tip(); } } if (blockcount < 1 || blockcount >= pindex->nHeight) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid block count: should be between 1 and the block's height"); } const CBlockIndex* pindexPast = pindex->GetAncestor(pindex->nHeight - blockcount); int nTimeDiff = pindex->GetMedianTimePast() - pindexPast->GetMedianTimePast(); int nTxDiff = pindex->nChainTx - pindexPast->nChainTx; UniValue ret(UniValue::VOBJ); ret.push_back(Pair("time", (int64_t)pindex->nTime)); ret.push_back(Pair("txcount", (int64_t)pindex->nChainTx)); ret.push_back(Pair("txrate", ((double)nTxDiff) / nTimeDiff)); return ret; } static const CRPCCommand commands[] = { // category name actor (function) okSafe argNames // --------------------- ------------------------ ----------------------- ------ ---------- { "blockchain", "getblockchaininfo", &getblockchaininfo, true, {} }, { "blockchain", "getchaintxstats", &getchaintxstats, true, {"nblocks", "blockhash"} }, { "blockchain", "getbestblockhash", &getbestblockhash, true, {} }, { "blockchain", "getblockcount", &getblockcount, true, {} }, { "blockchain", "getblock", &getblock, true, {"blockhash","verbosity|verbose"} }, { "blockchain", "getblockhash", &getblockhash, true, {"height"} }, { "blockchain", "getblockheader", &getblockheader, true, {"blockhash","verbose"} }, { "blockchain", "getchaintips", &getchaintips, true, {} }, { "blockchain", "getdifficulty", &getdifficulty, true, {} }, { "blockchain", "getmempoolancestors", &getmempoolancestors, true, {"txid","verbose"} }, { "blockchain", "getmempooldescendants", &getmempooldescendants, true, {"txid","verbose"} }, { "blockchain", "getmempoolentry", &getmempoolentry, true, {"txid"} }, { "blockchain", "getmempoolinfo", &getmempoolinfo, true, {} }, { "blockchain", "getrawmempool", &getrawmempool, true, {"verbose"} }, { "blockchain", "gettxout", &gettxout, true, {"txid","n","include_mempool"} }, { "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true, {} }, { "blockchain", "pruneblockchain", &pruneblockchain, true, {"height"} }, { "blockchain", "verifychain", &verifychain, true, {"checklevel","nblocks"} }, { "blockchain", "preciousblock", &preciousblock, true, {"blockhash"} }, /* Not shown in help */ { "hidden", "invalidateblock", &invalidateblock, true, {"blockhash"} }, { "hidden", "reconsiderblock", &reconsiderblock, true, {"blockhash"} }, { "hidden", "waitfornewblock", &waitfornewblock, true, {"timeout"} }, { "hidden", "waitforblock", &waitforblock, true, {"blockhash","timeout"} }, { "hidden", "waitforblockheight", &waitforblockheight, true, {"height","timeout"} }, }; void RegisterBlockchainRPCCommands(CRPCTable &t) { for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++) t.appendCommand(commands[vcidx].name, &commands[vcidx]); }
[ "support@maniacraft.net" ]
support@maniacraft.net
b073baf3aa5bec369f14baca71eee0d81cd279fe
934996b31ada702a7f2d327de1e0c14d9cef9e7a
/ChoudhryBilal00326_Assignment3/main.cpp
bd48a312f2159ab1f401f8233940133a19426f4f
[]
no_license
choudhrybilal/OOP-CS224
0a537951f5a1ddca1cc8d649e7b2a691cdc1c116
48d5f5d6dd66f52f4be10bf3a71218bc83acf02f
refs/heads/master
2020-03-19T09:45:59.852195
2018-07-23T07:56:57
2018-07-23T07:56:57
136,315,855
0
0
null
null
null
null
UTF-8
C++
false
false
8,602
cpp
/* Habib University, Summer Semester 2018, Object Oriented Programming & Design Methodologies(CS224), Assignment # 03; Package Delivery System. Instructor: Dr. Umair Azfar Khan TA: Ahmed Ali(aa02190) Choudhry Bilal Mazhar (cm00326) */ #include <iostream> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> using namespace std; class Box { int length; int width; int height; int volume; public: //public functions Box() //Constructor { length = 5 + (rand() % 26); //length between 5 and 30 inches width = 5 + (rand() % 26); //width between 5 and 30 inches height = 5 + (rand() % 26); //height between 5 and 30 inches } void Volume() //calculates the volume of each box { volume = length * width * height; } int get_volume() //returns the volume of the box { return volume; } }; class Truck { char driver[32]; int petrol; int money; int loaded_mileage; int empty_mileage; float total_journey; float cost_per_litre; float max_petrol; Box *array_box; //initializing boxes array public: //public functions Truck() //Constructor { total_journey = 60; //distance of the journey cost_per_litre = 2.73; //cost for one liter of petrol max_petrol = 50; //tank limit } void set_driver(char d[32]) //acceses the name of the driver from main and sets it here { strcpy(driver, d); //character array d is copied to driver } string get_driver() //returns the name of the driver { return driver; } void set_petrol(int p) //acceses the value of petrol from main and sets it { petrol = p; } int get_petrol() { return petrol; } void set_money(int m) { money = m; } int get_money() { return money; } void set_e_mileage(int e_mileage) { empty_mileage = e_mileage; } int get_e_mileage() { return empty_mileage; } void set_l_mileage(int l_mileage) { loaded_mileage = l_mileage; } int get_l_mileage() { return loaded_mileage; } int checker() //checks whether the truck has enough money to go and deliver packages { int up; float money_needed; if (petrol < 50) //checks if the driver has less than 50 liters of petrol { up = max_petrol - petrol; //amount of liters needed money_needed = up * cost_per_litre; //the amount of money needed to fill the tank if(money_needed > money) //if the amount of money needed is greater than the money the driver has then this truck can't go { cout << "The money needed to fill the tank is $" << money_needed << " and the driver initially has $ " << money << endl; return 0; } else //if the driver has enough cash to fill the tank then he can go { petrol = petrol + up; //fills the tank to 50 litres cout << "\nThe money needed to fill the tank is $ " << money_needed << " and the driver initially has $ " << money << endl; money = money - money_needed; //the cash needed to fill the tank is subtracted from the initial money return 1; } } return 0; } void print() //function prints out the updated details of the truck's driver { cout << "\n----->>> Driver is good to go!" << endl; cout << "-----> Updated Details: " <<endl; cout << "\n*******************************************" <<endl; cout << "Truck driver name: " << driver <<endl; cout << "Truck's petrol: " << petrol<<" liters"<<endl; cout << "Truck driver's money: $ " << money <<endl; cout << "Truck's mileage when loaded: " << loaded_mileage<<" km"<<endl; cout << "Truck's mileage when empty: " << empty_mileage<<" km\n"<<endl; } void Load(int numBox) //loads boxes into the truck { array_box = new Box[numBox]; for (int i = 0; i < numBox; i++) { Box b; b.Volume(); //stores the volume array_box[i] = b; cout << "Volume of box " << i + 1 << ": " << array_box[i].get_volume() << " cubic inches" << endl; } } void Unload() //unloads boxes from the truck { delete[] array_box; //deallocates the array } float Cost() //calculates the total cost for the complete journey { float lit, total, lit1; lit = (total_journey/loaded_mileage) * cost_per_litre; //money needed for going lit1 = (total_journey/empty_mileage) * cost_per_litre; //money needed for coming back total = lit + lit1; //total cost for the journey cout << "\nThe total cost of the journey is $ " << total << endl; return total; } }; int line_counter(const char* fileName) //tells the number of lines needed { FILE* file_pointer; //Declaring a file pointer char buff[32]; //Declaring a character array to store a line file_pointer = fopen(fileName, "r"); //Opening file as read only if (file_pointer == NULL) //If file is not found { perror ("Error opening file"); //Show Error return 0; } int counter = 0; //Counts the lines in file while(fgets(buff, 32, (FILE*)file_pointer) !=NULL) //If line read is not NULL { counter++; //increase line count } fclose(file_pointer); //close file when done return counter; //return line count } int main() { srand(time(0)); FILE* file_pointer; //Declaring a file pointer file_pointer = fopen("Drivers.txt", "r"); //Opening file as read only int count = line_counter("Drivers.txt"); int count1 = count/5; //since each driver has 5 lines of info Truck *array_truck; if (file_pointer == NULL) { perror ("Error opening file"); return 0; } array_truck = new Truck[count1]; cout <<" PACKAGE DELIVERY SYSTEM\n"<<endl; for (int i = 0; i < count1; i++) { cout <<"----------------------------------------("<<i+1<<")----------------------------------------"<<endl; Truck t; //creating an object char buff[32]; //Declaring a character array to store a line fgets(buff, 32, (FILE*)file_pointer); //Reading the name of the driver directly t.set_driver(buff); fgets(buff, 32, (FILE*)file_pointer); //Reading the next line as string t.set_petrol(atoi(buff)); //Converting the string to integer fgets(buff, 32, (FILE*)file_pointer); t.set_money(atoi(buff)); fgets(buff, 32, (FILE*)file_pointer); t.set_e_mileage(atoi(buff)); fgets(buff, 32, (FILE*)file_pointer); t.set_l_mileage(atoi(buff)); cout << "Truck driver name: " << t.get_driver() <<endl; cout << "Truck's petrol: " << t.get_petrol() <<" liters"<<endl; cout << "Truck driver's money: $ " << t.get_money() <<endl; cout << "Truck's mileage when loaded: " << t.get_l_mileage() <<" km"<<endl; cout << "Truck's mileage when empty: " << t.get_e_mileage() <<" km"<<endl; int random_boxes = 12 + (rand() % 9); //random packages between 12 to 20 if (t.checker() == 1) //checks if the driver has enough money to go { t.print(); cout << random_boxes << " Packages have been loaded on the truck:\n" << endl; t.Load(random_boxes); t.Unload(); cout << "\nThe truck has been unloaded!" << endl; t.Cost(); cout << endl; } else //if the checker function returns 0 then that truck can't go { cout << "\n----->>> This truck can't go!\n" << endl; } array_truck[i] = t; } delete [] array_truck; // deallocating array of truck fclose(file_pointer); //Closing file return 0; }
[ "39990031+choudhrybilal@users.noreply.github.com" ]
39990031+choudhrybilal@users.noreply.github.com
abf17135bd73832ddf1d3235e491b5a5e67c360e
3fca51025651363b205171c963d0c21e3a8450bf
/int2Str_test/main.cpp
7b92c466e065e518e7cf88a8291a58744285beff
[]
no_license
yujianjun1025/cplusplus_exercise
65191673eeb746d7a986fc8ac2ad4c42d10bb192
d2e1c74b0b0de6c59097d0127c7138a0836c022e
refs/heads/master
2021-01-21T12:11:06.897566
2016-03-30T03:21:26
2016-03-30T03:21:26
39,677,597
1
0
null
null
null
null
UTF-8
C++
false
false
356
cpp
#include<stdio.h> #include <iostream> #include <map> using namespace std; int main() { int n = 65535; char t[256]; std::string s; sprintf(t, "%d", n); s = t; cout <<"sprintf 转化结果:" << s << endl; map<string, string> map; map["a"] = n; cout<< "直接赋值转化结果:" << map["a"] << endl; return 0; }
[ "yujianjun@hbdata-search-test01.lf.sankuai.com" ]
yujianjun@hbdata-search-test01.lf.sankuai.com
17438b24412681977b21f6760fcc7ea8fc763745
8c2051a172d86f232d97455a43b387973277f4fc
/src/xmpp/biboumi_component.hpp
d5b87e91ccb706b4834148494e2de71eabeeaf36
[ "Zlib" ]
permissive
lep/biboumi
5fefdc3891cb38de5fad3d0285e7a36ed6dd387b
ba4fcbb68efdf34d173b0bc475d30e6dcbdb9553
refs/heads/master
2021-01-12T11:12:39.284514
2016-11-04T17:10:38
2016-11-04T17:10:38
72,871,259
0
0
null
null
null
null
UTF-8
C++
false
false
4,307
hpp
#pragma once #include <xmpp/xmpp_component.hpp> #include <bridge/bridge.hpp> #include <memory> #include <string> #include <map> namespace db { class MucLogLine; } struct ListElement; /** * A callback called when the waited iq result is received (it is matched * against the iq id) */ using iq_responder_callback_t = std::function<void(Bridge* bridge, const Stanza& stanza)>; /** * Interact with the Biboumi Bridge */ class BiboumiComponent: public XmppComponent { public: explicit BiboumiComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret); ~BiboumiComponent() = default; BiboumiComponent(const BiboumiComponent&) = delete; BiboumiComponent(BiboumiComponent&&) = delete; BiboumiComponent& operator=(const BiboumiComponent&) = delete; BiboumiComponent& operator=(BiboumiComponent&&) = delete; /** * Returns the bridge for the given user. If it does not exist, return * nullptr. */ Bridge* find_user_bridge(const std::string& full_jid); /** * Return a list of all the managed bridges. */ std::vector<Bridge*> get_bridges() const; /** * Send a "close" message to all our connected peers. That message * depends on the protocol used (this may be a QUIT irc message, or a * <stream/>, etc). We may also directly close the connection, or we may * wait for the remote peer to acknowledge it before closing. */ void shutdown(); /** * Run a check on all bridges, to remove all disconnected (socket is * closed, or no channel is joined) IrcClients. Some kind of garbage collector. */ void clean(); /** * Send a result IQ with the gateway disco informations. */ void send_self_disco_info(const std::string& id, const std::string& jid_to); /** * Send a result IQ with the disco informations regarding IRC server JIDs. */ void send_irc_server_disco_info(const std::string& id, const std::string& jid_to, const std::string& jid_from); /** * Sends the allowed namespaces in MUC message, according to * http://xmpp.org/extensions/xep-0045.html#impl-service-traffic */ void send_irc_channel_muc_traffic_info(const std::string id, const std::string& jid_from, const std::string& jid_to); /** * Send an iq version request */ void send_iq_version_request(const std::string& from, const std::string& jid_to); /** * Send a ping request */ void send_ping_request(const std::string& from, const std::string& jid_to, const std::string& id); /** * Send the channels list in one big stanza */ void send_iq_room_list_result(const std::string& id, const std::string& to_jid, const std::string& from, const ChannelList& channel_list, std::vector<ListElement>::const_iterator begin, std::vector<ListElement>::const_iterator end, const ResultSetInfo& rs_info); void send_invitation(const std::string& room_target, const std::string& jid_to, const std::string& author_nick); /** * Handle the various stanza types */ void handle_presence(const Stanza& stanza); void handle_message(const Stanza& stanza); void handle_iq(const Stanza& stanza); #ifdef USE_DATABASE bool handle_mam_request(const Stanza& stanza); void send_archived_message(const db::MucLogLine& log_line, const std::string& from, const std::string& to, const std::string& queryid); #endif private: /** * Return the bridge associated with the bare JID. Create a new one * if none already exist. */ Bridge* get_user_bridge(const std::string& user_jid); /** * A map of id -> callback. When we want to wait for an iq result, we add * the callback to this map, with the iq id as the key. When an iq result * is received, we look for a corresponding callback in this map. If * found, we call it and remove it. */ std::map<std::string, iq_responder_callback_t> waiting_iq; /** * One bridge for each user of the component. Indexed by the user's bare * jid */ std::unordered_map<std::string, std::unique_ptr<Bridge>> bridges; AdhocCommandsHandler irc_server_adhoc_commands_handler; AdhocCommandsHandler irc_channel_adhoc_commands_handler; };
[ "louiz@louiz.org" ]
louiz@louiz.org
089451c97cf15878d531947872c49bbfb8c096f0
0368436dc981ab44975d4b28935ae89a37065030
/src/core_memusage.h
d06eadfd6cbdb24b8153d045e0dce785c2d619a2
[ "MIT" ]
permissive
mirzaei-ce/core-koobit
b1d350c28f87764a14ed7e92e9918c7af90a93a0
7d24e9c554fec6f3631691f456e9873bc4536fbd
refs/heads/master
2021-08-14T19:04:05.775343
2017-11-16T14:35:05
2017-11-16T14:35:05
110,982,099
0
0
null
null
null
null
UTF-8
C++
false
false
2,219
h
// Copyright (c) 2015 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef KOOBIT_CORE_MEMUSAGE_H #define KOOBIT_CORE_MEMUSAGE_H #include "primitives/transaction.h" #include "primitives/block.h" #include "memusage.h" static inline size_t RecursiveDynamicUsage(const CScript& script) { return memusage::DynamicUsage(*static_cast<const CScriptBase*>(&script)); } static inline size_t RecursiveDynamicUsage(const COutPoint& out) { return 0; } static inline size_t RecursiveDynamicUsage(const CTxIn& in) { return RecursiveDynamicUsage(in.scriptSig) + RecursiveDynamicUsage(in.prevout); } static inline size_t RecursiveDynamicUsage(const CTxOut& out) { return RecursiveDynamicUsage(out.scriptPubKey); } static inline size_t RecursiveDynamicUsage(const CTransaction& tx) { size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout); for (std::vector<CTxIn>::const_iterator it = tx.vin.begin(); it != tx.vin.end(); it++) { mem += RecursiveDynamicUsage(*it); } for (std::vector<CTxOut>::const_iterator it = tx.vout.begin(); it != tx.vout.end(); it++) { mem += RecursiveDynamicUsage(*it); } return mem; } static inline size_t RecursiveDynamicUsage(const CMutableTransaction& tx) { size_t mem = memusage::DynamicUsage(tx.vin) + memusage::DynamicUsage(tx.vout); for (std::vector<CTxIn>::const_iterator it = tx.vin.begin(); it != tx.vin.end(); it++) { mem += RecursiveDynamicUsage(*it); } for (std::vector<CTxOut>::const_iterator it = tx.vout.begin(); it != tx.vout.end(); it++) { mem += RecursiveDynamicUsage(*it); } return mem; } static inline size_t RecursiveDynamicUsage(const CBlock& block) { size_t mem = memusage::DynamicUsage(block.vtx); for (std::vector<CTransaction>::const_iterator it = block.vtx.begin(); it != block.vtx.end(); it++) { mem += RecursiveDynamicUsage(*it); } return mem; } static inline size_t RecursiveDynamicUsage(const CBlockLocator& locator) { return memusage::DynamicUsage(locator.vHave); } #endif // KOOBIT_CORE_MEMUSAGE_H
[ "mirzaei@ce.sharif.edu" ]
mirzaei@ce.sharif.edu
77d6548ca557650e1dcf394ae917e97e44fca1fe
f34dd88f36ad1a05d49a48920d4fea2dd4cd6462
/hackerrank/Project-Euler/pe037.cpp
00ed7b962b24fd5b0a1e6bab59e3720d01b68acf
[]
no_license
ccd97/cp_solutions
e1a9f66eb9ae15c5aa80679f3695f32de0f55ded
702fd1c6a8c3bdc8e255a51abf66c5d71a31ff9e
refs/heads/master
2021-07-20T06:58:42.496450
2018-11-27T14:38:39
2018-11-27T14:41:36
130,831,095
0
0
null
null
null
null
UTF-8
C++
false
false
895
cpp
#include <bits/stdc++.h> using namespace std; #define MAX 1000006 bool prime[1000007]; void SieveOfEratosthenes() { memset(prime, true, sizeof(prime)); for (int p=2; p*p<=MAX; p++){ if (prime[p] == true){ for (int i=p*2; i<=MAX; i += p) prime[i] = false; } } prime[0] = false; prime[1] = false; } int calcTruPri(int num){ int div = 1, n= num; while (n/div >= 10) div *= 10; while(n > 0){ if(!prime[n]) return 0; n %= div; div /= 10; } n = num; while(n > 0){ if(!prime[n]) return 0; n /= 10; } return num; } int main(int argc, char const *argv[]) { SieveOfEratosthenes(); int n; cin>>n; unsigned long long tripsum = 0; for(int i=11; i<n; i++){ if(prime[i]) tripsum += calcTruPri(i); } cout<<tripsum<<endl; return 0; }
[ "dcunha.cyprien@gmail.com" ]
dcunha.cyprien@gmail.com
b1512380633b74483aa424968642285136ba34d1
05f7573db159e870fb26c847991c4cb8c407ed4c
/VBF/Source/VBF_CORE4.0/VBF_Interface/VBF_Plot/Massive/IVBF_MarkModelPointSprite.h
fa98e6ce14682014c280c962880c6c3805ccf346
[]
no_license
riyue625/OneGIS.ModelingTool
e126ef43429ce58d22c65832d96dbd113eacbf85
daf3dc91584df7ecfed6a51130ecdf6671614ac4
refs/heads/master
2020-05-28T12:12:43.543730
2018-09-06T07:42:00
2018-09-06T07:42:00
null
0
0
null
null
null
null
GB18030
C++
false
false
3,306
h
//************************************************************************ // FileName:IVBF_MarkModelPointSprite.h // Function:军标实体模型接口:点精灵(适用于绘制大量相同的点) // 该集合中所有点的纹理相同,尺寸相同,且始终朝向视点 // Author: 杜莹 // Date: 2015-11-23 //************************************************************************ #ifndef __IVBF_MARK_MODEL_POINTSPRITE_H__ #define __IVBF_MARK_MODEL_POINTSPRITE_H__ #include <VBF_Plot/IVBF_MarkModel.h> #include <VBF_Plot/Massive/VBF_3DPlotDataTypes_Massive.h> #include <Types/VBF_3DStyles.h> #include <VBF_Engine/VBF_SceneGraph/Image> typedef std::map<std::string, std::string> CVBF_UserValueMap; //-------------------------------------------------------------------- // 定义接口:IVBF_MarkModelPointSprite // 接口描述:点精灵 //-------------------------------------------------------------------- class IVBF_MarkModelPointSprite : public IVBF_MarkModel { public: virtual ~IVBF_MarkModelPointSprite() {} // 初始化集合中所有点的尺寸信息,只能调用一次,而且必须在添加单个模型之前调用 // fSizeInPixels -- 单个点的尺寸(单位:像素) virtual void InitSize(float fSizeInPixels)=0; // 初始化集合的纹理信息,只能调用一次,而且必须在添加单个模型之前调用 // 参数:pTexImage -- 集合中所有模型公用的纹理图像指针 // fTexAlpha -- 集合中所有模型的纹理透明度(默认值为1.0) virtual void InitTexture(osg::Image* pTexImage, float fTexAlpha=1.0f)=0; // 初始化空间分割后每个单元格中存储的最大点数(默认值为100) // 如果分割数<=5,表示点总数较少,精确裁剪优先,绘制效率次之;否则,绘制效率优先,精确裁剪次之 virtual void InitNumMaxPointsPerCell(unsigned int num)=0; // 添加一个点,并返回该点在集合中的序号,参数vGeo表示点的地理坐标 virtual int AddPoint(const osg::Vec3d& vGeo)=0; // 获取集合中点的个数 virtual int GetNumPoints()=0; // 添加/移除/获取用户自定义的简略参数对,用于显示被选模型的简略信息,前提是该模型已经添加 virtual void AddUserValue(int nIndex, const std::string& strName, const std::string& strValue, bool bOverwrite=true)=0; virtual void RemoveUseValue(int nIndex, const std::string& strName)=0; virtual bool GetUserValue(int nIndex, const std::string& strName, std::string& strValue)=0; virtual void SetUserValues(int nIndex, const CVBF_UserValueMap& values)=0; virtual bool GetUserValues(int nIndex, CVBF_UserValueMap& values)=0; // 添加/移除/获取用户自定义的详细参数对,用于显示被选模型的详细信息,前提是该模型已经添加 virtual void AddUserValueDetail(int nIndex, const std::string& strName, const std::string& strValue, bool bOverwrite=true)=0; virtual void RemoveUseValueDetail(int nIndex, const std::string& strName)=0; virtual bool GetUserValueDetail(int nIndex, const std::string& strName, std::string& strValue)=0; virtual void SetUserValuesDetail(int nIndex, const CVBF_UserValueMap& values)=0; virtual bool GetUserValuesDetail(int nIndex, CVBF_UserValueMap& values)=0; }; #endif
[ "robertsam@126.com" ]
robertsam@126.com
63e9ba6894cc10a02ba9c66869db761018d20e1d
5c2c7f71ae8adb724f1dc99935fd4fd37ee6523e
/art.cpp
b06fae2b7b4569481c82fbfb2445da688c14eae5
[]
no_license
Twisol/mushclient
d1b9de077b6fcc0c854e9ff459b3491b0fe16eb7
430896bb7abdd025e7a09ddbae40ebfef7e735f0
refs/heads/master
2021-01-18T19:14:24.835242
2010-09-19T07:53:50
2010-09-19T07:53:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,692
cpp
/* ASCII-art generator. Based on figlet. FIGlet Copyright 1991, 1993, 1994 Glenn Chappell and Ian Chai FIGlet Copyright 1996, 1997 John Cowan Portions written by Paul Burton Internet: <ianchai@usa.net> FIGlet, along with the various FIGlet fonts and documentation, is copyrighted under the provisions of the Artistic License (as listed in the file "artistic.license" which is included in this package. */ #include "stdafx.h" #include "MUSHclient.h" #include "TextDocument.h" #include "TextView.h" #include "doc.h" #include "dialogs\AsciiArtDlg.h" #ifdef _DEBUG //#define new DEBUG_NEW #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif #define MYSTRLEN(x) ((int)strlen(x)) /* Eliminate ANSI problem */ #define FONTFILESUFFIX ".flf" #define FONTFILEMAGICNUMBER "flf2" #define FSUFFIXLEN MYSTRLEN(FONTFILESUFFIX) #define CONTROLFILESUFFIX ".flc" #define CONTROLFILEMAGICNUMBER "flc2" /* no longer used in 2.2 */ #define CSUFFIXLEN MYSTRLEN(CONTROLFILESUFFIX) #define DEFAULTCOLUMNS 500 #ifndef DEFAULTFONTDIR #define DEFAULTFONTDIR "fonts" #endif #ifndef DEFAULTFONTFILE #define DEFAULTFONTFILE "standard.flf" #endif /**************************************************************************** Globals dealing with chars that are read ****************************************************************************/ typedef long inchr; /* "char" read from stdin */ static inchr *inchrline = NULL; /* Alloc'd inchr inchrline[inchrlinelenlimit+1]; */ /* Note: not null-terminated. */ static int inchrlinelen,inchrlinelenlimit; static inchr deutsch[7] = {196, 214, 220, 228, 246, 252, 223}; /* Latin-1 codes for German letters, respectively: LATIN CAPITAL LETTER A WITH DIAERESIS = A-umlaut LATIN CAPITAL LETTER O WITH DIAERESIS = O-umlaut LATIN CAPITAL LETTER U WITH DIAERESIS = U-umlaut LATIN SMALL LETTER A WITH DIAERESIS = a-umlaut LATIN SMALL LETTER O WITH DIAERESIS = o-umlaut LATIN SMALL LETTER U WITH DIAERESIS = u-umlaut LATIN SMALL LETTER SHARP S = ess-zed */ /**************************************************************************** Globals affected by command line options ****************************************************************************/ static int deutschflag,justification,paragraphflag,right2left,multibyte; static int cmdinput; #define SM_SMUSH 128 #define SM_KERN 64 #define SM_EQUAL 1 #define SM_LOWLINE 2 #define SM_HIERARCHY 4 #define SM_PAIR 8 #define SM_BIGX 16 #define SM_HARDBLANK 32 static int smushmode; #define SMO_NO 0 /* no command-line smushmode */ #define SMO_YES 1 /* use command-line smushmode, ignore font smushmode */ #define SMO_FORCE 2 /* logically OR command-line and font smushmodes */ static int smushoverride; static int outputwidth; static int outlinelenlimit; static char *fontdirname,*fontname; /**************************************************************************** Globals dealing with chars that are written ****************************************************************************/ typedef struct fc { inchr ord; char **thechar; /* Alloc'd char thechar[charheight][]; */ struct fc *next; } fcharnode; static fcharnode *fcharlist = NULL; static char **currchar; static int currcharwidth; static int previouscharwidth; static char **outputline = NULL; /* Alloc'd char outputline[charheight][outlinelenlimit+1]; */ static int outlinelen; /**************************************************************************** Globals read from font file ****************************************************************************/ static char hardblank; static int charheight; /**************************************************************************** myalloc Calls malloc. If malloc returns error, prints error message and quits. ****************************************************************************/ /* char *myalloc(size_t size) { char *ptr; ptr = new char [size]; if (ptr == NULL) ThrowErrorException ("Out of memory"); return ptr; } */ #define myalloc(arg) new char [arg] #define myfree(arg) delete [] arg /**************************************************************************** getparams Handles all command-line parameters. Puts all parameters within bounds. ****************************************************************************/ static void getparams() { extern char *optarg; extern int optind; int firstfont,infoprint; fontdirname = DEFAULTFONTDIR; firstfont = 1; deutschflag = 0; justification = -1; right2left = -1; paragraphflag = 0; infoprint = -1; cmdinput = 0; outputwidth = DEFAULTCOLUMNS; outlinelenlimit = outputwidth-1; } /**************************************************************************** readmagic Reads a four-character magic string from a stream. ****************************************************************************/ static void readmagic(CStdioFile & file, char * magic) { file.Read (magic, 4); magic[4] = 0; } /**************************************************************************** skiptoeol Skips to the end of a line, given a stream. ****************************************************************************/ static void skiptoeol(CStdioFile & fp) { char dummy [2]; while (fp.Read (dummy, 1)) if (dummy [0] == '\n') return; } /**************************************************************************** readfontchar Reads a font character from the font file, and places it in a newly-allocated entry in the list. ****************************************************************************/ static void readfontchar(CStdioFile & file, inchr theord, char * line, int maxlen) { int row,k; char endchar; fcharnode *fclsave; fclsave = fcharlist; fcharlist = (fcharnode*)myalloc(sizeof(fcharnode)); fcharlist->ord = theord; fcharlist->thechar = (char**)myalloc(sizeof(char*)*charheight); fcharlist->next = fclsave; for (row=0;row<charheight;row++) { if (file.ReadString(line,maxlen+1)==NULL) { line[0] = '\0'; } k = MYSTRLEN(line)-1; while (k>=0 && isspace(line[k])) { k--; } if (k>=0) { endchar = line[k]; while (k>=0 ? line[k]==endchar : 0) { k--; } } line[k+1] = '\0'; fcharlist->thechar[row] = (char*)myalloc(sizeof(char)*(k+2)); strcpy(fcharlist->thechar[row],line); } } /**************************************************************************** readfont Allocates memory, initializes variables, and reads in the font. ****************************************************************************/ static void readfont(CString strName) { #define MAXFIRSTLINELEN 1000 int i,row,numsread; inchr theord; int maxlen,cmtlines,ffright2left; int smush,smush2; char *fileline,magicnum[5]; CStdioFile fontfile (strName, CFile::modeRead|CFile::shareDenyNone|CFile::typeText); readmagic(fontfile,magicnum); fileline = (char*)myalloc(sizeof(char)*(MAXFIRSTLINELEN+1)); if (fontfile.ReadString(fileline,MAXFIRSTLINELEN+1)==NULL) { fileline[0] = '\0'; } if (MYSTRLEN(fileline)>0 ? fileline[MYSTRLEN(fileline)-1]!='\n' : 0) { skiptoeol(fontfile); } numsread = sscanf(fileline,"%*c%c %d %*d %d %d %d %d %d", &hardblank,&charheight,&maxlen,&smush,&cmtlines, &ffright2left,&smush2); myfree(fileline); if (strcmp(magicnum,FONTFILEMAGICNUMBER) || numsread<5) ThrowErrorException ("Not a FIGlet 2 font file"); for (i=1;i<=cmtlines;i++) { skiptoeol(fontfile); } if (numsread<6) { ffright2left = 0; } if (numsread<7) { /* if no smush2, decode smush into smush2 */ if (smush == 0) smush2 = SM_KERN; else if (smush < 0) smush2 = 0; else smush2 = (smush & 31) | SM_SMUSH; } if (charheight<1) { charheight = 1; } if (maxlen<1) { maxlen = 1; } maxlen += 100; /* Give ourselves some extra room */ if (smushoverride == SMO_NO) smushmode = smush2; else if (smushoverride == SMO_FORCE) smushmode |= smush2; if (right2left<0) { right2left = ffright2left; } if (justification<0) { justification = 2*right2left; } fileline = (char*)myalloc(sizeof(char)*(maxlen+1)); /* Allocate "missing" character */ fcharlist = (fcharnode*)myalloc(sizeof(fcharnode)); fcharlist->ord = 0; fcharlist->thechar = (char**)myalloc(sizeof(char*)*charheight); fcharlist->next = NULL; for (row=0;row<charheight;row++) { fcharlist->thechar[row] = (char*)myalloc(sizeof(char)); fcharlist->thechar[row][0] = '\0'; } for (theord=' ';theord<='~';theord++) { readfontchar(fontfile,theord,fileline,maxlen); } for (theord=0;theord<=6;theord++) { readfontchar(fontfile,deutsch[theord],fileline,maxlen); } while (fontfile.ReadString(fileline,maxlen+1)==NULL?0: sscanf(fileline,"%li",&theord)==1) { readfontchar(fontfile,theord,fileline,maxlen); } myfree(fileline); } /**************************************************************************** clearline Clears both the input (inchrline) and output (outputline) storage. ****************************************************************************/ static void clearline() { int i; for (i=0;i<charheight;i++) { outputline[i][0] = '\0'; } outlinelen = 0; inchrlinelen = 0; } /**************************************************************************** linealloc Allocates & clears outputline, inchrline. Sets inchrlinelenlimit. Called near beginning of main(). ****************************************************************************/ static void linealloc() { int row; outputline = (char**)myalloc(sizeof(char*)*charheight); for (row=0;row<charheight;row++) { outputline[row] = (char*)myalloc(sizeof(char)*(outlinelenlimit+1)); } inchrlinelenlimit = outputwidth*4+100; inchrline = (inchr*)myalloc(sizeof(inchr)*(inchrlinelenlimit+1)); clearline(); } /**************************************************************************** linefree Frees outputline, inchrline. ****************************************************************************/ static void linefree() { int row; if (outputline) { for (row=0;row<charheight;row++) { if (outputline[row]) myfree (outputline[row]); outputline[row] = NULL; } myfree (outputline); outputline = NULL; } if (inchrline) myfree (inchrline); inchrline = NULL; } static void fontfree() { int row; fcharnode *charptr, *nextptr; for (charptr=fcharlist; charptr; charptr=nextptr) { nextptr = charptr->next; // next node if (charptr->thechar) { for (row=0;row<charheight;row++) { if (charptr->thechar[row]) myfree (charptr->thechar[row]); charptr->thechar[row] = NULL; } myfree (charptr->thechar); charptr->thechar = NULL; } myfree (charptr); charptr = NULL; } // end of traversing list fcharlist = NULL; // list is empty now } /**************************************************************************** getletter Sets currchar to point to the font entry for the given character. Sets currcharwidth to the width of this character. ****************************************************************************/ static void getletter(inchr c) { fcharnode *charptr; for (charptr=fcharlist;charptr==NULL?0:charptr->ord!=c; charptr=charptr->next) ; if (charptr!=NULL) { currchar = charptr->thechar; } else { for (charptr=fcharlist;charptr==NULL?0:charptr->ord!=0; charptr=charptr->next) ; currchar = charptr->thechar; } previouscharwidth = currcharwidth; currcharwidth = MYSTRLEN(currchar[0]); } /**************************************************************************** smushem Given 2 characters, attempts to smush them into 1, according to smushmode. Returns smushed character or '\0' if no smushing can be done. smushmode values are sum of following (all values smush blanks): 1: Smush equal chars (not hardblanks) 2: Smush '_' with any char in hierarchy below 4: hierarchy: "|", "/\", "[]", "{}", "()", "<>" Each class in hier. can be replaced by later class. 8: [ + ] -> |, { + } -> |, ( + ) -> | 16: / + \ -> X, > + < -> X (only in that order) 32: hardblank + hardblank -> hardblank ****************************************************************************/ static char smushem(char lch,char rch) { if (lch==' ') return rch; if (rch==' ') return lch; if (previouscharwidth<2 || currcharwidth<2) return '\0'; /* Disallows overlapping if the previous character */ /* or the current character has a width of 1 or zero. */ if ((smushmode & SM_SMUSH) == 0) return '\0'; /* kerning */ if ((smushmode & 63) == 0) { /* This is smushing by universal overlapping. */ if (lch==' ') return rch; if (rch==' ') return lch; if (lch==hardblank) return rch; if (rch==hardblank) return lch; /* Above four lines ensure overlapping preference to */ /* visible characters. */ if (right2left==1) return lch; /* Above line ensures that the dominant (foreground) */ /* fig-character for overlapping is the latter in the */ /* user's text, not necessarily the rightmost character. */ return rch; /* Occurs in the absence of above exceptions. */ } if (smushmode & SM_HARDBLANK) { if (lch==hardblank && rch==hardblank) return lch; } if (lch==hardblank || rch==hardblank) return '\0'; if (smushmode & SM_EQUAL) { if (lch==rch) return lch; } if (smushmode & SM_LOWLINE) { if (lch=='_' && strchr("|/\\[]{}()<>",rch)) return rch; if (rch=='_' && strchr("|/\\[]{}()<>",lch)) return lch; } if (smushmode & SM_HIERARCHY) { if (lch=='|' && strchr("/\\[]{}()<>",rch)) return rch; if (rch=='|' && strchr("/\\[]{}()<>",lch)) return lch; if (strchr("/\\",lch) && strchr("[]{}()<>",rch)) return rch; if (strchr("/\\",rch) && strchr("[]{}()<>",lch)) return lch; if (strchr("[]",lch) && strchr("{}()<>",rch)) return rch; if (strchr("[]",rch) && strchr("{}()<>",lch)) return lch; if (strchr("{}",lch) && strchr("()<>",rch)) return rch; if (strchr("{}",rch) && strchr("()<>",lch)) return lch; if (strchr("()",lch) && strchr("<>",rch)) return rch; if (strchr("()",rch) && strchr("<>",lch)) return lch; } if (smushmode & SM_PAIR) { if (lch=='[' && rch==']') return '|'; if (rch=='[' && lch==']') return '|'; if (lch=='{' && rch=='}') return '|'; if (rch=='{' && lch=='}') return '|'; if (lch=='(' && rch==')') return '|'; if (rch=='(' && lch==')') return '|'; } if (smushmode & SM_BIGX) { if (lch=='/' && rch=='\\') return '|'; if (rch=='/' && lch=='\\') return 'Y'; if (lch=='>' && rch=='<') return 'X'; /* Don't want the reverse of above to give 'X'. */ } return '\0'; } /**************************************************************************** smushamt Returns the maximum amount that the current character can be smushed into the current line. ****************************************************************************/ static int smushamt() { int maxsmush,amt; int row,linebd,charbd; char ch1,ch2; if ((smushmode & (SM_SMUSH | SM_KERN)) == 0) { return 0; } maxsmush = currcharwidth; for (row=0;row<charheight;row++) { if (right2left) { for (charbd=MYSTRLEN(currchar[row]); ch1=currchar[row][charbd],(charbd>0&&(!ch1||ch1==' '));charbd--) ; for (linebd=0;ch2=outputline[row][linebd],ch2==' ';linebd++) ; amt = linebd+currcharwidth-1-charbd; } else { for (linebd=MYSTRLEN(outputline[row]); ch1 = outputline[row][linebd],(linebd>0&&(!ch1||ch1==' '));linebd--) ; for (charbd=0;ch2=currchar[row][charbd],ch2==' ';charbd++) ; amt = charbd+outlinelen-1-linebd; } if (!ch1||ch1==' ') { amt++; } else if (ch2) { if (smushem(ch1,ch2)!='\0') { amt++; } } if (amt<maxsmush) { maxsmush = amt; } } return maxsmush; } /**************************************************************************** addchar Attempts to add the given character onto the end of the current line. Returns 1 if this can be done, 0 otherwise. ****************************************************************************/ static int addchar(inchr c) { int smushamount,row,k; char *templine; getletter(c); smushamount = smushamt(); if (outlinelen+currcharwidth-smushamount>outlinelenlimit ||inchrlinelen+1>inchrlinelenlimit) { return 0; } templine = (char*)myalloc(sizeof(char)*(outlinelenlimit+1)); for (row=0;row<charheight;row++) { if (right2left) { strcpy(templine,currchar[row]); for (k=0;k<smushamount;k++) { templine[currcharwidth-smushamount+k] = smushem(templine[currcharwidth-smushamount+k],outputline[row][k]); } strcat(templine,outputline[row]+smushamount); strcpy(outputline[row],templine); } else { for (k=0;k<smushamount;k++) { outputline[row][outlinelen-smushamount+k] = smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]); } strcat(outputline[row],currchar[row]+smushamount); } } myfree(templine); outlinelen = MYSTRLEN(outputline[0]); inchrline[inchrlinelen++] = c; return 1; } void CTextView::OnEditAsciiart() { CAsciiArtDlg dlg; dlg.m_strText = App.m_strAsciiArtText; dlg.m_iLayout = App.m_iAsciiArtLayout; dlg.m_strFont = App.m_strAsciiArtFont; if (dlg.DoModal () != IDOK) return; // remember text but don't save in registry App.m_strAsciiArtText = dlg.m_strText; // remember layout in registry if (dlg.m_iLayout != (int) App.m_iAsciiArtLayout) App.db_write_int ("prefs", "AsciiArtLayout", dlg.m_iLayout); App.m_iAsciiArtLayout = dlg.m_iLayout; // remember font in registry if (dlg.m_strFont != App.m_strAsciiArtFont) App.db_write_string ("prefs", "AsciiArtFont", dlg.m_strFont); App.m_strAsciiArtFont = dlg.m_strFont; CString str = dlg.m_strText; switch (dlg.m_iLayout) { case 1: // full smush smushmode = SM_SMUSH; smushoverride = SMO_FORCE; break; case 2: // kern smushmode = SM_KERN; smushoverride = SMO_YES; break; case 3: // full width smushmode = 0; smushoverride = SMO_YES; break; case 4: // overlap smushmode = SM_SMUSH; smushoverride = SMO_YES; break; default: // default is normal smush smushoverride = SMO_NO; break; } // end of switch inchr c; int i; try { getparams (); readfont (dlg.m_strFont); linealloc(); for (i = 0; i < str.GetLength (); i++) { c = str [i]; if (isascii(c)&&isspace(c)) { c = (c=='\t'||c==' ') ? ' ' : '\n'; } if ((c>'\0' && c<' ' && c!='\n') || c==127) continue; addchar (c); } // end of processing each character for (i=0;i<charheight;i++) { CString strLine = Replace (outputline[i], hardblank, " "); GetEditCtrl ().ReplaceSel (CFormat ("%s%s", (LPCTSTR) strLine, ENDLINE), true); } linefree (); fontfree (); } catch (CException* e) { e->ReportError(); e->Delete(); linefree (); // free memory used fontfree (); } }
[ "nick@gammon.com.au" ]
nick@gammon.com.au
09bd8d81b20cdafb518ae4d207a018936fa51a46
28c83c7cf21ae5363a0de614d13fac32bca764e2
/Engine/include/openface/FaceWorker.h
112d1058f03b93f2b7b95d29b8f58d33969c23f4
[]
no_license
sumit33k/Emotinal-behaviour-analytics
477eea2cf39ab460aab9e021cda694190d690191
f53562e8b46fd1fc4b219ca37c2fc656a189b82c
refs/heads/master
2021-08-30T16:31:50.783313
2017-12-18T16:44:11
2017-12-18T16:44:11
114,663,050
0
0
null
null
null
null
UTF-8
C++
false
false
4,255
h
#pragma once #ifndef __FACE_WORKER_H #define __FACE_WORKER_H #include <thread> #include <atomic> #include <chrono> #include <FaceQueue.h> #define WORKER_DEFAULT_QUEUESIZE 2 namespace OpenFace { /// <summary> /// Base class wrapping an async worker-thread. /// </summary> template <typename T, typename U, typename W> class Worker { protected: ::std::thread mThread; ::std::atomic<bool> mIsRunning; ::std::atomic<float> mFPS; ::std::chrono::time_point<::std::chrono::high_resolution_clock> mTick; ::std::chrono::time_point<::std::chrono::high_resolution_clock> mTickLast; ::std::chrono::time_point<::std::chrono::high_resolution_clock> mTickLastMeasure; ::std::chrono::duration<long long, ::std::nano> mTickDelta; Queue<T> mQueueIn; Queue<U> mQueueOut; Queue<W> mCommands; long long mProcessedCount; virtual void init() { } virtual void shutdown() { } virtual void process(T item) { } virtual void execute(W command) { } /// <summary> /// This code is executed by the internal worker-thread /// </summary> void threadProc() { // get init ticks mTickLast = ::std::chrono::high_resolution_clock::now(); mTick = ::std::chrono::high_resolution_clock::now(); // mini sleep ::std::this_thread::sleep_for(::std::chrono::milliseconds(1)); // init of subclasses init(); /////////////////////////////////////////////////////////////////////////// // threadloop while (mIsRunning.load()) { // update current tick and delta to last tick mTick = ::std::chrono::high_resolution_clock::now(); mTickDelta = mTick - mTickLast; /////////////////////////////////////////////////////////////////////// // get span since last tps measuring const ::std::chrono::duration<long long, ::std::nano> NANOS_SINCE_MEASURE = mTick - mTickLastMeasure; // possibly calculate new TPS value for last span (every ~1000ms) if (NANOS_SINCE_MEASURE >= ::std::chrono::milliseconds(1000)) { const float RATIO = (float)mProcessedCount / (float)NANOS_SINCE_MEASURE.count(); mFPS.store(1000000000.0f * RATIO); // reset counter and store last TPS update tick mProcessedCount = 0; mTickLastMeasure = mTick; } /////////////////////////////////////////////////////////////////////// // try get command W command = mCommands.dequeue(); if (command) { execute(command); } /////////////////////////////////////////////////////////////////////// // try get work item T item = mQueueIn.dequeue(); // if there is an item, process it and immediately loop again if (item) { process(item); mProcessedCount++; } // otherwise sleep a bit else ::std::this_thread::sleep_for(::std::chrono::milliseconds(1)); /////////////////////////////////////////////////////////////////////// // save this tick as last tick mTickLast = mTick; } // shutdown of subclasses shutdown(); } public: /// <summary> /// Constructor /// </summary> Worker() : mIsRunning(false), mQueueIn(WORKER_DEFAULT_QUEUESIZE), mQueueOut(WORKER_DEFAULT_QUEUESIZE) { } /// <summary> /// Destructor /// </summary> ~Worker() { // free remaining queue items while (T item = mQueueIn.dequeue()) delete item; } /// <summary> /// Starts or stops the worker /// </summary> void setIsRunning(bool isRunning) { if (!mIsRunning.load()) { mIsRunning.store(true); mThread = ::std::thread(&Worker::threadProc, this); mThread.detach(); } else mIsRunning.store(false); } /// <summary> /// Returns current FPS rate. /// </summary> __forceinline float getFPS() { return mFPS.load(); } /// <summary> /// Adds a new task for the worker. /// </summary> __forceinline bool enqueueWork(T item) { return mQueueIn.enqueue(item); } /// <summary> /// Returns the next task result from the worker. /// </summary> __forceinline U dequeueResult() { return mQueueOut.dequeue(); } }; } #endif
[ "sumit3.k@gmail.com" ]
sumit3.k@gmail.com
863666a272d5a0cdc3130ed4b42b09096bfaf865
9846a863830457aba89f2f1b595d8e35f2e45faa
/Caja.cpp
bb8d8b210576286f99c4b61de2403e16636a3c1a
[]
no_license
lismunozfortea/Pang
c900f53e5c17db5889fc66f4215214cacbfbe597
22211a1d685343fe8851adb13ddb41198ad13b8e
refs/heads/main
2023-04-10T11:03:55.211523
2021-04-18T18:46:27
2021-04-18T18:46:27
359,226,153
1
1
null
null
null
null
UTF-8
C++
false
false
507
cpp
#include "freeglut.h" #include "Caja.h" Caja::Caja() { suelo.setColor(30, 89, 69); techo.setColor(30, 89, 69); pared_dcha.setColor(32, 96, 61); pared_izq.setColor(32, 96, 61); pared_izq.setLimits(-10.0f, -10.0f, 0.0f, 15.0f); techo.setLimits(-10.0f, 10.0f, 15.0f, 15.0f); pared_dcha.setLimits(10.0f, 10.0f, 15.0f, 0.0f); suelo.setLimits(10.0f, -10.0f, 0.0f, 0.0f); } void Caja::Dibuja() { suelo.Dibuja(); techo.Dibuja(); pared_izq.Dibuja(); pared_dcha.Dibuja(); }
[ "noreply@github.com" ]
lismunozfortea.noreply@github.com
7c401d629b761ed66bd633b2c5f6348fd19e4191
7e48d392300fbc123396c6a517dfe8ed1ea7179f
/RodentVR/Intermediate/Build/Win64/RodentVR/Inc/AnimationCore/NodeChain.generated.h
04475bb3592a3d097f440dc3dd816a1e46b40724
[]
no_license
WestRyanK/Rodent-VR
f4920071b716df6a006b15c132bc72d3b0cba002
2033946f197a07b8c851b9a5075f0cb276033af6
refs/heads/master
2021-06-14T18:33:22.141793
2020-10-27T03:25:33
2020-10-27T03:25:33
154,956,842
1
1
null
2018-11-29T09:56:21
2018-10-27T11:23:11
C++
UTF-8
C++
false
false
1,026
h
// 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/ObjectMacros.h" #include "UObject/ScriptMacros.h" PRAGMA_DISABLE_DEPRECATION_WARNINGS #ifdef ANIMATIONCORE_NodeChain_generated_h #error "NodeChain.generated.h already included, missing '#pragma once' in NodeChain.h" #endif #define ANIMATIONCORE_NodeChain_generated_h #define Engine_Source_Runtime_AnimationCore_Public_NodeChain_h_12_GENERATED_BODY \ friend struct Z_Construct_UScriptStruct_FNodeChain_Statics; \ static class UScriptStruct* StaticStruct(); template<> ANIMATIONCORE_API UScriptStruct* StaticStruct<struct FNodeChain>(); #undef CURRENT_FILE_ID #define CURRENT_FILE_ID Engine_Source_Runtime_AnimationCore_Public_NodeChain_h PRAGMA_ENABLE_DEPRECATION_WARNINGS
[ "west.ryan.k@gmail.com" ]
west.ryan.k@gmail.com
6653fbfbe95ce2cfb182301540389c894c4a6862
0c55a1486d32b05165400bfe3b724a0c02c3b338
/src/gui/app/Widgets/Button.h
b7eba7031c629ecf76a59869b3e5c4e6b82b984c
[]
no_license
hubert-kniola/szt-OS
4ad39a6fc9180779e9a78ea4c5d2b3c82bce5ff9
28fe68f10b76e201762cc50f4d14b2b347edb6bc
refs/heads/master
2022-04-04T13:47:57.049904
2020-01-15T20:55:23
2020-01-15T20:55:23
256,813,954
1
0
null
2020-04-18T17:33:39
2020-04-18T17:33:38
null
UTF-8
C++
false
false
802
h
#pragma once #include <SFML/Graphics.hpp> #include "../CommandButton.h" class Button { public: Button(float x, float y, const sf::Vector2f& size, const sf::String& title); virtual ~Button() = default; bool draw{ false }; bool clicked{ false }; bool areCommandsDrawn{ false }; virtual sf::FloatRect getGlobalBounds() const; virtual void markAsClicked(); virtual void markAsReleased(); void drawCommands(); void hideCommands(); virtual void setTemporaryColor(const sf::Color& color); virtual void drawTo(sf::RenderWindow& window) const; virtual void setPosition(const sf::Vector2f& position); virtual void setLabelFont(const sf::Font& font); std::vector<CommandButton> commands; private: sf::RectangleShape shape_; sf::Text label_; virtual void setRelativeLabelPosition_(); };
[ "bartoshmen@gmail.com" ]
bartoshmen@gmail.com
abda941e3ae111cc2b5e1613e65052d4ab6ff2b5
fc49c32c386e7b92f07848563aad0cf5d2a7acbc
/src/cthreadmgr.cpp
763e970f5e56c580d1a99dd67f7274ce5e5c42fb
[ "Apache-2.0" ]
permissive
joropito/argus
2e498ad3cac99473aca32656f04efe08cc7de603
22262a8edd0b6e3761c17092a4b0a05030e6e4e5
refs/heads/master
2021-01-19T06:39:49.146345
2019-01-04T13:53:42
2019-01-04T13:53:42
63,802,379
0
0
null
null
null
null
UTF-8
C++
false
false
2,783
cpp
#include "cthreadmgr.h" #include <iostream> #include <pthread.h> #include <unistd.h> using namespace std; void *Thread_Run(void *p) { CThreadMgr::ThreadPool_t* Thread = (CThreadMgr::ThreadPool_t*)p; CThreadMgr *mgr = Thread->m_pThreadMgr; mgr->m_pFunc(p); sleep(rand()%10); Thread->m_bActive = false; pthread_exit(NULL); } CThreadMgr::CThreadMgr(int max, int cleanuptime, string appname, void *(*func)(void*)) : m_iMax(max), m_iCleanupTime(cleanuptime), m_pFunc(func), m_sAppName(appname), m_bShutdown(false) { }; CThreadMgr::~CThreadMgr() { }; /* On step at a time */ int CThreadMgr::Tick() { ThreadPool_t* thr; void *status; /* Check for finished threads */ for(list<ThreadPool_t*>::iterator it=m_pThreads.begin(); it != m_pThreads.end(); ++it) { thr = (*it); if(!thr->m_bActive) { it++; FinishThread(thr->m_iThreadId); } } int total = ActiveThreads(); /* Start/Restart threads for available slots */ while(total < m_iMax) total += StartThread(total); } void CThreadMgr::SetShutdown() { m_bShutdown = true; } /* Shutdown the whole thread system */ int CThreadMgr::Shutdown() { ThreadPool_t* thr; void *status; m_bShutdown = true; while(CountThreads() > 0) { for(list<ThreadPool_t*>::iterator it=m_pThreads.begin(); it != m_pThreads.end(); ++it) { thr = (*it); if(!thr->m_bActive) { it++; FinishThread(thr->m_iThreadId); } } } } /* Wait for a thread to finish */ int CThreadMgr::FinishThread(int iThreadId) { ThreadPool_t* thr; void *status; for(list<ThreadPool_t*>::iterator it=m_pThreads.begin(); it != m_pThreads.end(); ++it) { thr = (*it); if(thr->m_iThreadId == iThreadId && !thr->m_bActive) { pthread_join(thr->m_pThread, &status); it = m_pThreads.erase(it); delete thr; return 0; } } return 1; } /* Start a thread */ int CThreadMgr::StartThread(int iThreadId) { ThreadPool_t *thr = (new ThreadPool_t); thr->m_iThreadId = iThreadId; thr->m_bActive = true; thr->m_bHandled = false; thr->m_pThreadMgr = this; m_pThreads.push_back(thr); pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); pthread_create(&thr->m_pThread, NULL, Thread_Run, (void*)thr); return 1; } int CThreadMgr::CountThreads() { return m_pThreads.size(); } int CThreadMgr::ActiveThreads() { int total = 0; ThreadPool_t* thr; for(list<ThreadPool_t*>::iterator it=m_pThreads.begin(); it != m_pThreads.end(); ++it) { thr = (*it); if(thr->m_bActive) total++; } return total; } int CThreadMgr::FinishedThreads() { int total = 0; ThreadPool_t* thr; for(list<ThreadPool_t*>::iterator it=m_pThreads.begin(); it != m_pThreads.end(); ++it) { thr = (*it); if(!thr->m_bActive) total++; } return total; }
[ "noreply@github.com" ]
joropito.noreply@github.com
8bc8c0dcfbf0978ba15f9b6de9ac1f5fb138f682
0800620ddb9aacb0eb5fe1550ce2fd20825029d3
/Día 4/E/E_no.cpp
182b35db7ac05880eba614e931e0d989bfb381eb
[]
no_license
IgnacioYanjari/Campamento
c95435f754c87045a85fd7dca6798dc6decbc84c
27ffd2a08093a4eab30c6d54d6e41628c855128e
refs/heads/master
2021-06-20T17:32:54.315661
2017-07-25T04:38:29
2017-07-25T04:38:29
97,542,924
0
0
null
2020-04-30T19:58:29
2017-07-18T02:24:13
C++
UTF-8
C++
false
false
2,650
cpp
// Utilities library #include <cstdlib> #include <bitset> #include <functional> #include <utility> #include <tuple> #include <limits> #include <cinttypes> #include <cassert> // Strings library #include <cctype> #include <cstring> #include <string> //Containers library #include <array> #include <vector> #include <deque> #include <list> #include <forward_list> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <stack> #include <queue> // Algorithms library #include <algorithm> // Iterators library #include <iterator> // Numerics library #include <cmath> #include <complex> #include <valarray> #include <numeric> // Input/Ouput library #include <iostream> #include <sstream> #include <iomanip> #include <cstdio> // Localization library #include <locale> // Regular expressions library #include <regex> // Support code using std::cout; using std::cin; using std::size_t; template <class Function> void repeat(std::size_t n, Function f) { while(n--) f(); } template <class T> T input_value(std::istream& input = std::cin) { T value; input >> value; return value; } int dp_bottom(std::vector< std::vector<int> > graph, std::vector<int> &memoized, int m, std::map<int, bool> map){ memoized.at(m) = 1; for(int j = m-1 ; j >=0 ;j--){ int suma=0; for(int i = m; i >= 0 ;i--){ if( graph.at(i).at(j) == 1 ){ suma+=memoized.at(i); } } memoized.at(j) = suma; } return memoized.at(0); } int dp_top_down(std::vector< std::vector<int> > graph, std::vector<int> &memoized, int m, std::map<int, bool> map){ // if(memoized) // memoized.at(m) = 1; // for(int j = m-1 ; j >=0 ;j--){ // int suma=0; // for(int i = m; i >= 0 ;i--){ // if( graph.at(i).at(j) == 1 ){ // suma+=memoized.at(i); // } // } // memoized.at(j) = suma; // } // return memoized.at(0); } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int N; bool first = true; while(cin>>N){ if(!first) cout<<"\n"; else first = false; std::map<int,bool> map; std::vector< std::vector<int> > graph( N+1 , std::vector<int>(N+1) ); std::vector<int > memoized( N+1 ); for (int i = 0; i < N; i++) { auto K = input_value<int>(); if( K == 0){ map[i] = true; } for (int j = 0; j < K; j++) { auto node = input_value<int>(); graph.at(node).at(i)=1; } } for (auto &elem : map) { graph.at(N).at(elem.first)=1; } std::cout<< dp_bottom(graph,memoized,N,map)<<"\n"; } }
[ "nach116@hotmail.com" ]
nach116@hotmail.com
b3e3ade9a327ac8b311807f8d41e05b6d116fc1d
cf7e0b065f3edbb38b4d8bdf4d63d51fc3b0106f
/src/alembic/lib/Alembic/AbcGeom/XformOp.cpp
fb03753b49e407b9176b8216a38941e53c236504
[]
no_license
appleseedhq/windows-deps
06478bc8ec8f4a9ec40399b763a038e5a76dfbf7
7955c4fa1c9e39080862deb84f5e4ddf0cf71f62
refs/heads/master
2022-11-21T07:16:35.646878
2019-12-11T19:46:46
2020-07-19T08:57:23
16,730,675
5
8
null
2020-07-19T08:57:25
2014-02-11T12:54:46
C++
UTF-8
C++
false
false
15,454
cpp
//-***************************************************************************** // // Copyright (c) 2009-2011, // Sony Pictures Imageworks, Inc. and // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. // // 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 Sony Pictures Imageworks, nor // Industrial Light & Magic nor the names of their contributors may be used // to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //-***************************************************************************** #include <Alembic/AbcGeom/XformOp.h> #include <boost/format.hpp> namespace Alembic { namespace AbcGeom { namespace ALEMBIC_VERSION_NS { //-***************************************************************************** XformOp::XformOp() : m_type( kTranslateOperation ) , m_hint( 0 ) { m_channels.clear(); m_channels.resize( 3 ); } //-***************************************************************************** XformOp::XformOp( const XformOperationType iType, const Alembic::Util::uint8_t iHint ) : m_type( iType ) { m_channels.clear(); switch ( m_type ) { case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: m_channels.resize( 1 ); break; case kScaleOperation: case kTranslateOperation: m_channels.resize( 3 ); break; case kRotateOperation: m_channels.resize( 4 ); break; case kMatrixOperation: m_channels.resize( 16 ); break; } setHint( iHint ); } //-***************************************************************************** XformOp::XformOp( const Alembic::Util::uint8_t iEncodedOp ) { m_type = (XformOperationType)(iEncodedOp >> 4); setHint( iEncodedOp & 0xF ); switch ( m_type ) { case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: m_channels.resize( 1 ); break; case kScaleOperation: case kTranslateOperation: m_channels.resize( 3 ); break; case kRotateOperation: m_channels.resize( 4 ); break; case kMatrixOperation: m_channels.resize( 16 ); break; } } //-***************************************************************************** XformOperationType XformOp::getType() const { return m_type; } //-***************************************************************************** void XformOp::setType( const XformOperationType iType ) { m_type = iType; m_hint = 0; switch ( m_type ) { case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: m_channels.resize( 1 ); break; case kScaleOperation: case kTranslateOperation: m_channels.resize( 3 ); break; case kRotateOperation: m_channels.resize( 4 ); break; case kMatrixOperation: m_channels.resize( 16 ); break; } } //-***************************************************************************** uint8_t XformOp::getHint() const { return m_hint; } //-***************************************************************************** void XformOp::setHint( const Alembic::Util::uint8_t iHint ) { // if a non-existant hint value is set, default it to 0 if ( m_type == kScaleOperation && iHint > kScaleHint ) { m_hint = 0; } else if ( m_type == kTranslateOperation && iHint > kRotatePivotTranslationHint ) { m_hint = 0; } else if ( ( m_type == kRotateOperation || m_type == kRotateXOperation || m_type == kRotateYOperation || m_type == kRotateZOperation ) && iHint > kRotateOrientationHint ) { m_hint = 0; } else if ( m_type == kMatrixOperation && iHint > kMayaShearHint ) { m_hint = 0; } else { m_hint = iHint; } } //-***************************************************************************** bool XformOp::isXAnimated() const { if ( m_type == kRotateXOperation || m_type == kRotateYOperation || m_type == kRotateZOperation ) { return false; } return m_animChannels.count( 0 ) > 0; } //-***************************************************************************** bool XformOp::isYAnimated() const { if ( m_type == kRotateXOperation || m_type == kRotateYOperation || m_type == kRotateZOperation ) { return false; } return m_animChannels.count( 1 ) > 0; } //-***************************************************************************** bool XformOp::isZAnimated() const { if ( m_type == kRotateXOperation || m_type == kRotateYOperation || m_type == kRotateZOperation ) { return false; } return m_animChannels.count( 2 ) > 0; } //-***************************************************************************** bool XformOp::isAngleAnimated() const { if ( m_type == kRotateXOperation || m_type == kRotateYOperation || m_type == kRotateZOperation ) { return m_animChannels.count( 0 ) > 0; } return m_animChannels.count( 3 ) > 0; } //-***************************************************************************** bool XformOp::isChannelAnimated( std::size_t iIndex ) const { return m_animChannels.count( iIndex ) > 0; } //-***************************************************************************** std::size_t XformOp::getNumChannels() const { return m_channels.size(); } //-***************************************************************************** double XformOp::getDefaultChannelValue( std::size_t iIndex ) const { switch ( m_type ) { case kTranslateOperation: case kRotateOperation: case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: return 0.0; case kScaleOperation: return 1.0; case kMatrixOperation: switch ( iIndex ) { case 0: case 5: case 10: case 15: return 1.0; default: return 0.0; } default: return 0.0; } } //-***************************************************************************** double XformOp::getChannelValue( std::size_t iIndex ) const { return m_channels[iIndex]; } //-***************************************************************************** void XformOp::setChannelValue( std::size_t iIndex, double iVal ) { m_channels[iIndex] = iVal; } //-***************************************************************************** Alembic::Util::uint8_t XformOp::getOpEncoding() const { return ( m_type << 4 ) | ( m_hint & 0xF ); } //-***************************************************************************** bool XformOp::isTranslateOp() const { return m_type == kTranslateOperation; } //-***************************************************************************** bool XformOp::isScaleOp() const { return m_type == kScaleOperation; } //-***************************************************************************** bool XformOp::isRotateOp() const { return m_type == kRotateOperation; } //-***************************************************************************** bool XformOp::isMatrixOp() const { return m_type == kMatrixOperation; } //-***************************************************************************** bool XformOp::isRotateXOp() const { return m_type == kRotateXOperation; } //-***************************************************************************** bool XformOp::isRotateYOp() const { return m_type == kRotateYOperation; } //-***************************************************************************** bool XformOp::isRotateZOp() const { return m_type == kRotateZOperation; } //-***************************************************************************** void XformOp::setVector( const Abc::V3d &iVec ) { ABCA_ASSERT( m_type != kMatrixOperation, "Meaningless to set Abc::V3d on matrix op" ); m_channels[0] = iVec.x; m_channels[1] = iVec.y; m_channels[2] = iVec.z; } //-***************************************************************************** void XformOp::setTranslate( const Abc::V3d &iTrans ) { ABCA_ASSERT( m_type == kTranslateOperation, "Meaningless to set translate on non-translate op." ); this->setVector( iTrans ); } //-***************************************************************************** void XformOp::setScale( const Abc::V3d &iScale ) { ABCA_ASSERT( m_type == kScaleOperation, "Meaningless to set scale on non-scale op." ); this->setVector( iScale ); } //-***************************************************************************** void XformOp::setAxis( const Abc::V3d &iAxis ) { ABCA_ASSERT( m_type == kRotateOperation, "Meaningless to set rotation axis on non-rotation or fixed " "angle rotation op." ); this->setVector( iAxis ); } //-***************************************************************************** void XformOp::setAngle( const double iAngle ) { switch ( m_type ) { case kRotateOperation: m_channels[3] = iAngle; break; case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: m_channels[0] = iAngle; break; default: ABCA_THROW( "Meaningless to set rotation angle on non-rotation op." ); } } //-***************************************************************************** void XformOp::setMatrix( const Abc::M44d &iMatrix ) { ABCA_ASSERT( m_type == kMatrixOperation, "Cannot set non-matrix op from Abc::M44d" ); for ( size_t i = 0 ; i < 4 ; ++i ) { for ( size_t j = 0 ; j < 4 ; ++j ) { m_channels[( i * 4 ) + j] = iMatrix.x[i][j]; } } } //-***************************************************************************** Abc::V3d XformOp::getVector() const { ABCA_ASSERT( m_type != kMatrixOperation, "Meaningless to get Abc::V3d from matrix op" ); return Abc::V3d( m_channels[0], m_channels[1], m_channels[2] ); } //-***************************************************************************** Abc::V3d XformOp::getTranslate() const { ABCA_ASSERT( m_type == kTranslateOperation, "Meaningless to get translate vector from non-translate op." ); return this->getVector(); } //-***************************************************************************** Abc::V3d XformOp::getScale() const { ABCA_ASSERT( m_type == kScaleOperation, "Meaningless to get scaling vector from non-scale op." ); return this->getVector(); } //-***************************************************************************** Abc::V3d XformOp::getAxis() const { switch ( m_type ) { case kRotateOperation: return this->getVector(); case kRotateXOperation: return Abc::V3d(1.0, 0.0, 0.0); case kRotateYOperation: return Abc::V3d(0.0, 1.0, 0.0); case kRotateZOperation: return Abc::V3d(0.0, 0.0, 1.0); default: ABCA_THROW( "Meaningless to get rotation axis from non-rotation op." ); } return Abc::V3d(0.0, 0.0, 0.0); } //-***************************************************************************** double XformOp::getAngle() const { switch ( m_type ) { case kRotateOperation: return m_channels[3]; case kRotateXOperation: case kRotateYOperation: case kRotateZOperation: return m_channels[0]; default: ABCA_THROW( "Meaningless to get rotation angle from non-rotation op." ); } return 0.0; } //-***************************************************************************** double XformOp::getXRotation() const { ABCA_ASSERT( m_type == kRotateOperation || m_type == kRotateXOperation, "Meaningless to get rotation angle from non-rotation op." ); if ( m_type == kRotateXOperation ) { return m_channels[0]; } else { Abc::M44d m; Abc::V3d rot; m.makeIdentity(); m.setAxisAngle( this->getVector(), DegreesToRadians( m_channels[3] ) ); Imath::extractEulerXYZ( m, rot ); return RadiansToDegrees( rot[0] ); } } //-***************************************************************************** double XformOp::getYRotation() const { ABCA_ASSERT( m_type == kRotateOperation || m_type == kRotateYOperation, "Meaningless to get rotation angle from non-rotation op." ); if ( m_type == kRotateYOperation ) { return m_channels[0]; } else { Abc::M44d m; Abc::V3d rot; m.makeIdentity(); m.setAxisAngle( this->getVector(), DegreesToRadians( m_channels[3] ) ); Imath::extractEulerXYZ( m, rot ); return RadiansToDegrees( rot[1] ); } } //-***************************************************************************** double XformOp::getZRotation() const { ABCA_ASSERT( m_type == kRotateOperation || m_type == kRotateZOperation, "Meaningless to get rotation angle from non-rotation op." ); if ( m_type == kRotateZOperation ) { return m_channels[0]; } else { Abc::M44d m; Abc::V3d rot; m.makeIdentity(); m.setAxisAngle( this->getVector(), DegreesToRadians( m_channels[3] ) ); Imath::extractEulerXYZ( m, rot ); return RadiansToDegrees( rot[2] ); } } //-***************************************************************************** Abc::M44d XformOp::getMatrix() const { ABCA_ASSERT( m_type == kMatrixOperation, "Can't get matrix from non-matrix op." ); Abc::M44d ret; for ( size_t i = 0 ; i < 4 ; ++i ) { for ( size_t j = 0 ; j < 4 ; ++j ) { ret.x[i][j] = m_channels[( i * 4 ) + j]; } } return ret; } } // End namespace ALEMBIC_VERSION_NS } // End namespace AbcGeom } // End namespace Alembic
[ "beaune@aist.enst.fr" ]
beaune@aist.enst.fr
104040b3d3b7b542b7eb4a58a645168b0ffe7a16
d2fcf9142c2a35065271848d0bf0b2ef38c7643b
/cf/dp_problems/580A.cpp
3b65b89e58945470a5b3206e0dcfbe59192dfe5e
[]
no_license
yashrsharma44/cp-archive
ede0e3cb67a388f760ef18907ad64b46e6223b9a
1baea4d1614fa637d9e4acf9dbaa261aec9f906e
refs/heads/master
2020-11-24T04:53:07.055089
2019-12-14T05:53:22
2019-12-14T05:53:22
227,973,288
0
0
null
null
null
null
UTF-8
C++
false
false
366
cpp
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<int> res; for(int i=0;i<n;i++){ int a; cin>>a; res.push_back(a); } int len_max=1; int mx = -1; for(int i=1;i<res.size();i++){ if(res[i-1] <= res[i]){ len_max+=1; } else { mx = max(mx, len_max); len_max = 1; } } cout << max(len_max, mx)<<endl; }
[ "yashrsharma44@gmail.com" ]
yashrsharma44@gmail.com
454f360ae9b84e006acb8d94c6fad62e0dca0c2b
4fdac6b6c7034fe087847497847727fb7bee5f9f
/Adapter.h
76526d9d4af85d17f849ed6f6890a3459165867f
[]
no_license
DennisAL54/Design-patterns
2b08825c2836c9ea2a3dbc78e17a135fd15064ee
f5aa87634f1f968dfffcb941ca87c4e7748fc6ee
refs/heads/master
2022-12-09T14:36:39.045352
2020-09-24T03:01:49
2020-09-24T03:01:49
298,143,214
0
0
null
null
null
null
UTF-8
C++
false
false
167
h
// // Created by dennis on 9/23/20. // #ifndef DESIGN_PATTERNS_ADAPTER_H #define DESIGN_PATTERNS_ADAPTER_H class Adapter { }; #endif //DESIGN_PATTERNS_ADAPTER_H
[ "alejimenezc@hotmail.com" ]
alejimenezc@hotmail.com
baddc9a7467858657209e743d474621fc5efc051
1d2247650a919b96c8ca82bf03f71ce7bacbfb94
/client/client.h
577960f9c45e23e32b746fdfc309ca9c3b789774
[ "BSD-3-Clause" ]
permissive
alisheikh/Replicant
e6d217bee9615478af3625c58c046591279630fe
2091e4f1c55d8bd9c710739bc48ac8eb74004cf4
refs/heads/master
2020-12-11T05:53:42.202763
2015-05-28T17:41:07
2015-05-28T17:41:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,312
h
// Copyright (c) 2015, Robert Escriva // 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 Replicant nor the names of its contributors may be // used to endorse or promote products derived from this software without // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. #ifndef replicant_daemon_client_h_ #define replicant_daemon_client_h_ // C #include <stdint.h> // STL #include <list> #include <map> #include <memory> #include <set> // e #include <e/error.h> #include <e/flagfd.h> #include <e/intrusive_ptr.h> // Replicant #include <replicant.h> #include "namespace.h" #include "common/bootstrap.h" #include "common/ids.h" #include "client/mapper.h" BEGIN_REPLICANT_NAMESPACE class pending; class pending_robust; class client { public: client(const char* coordinator, uint16_t port); client(const char* conn_str); ~client() throw (); public: int64_t poke(replicant_returncode* status); int64_t generate_unique_number(replicant_returncode* status, uint64_t* number); int64_t new_object(const char* object, const char* path, replicant_returncode* status); int64_t del_object(const char* object, replicant_returncode* status); int64_t kill_object(const char* object, replicant_returncode* status); int64_t backup_object(const char* object, replicant_returncode* status, char** state, size_t* state_sz); int64_t restore_object(const char* object, const char* backup, size_t backup_sz, replicant_returncode* status); int64_t list_objects(replicant_returncode* status, char** objects); int64_t call(const char* object, const char* func, const char* input, size_t input_sz, unsigned flags, replicant_returncode* status, char** output, size_t* output_sz); int64_t cond_wait(const char* object, const char* cond, uint64_t state, replicant_returncode* status, char** data, size_t* data_sz); int64_t cond_follow(const char* object, const char* cond, enum replicant_returncode* status, uint64_t* state, char** data, size_t* data_sz); int64_t defended_call(const char* object, const char* enter_func, const char* enter_input, size_t enter_input_sz, const char* exit_func, const char* exit_input, size_t exit_input_sz, replicant_returncode* status); int conn_str(replicant_returncode* status, char** servers); int64_t kill_server(uint64_t token, replicant_returncode* status); // looping/polling int64_t loop(int timeout, replicant_returncode* status); int64_t wait(int64_t id, int timeout, replicant_returncode* status); void kill(int64_t id); // Return the fildescriptor that replicant uses for networking int poll_fd(); // Block unitl there is incoming data or the timeout is reached int block(int timeout); // error handling const char* error_message(); const char* error_location(); void set_error_message(const char* msg); public: void reset_busybee(); int64_t inner_loop(replicant_returncode* status); bool maintain_connection(replicant_returncode* status); void possibly_clear_flagfd(); void handle_disruption(server_id si); int64_t send(pending* p); int64_t send_robust(pending_robust* p); bool send(server_id si, std::auto_ptr<e::buffer> msg, replicant_returncode* status); void callback_config(); void callback_tick(); void add_defense(uint64_t nonce) { m_defended.insert(nonce); } private: typedef std::map<std::pair<server_id, uint64_t>, e::intrusive_ptr<pending> > pending_map_t; typedef std::map<std::pair<server_id, uint64_t>, e::intrusive_ptr<pending_robust> > pending_robust_map_t; typedef std::list<e::intrusive_ptr<pending> > pending_list_t; typedef std::list<e::intrusive_ptr<pending_robust> > pending_robust_list_t; // communication bootstrap m_bootstrap; mapper m_busybee_mapper; std::auto_ptr<class busybee_st> m_busybee; // server selection uint64_t m_random_token; // configuration uint64_t m_config_state; char* m_config_data; size_t m_config_data_sz; replicant_returncode m_config_status; configuration m_config; // ticks uint64_t m_ticks; replicant_returncode m_tick_status; // defended nonces std::set<uint64_t> m_defended; // operations int64_t m_next_client_id; uint64_t m_next_nonce; pending_map_t m_pending; pending_robust_map_t m_pending_robust; pending_list_t m_pending_retry; pending_robust_list_t m_pending_robust_retry; pending_list_t m_complete; // persistent background operations pending_list_t m_persistent; // errror e::error m_last_error; // push events and problems up to higher layers e::flagfd m_flagfd; bool m_backoff; // used for internal calls, so they have a status ptr replicant_returncode m_dummy_status; private: client(const client&); client& operator = (const client&); }; END_REPLICANT_NAMESPACE #endif // replicant_daemon_client_h_
[ "robert@rescrv.net" ]
robert@rescrv.net
e81d60a6fd658dbda3df44adda6c1001824ea391
d988f3302c7c4f49583fec21c07658ddb09b81e0
/src/Cpl/TShell/Context_.h
ce28b9bce0f2a94c1b1a7e328de85c0d5aebb6b6
[]
no_license
johnttaylor/colony.apps
2b10141d8cb30067a5e387e6c53af9955549b17b
839f3d62b660111ab122a96f550c8ae9de63faa0
refs/heads/develop
2023-05-10T17:24:58.286447
2021-12-05T20:54:43
2021-12-05T20:54:43
41,272,799
0
0
null
2021-12-05T20:54:45
2015-08-24T00:10:30
C
UTF-8
C++
false
false
2,319
h
#ifndef Cpl_TShell_ContextApi_x_h_ #define Cpl_TShell_ContextApi_x_h_ /*----------------------------------------------------------------------------- * This file is part of the Colony.Core Project. The Colony.Core Project is an * open source project with a BSD type of licensing agreement. See the license * agreement (license.txt) in the top/ directory or on the Internet at * http://integerfox.com/colony.core/license.txt * * Copyright (c) 2014-2020 John T. Taylor * * Redistributions of the source code must retain the above copyright notice. *----------------------------------------------------------------------------*/ /** @file */ #include "Cpl/TShell/ProcessorApi.h" #include "Cpl/TShell/Command.h" #include "Cpl/Container/Map.h" /// namespace Cpl { /// namespace TShell { /** This Private Namespace class defines a "Context" for a TShell command. The Context provide common infrastructure, information, buffers, etc. that facilitates interaction between the Command Processor and individual commands. The application SHOULD NEVER directly access this interface. */ class Context_ : public ProcessorApi { public: /// This method returns the list of implemented commands virtual Cpl::Container::Map<Command>& getCommands() noexcept = 0; public: /// This method encodes and outputs the specified message/text. The method returns false if there was Output Stream error virtual bool writeFrame( const char* text ) noexcept = 0; /// Same as writeFrame(), but only outputs (at most) 'N' bytes as the content of the frame virtual bool writeFrame( const char* text, size_t maxBytes ) noexcept = 0; public: /** This method returns a working buffer for a command to format its output prior to 'writing the frame'. */ virtual Cpl::Text::String& getOutputBuffer() noexcept = 0; /** A shared/common working buffer. The buffer is guaranteed to be large enough hold any valid token from an input frame. The contents of buffer is guaranteed to be empty/cleared. */ virtual Cpl::Text::String& getTokenBuffer() noexcept = 0; /** Same as getTokenBuffer(), except provides a second/separate token buffer */ virtual Cpl::Text::String& getTokenBuffer2() noexcept = 0; public: /// Virtual destructor virtual ~Context_() {} }; }; // end namespaces }; #endif // end header latch
[ "john.t.taylor@gmail.com" ]
john.t.taylor@gmail.com
3c605b30d053912315674f94980c4c5ed214b647
c40c60471d9d6ceeb55cabe1845418f8056c98f3
/Sorting Algos/quick_sort.cpp
0df28a4f7e40987c6c282f2bc0b8fa5d99cdefbe
[]
no_license
bansalmohitwss/Contributed-code-in-Hackoctober
290ab3bab3f8971d850bc07a2ecec7b77eb4cf23
e53f5d8abc08bcfcf8cb7842f7c00478a8102f48
refs/heads/main
2022-12-21T08:03:23.009756
2020-10-03T16:01:46
2020-10-03T16:01:46
300,914,386
0
0
null
2020-10-03T15:35:59
2020-10-03T15:35:58
null
UTF-8
C++
false
false
720
cpp
#include<stdio.h> int partition(int arr[],int l,int u) { int i=l,j=u+1,temp; do{ do{ i++; }while(i<=u && arr[i]<arr[l]); do{ j--; }while(arr[j]>arr[l]); if(j>i) { temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } }while(j>i); temp = arr[l]; arr[l] = arr[j]; arr[j] = temp; return j; } void quick_sort(int arr[],int l,int u) { if(l>=u) return; int k = partition(arr,l,u); quick_sort(arr,l,k-1); quick_sort(arr,k+1,u); } int main() { int n; printf("Enter size of array : "); scanf("%d",&n); int i,arr[n]; for(i=0;i<n;i++) scanf("%d",&arr[i]); quick_sort(arr,0,n-1); for(i=0;i<n;i++) printf("%d ",arr[i]); return 0; }
[ "bansalmohit9414@gmail.com" ]
bansalmohit9414@gmail.com