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 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
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 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0e044dfb4873db8d46a29f19732a5d8330200bdd | c1857ff90afbfd93f1f785c67e57d3c9f62904d8 | /algorithms/cpp/44.WildcardMatching.cpp | 81d71fe2a3d42f3fd1ffd993194ecc2f4d201808 | [] | no_license | shengwudiyi/leetcode | fb86acdaaa5bd00e6e401b35bb93b4c5735f165a | 64939730c470cc373a668ebd994e25e48cf6fcd6 | refs/heads/master | 2021-07-20T11:04:58.848489 | 2020-04-21T05:20:13 | 2020-04-21T05:20:13 | 141,993,956 | 8 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,566 | cpp | // Source : https://leetcode-cn.com/problems/wildcard-matching/
// Author : Lianfeng Shen
// Date : 2019-05-16
// dp
class Solution {
public:
bool isMatch(string s, string p) {
bool dp[s.size()+1][p.size()+1];
fill(dp[0], dp[0] + (s.size()+1) * (p.size()+1), false);
for (int i=0; i <= s.size(); i++) {
for (int j=0; j <= p.size(); j++) {
if (i == 0 && j == 0) {
dp[i][j] = true;
} else if (i == 0) {
dp[i][j] = dp[i][j-1] && p[j-1] == '*';
} else if (j == 0) {
dp[i][j] = false;
} else {
dp[i][j] = (dp[i-1][j-1] && (s[i-1] == p[j-1] || p[j-1] == '?')) || ((dp[i][j-1] || dp[i-1][j]) && p[j-1] == '*');
}
}
}
return dp[s.size()][p.size()];
}
};
// backtracking
class Solution {
public:
bool isMatch(string s, string p) {
int i = 0, j = 0;
int start = -1;
int match;
while (i < s.size()) {
if (j < p.size() && (s[i] == p[j] || p[j] == '?')) {
i++; j++;
} else if (j < p.size() && p[j] == '*') {
start = j++;
match = i;
} else if (start != -1) {
i = ++match;
j = start+1;
} else {
return false;
}
}
while (j < p.size() && p[j] == '*') j++;
return j == p.size();
}
}; | [
"17091600416@163.com"
] | 17091600416@163.com |
5a480446796cbfeffed8e0a7448f8b50b713f419 | 777a75e6ed0934c193aece9de4421f8d8db01aac | /src/Providers/UNIXProviders/RoleBasedAuthorizationService/UNIX_RoleBasedAuthorizationService_AIX.hxx | 1ad2f0734afb19eb5d39d38666dea6c5be4b7411 | [
"MIT"
] | permissive | brunolauze/openpegasus-providers-old | 20fc13958016e35dc4d87f93d1999db0eae9010a | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | refs/heads/master | 2021-01-01T20:05:44.559362 | 2014-04-30T17:50:06 | 2014-04-30T17:50:06 | 19,132,738 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 152 | hxx | #ifdef PEGASUS_OS_AIX
#ifndef __UNIX_ROLEBASEDAUTHORIZATIONSERVICE_PRIVATE_H
#define __UNIX_ROLEBASEDAUTHORIZATIONSERVICE_PRIVATE_H
#endif
#endif
| [
"brunolauze@msn.com"
] | brunolauze@msn.com |
3d12e2315b72c8e18533413321bbca519a89b24c | 8f50c262f89d3dc4f15f2f67eb76e686b8f808f5 | /Trigger/TrigEvent/TrigCaloEventTPCnv/test/TrigEMClusterCnv_p3_test.cxx | e12a822b50f114082fac1ddb29c64463c9370acc | [
"Apache-2.0"
] | permissive | strigazi/athena | 2d099e6aab4a94ab8b636ae681736da4e13ac5c9 | 354f92551294f7be678aebcd7b9d67d2c4448176 | refs/heads/master | 2022-12-09T02:05:30.632208 | 2020-09-03T14:03:18 | 2020-09-03T14:03:18 | 292,587,480 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,252 | cxx | /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
/**
* @file TrigCaloEventTPCnv/test/TrigEMClusterCnv_p3_test.cxx
* @author scott snyder <snyder@bnl.gov>
* @date Jan, 2016
* @brief Tests for TrigEMClusterCnv_p3.
*/
#undef NDEBUG
#include "TrigCaloEventTPCnv/TrigEMClusterCnv_p3.h"
#include "SGTools/TestStore.h"
#include "TestTools/leakcheck.h"
#include "GaudiKernel/MsgStream.h"
#include <cassert>
#include <iostream>
void compare (const TrigCaloCluster& p1,
const TrigCaloCluster& p2)
{
assert (p1.rawEnergy() == p2.rawEnergy());
assert (p1.rawEt() == p2.rawEt());
for (int i=0; i < TrigCaloCluster_p2::MAXSIZE_P; i++) {
CaloSampling::CaloSample s = static_cast<CaloSampling::CaloSample>(i);
assert (p1.rawEnergy(s) == p2.rawEnergy(s));
}
assert (p1.rawEta() == p2.rawEta());
assert (p1.rawPhi() == p2.rawPhi());
assert (p1.RoIword() == p2.RoIword());
assert (p1.nCells() == p2.nCells());
assert (p1.quality() == p2.quality());
}
void compare (const TrigEMCluster& p1,
const TrigEMCluster& p2)
{
compare (static_cast<const TrigCaloCluster&>(p1),
static_cast<const TrigCaloCluster&>(p2));
assert (p1.energy() == p2.energy());
assert (p1.et() == p2.et());
for (int i=0; i < TrigCaloCluster_p2::MAXSIZE_P; i++) {
CaloSampling::CaloSample s = static_cast<CaloSampling::CaloSample>(i);
assert (p1.energy(s) == p2.energy(s));
}
assert (p1.eta() == p2.eta());
assert (p1.phi() == p2.phi());
assert (p1.e237() == p2.e237());
assert (p1.e277() == p2.e277());
assert (p1.fracs1() == p2.fracs1());
assert (p1.weta2() == p2.weta2());
assert (p1.ehad1() == p2.ehad1());
assert (p1.Eta1() == p2.Eta1());
assert (p1.emaxs1() == p2.emaxs1());
assert (p1.e2tsts1() == p2.e2tsts1());
assert (0 == p2.e233());
assert (0 == p2.wstot());
assert (p1.ringsLink() == p2.ringsLink());
}
void testit (const TrigEMCluster& trans1)
{
MsgStream log (0, "test");
TrigEMClusterCnv_p3 cnv;
TrigEMCluster_p3 pers;
cnv.transToPers (&trans1, &pers, log);
TrigEMCluster trans2;
cnv.persToTrans (&pers, &trans2, log);
compare (trans1, trans2);
}
void test1()
{
std::cout << "test1\n";
// Get proxy created outside of leak check.
ElementLink<RingerRingsContainer> foo ("foofoo", 10);
Athena_test::Leakcheck check;
TrigEMCluster trans1 (100000, 2.2, 1.5, 12345);
trans1.setRawEnergy (90000);
trans1.setRawEt (80000);
for (int i=0; i < CaloSampling::CaloSample::Unknown; i++) {
CaloSampling::CaloSample s = static_cast<CaloSampling::CaloSample>(i);
trans1.setRawEnergy (s, i*1000);
trans1.setEnergy (s, i*1000 + 500);
}
trans1.setRawEta (2.1);
trans1.setRawPhi (1.6);
trans1.setNCells (100);
trans1.setquality (10);
trans1.setEt (81000);
trans1.set_e237 (50000);
trans1.set_e277 (51000);
trans1.set_fracs1 (0.4);
trans1.set_weta2 (0.1);
trans1.set_ehad1 (10000);
trans1.set_Eta1 (2.5);
trans1.set_emaxs1 (7000);
trans1.set_e2tsts1 (5000);
trans1.set_e233 (40000);
trans1.set_wstot (0.7);
trans1.setRings (ElementLink<RingerRingsContainer> ("foofoo", 10));
testit (trans1);
}
int main()
{
SGTest::initTestStore();
test1();
return 0;
}
| [
"graemes.cern@gmail.com"
] | graemes.cern@gmail.com |
4dc8d1c21beabd7f36fe001cfebcb983e8bd4d41 | 23a5d39b3c9b171af32970fe0b0ad3e5c9ce9429 | /cpp/reverseString.cpp | 7ecc54107e261de68584c30b9a12a6a048b39a7d | [] | no_license | kellytay143/leetcode | 2e113b5268289f0be44e819cba3ffb22f8bb7aeb | 0e7ebc4762256f38f60baef1a2bf54aa2f6d0430 | refs/heads/master | 2023-02-24T22:16:32.001010 | 2021-01-31T02:46:44 | 2021-01-31T02:46:44 | 291,169,100 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 625 | cpp | // Source: https://leetcode.com/problems/reverse-string/
// Author: Kelly Tay
/**
Write a function that reverses a string. The input string is given as an array of characters char[].
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
You may assume all the characters consist of printable ascii characters.
**/
class Solution {
public:
void reverseString(vector<char>& s) {
for(int i = 0, j = s.size() - 1; i < s.size()/2; i++, j--) {
char temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}; | [
"kellytay@Kellys-MacBook-Pro.local"
] | kellytay@Kellys-MacBook-Pro.local |
be245f80da5a87162558283956f3fa16c9ee413b | f8c088586a7a0fbcb369db80365b658fba174809 | /src/qt/bitcoinunits.h | 79db5286934e4ab0afcaa9c1e0725ef02ad2cc9f | [
"MIT"
] | permissive | bhok/pinkdog | 5de8acedbe8d60057dd20e787d24568b2b476674 | 9cc57122a68402447a72dde09b6034b95009bed6 | refs/heads/master | 2021-01-19T10:17:23.480944 | 2017-02-14T00:14:16 | 2017-02-14T00:14:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,991 | h | // Copyright (c) 2011-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 BITCOIN_QT_BITCOINUNITS_H
#define BITCOIN_QT_BITCOINUNITS_H
#include "amount.h"
#include <QAbstractListModel>
#include <QString>
// U+2009 THIN SPACE = UTF-8 E2 80 89
#define REAL_THIN_SP_CP 0x2009
#define REAL_THIN_SP_UTF8 "\xE2\x80\x89"
#define REAL_THIN_SP_HTML " "
// U+200A HAIR SPACE = UTF-8 E2 80 8A
#define HAIR_SP_CP 0x200A
#define HAIR_SP_UTF8 "\xE2\x80\x8A"
#define HAIR_SP_HTML " "
// U+2006 SIX-PER-EM SPACE = UTF-8 E2 80 86
#define SIXPEREM_SP_CP 0x2006
#define SIXPEREM_SP_UTF8 "\xE2\x80\x86"
#define SIXPEREM_SP_HTML " "
// U+2007 FIGURE SPACE = UTF-8 E2 80 87
#define FIGURE_SP_CP 0x2007
#define FIGURE_SP_UTF8 "\xE2\x80\x87"
#define FIGURE_SP_HTML " "
// QMessageBox seems to have a bug whereby it doesn't display thin/hair spaces
// correctly. Workaround is to display a space in a small font. If you
// change this, please test that it doesn't cause the parent span to start
// wrapping.
#define HTML_HACK_SP "<span style='white-space: nowrap; font-size: 6pt'> </span>"
// Define THIN_SP_* variables to be our preferred type of thin space
#define THIN_SP_CP REAL_THIN_SP_CP
#define THIN_SP_UTF8 REAL_THIN_SP_UTF8
#define THIN_SP_HTML HTML_HACK_SP
/** Pinkdog unit definitions. Encapsulates parsing and formatting
and serves as list model for drop-down selection boxes.
*/
class BitcoinUnits: public QAbstractListModel
{
Q_OBJECT
public:
explicit BitcoinUnits(QObject *parent);
/** Pinkdog units.
@note Source: https://en.bitcoin.it/wiki/Units . Please add only sensible ones
*/
enum Unit
{
BTC,
mBTC,
uBTC
};
enum SeparatorStyle
{
separatorNever,
separatorStandard,
separatorAlways
};
//! @name Static API
//! Unit conversion and formatting
///@{
//! Get list of units, for drop-down box
static QList<Unit> availableUnits();
//! Is unit ID valid?
static bool valid(int unit);
//! Short name
static QString name(int unit);
//! Longer description
static QString description(int unit);
//! Number of Satoshis (1e-8) per unit
static qint64 factor(int unit);
//! Number of decimals left
static int decimals(int unit);
//! Format as string
static QString format(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
//! Format as string (with unit)
static QString formatWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
//! Format as HTML string (with unit)
static QString formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
//! Parse string to coin amount
static bool parse(int unit, const QString &value, CAmount *val_out);
//! Gets title for amount column including current display unit if optionsModel reference available */
static QString getAmountColumnTitle(int unit);
///@}
//! @name AbstractListModel implementation
//! List model for unit drop-down selection box.
///@{
enum RoleIndex {
/** Unit identifier */
UnitRole = Qt::UserRole
};
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
///@}
static QString removeSpaces(QString text)
{
text.remove(' ');
text.remove(QChar(THIN_SP_CP));
#if (THIN_SP_CP != REAL_THIN_SP_CP)
text.remove(QChar(REAL_THIN_SP_CP));
#endif
return text;
}
//! Return maximum number of base units (Satoshis)
static CAmount maxMoney();
private:
QList<BitcoinUnits::Unit> unitlist;
};
typedef BitcoinUnits::Unit BitcoinUnit;
#endif // BITCOIN_QT_BITCOINUNITS_H
| [
"pinkdog@protonmail.com"
] | pinkdog@protonmail.com |
56124c892387e48c90790154632a2076a2a7a2b9 | 814270a1bbcb10bda992628b2619f549d2a359e8 | /Program3/hw3_demo.cpp | 308e61d1a4b27598a0210a60e2b6d6c8be4352aa | [] | no_license | RagT/CSS432 | b23b9e3974efc7e48d388525d3406ce14f7d7a0b | 350580298137b527b310d6ea2600b1e8473ad348 | refs/heads/master | 2021-01-11T17:19:49.130392 | 2017-03-14T02:36:23 | 2017-03-14T02:36:23 | 79,746,558 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,141 | cpp | #include "Socket.h"
#include <stdlib.h>
using namespace std;
void server( );
void client( char ipName[] );
void usage( char progName[] );
Socket *sock;
int main( int argc, char* argv[] ) {
if ( argc > 1 ) {
sock = new Socket( atoi( argv[1] ) );
if ( argc == 2 )
server( );
else if ( argc == 3 )
client( argv[2] );
}
else {
usage( argv[0] );
return -1;
}
return 0;
}
void server( ) {
// Get a server sd
int serverSd = sock->getServerSocket( );
// Exchange data
char message[1500];
read( serverSd, message, 1500 );
write( serverSd, message, 1 );
// Close socket but not send FIN.
close( serverSd );
}
void client( char ipName[] ) {
// Get a client sd
int clientSd = sock->getClientSocket( ipName );
// Exchange data
char message[1500];
write( clientSd, message, 1500 );
read( clientSd, message, 1 );
// Close socket to send FIN.
close( clientSd );
}
void usage( char progName[] ) {
cerr << "usage:" << endl;
cerr << "server invocation: " << progName << " ipPort" << endl;
cerr << "client invocation: " << progName << " ipPort ipName" << endl;
}
| [
"raghutir@gmail.com"
] | raghutir@gmail.com |
f48e103604d8cb678b57c12fab2e7faf6696d419 | 63ebc66636bdbed675d35a1e8475f11e4da89ce2 | /src/device/devicedialog.cpp | 753f7e5818e407e6505752561c9a6f7c1454edc2 | [
"MIT"
] | permissive | RoPe93/nitroshare-desktop | 8582a7d509f60f22dbd4d3126b3c3f1537633c1b | fc99172b6bfd064b6895453da4b9f81eac8182f2 | refs/heads/master | 2021-01-23T20:56:06.136473 | 2015-02-24T07:06:17 | 2015-02-24T07:06:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,319 | cpp | /**
* The MIT License (MIT)
*
* Copyright (c) 2015 Nathan Osman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
**/
#include <QPushButton>
#include "devicedialog.h"
#include "ui_devicedialog.h"
DeviceDialog::DeviceDialog(DeviceModel *model)
: ui(new Ui::DeviceDialog)
{
ui->setupUi(this);
ui->deviceView->setModel(model);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(ui->deviceView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &DeviceDialog::toggleOkButton);
}
DeviceDialog::~DeviceDialog()
{
delete ui;
}
QModelIndex DeviceDialog::selectedDeviceIndex() const
{
QModelIndexList selection(ui->deviceView->selectionModel()->selectedIndexes());
return selection.count() ? selection.at(0) : QModelIndex();
}
QModelIndex DeviceDialog::getDevice(DeviceModel *model)
{
DeviceDialog deviceDialog(model);
if(deviceDialog.exec() == QDialog::Accepted) {
return deviceDialog.selectedDeviceIndex();
} else {
return QModelIndex();
}
}
void DeviceDialog::toggleOkButton(const QItemSelection &, const QItemSelection &)
{
bool itemSelected(ui->deviceView->selectionModel()->hasSelection());
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(itemSelected);
}
| [
"nathan@quickmediasolutions.com"
] | nathan@quickmediasolutions.com |
ffa473ed2d3575d5862837426477688cf7213e2d | b701633b3463fc7ee09aa4feca99e3a8bbdf7366 | /LAB3/median.cpp | f43fb707aa95690f42b3afc53ddc83d41f6661f4 | [] | no_license | MelikEfekan/Image-Processing | 027f85b4f72bcd31acf587867cf75952caebbbbe | 7238363ab752b53e4c576d3714c478af88c4f62a | refs/heads/main | 2023-01-20T02:14:02.010075 | 2020-11-11T00:35:50 | 2020-11-11T00:35:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,734 | cpp | // header inclusion
#include <stdio.h>
#include <opencv/cv.h> //you may need to
#include <opencv/highgui.h> //adjust import locations
#include <opencv/cxcore.h> //depending on your machine setup
using namespace cv;
void MedianFilter(
cv::Mat &input,
int size,
cv::Mat &blurredOutput);
int main( int argc, char** argv ) {
// LOADING THE IMAGE
char* imageName = argv[1];
Mat image;
image = imread( imageName, 1 );
if( argc != 2 || !image.data ) {
printf( " No image data \n " );
return -1;
}
// CONVERT COLOUR, BLUR AND SAVE
Mat gray_image;
cvtColor( image, gray_image, CV_BGR2GRAY );
Mat carBlurred;
MedianFilter(gray_image,5,carBlurred);
imwrite( "car2Median.jpg", carBlurred );
return 0;
}
void MedianFilter(cv::Mat &input, int size, cv::Mat &medianOutput) {
// intialise the output using the input
medianOutput.create(input.size(), input.type());
int radius = (size-1)/2;
cv::Mat paddedInput;
cv::copyMakeBorder( input, paddedInput, radius, radius, radius, radius, cv::BORDER_REPLICATE );
// now we can do the convoltion
for ( int i = 0; i < input.rows; i++ ) {
for( int j = 0; j < input.cols; j++ ) {
vector<double> vect;
for( int m = -radius; m <= radius; m++ ) {
for( int n = -radius; n <= radius; n++ ) {
int imagex = i + m + radius;
int imagey = j + n + radius;
vect.push_back(( double ) paddedInput.at<uchar>(imagex, imagey));
}
}
std::sort(vect.begin(), vect.end());
size_t size = vect.size();
medianOutput.at<uchar>(i, j) = (uchar) vect[(size)/2];
}
}
}
| [
"jb18940@bristol.ac.uk"
] | jb18940@bristol.ac.uk |
41d0e6722cf4f75cd61342fbf3558c3270865351 | 514fd4f09243055e4769efb426710338048454b1 | /tensorflow/compiler/xla/service/ar_crs_combiner.cc | 47d2c7e35705698d49950c2fa042af1c6327d521 | [
"Apache-2.0"
] | permissive | nnsuite/ubuntuport-tensorflow | 7fa1d26f3cc282cd725bd87f2864c8ac2e76bf99 | 01ea2d56d3f87063f86076e45673fa49794eebb0 | refs/heads/debian/c_api/1.13.1 | 2022-12-14T03:14:59.691723 | 2022-12-06T07:29:53 | 2022-12-07T00:46:40 | 202,048,406 | 2 | 8 | Apache-2.0 | 2022-12-07T00:46:41 | 2019-08-13T02:36:22 | C++ | UTF-8 | C++ | false | false | 11,218 | cc | /* Copyright 2018 The TensorFlow 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 "tensorflow/compiler/xla/service/ar_crs_combiner.h"
#include <string>
#include <utility>
#include <vector>
#include "tensorflow/compiler/xla/literal.h"
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/service/call_graph.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
#include "tensorflow/compiler/xla/service/pattern_matcher.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
namespace xla {
namespace {
namespace m = match;
// Returns true iff the argument instruction is an AllReduce, followed by a
// certain sequence of instructions and then a CRS. It must be possible to move
// the AR past each instruction in the sequence.
bool MatchesArCrsPattern(HloInstruction* instruction) {
auto can_ar_move_past_instruction = [](HloInstruction* instruction) -> bool {
if (instruction->user_count() != 1) {
return false;
}
auto opcode = instruction->opcode();
return opcode == HloOpcode::kBitcast || opcode == HloOpcode::kTranspose ||
opcode == HloOpcode::kReshape || opcode == HloOpcode::kConvert ||
opcode == HloOpcode::kAdd || opcode == HloOpcode::kSubtract ||
opcode == HloOpcode::kMultiply;
};
auto computation_is_addition = [](HloComputation* c) {
return c->instruction_count() == 3 &&
Match(c->root_instruction(), m::Add(m::Parameter(), m::Parameter()));
};
if (!instruction->IsCrossModuleAllReduce() ||
!computation_is_addition(instruction->called_computations()[0]) ||
instruction->user_count() != 1) {
return false;
}
auto next = instruction->users()[0];
while (!next->IsCrossReplicaAllReduce()) {
if (can_ar_move_past_instruction(next)) {
next = next->users()[0];
} else {
return false;
}
}
return computation_is_addition(next->called_computations()[0]);
}
} // namespace
absl::optional<HloInstruction*> ArCrsCombiner::WhileFromBodyParameter(
HloInstruction* instruction) {
CHECK_EQ(HloOpcode::kParameter, instruction->opcode());
HloComputation* computation = instruction->parent();
auto caller_instructions = call_graph_->GetComputationCallers(computation);
if (caller_instructions.size() == 1) {
auto caller_instruction = caller_instructions[0];
if (caller_instruction->opcode() == HloOpcode::kWhile) {
return caller_instruction;
}
}
return absl::optional<HloInstruction*>();
}
std::vector<HloInstruction*> ArCrsCombiner::GetAllTuples(
HloInstruction* instruction) {
if (instruction->opcode() == HloOpcode::kTuple) {
return {instruction};
}
if (instruction->opcode() == HloOpcode::kDomain) {
return GetAllTuples(instruction->operands()[0]);
}
if (instruction->opcode() == HloOpcode::kParameter) {
auto maybe_while = WhileFromBodyParameter(instruction);
if (!maybe_while) {
return {};
}
auto while_instr = *maybe_while;
auto init_tuples = GetAllTuples(while_instr->while_init());
auto body_tuples =
GetAllTuples(while_instr->while_body()->root_instruction());
if (init_tuples.empty() || body_tuples.empty()) {
return {};
}
init_tuples.insert(init_tuples.end(), body_tuples.begin(),
body_tuples.end());
return init_tuples;
}
if (instruction->opcode() == HloOpcode::kGetTupleElement) {
std::vector<HloInstruction*> result_tuples;
for (auto tuple : GetAllTuples(instruction->operands()[0])) {
auto tmp_tuples =
GetAllTuples(tuple->mutable_operand(instruction->tuple_index()));
if (tmp_tuples.empty()) {
return {};
}
result_tuples.insert(result_tuples.end(), tmp_tuples.begin(),
tmp_tuples.end());
}
return result_tuples;
}
return {};
}
bool ArCrsCombiner::TupleElementsComputeSameValue(
HloInstruction* tuple_shaped_instruction, int64 i1, int64 i2,
absl::flat_hash_map<int64, int64>* visited_pairs) {
auto tuples = GetAllTuples(tuple_shaped_instruction);
if (tuples.empty()) {
return false;
}
for (auto tuple : tuples) {
CHECK_EQ(tuple->opcode(), HloOpcode::kTuple);
if (!InstructionsComputeSameValue(tuple->mutable_operand(i1),
tuple->mutable_operand(i2),
visited_pairs)) {
return false;
}
}
return true;
}
/* static */
bool ArCrsCombiner::TestInstructionsComputeSameValue(HloInstruction* i1,
HloInstruction* i2) {
ArCrsCombiner combiner(/*num_spatial_partitions=*/2);
auto module = i1->parent()->parent();
CHECK_EQ(module, i2->parent()->parent());
combiner.call_graph_ = CallGraph::Build(module);
absl::flat_hash_map<int64, int64> visited_pairs;
return combiner.InstructionsComputeSameValue(i1, i2, &visited_pairs);
}
bool ArCrsCombiner::InstructionsComputeSameValue(
HloInstruction* i1, HloInstruction* i2,
absl::flat_hash_map<int64, int64>* visited_pairs) {
if (i1 == i2) {
return true;
}
auto uid1 = i1->unique_id();
auto uid2 = i2->unique_id();
auto min_uid = std::min(uid1, uid2);
auto max_uid = std::max(uid1, uid2);
auto it = visited_pairs->find(min_uid);
if (it != visited_pairs->end() && max_uid == it->second) {
return true;
}
auto opcode1 = i1->opcode();
auto operands1 = i1->operands();
if (opcode1 != i2->opcode() || operands1.size() != i2->operands().size()) {
return false;
}
visited_pairs->emplace(min_uid, max_uid);
for (int i = 0; i < operands1.size(); ++i) {
auto operand1 = operands1[i];
auto operand2 = i2->operands()[i];
if (!InstructionsComputeSameValue(operand1, operand2, visited_pairs)) {
return false;
}
}
if (opcode1 == HloOpcode::kParameter) {
// In the general case, we don't try to prove equality of parameters.
// We only try in the context of get-tuple-element
// (see TupleElementsComputeSameValue).
return false;
}
if (opcode1 == HloOpcode::kGetTupleElement) {
return i1->tuple_index() == i2->tuple_index() ||
TupleElementsComputeSameValue(operands1[0], i1->tuple_index(),
i2->tuple_index(), visited_pairs);
}
// Don't check that the operands are identical, because Identical can
// return false for instructions that compute the same value but are not
// identical, which we don't want. We have checked the arguments with
// InstructionsComputeSameValue earlier.
auto eq_instructions = [](const HloInstruction* i1,
const HloInstruction* i2) -> bool { return true; };
auto eq_computations = [](const HloComputation* a, const HloComputation* b) {
return *a == *b;
};
return i1->Identical(*i2, eq_instructions, eq_computations,
/*layout_sensitive=*/false);
}
void ArCrsCombiner::GroupAllReducesById(HloModule* module) {
for (HloComputation* computation : module->MakeNonfusionComputations()) {
for (HloInstruction* instruction : computation->instructions()) {
if (MatchesArCrsPattern(instruction)) {
all_reduce_map_[*(instruction->all_reduce_id())].push_back(instruction);
}
}
}
}
void ArCrsCombiner::KeepProvablyEqualInstructionGroups() {
for (auto it : all_reduce_map_) {
auto all_reduce_id = it.first;
auto instruction_vec = it.second;
CHECK_EQ(instruction_vec.size(), num_spatial_partitions_);
auto instr_0 = instruction_vec[0];
for (int i = 1; i < instruction_vec.size(); ++i) {
auto instr_i = instruction_vec[i];
auto next_0 = instr_0->users()[0];
auto next_i = instr_i->users()[0];
absl::flat_hash_map<int64, int64> visited_pairs;
do {
if (!InstructionsComputeSameValue(next_0, next_i, &visited_pairs)) {
all_reduce_map_.erase(all_reduce_id);
break;
}
next_0 = next_0->users()[0];
next_i = next_i->users()[0];
} while (!next_0->IsCrossReplicaAllReduce());
}
}
}
StatusOr<bool> ArCrsCombiner::RewriteGraph() {
if (all_reduce_map_.empty()) {
return false;
}
for (auto it : all_reduce_map_) {
auto instruction_vec = it.second;
for (auto all_reduce : instruction_vec) {
auto parent_computation = all_reduce->parent();
auto all_reduce_id = all_reduce->all_reduce_id();
auto prev = all_reduce->mutable_operand(0);
auto next = all_reduce->users()[0];
TF_CHECK_OK(all_reduce->ReplaceUseWith(next, prev));
TF_CHECK_OK(parent_computation->RemoveInstruction(all_reduce));
while (!next->IsCrossReplicaAllReduce()) {
switch (next->opcode()) {
case HloOpcode::kBitcast:
case HloOpcode::kTranspose:
case HloOpcode::kReshape:
case HloOpcode::kConvert:
case HloOpcode::kMultiply:
break;
case HloOpcode::kAdd:
case HloOpcode::kSubtract: {
auto other_operand = (next->operands()[0] == prev)
? next->operands()[1]
: next->operands()[0];
// To move the AR past the addition/subtraction, we need to divide
// other_operand by the number of spatial partitions.
auto shape = other_operand->shape();
Literal lit(shape);
lit.PopulateWithValue<float>(num_spatial_partitions_);
auto divisor = parent_computation->AddInstruction(
HloInstruction::CreateConstant(lit.Clone()));
auto division =
parent_computation->AddInstruction(HloInstruction::CreateBinary(
shape, HloOpcode::kDivide, other_operand, divisor));
TF_CHECK_OK(other_operand->ReplaceUseWith(next, division));
break;
}
default:
LOG(FATAL) << "Unexpected instruction: " << next->ToShortString();
}
prev = next;
next = next->users()[0];
}
// The AllReduce and the CRS are combined to an all-core AllReduce.
next->set_all_reduce_id(all_reduce_id);
}
}
return true;
}
StatusOr<bool> ArCrsCombiner::Run(HloModule* module) {
call_graph_ = CallGraph::Build(module);
GroupAllReducesById(module);
KeepProvablyEqualInstructionGroups();
return RewriteGraph();
}
} // namespace xla
| [
"myungjoo.ham@samsung.com"
] | myungjoo.ham@samsung.com |
a7e60f4ba899d0b7a38655211d5c0169e85a4fac | 5d99f4c819578fcd2a0647033a203ec0fc55d9d2 | /Montero_Dominguez_Ruben/P4/pedido-articulo.cpp | bfef33f1176b11cee2ff39da57355889ce6512df | [] | no_license | RubenZx/POO | c4a14060e70b9d633c519951322f11318eda628a | fe7a322d34b73d9203c07c24f2fdb565a59cec2d | refs/heads/master | 2020-03-11T03:39:08.317123 | 2019-06-10T13:56:09 | 2019-06-10T13:56:09 | 129,754,474 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,209 | cpp | #include "pedido-articulo.hpp"
/***************************************************** CLASE PEDIDO_ARTICULO *****************************************************/
void Pedido_Articulo::pedir(Pedido& ped, Articulo& art, double precio, unsigned cant)
{
directa_[&ped].insert(std::make_pair(&art, LineaPedido(precio, cant)));
inversa_[&art].insert(std::make_pair(&ped, LineaPedido(precio, cant)));
}
void Pedido_Articulo::pedir(Articulo& art, Pedido& ped, double precio, unsigned cant)
{
pedir(ped, art, precio, cant);
}
std::ostream& Pedido_Articulo::mostrarDetallePedidos(std::ostream& os)
{
double toti = 0.0;
Fecha hoy;
// iter->first <=> Pedido*
// iter->second <=> ItemsPedido
for(auto iter = directa_.begin(); iter != directa_.end(); iter++)
if(iter->first->fecha() <= hoy)
{
os << "Pedido núm. " << (iter->first)->numero() << "\n"
<< "Cliente: " << (iter->first)->tarjeta()->titular()->nombre() << "\t"
<< "Fecha: " << (iter->first)->fecha() << std::endl << iter->second;
toti += (iter->first)->total();
}
os << "TOTAL VENTAS\t" << std::fixed << std::setprecision(2) << toti << " €" << std::endl;
return os;
}
std::ostream& Pedido_Articulo::mostrarVentasArticulos(std::ostream& os)
{
// iter->first <=> Articulo*
// iter->second <=> Pedidos
for(auto iter = inversa_.begin(); iter != inversa_.end(); iter++)
{
os << "Ventas de [" << (iter->first)->referencia() << "] " << "\""
<< (iter->first)->titulo() << "\"\n"
<< iter->second << std::endl;
}
return os;
}
std::ostream& operator <<(std::ostream& os, const Pedido_Articulo::ItemsPedido& items)
{
double toti = 0.0;
os << " PVP\tCantidad\t\tArtículo\n" << Cadena(80, '=') << std::endl;
// iter->first <=> Articulo*
// iter->second <=> LineaPedido
for(auto iter = items.begin(); iter != items.end(); iter++)
{
os << std::fixed << std::setprecision(2) << (iter->first)->precio() << " €\t"
<< (iter->second).cantidad() << "\t\t" << (iter->first)->referencia() << " \"" << (iter->first)->titulo() << "\"" << std::endl;
toti += (iter->first)->precio() * (iter->second).cantidad();
}
os << Cadena(80, '=') << "\n"
<< "Total\t" << toti << " €\n" << std::endl;
return os;
}
std::ostream& operator <<(std::ostream& os, const Pedido_Articulo::Pedidos& peds)
{
double toti = 0.0;
int cantidad = 0;
os << "[Pedidos: " << peds.size() << "]\n"
<< Cadena(80, '=') << "\n"
<< " PVP\tCantidad\tFecha de venta\n"
<< Cadena(80, '=') << std::endl;
// iter->first <=> Pedido*
// iter->second <=> LineaPedido
for(auto iter = peds.begin(); iter != peds.end(); iter++)
{
os << iter->second << "\t\t" << (iter->first)->fecha() << std::endl;
cantidad += (iter->second).cantidad();
toti += (iter->second).precio_venta() * (iter->second).cantidad();
}
os << Cadena(80, '=') << "\n" << toti << " €\t" << cantidad << std::endl;
return os;
}
/***************************************************** CLASE LINEAPEDIDO *****************************************************/
std::ostream& operator <<(std::ostream& os, const LineaPedido& linP)
{
return os << std::fixed << std::setprecision(2) << linP.precio_venta() << " €\t" << linP.cantidad();
}
| [
"ruben.mondom@gmail.com"
] | ruben.mondom@gmail.com |
1ea340d4d01511982290e09de613cb1a58d95bcb | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-sagemaker/include/aws/sagemaker/model/DescribeHumanTaskUiResult.h | ca752c0a5920cfb50a961a8537b946d78bfb3d70 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 7,064 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/sagemaker/SageMaker_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/sagemaker/model/HumanTaskUiStatus.h>
#include <aws/core/utils/DateTime.h>
#include <aws/sagemaker/model/UiTemplateInfo.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace SageMaker
{
namespace Model
{
class AWS_SAGEMAKER_API DescribeHumanTaskUiResult
{
public:
DescribeHumanTaskUiResult();
DescribeHumanTaskUiResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DescribeHumanTaskUiResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline const Aws::String& GetHumanTaskUiArn() const{ return m_humanTaskUiArn; }
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline void SetHumanTaskUiArn(const Aws::String& value) { m_humanTaskUiArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline void SetHumanTaskUiArn(Aws::String&& value) { m_humanTaskUiArn = std::move(value); }
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline void SetHumanTaskUiArn(const char* value) { m_humanTaskUiArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiArn(const Aws::String& value) { SetHumanTaskUiArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiArn(Aws::String&& value) { SetHumanTaskUiArn(std::move(value)); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the human task user interface (worker task
* template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiArn(const char* value) { SetHumanTaskUiArn(value); return *this;}
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline const Aws::String& GetHumanTaskUiName() const{ return m_humanTaskUiName; }
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline void SetHumanTaskUiName(const Aws::String& value) { m_humanTaskUiName = value; }
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline void SetHumanTaskUiName(Aws::String&& value) { m_humanTaskUiName = std::move(value); }
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline void SetHumanTaskUiName(const char* value) { m_humanTaskUiName.assign(value); }
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiName(const Aws::String& value) { SetHumanTaskUiName(value); return *this;}
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiName(Aws::String&& value) { SetHumanTaskUiName(std::move(value)); return *this;}
/**
* <p>The name of the human task user interface (worker task template).</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiName(const char* value) { SetHumanTaskUiName(value); return *this;}
/**
* <p>The status of the human task user interface (worker task template). Valid
* values are listed below.</p>
*/
inline const HumanTaskUiStatus& GetHumanTaskUiStatus() const{ return m_humanTaskUiStatus; }
/**
* <p>The status of the human task user interface (worker task template). Valid
* values are listed below.</p>
*/
inline void SetHumanTaskUiStatus(const HumanTaskUiStatus& value) { m_humanTaskUiStatus = value; }
/**
* <p>The status of the human task user interface (worker task template). Valid
* values are listed below.</p>
*/
inline void SetHumanTaskUiStatus(HumanTaskUiStatus&& value) { m_humanTaskUiStatus = std::move(value); }
/**
* <p>The status of the human task user interface (worker task template). Valid
* values are listed below.</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiStatus(const HumanTaskUiStatus& value) { SetHumanTaskUiStatus(value); return *this;}
/**
* <p>The status of the human task user interface (worker task template). Valid
* values are listed below.</p>
*/
inline DescribeHumanTaskUiResult& WithHumanTaskUiStatus(HumanTaskUiStatus&& value) { SetHumanTaskUiStatus(std::move(value)); return *this;}
/**
* <p>The timestamp when the human task user interface was created.</p>
*/
inline const Aws::Utils::DateTime& GetCreationTime() const{ return m_creationTime; }
/**
* <p>The timestamp when the human task user interface was created.</p>
*/
inline void SetCreationTime(const Aws::Utils::DateTime& value) { m_creationTime = value; }
/**
* <p>The timestamp when the human task user interface was created.</p>
*/
inline void SetCreationTime(Aws::Utils::DateTime&& value) { m_creationTime = std::move(value); }
/**
* <p>The timestamp when the human task user interface was created.</p>
*/
inline DescribeHumanTaskUiResult& WithCreationTime(const Aws::Utils::DateTime& value) { SetCreationTime(value); return *this;}
/**
* <p>The timestamp when the human task user interface was created.</p>
*/
inline DescribeHumanTaskUiResult& WithCreationTime(Aws::Utils::DateTime&& value) { SetCreationTime(std::move(value)); return *this;}
inline const UiTemplateInfo& GetUiTemplate() const{ return m_uiTemplate; }
inline void SetUiTemplate(const UiTemplateInfo& value) { m_uiTemplate = value; }
inline void SetUiTemplate(UiTemplateInfo&& value) { m_uiTemplate = std::move(value); }
inline DescribeHumanTaskUiResult& WithUiTemplate(const UiTemplateInfo& value) { SetUiTemplate(value); return *this;}
inline DescribeHumanTaskUiResult& WithUiTemplate(UiTemplateInfo&& value) { SetUiTemplate(std::move(value)); return *this;}
private:
Aws::String m_humanTaskUiArn;
Aws::String m_humanTaskUiName;
HumanTaskUiStatus m_humanTaskUiStatus;
Aws::Utils::DateTime m_creationTime;
UiTemplateInfo m_uiTemplate;
};
} // namespace Model
} // namespace SageMaker
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
b248094088bfc6880faa922f737c2118eadc33d9 | 2773bfa3b85760c67054044a5450c48f5e8aed41 | /route.h | de6ee6bb051b3a659407efe3da1c247b342d58e4 | [] | no_license | vaz985/tp02_dcc022 | c5d6669ea3e994cd4ccd51d18da55c9a4fea3d68 | 4d746a1526fad154e99906d2d99805a78ce12bcc | refs/heads/master | 2020-03-31T03:54:50.775385 | 2018-10-29T15:25:40 | 2018-10-29T15:25:40 | 151,883,834 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 721 | h | #ifndef ROUTE_H
#define ROUTE_H
#include <bits/stdc++.h>
using namespace std;
class Route {
public:
int weight;
string target_ip, neighbour_ip;
struct timespec last_update;
bool operator< (const class Route& rhs) const;
Route(int weight, string target_ip, string neighbour_ip);
Route(const Route& r);
int get_weight() const {
return this->weight;
}
string get_target() const {
return this->target_ip;
}
string get_neighbour() const {
return this->neighbour_ip;
}
void update_time() {
clock_gettime(CLOCK_REALTIME, &this->last_update);
}
struct timespec get_time() const {
return this->last_update;
}
};
#endif
| [
"vaz985@gmail.com"
] | vaz985@gmail.com |
9f27006f7d644eb9768bfa3eaf0744650d04d857 | 2869351013099233c900e7b5b87f16310c1974fd | /src/render/opengl/shaders/ribbon_shaders.cpp | ed470d82cf4d7817afadf8f93696cf45a060ed97 | [
"MIT"
] | permissive | gumeo/polyscope | c8ddb5886fd7d5e0f681a3751c0f1fa128f49b65 | 16da52eadaa8b2198f1bc63f326f7524bec19d2c | refs/heads/master | 2023-08-10T18:18:52.111785 | 2021-10-07T22:37:38 | 2021-10-07T22:37:38 | 270,394,948 | 0 | 0 | MIT | 2020-06-07T18:25:49 | 2020-06-07T18:25:48 | null | UTF-8 | C++ | false | false | 5,776 | cpp | // Copyright 2017-2019, Nicholas Sharp and the Polyscope contributors. http://polyscope.run.
#include "polyscope/render/opengl/gl_shaders.h"
namespace polyscope {
namespace render {
// clang-format off
const ShaderStageSpecification RIBBON_VERT_SHADER = {
ShaderStageType::Vertex,
{ }, // uniforms
// attributes
{
{"a_position", DataType::Vector3Float},
{"a_color", DataType::Vector3Float},
{"a_normal", DataType::Vector3Float},
},
{}, // textures
// source
POLYSCOPE_GLSL(150,
in vec3 a_position;
in vec3 a_color;
in vec3 a_normal;
out vec3 Color;
out vec3 Normal;
void main()
{
Color = a_color;
Normal = a_normal;
gl_Position = vec4(a_position,1.0);
}
)
};
const ShaderStageSpecification RIBBON_GEOM_SHADER = {
ShaderStageType::Geometry,
// uniforms
{
{"u_modelView", DataType::Matrix44Float},
{"u_projMatrix", DataType::Matrix44Float},
{"u_ribbonWidth", DataType::Float},
{"u_depthOffset", DataType::Float},
},
// attributes
{
},
{}, // textures
// source
POLYSCOPE_GLSL(150,
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices=20) out;
in vec3 Color[];
in vec3 Normal[];
uniform mat4 u_modelView;
uniform mat4 u_projMatrix;
uniform float u_ribbonWidth;
uniform float u_depthOffset;
out vec3 colorToFrag;
out vec3 cameraNormalToFrag;
out float intensityToFrag;
void main() {
mat4 PV = u_projMatrix * u_modelView;
const float PI = 3.14159265358;
vec3 pos0 = gl_in[0].gl_Position.xyz;
vec3 pos1 = gl_in[1].gl_Position.xyz;
vec3 pos2 = gl_in[2].gl_Position.xyz;
vec3 pos3 = gl_in[3].gl_Position.xyz;
vec3 dir = normalize(pos2 - pos1);
vec3 prevDir = normalize(pos1 - pos0);
vec3 nextDir = normalize(pos3 - pos2);
vec3 sideVec0 = normalize(cross(normalize(dir + prevDir), Normal[1]));
vec3 sideVec1 = normalize(cross(normalize(dir + nextDir), Normal[2]));
// The points on the front and back sides of the ribbon
vec4 pStartLeft = vec4(pos1 + sideVec0 * u_ribbonWidth, 1);
vec4 pStartMid = vec4(pos1, 1);
vec4 pStartRight = vec4(pos1 - sideVec0 * u_ribbonWidth, 1);
vec4 pEndLeft = vec4(pos2 + sideVec1 * u_ribbonWidth, 1);
vec4 pEndMid = vec4(pos2, 1);
vec4 pEndRight = vec4(pos2 - sideVec1 * u_ribbonWidth, 1);
// First triangle
gl_Position = PV * pStartRight;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[1];
colorToFrag = Color[1];
intensityToFrag = 0.0;
EmitVertex();
gl_Position = PV * pEndRight;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[2];
colorToFrag = Color[2];
intensityToFrag = 0.0;
EmitVertex();
gl_Position = PV * pStartMid;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[1];
colorToFrag = Color[1];
intensityToFrag = 1.0;
EmitVertex();
// Second triangle
gl_Position = PV * pEndMid;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[2];
colorToFrag = Color[2];
intensityToFrag = 1.0;
EmitVertex();
// Third triangle
gl_Position = PV * pStartLeft;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[1];
colorToFrag = Color[1];
intensityToFrag = 0.0;
EmitVertex();
// Fourth triangle
gl_Position = PV * pEndLeft;
gl_Position.z -= u_depthOffset;
cameraNormalToFrag = mat3(u_modelView) * Normal[2];
colorToFrag = Color[2];
intensityToFrag = 0.0;
EmitVertex();
EndPrimitive();
}
)
};
const ShaderStageSpecification RIBBON_FRAG_SHADER = {
ShaderStageType::Fragment,
{ }, // uniforms
{ }, // attributes
// textures
{
{"t_mat_r", 2},
{"t_mat_g", 2},
{"t_mat_b", 2},
{"t_mat_k", 2},
},
// source
POLYSCOPE_GLSL(330 core,
uniform sampler2D t_mat_r;
uniform sampler2D t_mat_g;
uniform sampler2D t_mat_b;
uniform sampler2D t_mat_k;
in vec3 colorToFrag;
in vec3 cameraNormalToFrag;
in float intensityToFrag;
layout(location = 0) out vec4 outputF;
vec3 lightSurfaceMat(vec3 normal, vec3 color, sampler2D t_mat_r, sampler2D t_mat_g, sampler2D t_mat_b, sampler2D t_mat_k);
void main()
{
// Compute a fade factor to set the transparency
// Basically amounts to antialiasing in screen space when lines are relatively large on screen
float screenFadeLen = 2.5;
float dF = length(vec2(dFdx(intensityToFrag),dFdy(intensityToFrag)));
float thresh = min(dF * screenFadeLen, 0.2);
float fadeFactor = smoothstep(0, thresh, intensityToFrag);
outputF = vec4(lightSurfaceMat(cameraNormalToFrag, colorToFrag, t_mat_r, t_mat_g, t_mat_b, t_mat_k), fadeFactor);
}
)
};
// clang-format on
} // namespace gl
} // namespace polyscope
| [
"nsharp@cs.cmu.edu"
] | nsharp@cs.cmu.edu |
f277376e37011c534455b40cbf4e35d98a18f881 | 4f5d377ee355165d12b81361aec35d41da771e71 | /Primavera/GraphicsEngine.h | 6a52816327535eccb95f68dc9160f243b6f4d6bd | [] | no_license | johnmwalker/Primavera | ca29f00513ace8312cb19b18d762ff09ac438cf0 | 4e5ee6b125232738ff6a45829af7c91958a4bf1c | refs/heads/master | 2022-11-25T20:16:19.468347 | 2020-07-23T20:49:04 | 2020-07-23T20:49:04 | 276,738,648 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 599 | h | #pragma once
#include<d3d11.h>
//#include"SwapChain.h"
class SwapChain;
class DeviceContext;
class GraphicsEngine
{
public:
GraphicsEngine();
bool init();
bool release();
~GraphicsEngine();
SwapChain* createSwapChain();
DeviceContext* getImmediateDeviceContext();
static GraphicsEngine* get();
private:
ID3D11Device* m_d3d_device = nullptr;
D3D_FEATURE_LEVEL m_feature_level;
ID3D11DeviceContext* m_imm_context = nullptr;
IDXGIDevice* m_dxgi_device;
IDXGIAdapter* m_dxgi_adapter;
IDXGIFactory* m_dxgi_factory;
friend class SwapChain;
DeviceContext* m_imm_device_context;
};
| [
"john.m.walker2@gmail.com"
] | john.m.walker2@gmail.com |
98e65a62dfb1e5b10517b7b4d7783db7d910f6d8 | aa4565e477946917b30ee5d01ede8ee0916aba5a | /src/server/game/Spells/Spell.cpp | 01de77ba366657f1b9265c07f2566dc2a3352793 | [] | no_license | mmoglider/GlideCore | 2b157953188f9c83b2b0ede86c469b10790cdc2d | 76b4a7562210f6fa60326d44fbc7a2640e416351 | refs/heads/master | 2016-09-06T18:46:57.294884 | 2014-04-25T03:03:57 | 2014-04-25T03:03:57 | 15,888,600 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 297,110 | cpp | /*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Common.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Opcodes.h"
#include "Log.h"
#include "UpdateMask.h"
#include "World.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Player.h"
#include "Pet.h"
#include "Unit.h"
#include "Totem.h"
#include "Spell.h"
#include "DynamicObject.h"
#include "Guild.h"
#include "Group.h"
#include "UpdateData.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "CellImpl.h"
#include "SharedDefines.h"
#include "LootMgr.h"
#include "VMapFactory.h"
#include "Battleground.h"
#include "Util.h"
#include "TemporarySummon.h"
#include "Vehicle.h"
#include "SpellAuraEffects.h"
#include "ScriptMgr.h"
#include "ConditionMgr.h"
#include "DisableMgr.h"
#include "SpellScript.h"
#include "InstanceScript.h"
#include "SpellInfo.h"
#include "DB2Stores.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
SpellDestination::SpellDestination()
{
_position.Relocate(0, 0, 0, 0);
_transportGUID = 0;
_transportOffset.Relocate(0, 0, 0, 0);
}
SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId)
{
_position.Relocate(x, y, z, orientation);
_transportGUID = 0;
_position.m_mapId = mapId;
}
SpellDestination::SpellDestination(Position const& pos)
{
_position.Relocate(pos);
_transportGUID = 0;
}
SpellDestination::SpellDestination(WorldObject const& wObj)
{
_transportGUID = wObj.GetTransGUID();
_transportOffset.Relocate(wObj.GetTransOffsetX(), wObj.GetTransOffsetY(), wObj.GetTransOffsetZ(), wObj.GetTransOffsetO());
_position.Relocate(wObj);
_position.SetOrientation(wObj.GetOrientation());
}
SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
{
m_objectTarget = NULL;
m_itemTarget = NULL;
m_objectTargetGUID = 0;
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
m_targetMask = 0;
}
SpellCastTargets::~SpellCastTargets()
{
}
void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
{
data >> m_targetMask;
if (m_targetMask == TARGET_FLAG_NONE)
return;
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_CORPSE_ALLY))
data.readPackGUID(m_objectTargetGUID);
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
data.readPackGUID(m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
data.readPackGUID(m_src._transportGUID);
if (m_src._transportGUID)
data >> m_src._transportOffset.PositionXYZStream();
else
data >> m_src._position.PositionXYZStream();
}
else
{
m_src._transportGUID = caster->GetTransGUID();
if (m_src._transportGUID)
m_src._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO());
else
m_src._position.Relocate(caster);
}
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data.readPackGUID(m_dst._transportGUID);
if (m_dst._transportGUID)
data >> m_dst._transportOffset.PositionXYZStream();
else
data >> m_dst._position.PositionXYZStream();
}
else
{
m_dst._transportGUID = caster->GetTransGUID();
if (m_dst._transportGUID)
m_dst._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO());
else
m_dst._position.Relocate(caster);
}
if (m_targetMask & TARGET_FLAG_STRING)
data >> m_strTarget;
Update(caster);
}
void SpellCastTargets::Write(ByteBuffer& data)
{
data << uint32(m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_MINIPET))
data.appendPackGUID(m_objectTargetGUID);
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
{
if (m_itemTarget)
data.append(m_itemTarget->GetPackGUID());
else
data << uint8(0);
}
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
data.appendPackGUID(m_src._transportGUID); // relative position guid here - transport for example
if (m_src._transportGUID)
data << m_src._transportOffset.PositionXYZStream();
else
data << m_src._position.PositionXYZStream();
}
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data.appendPackGUID(m_dst._transportGUID); // relative position guid here - transport for example
if (m_dst._transportGUID)
data << m_dst._transportOffset.PositionXYZStream();
else
data << m_dst._position.PositionXYZStream();
}
if (m_targetMask & TARGET_FLAG_STRING)
data << m_strTarget;
}
uint64 SpellCastTargets::GetUnitTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
{
case HIGHGUID_PLAYER:
case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT:
case HIGHGUID_PET:
return m_objectTargetGUID;
default:
return 0LL;
}
}
Unit* SpellCastTargets::GetUnitTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToUnit();
return NULL;
}
void SpellCastTargets::SetUnitTarget(Unit* target)
{
if (!target)
return;
m_objectTarget = target;
m_objectTargetGUID = target->GetGUID();
m_targetMask |= TARGET_FLAG_UNIT;
}
uint64 SpellCastTargets::GetGOTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
{
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT:
return m_objectTargetGUID;
default:
return 0LL;
}
}
GameObject* SpellCastTargets::GetGOTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToGameObject();
return NULL;
}
void SpellCastTargets::SetGOTarget(GameObject* target)
{
if (!target)
return;
m_objectTarget = target;
m_objectTargetGUID = target->GetGUID();
m_targetMask |= TARGET_FLAG_GAMEOBJECT;
}
uint64 SpellCastTargets::GetCorpseTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
{
case HIGHGUID_CORPSE:
return m_objectTargetGUID;
default:
return 0LL;
}
}
Corpse* SpellCastTargets::GetCorpseTarget() const
{
if (m_objectTarget)
return m_objectTarget->ToCorpse();
return NULL;
}
WorldObject* SpellCastTargets::GetObjectTarget() const
{
return m_objectTarget;
}
uint64 SpellCastTargets::GetObjectTargetGUID() const
{
return m_objectTargetGUID;
}
void SpellCastTargets::RemoveObjectTarget()
{
m_objectTarget = NULL;
m_objectTargetGUID = 0LL;
m_targetMask &= ~(TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK);
}
void SpellCastTargets::SetItemTarget(Item* item)
{
if (!item)
return;
m_itemTarget = item;
m_itemTargetGUID = item->GetGUID();
m_itemTargetEntry = item->GetEntry();
m_targetMask |= TARGET_FLAG_ITEM;
}
void SpellCastTargets::SetTradeItemTarget(Player* caster)
{
m_itemTargetGUID = uint64(TRADE_SLOT_NONTRADED);
m_itemTargetEntry = 0;
m_targetMask |= TARGET_FLAG_TRADE_ITEM;
Update(caster);
}
void SpellCastTargets::UpdateTradeSlotItem()
{
if (m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM))
{
m_itemTargetGUID = m_itemTarget->GetGUID();
m_itemTargetEntry = m_itemTarget->GetEntry();
}
}
SpellDestination const* SpellCastTargets::GetSrc() const
{
return &m_src;
}
Position const* SpellCastTargets::GetSrcPos() const
{
return &m_src._position;
}
void SpellCastTargets::SetSrc(float x, float y, float z)
{
m_src = SpellDestination(x, y, z);
m_targetMask |= TARGET_FLAG_SOURCE_LOCATION;
}
void SpellCastTargets::SetSrc(Position const& pos)
{
m_src = SpellDestination(pos);
m_targetMask |= TARGET_FLAG_SOURCE_LOCATION;
}
void SpellCastTargets::SetSrc(WorldObject const& wObj)
{
m_src = SpellDestination(wObj);
m_targetMask |= TARGET_FLAG_SOURCE_LOCATION;
}
void SpellCastTargets::ModSrc(Position const& pos)
{
ASSERT(m_targetMask & TARGET_FLAG_SOURCE_LOCATION);
if (m_src._transportGUID)
{
Position offset;
m_src._position.GetPositionOffsetTo(pos, offset);
m_src._transportOffset.RelocateOffset(offset);
}
m_src._position.Relocate(pos);
}
void SpellCastTargets::RemoveSrc()
{
m_targetMask &= ~(TARGET_FLAG_SOURCE_LOCATION);
}
SpellDestination const* SpellCastTargets::GetDst() const
{
return &m_dst;
}
WorldLocation const* SpellCastTargets::GetDstPos() const
{
return &m_dst._position;
}
void SpellCastTargets::SetDst(float x, float y, float z, float orientation, uint32 mapId)
{
m_dst = SpellDestination(x, y, z, orientation, mapId);
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
}
void SpellCastTargets::SetDst(Position const& pos)
{
m_dst = SpellDestination(pos);
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
}
void SpellCastTargets::SetDst(WorldObject const& wObj)
{
m_dst = SpellDestination(wObj);
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
}
void SpellCastTargets::SetDst(SpellCastTargets const& spellTargets)
{
m_dst = spellTargets.m_dst;
m_targetMask |= TARGET_FLAG_DEST_LOCATION;
}
void SpellCastTargets::ModDst(Position const& pos)
{
ASSERT(m_targetMask & TARGET_FLAG_DEST_LOCATION);
if (m_dst._transportGUID)
{
Position offset;
m_dst._position.GetPositionOffsetTo(pos, offset);
m_dst._transportOffset.RelocateOffset(offset);
}
m_dst._position.Relocate(pos);
}
void SpellCastTargets::RemoveDst()
{
m_targetMask &= ~(TARGET_FLAG_DEST_LOCATION);
}
void SpellCastTargets::Update(Unit* caster)
{
m_objectTarget = m_objectTargetGUID ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : NULL;
m_itemTarget = NULL;
if (caster->GetTypeId() == TYPEID_PLAYER)
{
Player* player = caster->ToPlayer();
if (m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = player->GetItemByGuid(m_itemTargetGUID);
else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots
if (TradeData* pTrade = player->GetTradeData())
m_itemTarget = pTrade->GetTraderData()->GetItem(TRADE_SLOT_NONTRADED);
if (m_itemTarget)
m_itemTargetEntry = m_itemTarget->GetEntry();
}
// update positions by transport move
if (HasSrc() && m_src._transportGUID)
{
if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_src._transportGUID))
{
m_src._position.Relocate(transport);
m_src._position.RelocateOffset(m_src._transportOffset);
}
}
if (HasDst() && m_dst._transportGUID)
{
if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_dst._transportGUID))
{
m_dst._position.Relocate(transport);
m_dst._position.RelocateOffset(m_dst._transportOffset);
}
}
}
void SpellCastTargets::OutDebug() const
{
if (!m_targetMask)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "No targets");
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "target mask: %u", m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Object target: " UI64FMTD, m_objectTargetGUID);
if (m_targetMask & TARGET_FLAG_ITEM)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Trade item target: " UI64FMTD, m_itemTargetGUID);
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_STRING)
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "String: %s", m_strTarget.c_str());
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "speed: %f", m_speed);
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "elevation: %f", m_elevation);
}
SpellValue::SpellValue(SpellInfo const* proto)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
EffectBasePoints[i] = proto->Effects[i].BasePoints;
MaxAffectedTargets = proto->MaxAffectedTargets;
RadiusMod = 1.0f;
AuraStackAmount = 1;
}
Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) :
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)),
m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster)
, m_spellValue(new SpellValue(m_spellInfo)), m_preGeneratedPath(PathGenerator(m_caster))
{
m_customError = SPELL_CUSTOM_ERROR_NONE;
m_skipCheck = skipCheck;
m_selfContainer = NULL;
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
m_needComboPoints = m_spellInfo->NeedsComboPoints();
m_comboPointGain = 0;
m_delayStart = 0;
m_delayAtDamageCount = 0;
m_applyMultiplierMask = 0;
m_auraScaleMask = 0;
// Get data for type of attack
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE:
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_REQ_OFFHAND)
m_attackType = OFF_ATTACK;
else
m_attackType = BASE_ATTACK;
break;
case SPELL_DAMAGE_CLASS_RANGED:
m_attackType = m_spellInfo->IsRangedWeaponSpell() ? RANGED_ATTACK : BASE_ATTACK;
break;
default:
// Wands
if (m_spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG)
m_attackType = RANGED_ATTACK;
else
m_attackType = BASE_ATTACK;
break;
}
m_spellSchoolMask = info->GetSchoolMask(); // Can be override for some spell (wand shoot for example)
if (m_attackType == RANGED_ATTACK)
// wand case
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->DamageType);
if (originalCasterGUID)
m_originalCasterGUID = originalCasterGUID;
else
m_originalCasterGUID = m_caster->GetGUID();
if (m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
else
{
m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID);
if (m_originalCaster && !m_originalCaster->IsInWorld())
m_originalCaster = NULL;
}
m_spellState = SPELL_STATE_NULL;
_triggeredCastFlags = triggerFlags;
if (info->AttributesEx4 & SPELL_ATTR4_TRIGGERED)
_triggeredCastFlags = TRIGGERED_FULL_MASK;
m_CastItem = NULL;
m_castItemGUID = 0;
unitTarget = NULL;
itemTarget = NULL;
gameObjTarget = NULL;
focusObject = NULL;
m_cast_count = 0;
m_glyphIndex = 0;
m_preCastSpell = 0;
m_triggeredByAuraSpell = NULL;
m_spellAura = NULL;
//Auto Shot & Shoot (wand)
m_autoRepeat = m_spellInfo->IsAutoRepeatRangedSpell();
m_runesState = 0;
m_powerCost = 0; // setup to correct value in Spell::prepare, must not be used before.
m_casttime = 0; // setup to correct value in Spell::prepare, must not be used before.
m_timer = 0; // will set to castime in prepare
m_channelTargetEffectMask = 0;
// Determine if spell can be reflected back to the caster
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY)
&& !(m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
&& !m_spellInfo->IsPassive() && !m_spellInfo->IsPositive();
CleanupTargetList();
memset(m_effectExecuteData, 0, MAX_SPELL_EFFECTS * sizeof(ByteBuffer*));
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
m_destTargets[i] = SpellDestination(*m_caster);
}
Spell::~Spell()
{
// unload scripts
while (!m_loadedScripts.empty())
{
std::list<SpellScript*>::iterator itr = m_loadedScripts.begin();
(*itr)->_Unload();
delete (*itr);
m_loadedScripts.erase(itr);
}
if (m_referencedFromCurrentSpell && m_selfContainer && *m_selfContainer == this)
{
// Clean the reference to avoid later crash.
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
*m_selfContainer = NULL;
}
if (m_caster && m_caster->GetTypeId() == TYPEID_PLAYER)
ASSERT(m_caster->ToPlayer()->m_spellModTakingSpell != this);
delete m_spellValue;
CheckEffectExecuteData();
}
void Spell::InitExplicitTargets(SpellCastTargets const& targets)
{
m_targets = targets;
// this function tries to correct spell explicit targets for spell
// client doesn't send explicit targets correctly sometimes - we need to fix such spells serverside
// this also makes sure that we correctly send explicit targets to client (removes redundant data)
uint32 neededTargets = m_spellInfo->GetExplicitTargetMask();
if (WorldObject* target = m_targets.GetObjectTarget())
{
// check if object target is valid with needed target flags
// for unit case allow corpse target mask because player with not released corpse is a unit target
if ((target->ToUnit() && !(neededTargets & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK)))
|| (target->ToGameObject() && !(neededTargets & TARGET_FLAG_GAMEOBJECT_MASK))
|| (target->ToCorpse() && !(neededTargets & TARGET_FLAG_CORPSE_MASK)))
m_targets.RemoveObjectTarget();
}
else
{
// try to select correct unit target if not provided by client or by serverside cast
if (neededTargets & (TARGET_FLAG_UNIT_MASK))
{
Unit* unit = NULL;
// try to use player selection as a target
if (Player* playerCaster = m_caster->ToPlayer())
{
// selection has to be found and to be valid target for the spell
if (Unit* selectedUnit = ObjectAccessor::GetUnit(*m_caster, playerCaster->GetSelection()))
if (m_spellInfo->CheckExplicitTarget(m_caster, selectedUnit) == SPELL_CAST_OK)
unit = selectedUnit;
}
// try to use attacked unit as a target
else if ((m_caster->GetTypeId() == TYPEID_UNIT) && neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT))
unit = m_caster->GetVictim();
// didn't find anything - let's use self as target
if (!unit && neededTargets & (TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_ALLY))
unit = m_caster;
m_targets.SetUnitTarget(unit);
}
}
// check if spell needs dst target
if (neededTargets & TARGET_FLAG_DEST_LOCATION)
{
// and target isn't set
if (!m_targets.HasDst())
{
// try to use unit target if provided
if (WorldObject* target = targets.GetObjectTarget())
m_targets.SetDst(*target);
// or use self if not available
else
m_targets.SetDst(*m_caster);
}
}
else
m_targets.RemoveDst();
if (neededTargets & TARGET_FLAG_SOURCE_LOCATION)
{
if (!targets.HasSrc())
m_targets.SetSrc(*m_caster);
}
else
m_targets.RemoveSrc();
}
void Spell::SelectExplicitTargets()
{
// here go all explicit target changes made to explicit targets after spell prepare phase is finished
if (Unit* target = m_targets.GetUnitTarget())
{
// check for explicit target redirection, for Grounding Totem for example
if (m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT_ENEMY
|| (m_spellInfo->GetExplicitTargetMask() & TARGET_FLAG_UNIT && !m_spellInfo->IsPositive()))
{
Unit* redirect;
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MAGIC:
redirect = m_caster->GetMagicHitRedirectTarget(target, m_spellInfo);
break;
case SPELL_DAMAGE_CLASS_MELEE:
case SPELL_DAMAGE_CLASS_RANGED:
redirect = m_caster->GetMeleeHitRedirectTarget(target, m_spellInfo);
break;
default:
redirect = NULL;
break;
}
if (redirect && (redirect != target))
m_targets.SetUnitTarget(redirect);
}
}
}
void Spell::SelectSpellTargets()
{
// select targets for cast phase
SelectExplicitTargets();
uint32 processedAreaEffectsMask = 0;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// not call for empty effect.
// Also some spells use not used effect targets for store targets for dummy effect in triggered spells
if (!m_spellInfo->Effects[i].IsEffect())
continue;
// set expected type of implicit targets to be sent to client
uint32 implicitTargetMask = GetTargetFlagMask(m_spellInfo->Effects[i].TargetA.GetObjectType()) | GetTargetFlagMask(m_spellInfo->Effects[i].TargetB.GetObjectType());
if (implicitTargetMask & TARGET_FLAG_UNIT)
m_targets.SetTargetFlag(TARGET_FLAG_UNIT);
if (implicitTargetMask & (TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM))
m_targets.SetTargetFlag(TARGET_FLAG_GAMEOBJECT);
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetA, processedAreaEffectsMask);
SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetB, processedAreaEffectsMask);
// Select targets of effect based on effect type
// those are used when no valid target could be added for spell effect based on spell target type
// some spell effects use explicit target as a default target added to target map (like SPELL_EFFECT_LEARN_SPELL)
// some spell effects add target to target map only when target type specified (like SPELL_EFFECT_WEAPON)
// some spell effects don't add anything to target map (confirmed with sniffs) (like SPELL_EFFECT_DESTROY_ALL_TOTEMS)
SelectEffectTypeImplicitTargets(i);
if (m_targets.HasDst())
AddDestTarget(*m_targets.GetDst(), i);
if (m_spellInfo->IsChanneled())
{
uint8 mask = (1 << i);
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->effectMask & mask)
{
m_channelTargetEffectMask |= mask;
break;
}
}
}
else if (m_auraScaleMask)
{
bool checkLvl = !m_UniqueTargetInfo.empty();
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end();)
{
// remove targets which did not pass min level check
if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask)
{
// Do not check for selfcast
if (!ihit->scaleAura && ihit->targetGUID != m_caster->GetGUID())
{
m_UniqueTargetInfo.erase(ihit++);
continue;
}
}
++ihit;
}
if (checkLvl && m_UniqueTargetInfo.empty())
{
SendCastResult(SPELL_FAILED_LOWLEVEL);
finish(false);
}
}
}
if (m_targets.HasDst())
{
if (m_targets.HasTraj())
{
float speed = m_targets.GetSpeedXY();
if (speed > 0.0f)
m_delayMoment = (uint64)floor(m_targets.GetDist2d() / speed * 1000.0f);
}
else if (m_spellInfo->Speed > 0.0f)
{
float dist = m_caster->GetDistance(*m_targets.GetDstPos());
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
m_delayMoment = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
m_delayMoment = uint64(m_spellInfo->Speed * 1000.0f);
}
}
}
void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask)
{
if (!targetType.GetTarget())
return;
uint32 effectMask = 1 << effIndex;
// set the same target list for all effects
// some spells appear to need this, however this requires more research
switch (targetType.GetSelectionCategory())
{
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
// targets for effect already selected
if (effectMask & processedEffectMask)
return;
// choose which targets we can select at once
for (uint32 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j)
{
SpellEffectInfo const* effects = GetSpellInfo()->Effects;
if (effects[effIndex].TargetA.GetTarget() == effects[j].TargetA.GetTarget() &&
effects[effIndex].TargetB.GetTarget() == effects[j].TargetB.GetTarget() &&
effects[effIndex].ImplicitTargetConditions == effects[j].ImplicitTargetConditions &&
effects[effIndex].CalcRadius(m_caster) == effects[j].CalcRadius(m_caster) &&
CheckScriptEffectImplicitTargets(effIndex, j))
{
effectMask |= 1 << j;
}
}
processedEffectMask |= effectMask;
break;
default:
break;
}
switch (targetType.GetSelectionCategory())
{
case TARGET_SELECT_CATEGORY_CHANNEL:
SelectImplicitChannelTargets(effIndex, targetType);
break;
case TARGET_SELECT_CATEGORY_NEARBY:
SelectImplicitNearbyTargets(effIndex, targetType, effectMask);
break;
case TARGET_SELECT_CATEGORY_CONE:
SelectImplicitConeTargets(effIndex, targetType, effectMask);
break;
case TARGET_SELECT_CATEGORY_AREA:
SelectImplicitAreaTargets(effIndex, targetType, effectMask);
break;
case TARGET_SELECT_CATEGORY_DEFAULT:
switch (targetType.GetObjectType())
{
case TARGET_OBJECT_TYPE_SRC:
switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
m_targets.SetSrc(*m_caster);
break;
default:
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC");
break;
}
break;
case TARGET_OBJECT_TYPE_DEST:
switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
SelectImplicitCasterDestTargets(effIndex, targetType);
break;
case TARGET_REFERENCE_TYPE_TARGET:
SelectImplicitTargetDestTargets(effIndex, targetType);
break;
case TARGET_REFERENCE_TYPE_DEST:
SelectImplicitDestDestTargets(effIndex, targetType);
break;
default:
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
break;
}
break;
default:
switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_CASTER:
SelectImplicitCasterObjectTargets(effIndex, targetType);
break;
case TARGET_REFERENCE_TYPE_TARGET:
SelectImplicitTargetObjectTargets(effIndex, targetType);
break;
default:
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT");
break;
}
break;
}
break;
case TARGET_SELECT_CATEGORY_NYI:
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget());
break;
default:
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target category");
break;
}
}
void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER)
{
ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target reference type");
return;
}
Spell* channeledSpell = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL);
if (!channeledSpell)
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitChannelTargets: cannot find channel spell for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
return;
}
switch (targetType.GetTarget())
{
case TARGET_UNIT_CHANNEL_TARGET:
{
WorldObject* target = ObjectAccessor::GetUnit(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
CallScriptObjectTargetSelectHandlers(target, effIndex);
// unit target may be no longer avalible - teleported out of map for example
if (target && target->ToUnit())
AddUnitTarget(target->ToUnit(), 1 << effIndex);
else
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
break;
}
case TARGET_DEST_CHANNEL_TARGET:
if (channeledSpell->m_targets.HasDst())
m_targets.SetDst(channeledSpell->m_targets);
else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, m_originalCaster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT)))
{
CallScriptObjectTargetSelectHandlers(target, effIndex);
if (target)
m_targets.SetDst(*target);
}
else
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
break;
case TARGET_DEST_CHANNEL_CASTER:
m_targets.SetDst(*channeledSpell->GetCaster());
break;
default:
ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type");
break;
}
}
void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
{
if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER)
{
ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented target reference type");
return;
}
float range = 0.0f;
switch (targetType.GetCheckType())
{
case TARGET_CHECK_ENEMY:
range = m_spellInfo->GetMaxRange(false, m_caster, this);
break;
case TARGET_CHECK_ALLY:
case TARGET_CHECK_PARTY:
case TARGET_CHECK_RAID:
case TARGET_CHECK_RAID_CLASS:
range = m_spellInfo->GetMaxRange(true, m_caster, this);
break;
case TARGET_CHECK_ENTRY:
case TARGET_CHECK_DEFAULT:
range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive(), m_caster, this);
break;
default:
ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented selection check type");
break;
}
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
// handle emergency case - try to use other provided targets if no conditions provided
if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty()))
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex);
switch (targetType.GetObjectType())
{
case TARGET_OBJECT_TYPE_GOBJ:
if (m_spellInfo->RequiresSpellFocus)
{
if (focusObject)
AddGOTarget(focusObject, effMask);
return;
}
break;
case TARGET_OBJECT_TYPE_DEST:
if (m_spellInfo->RequiresSpellFocus)
{
if (focusObject)
m_targets.SetDst(*focusObject);
return;
}
break;
default:
break;
}
}
WorldObject* target = SearchNearbyTarget(range, targetType.GetObjectType(), targetType.GetCheckType(), condList);
if (!target)
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
return;
}
CallScriptObjectTargetSelectHandlers(target, effIndex);
switch (targetType.GetObjectType())
{
case TARGET_OBJECT_TYPE_UNIT:
if (Unit* unitTarget = target->ToUnit())
AddUnitTarget(unitTarget, effMask, true, false);
break;
case TARGET_OBJECT_TYPE_GOBJ:
if (GameObject* gobjTarget = target->ToGameObject())
AddGOTarget(gobjTarget, effMask);
break;
case TARGET_OBJECT_TYPE_DEST:
m_targets.SetDst(*target);
break;
default:
ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented target object type");
break;
}
SelectImplicitChainTargets(effIndex, targetType, target, effMask);
}
void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
{
if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER)
{
ASSERT(false && "Spell::SelectImplicitConeTargets: received not implemented target reference type");
return;
}
std::list<WorldObject*> targets;
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
float coneAngle = M_PI/2;
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod;
if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList))
{
Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> searcher(m_caster, targets, check, containerTypeMask);
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellConeTargetCheck> >(searcher, containerTypeMask, m_caster, m_caster, radius);
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
if (!targets.empty())
{
// Other special target selection goes here
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
Trinity::Containers::RandomResizeList(targets, maxTargets);
// for compability with older code - add only unit and go targets
/// @todo remove this
std::list<Unit*> unitTargets;
std::list<GameObject*> gObjTargets;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
unitTargets.push_back(unitTarget);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
gObjTargets.push_back(gObjTarget);
}
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
for (std::list<GameObject*>::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr)
AddGOTarget(*itr, effMask);
}
}
}
void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask)
{
Unit* referer = NULL;
switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_SRC:
case TARGET_REFERENCE_TYPE_DEST:
case TARGET_REFERENCE_TYPE_CASTER:
referer = m_caster;
break;
case TARGET_REFERENCE_TYPE_TARGET:
referer = m_targets.GetUnitTarget();
break;
case TARGET_REFERENCE_TYPE_LAST:
{
// find last added target for this effect
for (std::list<TargetInfo>::reverse_iterator ihit = m_UniqueTargetInfo.rbegin(); ihit != m_UniqueTargetInfo.rend(); ++ihit)
{
if (ihit->effectMask & (1<<effIndex))
{
referer = ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
break;
}
}
break;
}
default:
ASSERT(false && "Spell::SelectImplicitAreaTargets: received not implemented target reference type");
return;
}
if (!referer)
return;
Position const* center = NULL;
switch (targetType.GetReferenceType())
{
case TARGET_REFERENCE_TYPE_SRC:
center = m_targets.GetSrcPos();
break;
case TARGET_REFERENCE_TYPE_DEST:
center = m_targets.GetDstPos();
break;
case TARGET_REFERENCE_TYPE_CASTER:
case TARGET_REFERENCE_TYPE_TARGET:
case TARGET_REFERENCE_TYPE_LAST:
center = referer;
break;
default:
ASSERT(false && "Spell::SelectImplicitAreaTargets: received not implemented target reference type");
return;
}
std::list<WorldObject*> targets;
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod;
SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), m_spellInfo->Effects[effIndex].ImplicitTargetConditions);
// Custom entries
/// @todo remove those
switch (m_spellInfo->Id)
{
case 46584: // Raise Dead
{
if (Player* playerCaster = m_caster->ToPlayer())
{
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
switch ((*itr)->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
{
Unit* unitTarget = (*itr)->ToUnit();
if (unitTarget->IsAlive() || !playerCaster->isHonorOrXPTarget(unitTarget)
|| ((unitTarget->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0)
|| (unitTarget->GetDisplayId() != unitTarget->GetNativeDisplayId()))
break;
AddUnitTarget(unitTarget, effMask, false);
// no break;
}
case TYPEID_CORPSE: // wont work until corpses are allowed in target lists, but at least will send dest in packet
m_targets.SetDst(*(*itr));
return; // nothing more to do here
default:
break;
}
}
}
return; // don't add targets to target map
}
// Corpse Explosion
case 49158:
case 51325:
case 51326:
case 51327:
case 51328:
// check if our target is not valid (spell can target ghoul or dead unit)
if (!(m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId() &&
((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID())
|| m_targets.GetUnitTarget()->isDead())))
{
// remove existing targets
CleanupTargetList();
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
switch ((*itr)->GetTypeId())
{
case TYPEID_UNIT:
case TYPEID_PLAYER:
if (!(*itr)->ToUnit()->isDead())
break;
AddUnitTarget((*itr)->ToUnit(), 1 << effIndex, false);
return;
default:
break;
}
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
finish(false);
}
return;
default:
break;
}
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
std::list<Unit*> unitTargets;
std::list<GameObject*> gObjTargets;
// for compability with older code - add only unit and go targets
/// @todo remove this
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
unitTargets.push_back(unitTarget);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
gObjTargets.push_back(gObjTarget);
}
if (!unitTargets.empty())
{
// Special target selection for smart heals and energizes
uint32 maxSize = 0;
int32 power = -1;
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (m_spellInfo->Id)
{
case 52759: // Ancestral Awakening
case 71610: // Echoes of Light (Althor's Abacus normal version)
case 71641: // Echoes of Light (Althor's Abacus heroic version)
maxSize = 1;
power = POWER_HEALTH;
break;
case 54968: // Glyph of Holy Light
maxSize = m_spellInfo->MaxAffectedTargets;
power = POWER_HEALTH;
break;
case 57669: // Replenishment
// In arenas Replenishment may only affect the caster
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->InArena())
{
unitTargets.clear();
unitTargets.push_back(m_caster);
break;
}
maxSize = 10;
power = POWER_MANA;
break;
default:
break;
}
break;
case SPELLFAMILY_PRIEST:
if (m_spellInfo->SpellFamilyFlags[0] == 0x10000000) // Circle of Healing
{
maxSize = m_caster->HasAura(55675) ? 6 : 5; // Glyph of Circle of Healing
power = POWER_HEALTH;
}
else if (m_spellInfo->Id == 64844) // Divine Hymn
{
maxSize = 3;
power = POWER_HEALTH;
}
else if (m_spellInfo->Id == 64904) // Hymn of Hope
{
maxSize = 3;
power = POWER_MANA;
}
else
break;
// Remove targets outside caster's raid
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
else
++itr;
}
break;
case SPELLFAMILY_DRUID:
if (m_spellInfo->SpellFamilyFlags[1] == 0x04000000) // Wild Growth
{
maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth
power = POWER_HEALTH;
}
else
break;
// Remove targets outside caster's raid
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
else
++itr;
break;
default:
break;
}
if (maxSize && power != -1)
{
if (Powers(power) == POWER_HEALTH)
{
if (unitTargets.size() > maxSize)
{
unitTargets.sort(Trinity::HealthPctOrderPred());
unitTargets.resize(maxSize);
}
}
else
{
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if ((*itr)->getPowerType() != (Powers)power)
itr = unitTargets.erase(itr);
else
++itr;
if (unitTargets.size() > maxSize)
{
unitTargets.sort(Trinity::PowerPctOrderPred((Powers)power));
unitTargets.resize(maxSize);
}
}
}
// Other special target selection goes here
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
Trinity::Containers::RandomResizeList(unitTargets, maxTargets);
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
}
if (!gObjTargets.empty())
{
if (uint32 maxTargets = m_spellValue->MaxAffectedTargets)
Trinity::Containers::RandomResizeList(gObjTargets, maxTargets);
for (std::list<GameObject*>::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr)
AddGOTarget(*itr, effMask);
}
}
void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
switch (targetType.GetTarget())
{
case TARGET_DEST_CASTER:
m_targets.SetDst(*m_caster);
return;
case TARGET_DEST_HOME:
if (Player* playerCaster = m_caster->ToPlayer())
m_targets.SetDst(playerCaster->m_homebindX, playerCaster->m_homebindY, playerCaster->m_homebindZ, playerCaster->GetOrientation(), playerCaster->m_homebindMapId);
return;
case TARGET_DEST_DB:
if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id, effIndex))
{
/// @todo fix this check
if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND))
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId);
else if (st->target_mapId == m_caster->GetMapId())
m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation);
}
else
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id);
WorldObject* target = m_targets.GetObjectTarget();
m_targets.SetDst(target ? *target : *m_caster);
}
return;
case TARGET_DEST_CASTER_FISHING:
{
float min_dis = m_spellInfo->GetMinRange(true);
float max_dis = m_spellInfo->GetMaxRange(true);
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
float x, y, z, angle;
angle = (float)rand_norm() * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle);
float ground = z;
float liquidLevel = m_caster->GetMap()->GetWaterOrGroundLevel(x, y, z, &ground);
if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
{
SendCastResult(SPELL_FAILED_NOT_HERE);
SendChannelUpdate(0);
finish(false);
return;
}
if (ground + 0.75 > liquidLevel)
{
SendCastResult(SPELL_FAILED_TOO_SHALLOW);
SendChannelUpdate(0);
finish(false);
return;
}
m_targets.SetDst(x, y, liquidLevel, m_caster->GetOrientation());
return;
}
default:
break;
}
float dist;
float angle = targetType.CalcDirectionAngle();
float objSize = m_caster->GetObjectSize();
if (targetType.GetTarget() == TARGET_DEST_CASTER_SUMMON)
dist = PET_FOLLOW_DIST;
else
dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
if (dist < objSize)
dist = objSize;
else if (targetType.GetTarget() == TARGET_DEST_CASTER_RANDOM)
dist = objSize + (dist - objSize) * (float)rand_norm();
Position pos;
if (targetType.GetTarget() == TARGET_DEST_CASTER_FRONT_LEAP)
m_caster->GetFirstCollisionPosition(pos, dist, angle);
else
m_caster->GetNearPosition(pos, dist, angle);
m_targets.SetDst(*m_caster);
m_targets.ModDst(pos);
}
void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
WorldObject* target = m_targets.GetObjectTarget();
switch (targetType.GetTarget())
{
case TARGET_DEST_TARGET_ENEMY:
case TARGET_DEST_TARGET_ANY:
m_targets.SetDst(*target);
return;
default:
break;
}
float angle = targetType.CalcDirectionAngle();
float objSize = target->GetObjectSize();
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
if (dist < objSize)
dist = objSize;
else if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM)
dist = objSize + (dist - objSize) * (float)rand_norm();
Position pos;
target->GetNearPosition(pos, dist, angle);
m_targets.SetDst(*target);
m_targets.ModDst(pos);
}
void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
// set destination to caster if no dest provided
// can only happen if previous destination target could not be set for some reason
// (not found nearby target, or channel target for example
// maybe we should abort the spell in such case?
if (!m_targets.HasDst())
m_targets.SetDst(*m_caster);
switch (targetType.GetTarget())
{
case TARGET_DEST_DYNOBJ_ENEMY:
case TARGET_DEST_DYNOBJ_ALLY:
case TARGET_DEST_DYNOBJ_NONE:
case TARGET_DEST_DEST:
return;
case TARGET_DEST_TRAJ:
SelectImplicitTrajTargets();
return;
default:
break;
}
float angle = targetType.CalcDirectionAngle();
float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster);
if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM)
dist *= (float)rand_norm();
Position pos = *m_targets.GetDstPos();
m_caster->MovePosition(pos, dist, angle);
m_targets.ModDst(pos);
}
void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
WorldObject* target = NULL;
bool checkIfValid = true;
switch (targetType.GetTarget())
{
case TARGET_UNIT_CASTER:
target = m_caster;
checkIfValid = false;
break;
case TARGET_UNIT_MASTER:
target = m_caster->GetCharmerOrOwner();
break;
case TARGET_UNIT_PET:
target = m_caster->GetGuardianPet();
break;
case TARGET_UNIT_SUMMONER:
if (m_caster->IsSummon())
target = m_caster->ToTempSummon()->GetSummoner();
break;
case TARGET_UNIT_VEHICLE:
target = m_caster->GetVehicleBase();
break;
case TARGET_UNIT_PASSENGER_0:
case TARGET_UNIT_PASSENGER_1:
case TARGET_UNIT_PASSENGER_2:
case TARGET_UNIT_PASSENGER_3:
case TARGET_UNIT_PASSENGER_4:
case TARGET_UNIT_PASSENGER_5:
case TARGET_UNIT_PASSENGER_6:
case TARGET_UNIT_PASSENGER_7:
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
target = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0);
break;
default:
break;
}
CallScriptObjectTargetSelectHandlers(target, effIndex);
if (target && target->ToUnit())
AddUnitTarget(target->ToUnit(), 1 << effIndex, checkIfValid);
}
void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)
{
ASSERT((m_targets.GetObjectTarget() || m_targets.GetItemTarget()) && "Spell::SelectImplicitTargetObjectTargets - no explicit object or item target available!");
WorldObject* target = m_targets.GetObjectTarget();
CallScriptObjectTargetSelectHandlers(target, effIndex);
if (target)
{
if (Unit* unit = target->ToUnit())
AddUnitTarget(unit, 1 << effIndex, true, false);
else if (GameObject* gobj = target->ToGameObject())
AddGOTarget(gobj, 1 << effIndex);
SelectImplicitChainTargets(effIndex, targetType, target, 1 << effIndex);
}
// Script hook can remove object target and we would wrongly land here
else if (Item* item = m_targets.GetItemTarget())
AddItemTarget(item, 1 << effIndex);
}
void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask)
{
uint32 maxTargets = m_spellInfo->Effects[effIndex].ChainTarget;
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this);
if (maxTargets > 1)
{
// mark damage multipliers as used
for (uint32 k = effIndex; k < MAX_SPELL_EFFECTS; ++k)
if (effMask & (1 << k))
m_damageMultipliers[k] = 1.0f;
m_applyMultiplierMask |= effMask;
std::list<WorldObject*> targets;
SearchChainTargets(targets, maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType()
, m_spellInfo->Effects[effIndex].ImplicitTargetConditions, targetType.GetTarget() == TARGET_UNIT_TARGET_CHAINHEAL_ALLY);
// Chain primary target is added earlier
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex);
// for backward compability
std::list<Unit*> unitTargets;
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
if (Unit* unitTarget = (*itr)->ToUnit())
unitTargets.push_back(unitTarget);
for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr)
AddUnitTarget(*itr, effMask, false);
}
}
float tangent(float x)
{
x = tan(x);
//if (x < std::numeric_limits<float>::max() && x > -std::numeric_limits<float>::max()) return x;
//if (x >= std::numeric_limits<float>::max()) return std::numeric_limits<float>::max();
//if (x <= -std::numeric_limits<float>::max()) return -std::numeric_limits<float>::max();
if (x < 100000.0f && x > -100000.0f) return x;
if (x >= 100000.0f) return 100000.0f;
if (x <= 100000.0f) return -100000.0f;
return 0.0f;
}
#define DEBUG_TRAJ(a) //a
void Spell::SelectImplicitTrajTargets()
{
if (!m_targets.HasTraj())
return;
float dist2d = m_targets.GetDist2d();
if (!dist2d)
return;
float srcToDestDelta = m_targets.GetDstPos()->m_positionZ - m_targets.GetSrcPos()->m_positionZ;
std::list<WorldObject*> targets;
Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, m_targets.GetSrcPos(), m_caster, m_spellInfo);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> searcher(m_caster, targets, check, GRID_MAP_TYPE_MASK_ALL);
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellTrajTargetCheck> > (searcher, GRID_MAP_TYPE_MASK_ALL, m_caster, m_targets.GetSrcPos(), dist2d);
if (targets.empty())
return;
targets.sort(Trinity::ObjectDistanceOrderPred(m_caster));
float b = tangent(m_targets.GetElevation());
float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d);
if (a > -0.0001f)
a = 0;
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: a %f b %f", a, b);)
float bestDist = m_spellInfo->GetMaxRange(false);
std::list<WorldObject*>::const_iterator itr = targets.begin();
for (; itr != targets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || (unitTarget)->GetVehicle())//(*itr)->IsOnVehicle(m_caster))
continue;
const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3)
/// @todo all calculation should be based on src instead of m_caster
const float objDist2d = m_targets.GetSrcPos()->GetExactDist2d(*itr) * std::cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr));
const float dz = (*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ;
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
float dist = objDist2d - size;
float height = dist * (a * dist + b);
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
if (dist < bestDist && height < dz + size && height > dz - size)
{
bestDist = dist > 0 ? dist : 0;
break;
}
#define CHECK_DIST {\
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
if (dist > bestDist)\
continue;\
if (dist < objDist2d + size && dist > objDist2d - size)\
{\
bestDist = dist;\
break;\
}\
}
if (!a)
{
height = dz - size;
dist = height / b;
CHECK_DIST;
height = dz + size;
dist = height / b;
CHECK_DIST;
continue;
}
height = dz - size;
float sqrt1 = b * b + 4 * a * height;
if (sqrt1 > 0)
{
sqrt1 = sqrt(sqrt1);
dist = (sqrt1 - b) / (2 * a);
CHECK_DIST;
}
height = dz + size;
float sqrt2 = b * b + 4 * a * height;
if (sqrt2 > 0)
{
sqrt2 = sqrt(sqrt2);
dist = (sqrt2 - b) / (2 * a);
CHECK_DIST;
dist = (-sqrt2 - b) / (2 * a);
CHECK_DIST;
}
if (sqrt1 > 0)
{
dist = (-sqrt1 - b) / (2 * a);
CHECK_DIST;
}
}
if (m_targets.GetSrcPos()->GetExactDist2d(m_targets.GetDstPos()) > bestDist)
{
float x = m_targets.GetSrcPos()->m_positionX + std::cos(m_caster->GetOrientation()) * bestDist;
float y = m_targets.GetSrcPos()->m_positionY + std::sin(m_caster->GetOrientation()) * bestDist;
float z = m_targets.GetSrcPos()->m_positionZ + bestDist * (a * bestDist + b);
if (itr != targets.end())
{
float distSq = (*itr)->GetExactDistSq(x, y, z);
float sizeSq = (*itr)->GetObjectSize();
sizeSq *= sizeSq;
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
if (distSq > sizeSq)
{
float factor = 1 - sqrt(sizeSq / distSq);
x += factor * ((*itr)->GetPositionX() - x);
y += factor * ((*itr)->GetPositionY() - y);
z += factor * ((*itr)->GetPositionZ() - z);
distSq = (*itr)->GetExactDistSq(x, y, z);
DEBUG_TRAJ(TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
}
}
Position trajDst;
trajDst.Relocate(x, y, z, m_caster->GetOrientation());
m_targets.ModDst(trajDst);
}
if (Vehicle* veh = m_caster->GetVehicleKit())
veh->SetLastShootPos(*m_targets.GetDstPos());
}
void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
{
// special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER
/// @todo this is a workaround - target shouldn't be stored in target map for those spells
switch (m_spellInfo->Effects[effIndex].Effect)
{
case SPELL_EFFECT_SUMMON_RAF_FRIEND:
case SPELL_EFFECT_SUMMON_PLAYER:
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
{
WorldObject* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex));
if (target && target->ToPlayer())
AddUnitTarget(target->ToUnit(), 1 << effIndex, false);
}
return;
default:
break;
}
// select spell implicit targets based on effect type
if (!m_spellInfo->Effects[effIndex].GetImplicitTargetType())
return;
uint32 targetMask = m_spellInfo->Effects[effIndex].GetMissingTargetMask();
if (!targetMask)
return;
WorldObject* target = NULL;
switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType())
{
// add explicit object target or self to the target map
case EFFECT_IMPLICIT_TARGET_EXPLICIT:
// player which not released his spirit is Unit, but target flag for it is TARGET_FLAG_CORPSE_MASK
if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK))
{
if (Unit* unitTarget = m_targets.GetUnitTarget())
target = unitTarget;
else if (targetMask & TARGET_FLAG_CORPSE_MASK)
{
if (Corpse* corpseTarget = m_targets.GetCorpseTarget())
{
/// @todo this is a workaround - corpses should be added to spell target map too, but we can't do that so we add owner instead
if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
target = owner;
}
}
else //if (targetMask & TARGET_FLAG_UNIT_MASK)
target = m_caster;
}
if (targetMask & TARGET_FLAG_ITEM_MASK)
{
if (Item* itemTarget = m_targets.GetItemTarget())
AddItemTarget(itemTarget, 1 << effIndex);
return;
}
if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK)
target = m_targets.GetGOTarget();
break;
// add self to the target map
case EFFECT_IMPLICIT_TARGET_CASTER:
if (targetMask & TARGET_FLAG_UNIT_MASK)
target = m_caster;
break;
default:
break;
}
CallScriptObjectTargetSelectHandlers(target, SpellEffIndex(effIndex));
if (target)
{
if (target->ToUnit())
AddUnitTarget(target->ToUnit(), 1 << effIndex, false);
else if (target->ToGameObject())
AddGOTarget(target->ToGameObject(), 1 << effIndex);
}
}
uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList)
{
// this function selects which containers need to be searched for spell target
uint32 retMask = GRID_MAP_TYPE_MASK_ALL;
// filter searchers based on searched object type
switch (objType)
{
case TARGET_OBJECT_TYPE_UNIT:
case TARGET_OBJECT_TYPE_UNIT_AND_DEST:
case TARGET_OBJECT_TYPE_CORPSE:
case TARGET_OBJECT_TYPE_CORPSE_ENEMY:
case TARGET_OBJECT_TYPE_CORPSE_ALLY:
retMask &= GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_CREATURE;
break;
case TARGET_OBJECT_TYPE_GOBJ:
case TARGET_OBJECT_TYPE_GOBJ_ITEM:
retMask &= GRID_MAP_TYPE_MASK_GAMEOBJECT;
break;
default:
break;
}
if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_DEAD))
retMask &= ~GRID_MAP_TYPE_MASK_CORPSE;
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS)
retMask &= GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER;
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS)
retMask &= GRID_MAP_TYPE_MASK_PLAYER;
if (condList)
retMask &= sConditionMgr->GetSearcherTypeMaskForConditionList(*condList);
return retMask;
}
template<class SEARCHER>
void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius)
{
if (!containerMask)
return;
// search world and grid for possible targets
bool searchInGrid = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_GAMEOBJECT);
bool searchInWorld = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE);
if (searchInGrid || searchInWorld)
{
float x, y;
x = pos->GetPositionX();
y = pos->GetPositionY();
CellCoord p(Trinity::ComputeCellCoord(x, y));
Cell cell(p);
cell.SetNoCreate();
Map& map = *(referer->GetMap());
if (searchInWorld)
{
TypeContainerVisitor<SEARCHER, WorldTypeMapContainer> world_object_notifier(searcher);
cell.Visit(p, world_object_notifier, map, radius, x, y);
}
if (searchInGrid)
{
TypeContainerVisitor<SEARCHER, GridTypeMapContainer > grid_object_notifier(searcher);
cell.Visit(p, grid_object_notifier, map, radius, x, y);
}
}
}
WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList)
{
WorldObject* target = NULL;
uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList);
if (!containerTypeMask)
return NULL;
Trinity::WorldObjectSpellNearbyTargetCheck check(range, m_caster, m_spellInfo, selectionType, condList);
Trinity::WorldObjectLastSearcher<Trinity::WorldObjectSpellNearbyTargetCheck> searcher(m_caster, target, check, containerTypeMask);
SearchTargets<Trinity::WorldObjectLastSearcher<Trinity::WorldObjectSpellNearbyTargetCheck> > (searcher, containerTypeMask, m_caster, m_caster, range);
return target;
}
void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList)
{
uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList);
if (!containerTypeMask)
return;
Trinity::WorldObjectSpellAreaTargetCheck check(range, position, m_caster, referer, m_spellInfo, selectionType, condList);
Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> searcher(m_caster, targets, check, containerTypeMask);
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> > (searcher, containerTypeMask, m_caster, position, range);
}
void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal)
{
// max dist for jump target selection
float jumpRadius = 0.0f;
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_RANGED:
// 7.5y for multi shot
jumpRadius = 7.5f;
break;
case SPELL_DAMAGE_CLASS_MELEE:
// 5y for swipe, cleave and similar
jumpRadius = 5.0f;
break;
case SPELL_DAMAGE_CLASS_NONE:
case SPELL_DAMAGE_CLASS_MAGIC:
// 12.5y for chain heal spell since 3.2 patch
if (isChainHeal)
jumpRadius = 12.5f;
// 10y as default for magic chain spells
else
jumpRadius = 10.0f;
break;
}
// chain lightning/heal spells and similar - allow to jump at larger distance and go out of los
bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN
|| m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE
|| m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC);
// max dist which spell can reach
float searchRadius = jumpRadius;
if (isBouncingFar)
searchRadius *= chainTargets;
std::list<WorldObject*> tempTargets;
SearchAreaTargets(tempTargets, searchRadius, target, m_caster, objectType, selectType, condList);
tempTargets.remove(target);
// remove targets which are always invalid for chain spells
// for some spells allow only chain targets in front of caster (swipe for example)
if (!isBouncingFar)
{
for (std::list<WorldObject*>::iterator itr = tempTargets.begin(); itr != tempTargets.end();)
{
std::list<WorldObject*>::iterator checkItr = itr++;
if (!m_caster->HasInArc(static_cast<float>(M_PI), *checkItr))
tempTargets.erase(checkItr);
}
}
while (chainTargets)
{
// try to get unit for next chain jump
std::list<WorldObject*>::iterator foundItr = tempTargets.end();
// get unit with highest hp deficit in dist
if (isChainHeal)
{
uint32 maxHPDeficit = 0;
for (std::list<WorldObject*>::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr)
{
if (Unit* unitTarget = (*itr)->ToUnit())
{
uint32 deficit = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unitTarget, jumpRadius) && target->IsWithinLOSInMap(unitTarget))
{
foundItr = itr;
maxHPDeficit = deficit;
}
}
}
}
// get closest object
else
{
for (std::list<WorldObject*>::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr)
{
if (foundItr == tempTargets.end())
{
if ((!isBouncingFar || target->IsWithinDist(*itr, jumpRadius)) && target->IsWithinLOSInMap(*itr))
foundItr = itr;
}
else if (target->GetDistanceOrder(*itr, *foundItr) && target->IsWithinLOSInMap(*itr))
foundItr = itr;
}
}
// not found any valid target - chain ends
if (foundItr == tempTargets.end())
break;
target = *foundItr;
tempTargets.erase(foundItr);
targets.push_back(target);
--chainTargets;
}
}
void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
{
//==========================================================================================
// Now fill data for trigger system, need know:
// can spell trigger another or not (m_canTrigger)
// Create base triggers flags for Attacker and Victim (m_procAttacker, m_procVictim and m_procEx)
//==========================================================================================
m_procVictim = m_procAttacker = 0;
// Get data for type of attack and fill base info for trigger
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MELEE:
m_procAttacker = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS;
if (m_attackType == OFF_ATTACK)
m_procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK;
else
m_procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK;
m_procVictim = PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS;
break;
case SPELL_DAMAGE_CLASS_RANGED:
// Auto attack
if (m_spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG)
{
m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK;
m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK;
}
else // Ranged spell attack
{
m_procAttacker = PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS;
m_procVictim = PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS;
}
break;
default:
if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON &&
m_spellInfo->EquippedItemSubClassMask & (1<<ITEM_SUBCLASS_WEAPON_WAND)
&& m_spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) // Wands auto attack
{
m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK;
m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK;
}
// For other spells trigger procflags are set in Spell::DoAllEffectOnTarget
// Because spell positivity is dependant on target
}
m_procEx = PROC_EX_NONE;
// Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER &&
(m_spellInfo->SpellFamilyFlags[0] & 0x18 || // Freezing and Frost Trap, Freezing Arrow
m_spellInfo->Id == 57879 || // Snake Trap - done this way to avoid double proc
m_spellInfo->SpellFamilyFlags[2] & 0x00024000)) // Explosive and Immolation Trap
{
m_procAttacker |= PROC_FLAG_DONE_TRAP_ACTIVATION;
}
/* Effects which are result of aura proc from triggered spell cannot proc
to prevent chain proc of these spells */
// Hellfire Effect - trigger as DOT
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[0] & 0x00000040)
{
m_procAttacker = PROC_FLAG_DONE_PERIODIC;
m_procVictim = PROC_FLAG_TAKEN_PERIODIC;
}
// Ranged autorepeat attack is set as triggered spell - ignore it
if (!(m_procAttacker & PROC_FLAG_DONE_RANGED_AUTO_ATTACK))
{
if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS &&
(m_spellInfo->AttributesEx2 & SPELL_ATTR2_TRIGGERED_CAN_TRIGGER_PROC ||
m_spellInfo->AttributesEx3 & SPELL_ATTR3_TRIGGERED_CAN_TRIGGER_PROC_2))
m_procEx |= PROC_EX_INTERNAL_CANT_PROC;
else if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS)
m_procEx |= PROC_EX_INTERNAL_TRIGGERED;
}
// Totem casts require spellfamilymask defined in spell_proc_event to proc
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsTotem() && m_caster->IsControlledByPlayer())
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
}
void Spell::CleanupTargetList()
{
m_UniqueTargetInfo.clear();
m_UniqueGOTargetInfo.clear();
m_UniqueItemInfo.clear();
m_delayMoment = 0;
}
void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/, bool implicit /*= true*/)
{
for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex))
effectMask &= ~(1 << effIndex);
// no effects left
if (!effectMask)
return;
if (checkIfValid)
if (m_spellInfo->CheckTarget(m_caster, target, implicit) != SPELL_CAST_OK)
return;
// Check for effect immune skip if immuned
for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex))
effectMask &= ~(1 << effIndex);
uint64 targetGUID = target->GetGUID();
// Lookup target in already in list
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (targetGUID == ihit->targetGUID) // Found in list
{
ihit->effectMask |= effectMask; // Immune effects removed from mask
ihit->scaleAura = false;
if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target)
{
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel)
ihit->scaleAura = true;
}
return;
}
}
// This is new target calculate data for him
// Get spell hit result on target
TargetInfo targetInfo;
targetInfo.targetGUID = targetGUID; // Store target GUID
targetInfo.effectMask = effectMask; // Store all effects not immune
targetInfo.processed = false; // Effects not apply on target
targetInfo.alive = target->IsAlive();
targetInfo.damage = 0;
targetInfo.crit = false;
targetInfo.scaleAura = false;
if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target)
{
SpellInfo const* auraSpell = m_spellInfo->GetFirstRankSpell();
if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel)
targetInfo.scaleAura = true;
}
// Calculate hit result
if (m_originalCaster)
{
targetInfo.missCondition = m_originalCaster->SpellHitResult(target, m_spellInfo, m_canReflect);
if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE)
targetInfo.missCondition = SPELL_MISS_NONE;
}
else
targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE;
// Spell have speed - need calculate incoming time
// Incoming time is zero for self casts. At least I think so.
if (m_spellInfo->Speed > 0.0f && m_caster != target)
{
// calculate spell incoming interval
/// @todo this is a hack
float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
targetInfo.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
targetInfo.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
// Calculate minimum incoming time
if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay)
m_delayMoment = targetInfo.timeDelay;
}
else
targetInfo.timeDelay = 0LL;
// If target reflect spell back to caster
if (targetInfo.missCondition == SPELL_MISS_REFLECT)
{
// Calculate reflected spell result on caster
targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect);
if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell
targetInfo.reflectResult = SPELL_MISS_PARRY;
// Increase time interval for reflected spells by 1.5
targetInfo.timeDelay += targetInfo.timeDelay >> 1;
}
else
targetInfo.reflectResult = SPELL_MISS_NONE;
// Add target to list
m_UniqueTargetInfo.push_back(targetInfo);
}
void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
{
for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (!m_spellInfo->Effects[effIndex].IsEffect())
effectMask &= ~(1 << effIndex);
else
{
switch (m_spellInfo->Effects[effIndex].Effect)
{
case SPELL_EFFECT_GAMEOBJECT_DAMAGE:
case SPELL_EFFECT_GAMEOBJECT_REPAIR:
case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE:
if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
effectMask &= ~(1 << effIndex);
break;
default:
break;
}
}
}
if (!effectMask)
return;
uint64 targetGUID = go->GetGUID();
// Lookup target in already in list
for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
if (targetGUID == ihit->targetGUID) // Found in list
{
ihit->effectMask |= effectMask; // Add only effect mask
return;
}
}
// This is new target calculate data for him
GOTargetInfo target;
target.targetGUID = targetGUID;
target.effectMask = effectMask;
target.processed = false; // Effects not apply on target
// Spell have speed - need calculate incoming time
if (m_spellInfo->Speed > 0.0f)
{
// calculate spell incoming interval
float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ());
if (dist < 5.0f)
dist = 5.0f;
if (!(m_spellInfo->AttributesEx9 & SPELL_ATTR9_SPECIAL_DELAY_CALCULATION))
target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f));
else
target.timeDelay = uint64(m_spellInfo->Speed * 1000.0f);
if (m_delayMoment == 0 || m_delayMoment > target.timeDelay)
m_delayMoment = target.timeDelay;
}
else
target.timeDelay = 0LL;
// Add target to list
m_UniqueGOTargetInfo.push_back(target);
}
void Spell::AddItemTarget(Item* item, uint32 effectMask)
{
for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
if (!m_spellInfo->Effects[effIndex].IsEffect())
effectMask &= ~(1 << effIndex);
// no effects left
if (!effectMask)
return;
// Lookup target in already in list
for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
{
if (item == ihit->item) // Found in list
{
ihit->effectMask |= effectMask; // Add only effect mask
return;
}
}
// This is new target add data
ItemTargetInfo target;
target.item = item;
target.effectMask = effectMask;
m_UniqueItemInfo.push_back(target);
}
void Spell::AddDestTarget(SpellDestination const& dest, uint32 effIndex)
{
m_destTargets[effIndex] = dest;
}
void Spell::DoAllEffectOnTarget(TargetInfo* target)
{
if (!target || target->processed)
return;
target->processed = true; // Target checked in apply effects procedure
// Get mask of effects for target
uint8 mask = target->effectMask;
Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
if (!unit)
{
uint8 farMask = 0;
// create far target mask
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effects[i].IsFarUnitTargetEffect())
if ((1 << i) & mask)
farMask |= (1 << i);
if (!farMask)
return;
// find unit in world
unit = ObjectAccessor::FindUnit(target->targetGUID);
if (!unit)
return;
// do far effects on the unit
// can't use default call because of threading, do stuff as fast as possible
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (farMask & (1 << i))
HandleEffects(unit, NULL, NULL, i, SPELL_EFFECT_HANDLE_HIT_TARGET);
return;
}
if (unit->IsAlive() != target->alive)
return;
if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime)
return; // No missinfo in that case
// Get original caster (if exist) and calculate damage/healing from him data
Unit* caster = m_originalCaster ? m_originalCaster : m_caster;
// Skip if m_originalCaster not avaiable
if (!caster)
return;
SpellMissInfo missInfo = target->missCondition;
// Need init unitTarget by default unit (can changed in code on reflect)
// Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem)
unitTarget = unit;
// Reset damage/healing counter
m_damage = target->damage;
m_healing = -target->damage;
// Fill base trigger info
uint32 procAttacker = m_procAttacker;
uint32 procVictim = m_procVictim;
uint32 procEx = m_procEx;
m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied
//Spells with this flag cannot trigger if effect is casted on self
bool canEffectTrigger = !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && CanExecuteTriggersOnHit(mask);
Unit* spellHitTarget = NULL;
if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
spellHitTarget = unit;
else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
{
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
{
spellHitTarget = m_caster;
if (m_caster->GetTypeId() == TYPEID_UNIT)
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
}
}
if (spellHitTarget)
{
SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura);
if (missInfo2 != SPELL_MISS_NONE)
{
if (missInfo2 != SPELL_MISS_MISS)
m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo2);
m_damage = 0;
spellHitTarget = NULL;
}
}
// Do not take combo points on dodge and miss
if (missInfo != SPELL_MISS_NONE && m_needComboPoints &&
m_targets.GetUnitTargetGUID() == target->targetGUID)
{
m_needComboPoints = false;
// Restore spell mods for a miss/dodge/parry Cold Blood
/// @todo check how broad this rule should be
if (m_caster->GetTypeId() == TYPEID_PLAYER && (missInfo == SPELL_MISS_MISS ||
missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY))
m_caster->ToPlayer()->RestoreSpellMods(this, 14177);
}
// Trigger info was not filled in spell::preparedatafortriggersystem - we do it now
if (canEffectTrigger && !procAttacker && !procVictim)
{
bool positive = true;
if (m_damage > 0)
positive = false;
else if (!m_healing)
{
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
// If at least one effect negative spell is negative hit
if (mask & (1<<i) && !m_spellInfo->IsPositiveEffect(i))
{
positive = false;
break;
}
}
switch (m_spellInfo->DmgClass)
{
case SPELL_DAMAGE_CLASS_MAGIC:
if (positive)
{
procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS;
procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS;
}
else
{
procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG;
procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG;
}
break;
case SPELL_DAMAGE_CLASS_NONE:
if (positive)
{
procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS;
procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS;
}
else
{
procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG;
procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG;
}
break;
}
}
CallScriptOnHitHandlers();
// All calculated do it!
// Do healing and triggers
if (m_healing > 0)
{
bool crit = caster->isSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask);
uint32 addhealth = m_healing;
if (crit)
{
procEx |= PROC_EX_CRITICAL_HIT;
addhealth = caster->SpellCriticalHealingBonus(m_spellInfo, addhealth, NULL);
}
else
procEx |= PROC_EX_NORMAL_HIT;
int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit);
unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
m_healing = gain;
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
}
// Do damage and triggers
else if (m_damage > 0)
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
// Add bonuses and fill damageInfo struct
caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit);
caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb);
// Send log damage message to client
caster->SendSpellNonMeleeDamageLog(&damageInfo);
procEx |= createProcExtendMask(&damageInfo, missInfo);
procVictim |= PROC_FLAG_TAKEN_DAMAGE;
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
{
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
if (caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 &&
(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED))
caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
}
m_damage = damageInfo.damage;
caster->DealSpellDamage(&damageInfo, true);
}
// Passive spell hits/misses or active spells only misses (only triggers)
else
{
// Fill base damage struct (unitTarget - is real spell target)
SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask);
procEx |= createProcExtendMask(&damageInfo, missInfo);
// Do triggers for unit (reflect triggers passed on hit phase for correct drop charge)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
// Failed Pickpocket, reveal rogue
if (missInfo == SPELL_MISS_RESIST && m_spellInfo->AttributesCu & SPELL_ATTR0_CU_PICKPOCKET && unitTarget->GetTypeId() == TYPEID_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
if (unitTarget->ToCreature()->IsAIEnabled)
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
}
}
if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL)))
{
m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO));
if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC)
if (!unit->IsStandState())
unit->SetStandState(UNIT_STAND_STATE_STAND);
}
if (spellHitTarget)
{
//AI functions
if (spellHitTarget->GetTypeId() == TYPEID_UNIT)
{
if (spellHitTarget->ToCreature()->IsAIEnabled)
spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo);
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm...)
if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->IsPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
p->CastedCreatureOrGO(spellHitTarget->GetEntry(), spellHitTarget->GetGUID(), m_spellInfo->Id);
}
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
DoTriggersOnSpellHit(spellHitTarget, mask);
// if target is fallged for pvp also flag caster if a player
if (unit->IsPvP() && m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->UpdatePvP(true);
CallScriptAfterHitHandlers();
}
}
SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura)
{
if (!unit || !effectMask)
return SPELL_MISS_EVADE;
// For delayed spells immunity may be applied between missile launch and hit - check immunity for that case
if (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))
return SPELL_MISS_IMMUNE;
// disable effects to which unit is immune
SpellMissInfo returnVal = SPELL_MISS_IMMUNE;
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
if (effectMask & (1 << effectNumber))
if (unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber))
effectMask &= ~(1 << effectNumber);
if (!effectMask)
return returnVal;
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers();
if (Player* player = unit->ToPlayer())
{
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, 0, m_caster);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
}
if (Player* player = m_caster->ToPlayer())
{
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, 0, unit);
}
if (m_caster != unit)
{
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
return SPELL_MISS_EVADE;
if (m_caster->_IsValidAttackTarget(unit, m_spellInfo))
{
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
/// @todo This is a hack. But we do not know what types of stealth should be interrupted by CC
if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) && unit->IsControlledByPlayer())
unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
}
else if (m_caster->IsFriendlyTo(unit))
{
// for delayed spells ignore negative spells (after duel end) for friendly targets
/// @todo this cause soul transfer bugged
// 63881 - Malady of the Mind jump spell (Yogg-Saron)
if (m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive() && m_spellInfo->Id != 63881)
return SPELL_MISS_EVADE;
// assisting case, healing and resurrection
if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER))
{
m_caster->SetContestedPvP();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->UpdatePvP(true);
}
if (unit->IsInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO))
{
m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit);
unit->getHostileRefManager().threatAssist(m_caster, 0.0f);
}
}
}
// Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add
m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell);
if (m_diminishGroup)
{
m_diminishLevel = unit->GetDiminishing(m_diminishGroup);
DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup);
// Increase Diminishing on unit, current informations for actually casts will use values above
if ((type == DRTYPE_PLAYER && unit->GetCharmerOrOwnerPlayerOrPlayerItself()) || type == DRTYPE_ALL)
unit->IncrDiminishing(m_diminishGroup);
}
uint8 aura_effmask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (effectMask & (1 << i) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect())
aura_effmask |= 1 << i;
if (aura_effmask)
{
// Select rank for aura with level requirements only in specific cases
// Unit has to be target only of aura effect, both caster and target have to be players, target has to be other than unit target
SpellInfo const* aurSpellInfo = m_spellInfo;
int32 basePoints[3];
if (scaleAura)
{
aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel());
ASSERT(aurSpellInfo);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
basePoints[i] = aurSpellInfo->Effects[i].BasePoints;
if (m_spellInfo->Effects[i].Effect != aurSpellInfo->Effects[i].Effect)
{
aurSpellInfo = m_spellInfo;
break;
}
}
}
if (m_originalCaster)
{
bool refresh = false;
m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit,
m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh);
if (m_spellAura)
{
// Set aura stack amount to desired value
if (m_spellValue->AuraStackAmount > 1)
{
if (!refresh)
m_spellAura->SetStackAmount(m_spellValue->AuraStackAmount);
else
m_spellAura->ModStackAmount(m_spellValue->AuraStackAmount);
}
// Now Reduce spell duration using data received at spell hit
int32 duration = m_spellAura->GetMaxDuration();
int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo);
float diminishMod = unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration);
// unit is immune to aura if it was diminished to 0 duration
if (diminishMod == 0.0f)
{
m_spellAura->Remove();
bool found = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (effectMask & (1 << i) && m_spellInfo->Effects[i].Effect != SPELL_EFFECT_APPLY_AURA)
found = true;
if (!found)
return SPELL_MISS_IMMUNE;
}
else
{
((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup);
bool positive = m_spellAura->GetSpellInfo()->IsPositive();
if (AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID()))
positive = aurApp->IsPositive();
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask);
if (duration > 0)
{
// Haste modifies duration of channeled spells
if (m_spellInfo->IsChanneled())
{
if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
}
else if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
{
int32 origDuration = duration;
duration = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (AuraEffect const* eff = m_spellAura->GetEffect(i))
if (int32 amplitude = eff->GetAmplitude()) // amplitude is hastened by UNIT_MOD_CAST_SPEED
duration = std::max(std::max(origDuration / amplitude, 1) * amplitude, duration);
// if there is no periodic effect
if (!duration)
duration = int32(origDuration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED));
}
}
if (duration != m_spellAura->GetMaxDuration())
{
m_spellAura->SetMaxDuration(duration);
m_spellAura->SetDuration(duration);
}
m_spellAura->_RegisterForTargets();
}
}
}
}
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
if (effectMask & (1 << effectNumber))
HandleEffects(unit, NULL, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET);
return SPELL_MISS_NONE;
}
void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
{
// Apply additional spell effects to target
/// @todo move this code to scripts
if (m_preCastSpell)
{
// Paladin immunity shields
if (m_preCastSpell == 61988)
{
// Cast Forbearance
m_caster->CastSpell(unit, 25771, true);
// Cast Avenging Wrath Marker
unit->CastSpell(unit, 61987, true);
}
// Avenging Wrath
if (m_preCastSpell == 61987)
// Cast the serverside immunity shield marker
m_caster->CastSpell(unit, 61988, true);
if (sSpellMgr->GetSpellInfo(m_preCastSpell))
// Blizz seems to just apply aura without bothering to cast
m_caster->AddAura(m_preCastSpell, unit);
}
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
// this is executed after spell proc spells on target hit
// spells are triggered for each hit spell target
// info confirmed with retail sniffs of permafrost and shadow weaving
if (!m_hitTriggerSpells.empty())
{
int _duration = 0;
for (HitTriggerSpellList::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i)
{
if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance))
{
m_caster->CastSpell(unit, i->triggeredSpell, true);
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id);
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
// set duration of current aura to the triggered spell
if (i->triggeredSpell->GetDuration() == -1)
{
if (Aura* triggeredAur = unit->GetAura(i->triggeredSpell->Id, m_caster->GetGUID()))
{
// get duration from aura-only once
if (!_duration)
{
Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID());
_duration = aur ? aur->GetDuration() : -1;
}
triggeredAur->SetDuration(_duration);
}
}
}
}
}
// trigger linked auras remove/apply
/// @todo remove/cleanup this, as this table is not documented and people are doing stupid things with it
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT))
{
for (std::vector<int32>::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i)
{
if (*i < 0)
unit->RemoveAurasDueToSpell(-(*i));
else
unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID());
}
}
}
void Spell::DoAllEffectOnTarget(GOTargetInfo* target)
{
if (target->processed) // Check target
return;
target->processed = true; // Target checked in apply effects procedure
uint32 effectMask = target->effectMask;
if (!effectMask)
return;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
if (!go)
return;
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers();
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
if (effectMask & (1 << effectNumber))
HandleEffects(NULL, NULL, go, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET);
CallScriptOnHitHandlers();
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm...)
if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id);
CallScriptAfterHitHandlers();
}
void Spell::DoAllEffectOnTarget(ItemTargetInfo* target)
{
uint32 effectMask = target->effectMask;
if (!target->item || !effectMask)
return;
PrepareScriptHitHandlers();
CallScriptBeforeHitHandlers();
for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber)
if (effectMask & (1 << effectNumber))
HandleEffects(NULL, target->item, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET);
CallScriptOnHitHandlers();
CallScriptAfterHitHandlers();
}
bool Spell::UpdateChanneledTargetList()
{
// Not need check return true
if (m_channelTargetEffectMask == 0)
return true;
uint8 channelTargetEffectMask = m_channelTargetEffectMask;
uint8 channelAuraMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
channelAuraMask |= 1<<i;
channelAuraMask &= channelTargetEffectMask;
float range = 0;
if (channelAuraMask)
{
range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive());
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
}
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->missCondition == SPELL_MISS_NONE && (channelTargetEffectMask & ihit->effectMask))
{
Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (!unit)
continue;
if (IsValidDeadOrAliveTarget(unit))
{
if (channelAuraMask & ihit->effectMask)
{
if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID))
{
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit, range))
{
ihit->effectMask &= ~aurApp->GetEffectMask();
unit->RemoveAura(aurApp);
continue;
}
}
else // aura is dispelled
continue;
}
channelTargetEffectMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target
}
}
}
// is all effects from m_needAliveTargetMask have alive targets
return channelTargetEffectMask == 0;
}
void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura)
{
if (m_CastItem)
m_castItemGUID = m_CastItem->GetGUID();
else
m_castItemGUID = 0;
InitExplicitTargets(*targets);
// Fill aura scaling information
if (m_caster->IsControlledByPlayer() && !m_spellInfo->IsPassive() && m_spellInfo->SpellLevel && !m_spellInfo->IsChanneled() && !(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_SCALING))
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA)
{
// Change aura with ranks only if basepoints are taken from spellInfo and aura is positive
if (m_spellInfo->IsPositiveEffect(i))
{
m_auraScaleMask |= (1 << i);
if (m_spellValue->EffectBasePoints[i] != m_spellInfo->Effects[i].BasePoints)
{
m_auraScaleMask = 0;
break;
}
}
}
}
}
m_spellState = SPELL_STATE_PREPARING;
if (triggeredByAura)
m_triggeredByAuraSpell = triggeredByAura->GetSpellInfo();
// create and add update event for this spell
SpellEvent* Event = new SpellEvent(this);
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
//Prevent casting at cast another spell (ServerSide check)
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS) && m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count)
{
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
finish(false);
return;
}
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster))
{
SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE);
finish(false);
return;
}
LoadScripts();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
// Fill cost data (not use power for item casts
m_powerCost = m_CastItem ? 0 : m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
// Set combo point requirement
if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem || !m_caster->m_movedPlayer)
m_needComboPoints = false;
SpellCastResult result = CheckCast(true);
// target is checked in too many locations and with different results to handle each of them
// handle just the general SPELL_FAILED_BAD_TARGETS result which is the default result for most DBC target checks
if (_triggeredCastFlags & TRIGGERED_IGNORE_TARGET_CHECK && result == SPELL_FAILED_BAD_TARGETS)
result = SPELL_CAST_OK;
if (result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
{
// Periodic auras should be interrupted when aura triggers a spell which can't be cast
// for example bladestorm aura should be removed on disarm as of patch 3.3.5
// channeled periodic spells should be affected by this (arcane missiles, penance, etc)
// a possible alternative sollution for those would be validating aura target on unit state change
if (triggeredByAura && triggeredByAura->IsPeriodic() && !triggeredByAura->GetBase()->IsPassive())
{
SendChannelUpdate(0);
triggeredByAura->GetBase()->SetDuration(0);
}
SendCastResult(result);
finish(false);
return;
}
// Prepare data for triggers
prepareDataForTriggerSystem(triggeredByAura);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = m_spellInfo->CalcCastTime(m_caster, this);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
// Set casttime to 0 if .cheat casttime is enabled.
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_CASTTIME))
m_casttime = 0;
}
// don't allow channeled spells / spells with cast time to be casted while moving
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
// don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
if (((m_spellInfo->IsChanneled() || m_casttime) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->isMoving() &&
m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) && !m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_CAST_WHILE_WALKING, m_spellInfo))
{
SendCastResult(SPELL_FAILED_MOVING);
finish(false);
return;
}
// set timer base at cast time
ReSetTimer();
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask());
//Containers for channeled spells have to be set
/// @todoApply this to all casted spells if needed
// Why check duration? 29350: channelled triggers channelled
if ((_triggeredCastFlags & TRIGGERED_CAST_DIRECTLY) && (!m_spellInfo->IsChanneled() || !m_spellInfo->GetMaxDuration()))
cast(true);
else
{
// stealth must be removed at cast starting (at show channel bar)
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS) && m_spellInfo->IsBreakingStealth())
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_spellInfo->Effects[i].GetUsedTargetObjectType() == TARGET_OBJECT_TYPE_UNIT)
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK);
break;
}
}
m_caster->SetCurrentCastedSpell(this);
SendSpellStart();
// set target for proper facing
if ((m_casttime || m_spellInfo->IsChanneled()) && !(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
if (m_caster->GetTypeId() == TYPEID_UNIT && m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
m_caster->FocusTarget(this, m_targets.GetObjectTarget());
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD))
TriggerGlobalCooldown();
//item: first cast may destroy item and second cast causes crash
if (!m_casttime && !m_spellInfo->StartRecoveryTime && !m_castItemGUID && GetCurrentContainer() == CURRENT_GENERIC_SPELL)
cast(true);
}
}
void Spell::cancel()
{
if (m_spellState == SPELL_STATE_FINISHED)
return;
uint32 oldState = m_spellState;
m_spellState = SPELL_STATE_FINISHED;
m_autoRepeat = false;
switch (oldState)
{
case SPELL_STATE_PREPARING:
CancelGlobalCooldown();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->RestoreSpellMods(this);
case SPELL_STATE_DELAYED:
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
break;
case SPELL_STATE_CASTING:
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
// spell is canceled-take mods and clear list
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->RemoveSpellMods(this);
m_appliedMods.clear();
break;
default:
break;
}
SetReferencedFromCurrent(false);
if (m_selfContainer && *m_selfContainer == this)
*m_selfContainer = NULL;
m_caster->RemoveDynObject(m_spellInfo->Id);
if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet
m_caster->RemoveGameObject(m_spellInfo->Id, true);
//set state back so finish will be processed
m_spellState = oldState;
finish(false);
}
void Spell::cast(bool skipCheck)
{
// update pointers base at GUIDs to prevent access to non-existed already object
UpdatePointers();
// cancel at lost explicit target during cast
if (m_targets.GetObjectTargetGUID() && !m_targets.GetObjectTarget())
{
cancel();
return;
}
if (Player* playerCaster = m_caster->ToPlayer())
{
// now that we've done the basic check, now run the scripts
// should be done before the spell is actually executed
sScriptMgr->OnPlayerSpellCast(playerCaster, this, skipCheck);
// As of 3.0.2 pets begin attacking their owner's target immediately
// Let any pets know we've attacked something. Check DmgClass for harmful spells only
// This prevents spells such as Hunter's Mark from triggering pet attack
if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE)
if (Pet* playerPet = playerCaster->GetPet())
if (playerPet->IsAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT))
playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit());
}
SetExecutedCurrently(true);
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))
if (m_caster->GetTypeId() == TYPEID_UNIT && m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget())
m_caster->SetInFront(m_targets.GetObjectTarget());
// Should this be done for original caster?
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
// Set spell which will drop charges for triggered cast spells
// if not successfully casted, will be remove in finish(false)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
}
CallScriptBeforeCastHandlers();
// skip check if done already (for instant cast spells for example)
if (!skipCheck)
{
SpellCastResult castResult = CheckCast(false);
if (castResult != SPELL_CAST_OK)
{
SendCastResult(castResult);
SendInterrupted(0);
//restore spell mods
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_caster->ToPlayer()->RestoreSpellMods(this);
// cleanup after mod system
// triggered spell pointer can be not removed in some cases
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
}
finish(false);
SetExecutedCurrently(false);
return;
}
// additional check after cast bar completes (must not be in CheckCast)
// if trade not complete then remember it in trade data
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (TradeData* my_trade = m_caster->ToPlayer()->GetTradeData())
{
if (!my_trade->IsInAcceptProcess())
{
// Spell will be casted at completing the trade. Silently ignore at this place
my_trade->SetSpell(m_spellInfo->Id, m_CastItem);
SendCastResult(SPELL_FAILED_DONT_REPORT);
SendInterrupted(0);
m_caster->ToPlayer()->RestoreSpellMods(this);
// cleanup after mod system
// triggered spell pointer can be not removed in some cases
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
finish(false);
SetExecutedCurrently(false);
return;
}
}
}
}
}
SelectSpellTargets();
// Spell may be finished after target map check
if (m_spellState == SPELL_STATE_FINISHED)
{
SendInterrupted(0);
//restore spell mods
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_caster->ToPlayer()->RestoreSpellMods(this);
// cleanup after mod system
// triggered spell pointer can be not removed in some cases
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
}
finish(false);
SetExecutedCurrently(false);
return;
}
PrepareTriggersExecutedOnHit();
CallScriptOnCastHandlers();
// traded items have trade slot instead of guid in m_itemTargetGUID
// set to real guid to be sent later to the client
m_targets.UpdateTradeSlotItem();
if (Player* player = m_caster->ToPlayer())
{
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_ITEM) && m_CastItem)
{
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_ITEM, m_CastItem->GetEntry());
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry());
}
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
}
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
{
// Powers have to be taken before SendSpellGo
TakePower();
TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
}
else if (Item* targetItem = m_targets.GetItemTarget())
{
/// Not own traded item (in trader trade slot) req. reagents including triggered spell case
if (targetItem->GetOwnerGUID() != m_caster->GetGUID())
TakeReagents();
}
// CAST SPELL
SendSpellCooldown();
PrepareScriptHitHandlers();
HandleLaunchPhase();
// we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
SendSpellGo();
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
if ((m_spellInfo->Speed > 0.0f && !m_spellInfo->IsChanneled()) || m_spellInfo->Id == 14157)
{
// Remove used for cast item if need (it can be already NULL after TakeReagents call
// in case delayed spell remove item at cast delay start
TakeCastItem();
// Okay, maps created, now prepare flags
m_immediateHandled = false;
m_spellState = SPELL_STATE_DELAYED;
SetDelayStart(0);
if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
m_caster->ClearUnitState(UNIT_STATE_CASTING);
}
else
{
// Immediate spell, no big deal
handle_immediate();
}
CallScriptAfterCastHandlers();
if (const std::vector<int32> *spell_triggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id))
{
for (std::vector<int32>::const_iterator i = spell_triggered->begin(); i != spell_triggered->end(); ++i)
if (*i < 0)
m_caster->RemoveAurasDueToSpell(-(*i));
else
m_caster->CastSpell(m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster, *i, true);
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
//Clear spell cooldowns after every spell is cast if .cheat cooldown is enabled.
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
}
SetExecutedCurrently(false);
}
void Spell::handle_immediate()
{
// start channeling if applicable
if (m_spellInfo->IsChanneled())
{
int32 duration = m_spellInfo->GetDuration();
if (duration > 0)
{
// First mod_duration then haste - see Missile Barrage
// Apply duration mod
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
// Apply haste mods
if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION)
m_caster->ModSpellCastTime(m_spellInfo, duration, this);
m_spellState = SPELL_STATE_CASTING;
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
SendChannelStart(duration);
}
else if (duration == -1)
{
m_spellState = SPELL_STATE_CASTING;
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
SendChannelStart(duration);
}
}
PrepareTargetProcessing();
// process immediate effects (items, ground, etc.) also initialize some variables
_handle_immediate_phase();
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit));
for (std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit));
FinishTargetProcessing();
// spell is finished, perform some last features of the spell here
_handle_finish_phase();
// Remove used for cast item if need (it can be already NULL after TakeReagents call
TakeCastItem();
// handle ammo consumption for thrown weapons
if (m_spellInfo->IsRangedWeaponSpell() && m_spellInfo->IsChanneled())
TakeAmmo();
if (m_spellState != SPELL_STATE_CASTING)
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
}
uint64 Spell::handle_delayed(uint64 t_offset)
{
UpdatePointers();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
uint64 next_time = 0;
PrepareTargetProcessing();
if (!m_immediateHandled)
{
_handle_immediate_phase();
m_immediateHandled = true;
}
bool single_missile = (m_targets.HasDst());
// now recheck units targeting correctness (need before any effects apply to prevent adding immunity at first effect not allow apply second spell effect and similar cases)
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->processed == false)
{
if (single_missile || ihit->timeDelay <= t_offset)
{
ihit->timeDelay = t_offset;
DoAllEffectOnTarget(&(*ihit));
}
else if (next_time == 0 || ihit->timeDelay < next_time)
next_time = ihit->timeDelay;
}
}
// now recheck gameobject targeting correctness
for (std::list<GOTargetInfo>::iterator ighit= m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
{
if (ighit->processed == false)
{
if (single_missile || ighit->timeDelay <= t_offset)
DoAllEffectOnTarget(&(*ighit));
else if (next_time == 0 || ighit->timeDelay < next_time)
next_time = ighit->timeDelay;
}
}
FinishTargetProcessing();
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
// All targets passed - need finish phase
if (next_time == 0)
{
// spell is finished, perform some last features of the spell here
_handle_finish_phase();
finish(true); // successfully finish spell cast
// return zero, spell is finished now
return 0;
}
else
{
// spell is unfinished, return next execution time
return next_time;
}
}
void Spell::_handle_immediate_phase()
{
m_spellAura = NULL;
// initialize Diminishing Returns Data
m_diminishLevel = DIMINISHING_LEVEL_1;
m_diminishGroup = DIMINISHING_NONE;
// handle some immediate features of the spell here
HandleThreatSpells();
PrepareScriptHitHandlers();
// handle effects with SPELL_EFFECT_HANDLE_HIT mode
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
// don't do anything for empty effect
if (!m_spellInfo->Effects[j].IsEffect())
continue;
// call effect handlers to handle destination hit
HandleEffects(NULL, NULL, NULL, j, SPELL_EFFECT_HANDLE_HIT);
}
// process items
for (std::list<ItemTargetInfo>::iterator ihit= m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
DoAllEffectOnTarget(&(*ihit));
if (!m_originalCaster)
return;
// Handle procs on cast
/// @todo finish new proc system:P
if (m_UniqueTargetInfo.empty() && m_targets.HasDst())
{
uint32 procAttacker = m_procAttacker;
if (!procAttacker)
procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS;
// Proc the spells that have DEST target
m_originalCaster->ProcDamageAndSpell(NULL, procAttacker, 0, m_procEx | PROC_EX_NORMAL_HIT, 0, BASE_ATTACK, m_spellInfo, m_triggeredByAuraSpell);
}
}
void Spell::_handle_finish_phase()
{
if (m_caster->m_movedPlayer)
{
// Take for real after all targets are processed
if (m_needComboPoints)
m_caster->m_movedPlayer->ClearComboPoints();
// Real add combo points from effects
if (m_comboPointGain)
m_caster->m_movedPlayer->GainSpellComboPoints(m_comboPointGain);
if (m_spellInfo->PowerType == POWER_HOLY_POWER && m_caster->m_movedPlayer->getClass() == CLASS_PALADIN)
HandleHolyPower(m_caster->m_movedPlayer);
}
if (m_caster->m_extraAttacks && GetSpellInfo()->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
m_caster->HandleProcExtraAttackFor(m_caster->GetVictim());
/// @todo trigger proc phase finish here
}
void Spell::SendSpellCooldown()
{
Player* _player = m_caster->ToPlayer();
if (!_player)
return;
// mana/health/etc potions, disabled by client (until combat out as declarate)
if (m_CastItem && m_CastItem->IsPotion())
{
// need in some way provided data for Spell::finish SendCooldownEvent
_player->SetLastPotionId(m_CastItem->GetEntry());
return;
}
// have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation)
if (m_spellInfo->Attributes & (SPELL_ATTR0_DISABLED_WHILE_ACTIVE | SPELL_ATTR0_PASSIVE) || (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD))
return;
_player->AddSpellAndCategoryCooldowns(m_spellInfo, m_CastItem ? m_CastItem->GetEntry() : 0, this);
}
void Spell::update(uint32 difftime)
{
// update pointers based at it's GUIDs
UpdatePointers();
if (m_targets.GetUnitTargetGUID() && !m_targets.GetUnitTarget())
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
cancel();
return;
}
// check if the player caster has moved before the spell finished
// with the exception of spells affected with SPELL_AURA_CAST_WHILE_WALKING effect
if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) &&
m_caster->isMoving() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT) &&
(m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK || !m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR)) &&
!m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_CAST_WHILE_WALKING, m_spellInfo))
{
// don't cancel for melee, autorepeat, triggered and instant spells
if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !IsTriggered())
cancel();
}
switch (m_spellState)
{
case SPELL_STATE_PREPARING:
{
if (m_timer > 0)
{
if (difftime >= (uint32)m_timer)
m_timer = 0;
else
m_timer -= difftime;
}
if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat())
// don't CheckCast for instant spells - done in spell::prepare, skip duplicate checks, needed for range checks for example
cast(!m_casttime);
break;
}
case SPELL_STATE_CASTING:
{
if (m_timer)
{
// check if there are alive targets left
if (!UpdateChanneledTargetList())
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id);
SendChannelUpdate(0);
finish();
}
if (m_timer > 0)
{
if (difftime >= (uint32)m_timer)
m_timer = 0;
else
m_timer -= difftime;
}
}
if (m_timer == 0)
{
SendChannelUpdate(0);
// channeled spell processed independently for quest targeting
// cast at creature (or GO) quest objectives update at successful cast channel finished
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm...)
if (!IsAutoRepeat() && !IsNextMeleeSwingSpell())
{
if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo* target = &*ihit;
if (!IS_CRE_OR_VEH_GUID(target->targetGUID))
continue;
Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
if (unit == NULL)
continue;
p->CastedCreatureOrGO(unit->GetEntry(), unit->GetGUID(), m_spellInfo->Id);
}
for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
GOTargetInfo* target = &*ihit;
GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID);
if (!go)
continue;
p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id);
}
}
}
finish();
}
break;
}
default:
break;
}
}
void Spell::finish(bool ok)
{
if (!m_caster)
return;
if (m_spellState == SPELL_STATE_FINISHED)
return;
m_spellState = SPELL_STATE_FINISHED;
if (m_spellInfo->IsChanneled())
m_caster->UpdateInterruptMask();
if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true))
m_caster->ClearUnitState(UNIT_STATE_CASTING);
// Unsummon summon as possessed creatures on spell cancel
if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (Unit* charm = m_caster->GetCharm())
if (charm->GetTypeId() == TYPEID_UNIT
&& charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET)
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
((Puppet*)charm)->UnSummon();
}
if (m_caster->GetTypeId() == TYPEID_UNIT)
m_caster->ReleaseFocus(this);
if (!ok)
return;
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsSummon())
{
// Unsummon statue
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (spellInfo && spellInfo->SpellIconID == 2056)
{
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id);
m_caster->setDeathState(JUST_DIED);
return;
}
}
if (IsAutoActionResetSpell())
{
bool found = false;
Unit::AuraEffectList const& vIgnoreReset = m_caster->GetAuraEffectsByType(SPELL_AURA_IGNORE_MELEE_RESET);
for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
{
if ((*i)->IsAffectingSpell(m_spellInfo))
{
found = true;
break;
}
}
if (!found && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_RESET_AUTO_ACTIONS))
{
m_caster->resetAttackTimer(BASE_ATTACK);
if (m_caster->haveOffhandWeapon())
m_caster->resetAttackTimer(OFF_ATTACK);
m_caster->resetAttackTimer(RANGED_ATTACK);
}
}
// potions disabled by client, send event "not in combat" if need
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (!m_triggeredByAuraSpell)
m_caster->ToPlayer()->UpdatePotionCooldown(this);
// triggered spell pointer can be not set in some cases
// this is needed for proper apply of triggered spell mods
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
// Take mods after trigger spell (needed for 14177 to affect 48664)
// mods are taken only on succesfull cast and independantly from targets of the spell
m_caster->ToPlayer()->RemoveSpellMods(this);
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
}
// Stop Attack for some spells
if (m_spellInfo->Attributes & SPELL_ATTR0_STOP_ATTACK_TARGET)
m_caster->AttackStop();
}
void Spell::SendCastResult(SpellCastResult result)
{
if (result == SPELL_CAST_OK)
return;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
if (m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
return;
SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError);
}
void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/, Opcodes opcode /*= SMSG_CAST_FAILED*/)
{
if (result == SPELL_CAST_OK)
return;
WorldPacket data(opcode, (4+1+1));
data << uint8(cast_count); // single cast or multi 2.3 (0/1)
data << uint32(spellInfo->Id);
data << uint8(result); // problem
switch (result)
{
case SPELL_FAILED_NOT_READY:
data << uint32(0); // unknown (value 1 update cooldowns on client flag)
break;
case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
data << uint32(spellInfo->RequiresSpellFocus); // SpellFocusObject.dbc id
break;
case SPELL_FAILED_REQUIRES_AREA: // AreaTable.dbc id
// hardcode areas limitation case
switch (spellInfo->Id)
{
case 41617: // Cenarion Mana Salve
case 41619: // Cenarion Healing Salve
data << uint32(3905);
break;
case 41618: // Bottled Nethergon Energy
case 41620: // Bottled Nethergon Vapor
data << uint32(3842);
break;
case 45373: // Bloodberry Elixir
data << uint32(4075);
break;
default: // default case (don't must be)
data << uint32(0);
break;
}
break;
case SPELL_FAILED_TOTEMS:
if (spellInfo->Totem[0])
data << uint32(spellInfo->Totem[0]);
if (spellInfo->Totem[1])
data << uint32(spellInfo->Totem[1]);
break;
case SPELL_FAILED_TOTEM_CATEGORY:
if (spellInfo->TotemCategory[0])
data << uint32(spellInfo->TotemCategory[0]);
if (spellInfo->TotemCategory[1])
data << uint32(spellInfo->TotemCategory[1]);
break;
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND:
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND:
data << uint32(spellInfo->EquippedItemClass);
data << uint32(spellInfo->EquippedItemSubClassMask);
break;
case SPELL_FAILED_TOO_MANY_OF_ITEM:
{
uint32 item = 0;
for (int8 eff = 0; eff < MAX_SPELL_EFFECTS; eff++)
if (spellInfo->Effects[eff].ItemType)
item = spellInfo->Effects[eff].ItemType;
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item);
if (proto && proto->ItemLimitCategory)
data << uint32(proto->ItemLimitCategory);
break;
}
case SPELL_FAILED_PREVENTED_BY_MECHANIC:
data << uint32(spellInfo->GetAllEffectsMechanicMask()); // SpellMechanic.dbc id
break;
case SPELL_FAILED_NEED_EXOTIC_AMMO:
data << uint32(spellInfo->EquippedItemSubClassMask); // seems correct...
break;
case SPELL_FAILED_NEED_MORE_ITEMS:
data << uint32(0); // Item id
data << uint32(0); // Item count?
break;
case SPELL_FAILED_MIN_SKILL:
data << uint32(0); // SkillLine.dbc id
data << uint32(0); // required skill value
break;
case SPELL_FAILED_FISHING_TOO_LOW:
data << uint32(0); // required fishing skill
break;
case SPELL_FAILED_CUSTOM_ERROR:
data << uint32(customError);
break;
case SPELL_FAILED_SILENCED:
data << uint32(0); // Unknown
break;
case SPELL_FAILED_REAGENTS:
{
uint32 missingItem = 0;
for (uint32 i = 0; i < MAX_SPELL_REAGENTS; i++)
{
if (spellInfo->Reagent[i] <= 0)
continue;
uint32 itemid = spellInfo->Reagent[i];
uint32 itemcount = spellInfo->ReagentCount[i];
if (!caster->HasItemCount(itemid, itemcount))
{
missingItem = itemid;
break;
}
}
data << uint32(missingItem); // first missing item
break;
}
// TODO: SPELL_FAILED_NOT_STANDING
default:
break;
}
caster->GetSession()->SendPacket(&data);
}
void Spell::SendSpellStart()
{
if (!IsNeedSendToClient())
return;
//TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
if (m_spellInfo->RuneCostID && m_spellInfo->PowerType == POWER_RUNES)
castFlags |= CAST_FLAG_UNKNOWN_19;
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
else
data.append(m_caster->GetPackGUID());
data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
data << uint32(m_timer); // delay?
data << uint32(m_casttime);
m_targets.Write(data);
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
{
//TODO: There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
//The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
if (Player* player = m_caster->ToPlayer())
{
data << uint8(m_runesState); // runes state before
data << uint8(player->GetRunesState()); // runes state after
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
// float casts ensure the division is performed on floats as we need float result
float baseCd = float(player->GetRuneBaseCooldown(i));
data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
}
}
else
{
data << uint8(0);
data << uint8(0);
for (uint8 i = 0; i < MAX_RUNES; ++i)
data << uint8(0);
}
}
if (castFlags & CAST_FLAG_PROJECTILE)
{
data << uint32(0); // Ammo display ID
data << uint32(0); // Inventory Type
}
if (castFlags & CAST_FLAG_IMMUNITY)
{
data << uint32(0);
data << uint32(0);
}
if (castFlags & CAST_FLAG_HEAL_PREDICTION)
{
data << uint32(0);
data << uint8(0); // unkByte
// if (unkByte == 2)
// data.append(0);
}
m_caster->SendMessageToSet(&data, true);
}
void Spell::SendSpellGo()
{
// not send invisible spell casting
if (!IsNeedSendToClient())
return;
//TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
// triggered spells with spell visual != 0
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
if ((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
&& m_spellInfo->RuneCostID
&& m_spellInfo->PowerType == POWER_RUNES)
{
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
}
if (m_spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
{
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
}
if (m_targets.HasTraj())
castFlags |= CAST_FLAG_ADJUST_MISSILE;
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
else
data.append(m_caster->GetPackGUID());
data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
data << uint32(m_timer);
data << uint32(getMSTime()); // timestamp
WriteSpellGoTargets(&data);
m_targets.Write(data);
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list
{
/// @todo There is a crash caused by a spell with CAST_FLAG_RUNE_LIST casted by a creature
//The creature is the mover of a player, so HandleCastSpellOpcode uses it as the caster
if (Player* player = m_caster->ToPlayer())
{
data << uint8(m_runesState); // runes state before
data << uint8(player->GetRunesState()); // runes state after
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
// float casts ensure the division is performed on floats as we need float result
float baseCd = float(player->GetRuneBaseCooldown(i));
data << uint8((baseCd - float(player->GetRuneCooldown(i))) / baseCd * 255); // rune cooldown passed
}
}
}
if (castFlags & CAST_FLAG_ADJUST_MISSILE)
{
data << m_targets.GetElevation();
data << uint32(m_delayMoment);
}
if (castFlags & CAST_FLAG_PROJECTILE)
{
data << uint32(0); // Ammo display ID
data << uint32(0); // Inventory Type
}
if (castFlags & CAST_FLAG_VISUAL_CHAIN)
{
data << uint32(0);
data << uint32(0);
}
if (m_targets.GetTargetMask() & TARGET_FLAG_DEST_LOCATION)
{
data << uint8(0);
}
if (m_targets.GetTargetMask() & TARGET_FLAG_EXTRA_TARGETS)
{
data << uint32(0); // Extra targets count
/*
for (uint8 i = 0; i < count; ++i)
{
data << float(0); // Target Position X
data << float(0); // Target Position Y
data << float(0); // Target Position Z
data << uint64(0); // Target Guid
}
*/
}
m_caster->SendMessageToSet(&data, true);
}
/// Writes miss and hit targets for a SMSG_SPELL_GO packet
void Spell::WriteSpellGoTargets(WorldPacket* data)
{
// This function also fill data for channeled spells:
// m_needAliveTargetMask req for stop channelig if one target die
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state
// possibly SPELL_MISS_IMMUNE2 for this??
ihit->missCondition = SPELL_MISS_IMMUNE2;
}
// Hit and miss target counts are both uint8, that limits us to 255 targets for each
// sending more than 255 targets crashes the client (since count sent would be wrong)
// Spells like 40647 (with a huge radius) can easily reach this limit (spell might need
// target conditions but we still need to limit the number of targets sent and keeping
// correct count for both hit and miss).
uint32 hit = 0;
size_t hitPos = data->wpos();
*data << (uint8)0; // placeholder
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && hit <= 255; ++ihit)
{
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << uint64(ihit->targetGUID);
m_channelTargetEffectMask |=ihit->effectMask;
++hit;
}
}
for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit <= 255; ++ighit)
{
*data << uint64(ighit->targetGUID); // Always hits
++hit;
}
uint32 miss = 0;
size_t missPos = data->wpos();
*data << (uint8)0; // placeholder
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end() && miss <= 255; ++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss
{
*data << uint64(ihit->targetGUID);
*data << uint8(ihit->missCondition);
if (ihit->missCondition == SPELL_MISS_REFLECT)
*data << uint8(ihit->reflectResult);
++miss;
}
}
// Reset m_needAliveTargetMask for non channeled spell
if (!m_spellInfo->IsChanneled())
m_channelTargetEffectMask = 0;
data->put<uint8>(hitPos, (uint8)hit);
data->put<uint8>(missPos, (uint8)miss);
}
void Spell::SendLogExecute()
{
WorldPacket data(SMSG_SPELLLOGEXECUTE, (8+4+4+4+4+8));
data.append(m_caster->GetPackGUID());
data << uint32(m_spellInfo->Id);
uint8 effCount = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_effectExecuteData[i])
++effCount;
}
if (!effCount)
return;
data << uint32(effCount);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!m_effectExecuteData[i])
continue;
data << uint32(m_spellInfo->Effects[i].Effect); // spell effect
data.append(*m_effectExecuteData[i]);
delete m_effectExecuteData[i];
m_effectExecuteData[i] = NULL;
}
m_caster->SendMessageToSet(&data, true);
}
void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(target->GetPackGUID());
*m_effectExecuteData[effIndex] << uint32(powerTaken);
*m_effectExecuteData[effIndex] << uint32(powerType);
*m_effectExecuteData[effIndex] << float(gainMultiplier);
}
void Spell::ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << uint32(attCount);
}
void Spell::ExecuteLogEffectInterruptCast(uint8 /*effIndex*/, Unit* victim, uint32 spellId)
{
ObjectGuid casterGuid = m_caster->GetGUID();
ObjectGuid targetGuid = victim->GetGUID();
WorldPacket data(SMSG_SPELLINTERRUPTLOG, 8 + 8 + 4 + 4);
data.WriteBit(targetGuid[4]);
data.WriteBit(casterGuid[5]);
data.WriteBit(casterGuid[6]);
data.WriteBit(casterGuid[1]);
data.WriteBit(casterGuid[3]);
data.WriteBit(casterGuid[0]);
data.WriteBit(targetGuid[3]);
data.WriteBit(targetGuid[5]);
data.WriteBit(targetGuid[1]);
data.WriteBit(casterGuid[4]);
data.WriteBit(casterGuid[7]);
data.WriteBit(targetGuid[7]);
data.WriteBit(targetGuid[6]);
data.WriteBit(targetGuid[2]);
data.WriteBit(casterGuid[2]);
data.WriteBit(targetGuid[0]);
data.WriteByteSeq(casterGuid[7]);
data.WriteByteSeq(casterGuid[6]);
data.WriteByteSeq(casterGuid[3]);
data.WriteByteSeq(casterGuid[2]);
data.WriteByteSeq(targetGuid[3]);
data.WriteByteSeq(targetGuid[6]);
data.WriteByteSeq(targetGuid[2]);
data.WriteByteSeq(targetGuid[4]);
data.WriteByteSeq(targetGuid[7]);
data.WriteByteSeq(targetGuid[0]);
data.WriteByteSeq(casterGuid[4]);
data << uint32(m_spellInfo->Id);
data.WriteByteSeq(targetGuid[1]);
data.WriteByteSeq(casterGuid[0]);
data.WriteByteSeq(casterGuid[5]);
data.WriteByteSeq(casterGuid[1]);
data << uint32(spellId);
data.WriteByteSeq(targetGuid[5]);
m_caster->SendMessageToSet(&data, true);
}
void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << int32(itemId);
*m_effectExecuteData[effIndex] << int32(slot);
}
void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
}
void Spell::ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry)
{
InitEffectExecuteData(effIndex);
*m_effectExecuteData[effIndex] << uint32(entry);
}
void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry)
{
InitEffectExecuteData(effIndex);
*m_effectExecuteData[effIndex] << uint32(entry);
}
void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
}
void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
}
void Spell::ExecuteLogEffectResurrect(uint8 effIndex, Unit* target)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(target->GetPackGUID());
}
void Spell::SendInterrupted(uint8 result)
{
WorldPacket data(SMSG_SPELL_FAILURE, (8+4+1));
data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
m_caster->SendMessageToSet(&data, true);
data.Initialize(SMSG_SPELL_FAILED_OTHER, (8+4));
data.append(m_caster->GetPackGUID());
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
m_caster->SendMessageToSet(&data, true);
}
void Spell::SendChannelUpdate(uint32 time)
{
if (time == 0)
{
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}
WorldPacket data(MSG_CHANNEL_UPDATE, 8+4);
data.append(m_caster->GetPackGUID());
data << uint32(time);
m_caster->SendMessageToSet(&data, true);
}
void Spell::SendChannelStart(uint32 duration)
{
uint64 channelTarget = m_targets.GetObjectTargetGUID();
if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8+4+4));
data.append(m_caster->GetPackGUID());
data << uint32(m_spellInfo->Id);
data << uint32(duration);
data << uint8(0); // immunity (castflag & 0x04000000)
/*
if (immunity)
{
data << uint32(); // CastSchoolImmunities
data << uint32(); // CastImmunities
}
*/
data << uint8(0); // healPrediction (castflag & 0x40000000)
/*
if (healPrediction)
{
data.appendPackGUID(channelTarget); // target packguid
data << uint32(); // spellid
data << uint8(0); // unk3
if (unk3 == 2)
data.append(); // unk packed guid (unused ?)
}
*/
m_caster->SendMessageToSet(&data, true);
m_timer = duration;
if (channelTarget)
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, channelTarget);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
void Spell::SendResurrectRequest(Player* target)
{
// get ressurector name for creature resurrections, otherwise packet will be not accepted
// for player resurrections the name is looked up by guid
std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER
? ""
: m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()));
WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+sentName.size()+1+1+1+4));
data << uint64(m_caster->GetGUID());
data << uint32(sentName.size() + 1);
data << sentName;
data << uint8(0); // null terminator
data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); // "you'll be afflicted with resurrection sickness"
// override delay sent with SMSG_CORPSE_RECLAIM_DELAY, set instant resurrection for spells with this attribute
// 4.2.2 edit : id of the spell used to resurect. (used client-side for Mass Resurect)
data << uint32(m_spellInfo->Id);
target->GetSession()->SendPacket(&data);
}
void Spell::TakeCastItem()
{
if (!m_CastItem)
return;
Player* player = m_caster->ToPlayer();
if (!player)
return;
// not remove cast item at triggered spell (equipping, weapon damage, etc)
if (_triggeredCastFlags & TRIGGERED_IGNORE_CAST_ITEM)
return;
ItemTemplate const* proto = m_CastItem->GetTemplate();
if (!proto)
{
// This code is to avoid a crash
// I'm not sure, if this is really an error, but I guess every item needs a prototype
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
return;
}
bool expendable = false;
bool withoutCharges = false;
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
if (proto->Spells[i].SpellId)
{
// item has limited charges
if (proto->Spells[i].SpellCharges)
{
if (proto->Spells[i].SpellCharges < 0)
expendable = true;
int32 charges = m_CastItem->GetSpellCharges(i);
// item has charges left
if (charges)
{
(charges > 0) ? --charges : ++charges; // abs(charges) less at 1 after use
if (proto->Stackable == 1)
m_CastItem->SetSpellCharges(i, charges);
m_CastItem->SetState(ITEM_CHANGED, player);
}
// all charges used
withoutCharges = (charges == 0);
}
}
}
if (expendable && withoutCharges)
{
uint32 count = 1;
m_caster->ToPlayer()->DestroyItemCount(m_CastItem, count, true);
// prevent crash at access to deleted m_targets.GetItemTarget
if (m_CastItem == m_targets.GetItemTarget())
m_targets.SetItemTarget(NULL);
m_CastItem = NULL;
}
}
void Spell::TakePower()
{
if (m_CastItem || m_triggeredByAuraSpell)
return;
//Don't take power if the spell is cast while .cheat power is enabled.
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_POWER))
return;
}
Powers powerType = Powers(m_spellInfo->PowerType);
bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNES)
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID)
{
if (ihit->missCondition != SPELL_MISS_NONE)
{
hit = false;
//lower spell cost on fail (by talent aura)
if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
}
break;
}
}
if (powerType == POWER_RUNES)
{
TakeRunePower(hit);
return;
}
if (!m_powerCost)
return;
// health as power used
if (powerType == POWER_HEALTH)
{
m_caster->ModifyHealth(-(int32)m_powerCost);
return;
}
if (powerType >= MAX_POWERS)
{
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::TakePower: Unknown power type '%d'", powerType);
return;
}
if (hit)
m_caster->ModifyPower(powerType, -m_powerCost);
else
m_caster->ModifyPower(powerType, -irand(0, m_powerCost/4));
}
void Spell::TakeAmmo()
{
if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
// wands don't have ammo
if (!pItem || pItem->IsBroken() || pItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
return;
if (pItem->GetTemplate()->InventoryType == INVTYPE_THROWN)
{
if (pItem->GetMaxStackCount() == 1)
{
// decrease durability for non-stackable throw weapon
m_caster->ToPlayer()->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
}
else
{
// decrease items amount for stackable throw weapon
uint32 count = 1;
m_caster->ToPlayer()->DestroyItemCount(pItem, count, true);
}
}
}
}
SpellCastResult Spell::CheckRuneCost(uint32 runeCostID)
{
if (m_spellInfo->PowerType != POWER_RUNES || !runeCostID)
return SPELL_CAST_OK;
Player* player = m_caster->ToPlayer();
if (!player)
return SPELL_CAST_OK;
if (player->getClass() != CLASS_DEATH_KNIGHT)
return SPELL_CAST_OK;
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(runeCostID);
if (!src)
return SPELL_CAST_OK;
if (src->NoRuneCost())
return SPELL_CAST_OK;
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
for (uint32 i = 0; i < RUNE_DEATH; ++i)
{
runeCost[i] = src->RuneCost[i];
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
runeCost[RUNE_DEATH] = MAX_RUNES; // calculated later
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
if ((player->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
runeCost[rune]--;
}
for (uint32 i = 0; i < RUNE_DEATH; ++i)
if (runeCost[i] > 0)
runeCost[RUNE_DEATH] += runeCost[i];
if (runeCost[RUNE_DEATH] > MAX_RUNES)
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
return SPELL_CAST_OK;
}
void Spell::TakeRunePower(bool didHit)
{
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_caster->getClass() != CLASS_DEATH_KNIGHT)
return;
SpellRuneCostEntry const* runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID);
if (!runeCostData || (runeCostData->NoRuneCost() && runeCostData->NoRunicPowerGain()))
return;
Player* player = m_caster->ToPlayer();
m_runesState = player->GetRunesState(); // store previous state
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
for (uint32 i = 0; i < RUNE_DEATH; ++i)
{
runeCost[i] = runeCostData->RuneCost[i];
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
runeCost[RUNE_DEATH] = 0; // calculated later
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
if (!player->GetRuneCooldown(i) && runeCost[rune] > 0)
{
player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN));
player->SetLastUsedRune(rune);
runeCost[rune]--;
}
}
runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST];
if (runeCost[RUNE_DEATH] > 0)
{
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH)
{
player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN));
player->SetLastUsedRune(rune);
runeCost[rune]--;
// keep Death Rune type if missed
if (didHit)
player->RestoreBaseRune(i);
if (runeCost[RUNE_DEATH] == 0)
break;
}
}
}
// you can gain some runic power when use runes
if (didHit)
if (int32 rp = int32(runeCostData->runePowerGain * sWorld->getRate(RATE_POWER_RUNICPOWER_INCOME)))
player->ModifyPower(POWER_RUNIC_POWER, int32(rp));
}
void Spell::TakeReagents()
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : NULL;
// do not take reagents for these item casts
if (castItemTemplate && castItemTemplate->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return;
Player* p_caster = m_caster->ToPlayer();
if (p_caster->CanNoReagentCast(m_spellInfo))
return;
for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
{
if (m_spellInfo->Reagent[x] <= 0)
continue;
uint32 itemid = m_spellInfo->Reagent[x];
uint32 itemcount = m_spellInfo->ReagentCount[x];
// if CastItem is also spell reagent
if (castItemTemplate && castItemTemplate->ItemId == itemid)
{
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
if (castItemTemplate->Spells[s].SpellCharges < 0 && abs(charges) < 2)
{
++itemcount;
break;
}
}
m_CastItem = NULL;
}
// if GetItemTarget is also spell reagent
if (m_targets.GetItemTargetEntry() == itemid)
m_targets.SetItemTarget(NULL);
p_caster->DestroyItemCount(itemid, itemcount, true);
}
}
void Spell::HandleThreatSpells()
{
if (m_UniqueTargetInfo.empty())
return;
if ((m_spellInfo->AttributesEx & SPELL_ATTR1_NO_THREAT) ||
(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO))
return;
float threat = 0.0f;
if (SpellThreatEntry const* threatEntry = sSpellMgr->GetSpellThreatEntry(m_spellInfo->Id))
{
if (threatEntry->apPctMod != 0.0f)
threat += threatEntry->apPctMod * m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
threat += threatEntry->flatMod;
}
else if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_NO_INITIAL_THREAT) == 0)
threat += m_spellInfo->SpellLevel;
// past this point only multiplicative effects occur
if (threat == 0.0f)
return;
// since 2.0.1 threat from positive effects also is distributed among all targets, so the overall caused threat is at most the defined bonus
threat /= m_UniqueTargetInfo.size();
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->missCondition != SPELL_MISS_NONE)
continue;
Unit* target = ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (!target)
continue;
// positive spells distribute threat among all units that are in combat with target, like healing
if (m_spellInfo->_IsPositiveSpell())
target->getHostileRefManager().threatAssist(m_caster, threat, m_spellInfo);
// for negative spells threat gets distributed among affected targets
else
{
if (!target->CanHaveThreatList())
continue;
target->AddThreat(m_caster, threat, m_spellInfo->GetSchoolMask(), m_spellInfo);
}
}
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size()));
}
void Spell::HandleHolyPower(Player* caster)
{
if (!caster)
return;
bool hit = true;
Player* modOwner = caster->GetSpellModOwner();
m_powerCost = caster->GetPower(POWER_HOLY_POWER); // Always use all the holy power we have
if (!m_powerCost || !modOwner)
return;
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (ihit->targetGUID == targetGUID)
{
if (ihit->missCondition != SPELL_MISS_NONE && ihit->missCondition != SPELL_MISS_MISS)
hit = false;
break;
}
}
// The spell did hit the target, apply aura cost mods if there are any.
if (hit)
{
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, m_powerCost);
m_caster->ModifyPower(POWER_HOLY_POWER, -m_powerCost);
}
}
}
void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode)
{
effectHandleMode = mode;
unitTarget = pUnitTarget;
itemTarget = pItemTarget;
gameObjTarget = pGOTarget;
destTarget = &m_destTargets[i]._position;
uint8 eff = m_spellInfo->Effects[i].Effect;
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: %u Effect : %u", m_spellInfo->Id, eff);
damage = CalculateDamage(i, unitTarget);
bool preventDefault = CallScriptEffectHandlers((SpellEffIndex)i, mode);
if (!preventDefault && eff < TOTAL_SPELL_EFFECTS)
{
(this->*SpellEffects[eff])((SpellEffIndex)i);
}
}
SpellCastResult Spell::CheckCast(bool strict)
{
// check death state
if (!m_caster->IsAlive() && !(m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && !((m_spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD) || (IsTriggered() && !m_triggeredByAuraSpell)))
return SPELL_FAILED_CASTER_DEAD;
// check cooldowns to prevent cheating
if (m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE))
{
//can cast triggered (by aura only?) spells while have this flag
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
return SPELL_FAILED_SPELL_IN_PROGRESS;
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
{
if (m_triggeredByAuraSpell)
return SPELL_FAILED_DONT_REPORT;
else
return SPELL_FAILED_NOT_READY;
}
}
if (m_spellInfo->AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
{
m_customError = SPELL_CUSTOM_ERROR_GM_ONLY;
return SPELL_FAILED_CUSTOM_ERROR;
}
// Check global cooldown
if (strict && !(_triggeredCastFlags & TRIGGERED_IGNORE_GCD) && HasGlobalCooldown())
return SPELL_FAILED_NOT_READY;
// only triggered spells can be processed an ended battleground
if (!IsTriggered() && m_caster->GetTypeId() == TYPEID_PLAYER)
if (Battleground* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() == STATUS_WAIT_LEAVE)
return SPELL_FAILED_DONT_REPORT;
if (m_caster->GetTypeId() == TYPEID_PLAYER && VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled())
{
if (m_spellInfo->Attributes & SPELL_ATTR0_OUTDOORS_ONLY &&
!m_caster->GetMap()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()))
return SPELL_FAILED_ONLY_OUTDOORS;
if (m_spellInfo->Attributes & SPELL_ATTR0_INDOORS_ONLY &&
m_caster->GetMap()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()))
return SPELL_FAILED_ONLY_INDOORS;
}
// only check at first call, Stealth auras are already removed at second call
// for now, ignore triggered spells
if (strict && !(_triggeredCastFlags & TRIGGERED_IGNORE_SHAPESHIFT))
{
bool checkForm = true;
// Ignore form req aura
Unit::AuraEffectList const& ignore = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
for (Unit::AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
{
if (!(*i)->IsAffectingSpell(m_spellInfo))
continue;
checkForm = false;
break;
}
if (checkForm)
{
// Cannot be used in this stance/form
SpellCastResult shapeError = m_spellInfo->CheckShapeshift(m_caster->GetShapeshiftForm());
if (shapeError != SPELL_CAST_OK)
return shapeError;
if ((m_spellInfo->Attributes & SPELL_ATTR0_ONLY_STEALTHED) && !(m_caster->HasStealthAura()))
return SPELL_FAILED_ONLY_STEALTHED;
}
}
Unit::AuraEffectList const& blockSpells = m_caster->GetAuraEffectsByType(SPELL_AURA_BLOCK_SPELL_FAMILY);
for (Unit::AuraEffectList::const_iterator blockItr = blockSpells.begin(); blockItr != blockSpells.end(); ++blockItr)
if (uint32((*blockItr)->GetMiscValue()) == m_spellInfo->SpellFamilyName)
return SPELL_FAILED_SPELL_UNAVAILABLE;
bool reqCombat = true;
Unit::AuraEffectList const& stateAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
{
if ((*j)->IsAffectingSpell(m_spellInfo))
{
m_needComboPoints = false;
if ((*j)->GetMiscValue() == 1)
{
reqCombat=false;
break;
}
}
}
// caster state requirements
// not for triggered spells (needed by execute)
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE))
{
if (m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraStateType(m_spellInfo->CasterAuraState), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
if (m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraStateType(m_spellInfo->CasterAuraStateNot), m_spellInfo, m_caster))
return SPELL_FAILED_CASTER_AURASTATE;
// Note: spell 62473 requres casterAuraSpell = triggering spell
if (m_spellInfo->CasterAuraSpell && !m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->CasterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
if (m_spellInfo->ExcludeCasterAuraSpell && m_caster->HasAura(sSpellMgr->GetSpellIdForDifficulty(m_spellInfo->ExcludeCasterAuraSpell, m_caster)))
return SPELL_FAILED_CASTER_AURASTATE;
if (reqCombat && m_caster->IsInCombat() && !m_spellInfo->CanBeUsedInCombat())
return SPELL_FAILED_AFFECTING_COMBAT;
}
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
// Do not cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() && !m_caster->HasAuraTypeWithAffectMask(SPELL_AURA_CAST_WHILE_WALKING, m_spellInfo))
{
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
if ((!m_caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING_FAR) || m_spellInfo->Effects[0].Effect != SPELL_EFFECT_STUCK) &&
(IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0))
return SPELL_FAILED_MOVING;
}
// Check vehicle flags
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE))
{
SpellCastResult vehicleCheck = m_spellInfo->CheckVehicle(m_caster);
if (vehicleCheck != SPELL_CAST_OK)
return vehicleCheck;
}
// check spell cast conditions from database
{
ConditionSourceInfo condInfo = ConditionSourceInfo(m_caster);
condInfo.mConditionTargets[1] = m_targets.GetObjectTarget();
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
{
// mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
{
if (condInfo.mLastFailedCondition->ErrorType == SPELL_FAILED_CUSTOM_ERROR)
m_customError = SpellCustomErrors(condInfo.mLastFailedCondition->ErrorTextId);
return SpellCastResult(condInfo.mLastFailedCondition->ErrorType);
}
if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_FAILED_BAD_TARGETS;
}
}
// Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case)
// those spells may have incorrect target entries or not filled at all (for example 15332)
// such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead
// also, such casts shouldn't be sent to client
if (!((m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster)))
{
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_originalCaster ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
if (castResult != SPELL_CAST_OK)
return castResult;
}
if (Unit* target = m_targets.GetUnitTarget())
{
SpellCastResult castResult = m_spellInfo->CheckTarget(m_caster, target, false);
if (castResult != SPELL_CAST_OK)
return castResult;
if (target != m_caster)
{
// Must be behind the target
if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET) && target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_BEHIND;
// Target must be facing you
if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER) && !target->HasInArc(static_cast<float>(M_PI), m_caster))
return SPELL_FAILED_NOT_INFRONT;
if (m_caster->GetEntry() != WORLD_TRIGGER) // Ignore LOS for gameobjects casts (wrongly casted by a trigger)
if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOSInMap(target))
return SPELL_FAILED_LINE_OF_SIGHT;
}
}
// Check for line of sight for spells with dest
if (m_targets.HasDst())
{
float x, y, z;
m_targets.GetDstPos()->GetPosition(x, y, z);
if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z))
return SPELL_FAILED_LINE_OF_SIGHT;
}
// check pet presence
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET)
{
if (!m_caster->GetGuardianPet())
{
if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells
return SPELL_FAILED_DONT_REPORT;
else
return SPELL_FAILED_NO_PET;
}
break;
}
}
// Spell casted only on battleground
if ((m_spellInfo->AttributesEx3 & SPELL_ATTR3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER)
if (!m_caster->ToPlayer()->InBattleground())
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
// do not allow spells to be cast in arenas or rated battlegrounds
if (Player* player = m_caster->ToPlayer())
if (player->InArena()/* || player->InRatedBattleGround() NYI*/)
{
SpellCastResult castResult = CheckArenaAndRatedBattlegroundCastRules();
if (castResult != SPELL_CAST_OK)
return castResult;
}
// zone check
if (m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->IsGameMaster())
{
uint32 zone, area;
m_caster->GetZoneAndAreaId(zone, area);
SpellCastResult locRes= m_spellInfo->CheckLocation(m_caster->GetMapId(), zone, area,
m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : NULL);
if (locRes != SPELL_CAST_OK)
return locRes;
}
// not let players cast spells at mount (and let do it to creatures)
if (m_caster->IsMounted() && m_caster->GetTypeId() == TYPEID_PLAYER && !(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE) &&
!m_spellInfo->IsPassive() && !(m_spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_MOUNTED))
{
if (m_caster->IsInFlight())
return SPELL_FAILED_NOT_ON_TAXI;
else
return SPELL_FAILED_NOT_MOUNTED;
}
SpellCastResult castResult = SPELL_CAST_OK;
// always (except passive spells) check items (focus object can be required for any type casts)
if (!m_spellInfo->IsPassive())
{
castResult = CheckItems();
if (castResult != SPELL_CAST_OK)
return castResult;
}
// Triggered spells also have range check
/// @todo determine if there is some flag to enable/disable the check
castResult = CheckRange(strict);
if (castResult != SPELL_CAST_OK)
return castResult;
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
{
castResult = CheckPower();
if (castResult != SPELL_CAST_OK)
return castResult;
}
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURAS))
{
castResult = CheckCasterAuras();
if (castResult != SPELL_CAST_OK)
return castResult;
}
// script hook
castResult = CallScriptCheckCastHandlers();
if (castResult != SPELL_CAST_OK)
return castResult;
bool hasDispellableAura = false;
bool hasNonDispelEffect = false;
uint32 dispelMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_DISPEL)
{
if (m_spellInfo->Effects[i].IsTargetingArea() || m_spellInfo->AttributesEx & SPELL_ATTR1_MELEE_COMBAT_START)
{
hasDispellableAura = true;
break;
}
dispelMask |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
else if (m_spellInfo->Effects[i].IsEffect())
{
hasNonDispelEffect = true;
break;
}
}
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// for effects of spells that have only one target
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_DUMMY:
{
if (m_spellInfo->Id == 19938) // Awaken Peon
{
Unit* unit = m_targets.GetUnitTarget();
if (!unit || !unit->HasAura(17743))
return SPELL_FAILED_BAD_TARGETS;
}
else if (m_spellInfo->Id == 31789) // Righteous Defense
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_DONT_REPORT;
Unit* target = m_targets.GetUnitTarget();
if (!target || !target->IsFriendlyTo(m_caster) || target->getAttackers().empty())
return SPELL_FAILED_BAD_TARGETS;
}
break;
}
case SPELL_EFFECT_LEARN_SPELL:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_PET)
break;
Pet* pet = m_caster->ToPlayer()->GetPet();
if (!pet)
return SPELL_FAILED_NO_PET;
SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
break;
}
case SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if (Guild* guild = m_caster->ToPlayer()->GetGuild())
if (guild->GetLeaderGUID() != m_caster->ToPlayer()->GetGUID())
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
break;
}
case SPELL_EFFECT_LEARN_PET_SPELL:
{
// check target only for unit target case
if (Unit* unitTarget = m_targets.GetUnitTarget())
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
Pet* pet = unitTarget->ToPet();
if (!pet || pet->GetOwner() != m_caster)
return SPELL_FAILED_BAD_TARGETS;
SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell);
if (!learn_spellproto)
return SPELL_FAILED_NOT_KNOWN;
if (m_spellInfo->SpellLevel > pet->getLevel())
return SPELL_FAILED_LOWLEVEL;
}
break;
}
case SPELL_EFFECT_APPLY_GLYPH:
{
uint32 glyphId = m_spellInfo->Effects[i].MiscValue;
if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyphId))
if (m_caster->HasAura(gp->SpellId))
return SPELL_FAILED_UNIQUE_GLYPH;
break;
}
case SPELL_EFFECT_FEED_PET:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
Item* foodItem = m_targets.GetItemTarget();
if (!foodItem)
return SPELL_FAILED_BAD_TARGETS;
Pet* pet = m_caster->ToPlayer()->GetPet();
if (!pet)
return SPELL_FAILED_NO_PET;
if (!pet->HaveInDiet(foodItem->GetTemplate()))
return SPELL_FAILED_WRONG_PET_FOOD;
if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel))
return SPELL_FAILED_FOOD_LOWLEVEL;
if (m_caster->IsInCombat() || pet->IsInCombat())
return SPELL_FAILED_AFFECTING_COMBAT;
break;
}
case SPELL_EFFECT_POWER_BURN:
case SPELL_EFFECT_POWER_DRAIN:
{
// Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Unit* target = m_targets.GetUnitTarget())
if (target != m_caster && target->getPowerType() != Powers(m_spellInfo->Effects[i].MiscValue))
return SPELL_FAILED_BAD_TARGETS;
break;
}
case SPELL_EFFECT_CHARGE:
{
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR)
{
// Warbringer - can't be handled in proc system - should be done before checkcast root check and charge effect process
if (strict && m_caster->IsScriptOverriden(m_spellInfo, 6953))
m_caster->RemoveMovementImpairingAuras();
}
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
return SPELL_FAILED_ROOTED;
if (GetSpellInfo()->NeedsExplicitUnitTarget())
{
Unit* target = m_targets.GetUnitTarget();
if (!target)
return SPELL_FAILED_DONT_REPORT;
Position pos;
target->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
target->GetFirstCollisionPosition(pos, CONTACT_DISTANCE, target->GetRelativeAngle(m_caster));
m_preGeneratedPath.SetPathLengthLimit(m_spellInfo->GetMaxRange(true) * 1.5f);
bool result = m_preGeneratedPath.CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ + target->GetObjectSize());
if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
else if (!result || m_preGeneratedPath.GetPathType() & PATHFIND_NOPATH)
return SPELL_FAILED_NOPATH;
}
break;
}
case SPELL_EFFECT_SKINNING:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.GetUnitTarget() || m_targets.GetUnitTarget()->GetTypeId() != TYPEID_UNIT)
return SPELL_FAILED_BAD_TARGETS;
if (!(m_targets.GetUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE))
return SPELL_FAILED_TARGET_UNSKINNABLE;
Creature* creature = m_targets.GetUnitTarget()->ToCreature();
if (creature->GetCreatureType() != CREATURE_TYPE_CRITTER && !creature->loot.isLooted())
return SPELL_FAILED_TARGET_NOT_LOOTED;
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
int32 TargetLevel = m_targets.GetUnitTarget()->getLevel();
int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5);
if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
// chance for fail at orange skinning attempt
if ((m_selfContainer && (*m_selfContainer) == this) &&
skillValue < sWorld->GetConfigMaxSkillValue() &&
(ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37))
return SPELL_FAILED_TRY_AGAIN;
break;
}
case SPELL_EFFECT_OPEN_LOCK:
{
if (m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_TARGET &&
m_spellInfo->Effects[i].TargetA.GetTarget() != TARGET_GAMEOBJECT_ITEM_TARGET)
break;
if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
// we need a go target in case of TARGET_GAMEOBJECT_TARGET
|| (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget()))
return SPELL_FAILED_BAD_TARGETS;
Item* pTempItem = NULL;
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID()));
}
else if (m_targets.GetTargetMask() & TARGET_FLAG_ITEM)
pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.GetItemTargetGUID());
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM_TARGET
if (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET &&
!m_targets.GetGOTarget() &&
(!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
return SPELL_FAILED_BAD_TARGETS;
if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
m_targets.GetGOTarget()->GetGOInfo()->type != GAMEOBJECT_TYPE_TRAP))
if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners
!m_caster->ToPlayer()->CanUseBattlegroundObject(m_targets.GetGOTarget()))
return SPELL_FAILED_TRY_AGAIN;
// get the lock entry
uint32 lockId = 0;
if (GameObject* go = m_targets.GetGOTarget())
{
lockId = go->GetGOInfo()->GetLockId();
if (!lockId)
return SPELL_FAILED_BAD_TARGETS;
}
else if (Item* itm = m_targets.GetItemTarget())
lockId = itm->GetTemplate()->LockID;
SkillType skillId = SKILL_NONE;
int32 reqSkillValue = 0;
int32 skillValue = 0;
// check lock compatibility
SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue);
if (res != SPELL_CAST_OK)
return res;
// chance for fail at orange mining/herb/LockPicking gathering attempt
// second check prevent fail at rechecks
if (skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this)))
{
bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING;
// chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
if ((canFailAtMax || skillValue < sWorld->GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37))
return SPELL_FAILED_TRY_AGAIN;
}
break;
}
case SPELL_EFFECT_RESURRECT_PET:
{
Creature* pet = m_caster->GetGuardianPet();
if (pet && pet->IsAlive())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
break;
}
// This is generic summon effect
case SPELL_EFFECT_SUMMON:
{
SummonPropertiesEntry const* SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB);
if (!SummonProperties)
break;
switch (SummonProperties->Category)
{
case SUMMON_CATEGORY_PET:
if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
case SUMMON_CATEGORY_PUPPET:
if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
break;
}
case SPELL_EFFECT_CREATE_TAMED_PET:
{
if (m_targets.GetUnitTarget())
{
if (m_targets.GetUnitTarget()->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if (m_targets.GetUnitTarget()->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
}
break;
}
case SPELL_EFFECT_SUMMON_PET:
{
if (m_caster->GetPetGUID()) //let warlock do a replacement summon
{
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK)
{
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
if (Pet* pet = m_caster->ToPlayer()->GetPet())
pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID());
}
else
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
}
if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;
}
case SPELL_EFFECT_SUMMON_PLAYER:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if (!m_caster->ToPlayer()->GetSelection())
return SPELL_FAILED_BAD_TARGETS;
Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection());
if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
return SPELL_FAILED_BAD_TARGETS;
// check if our map is dungeon
MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId());
if (map->IsDungeon())
{
uint32 mapId = m_caster->GetMap()->GetId();
Difficulty difficulty = m_caster->GetMap()->GetDifficulty();
if (map->IsRaid())
if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty))
if (InstancePlayerBind* casterBind = m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty))
if (targetBind->perm && targetBind->save != casterBind->save)
return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE;
InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapId);
if (!instance)
return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
if (!target->Satisfy(sObjectMgr->GetAccessRequirement(mapId, difficulty), mapId))
return SPELL_FAILED_BAD_TARGETS;
}
break;
}
// RETURN HERE
case SPELL_EFFECT_SUMMON_RAF_FRIEND:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
Player* playerCaster = m_caster->ToPlayer();
//
if (!(playerCaster->GetSelection()))
return SPELL_FAILED_BAD_TARGETS;
Player* target = ObjectAccessor::FindPlayer(playerCaster->GetSelection());
if (!target ||
!(target->GetSession()->GetRecruiterId() == playerCaster->GetSession()->GetAccountId() || target->GetSession()->GetAccountId() == playerCaster->GetSession()->GetRecruiterId()))
return SPELL_FAILED_BAD_TARGETS;
break;
}
case SPELL_EFFECT_LEAP:
case SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER:
{
//Do not allow to cast it before BG starts.
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() != STATUS_IN_PROGRESS)
return SPELL_FAILED_TRY_AGAIN;
break;
}
case SPELL_EFFECT_STEAL_BENEFICIAL_BUFF:
{
if (m_targets.GetUnitTarget() == m_caster)
return SPELL_FAILED_BAD_TARGETS;
break;
}
case SPELL_EFFECT_LEAP_BACK:
{
if (m_caster->HasUnitState(UNIT_STATE_ROOT))
{
if (m_caster->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_ROOTED;
else
return SPELL_FAILED_DONT_REPORT;
}
break;
}
case SPELL_EFFECT_TALENT_SPEC_SELECT:
// can't change during already started arena/battleground
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
if (bg->GetStatus() == STATUS_IN_PROGRESS)
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
break;
default:
break;
}
}
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (m_spellInfo->Effects[i].ApplyAuraName)
{
case SPELL_AURA_MOD_POSSESS_PET:
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_NO_PET;
Pet* pet = m_caster->ToPlayer()->GetPet();
if (!pet)
return SPELL_FAILED_NO_PET;
if (pet->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
break;
}
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_AOE_CHARM:
{
if (m_caster->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_CHARM
|| m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_POSSESS)
{
if (m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
if (m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
}
if (Unit* target = m_targets.GetUnitTarget())
{
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
if (target->IsMounted())
return SPELL_FAILED_CANT_BE_CHARMED;
if (target->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
int32 damage = CalculateDamage(i, target);
if (damage && int32(target->getLevel()) > damage)
return SPELL_FAILED_HIGHLEVEL;
}
break;
}
case SPELL_AURA_MOUNTED:
{
if (m_caster->IsInWater())
return SPELL_FAILED_ONLY_ABOVEWATER;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
bool allowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattlegroundOrArena();
InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId());
if (it)
allowMount = it->AllowMount;
if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId)
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
if (m_caster->IsInDisallowedMountForm())
return SPELL_FAILED_NOT_SHAPESHIFT;
break;
}
case SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS:
{
if (!m_targets.GetUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
// can be casted at non-friendly unit or own pet/charm
if (m_caster->IsFriendlyTo(m_targets.GetUnitTarget()))
return SPELL_FAILED_TARGET_FRIENDLY;
break;
}
case SPELL_AURA_FLY:
case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED:
{
// not allow cast fly spells if not have req. skills (all spells is self target)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->IsAlive())
{
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
if (AreaTableEntry const* area = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
if (area->flags & AREA_FLAG_NO_FLY_ZONE || (Bf && !Bf->CanFlyIn()))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
}
break;
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
{
if (m_spellInfo->Effects[i].IsTargetingArea())
break;
if (!m_targets.GetUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem)
break;
if (m_targets.GetUnitTarget()->getPowerType() != POWER_MANA)
return SPELL_FAILED_BAD_TARGETS;
break;
}
default:
break;
}
}
// check trade slot case (last, for allow catch any another cast problems)
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (m_CastItem)
return SPELL_FAILED_ITEM_ENCHANT_TRADE_WINDOW;
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_NOT_TRADING;
TradeData* my_trade = m_caster->ToPlayer()->GetTradeData();
if (!my_trade)
return SPELL_FAILED_NOT_TRADING;
TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID());
if (slot != TRADE_SLOT_NONTRADED)
return SPELL_FAILED_BAD_TARGETS;
if (!IsTriggered())
if (my_trade->GetSpell())
return SPELL_FAILED_ITEM_ALREADY_ENCHANTED;
}
// check if caster has at least 1 combo point for spells that require combo points
if (m_needComboPoints)
if (Player* plrCaster = m_caster->ToPlayer())
if (!plrCaster->GetComboPoints())
return SPELL_FAILED_NO_COMBO_POINTS;
// all ok
return SPELL_CAST_OK;
}
SpellCastResult Spell::CheckPetCast(Unit* target)
{
if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS)) //prevent spellcast interruption by another spellcast
return SPELL_FAILED_SPELL_IN_PROGRESS;
// dead owner (pets still alive when owners ressed?)
if (Unit* owner = m_caster->GetCharmerOrOwner())
if (!owner->IsAlive())
return SPELL_FAILED_CASTER_DEAD;
if (!target && m_targets.GetUnitTarget())
target = m_targets.GetUnitTarget();
if (m_spellInfo->NeedsExplicitUnitTarget())
{
if (!target)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
m_targets.SetUnitTarget(target);
}
// cooldown
if (Creature const* creatureCaster = m_caster->ToCreature())
if (creatureCaster->HasSpellCooldown(m_spellInfo->Id))
return SPELL_FAILED_NOT_READY;
return CheckCast(true);
}
SpellCastResult Spell::CheckCasterAuras() const
{
// spells totally immuned to caster auras (wsg flag drop, give marks etc)
if (m_spellInfo->AttributesEx6 & SPELL_ATTR6_IGNORE_CASTER_AURAS)
return SPELL_CAST_OK;
uint8 school_immune = 0;
uint32 mechanic_immune = 0;
uint32 dispel_immune = 0;
// Check if the spell grants school or mechanic immunity.
// We use bitmasks so the loop is done only once and not on every aura check below.
if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY)
mechanic_immune |= 1 << uint32(m_spellInfo->Effects[i].MiscValue);
else if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_DISPEL_IMMUNITY)
dispel_immune |= SpellInfo::GetDispelMask(DispelType(m_spellInfo->Effects[i].MiscValue));
}
// immune movement impairment and loss of control
if (m_spellInfo->Id == 42292 || m_spellInfo->Id == 59752 || m_spellInfo->Id == 19574)
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
bool usableInStun = m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_STUNNED;
// Glyph of Pain Suppression
// Allow Pain Suppression and Guardian Spirit to be cast while stunned
// there is no other way to handle it
if ((m_spellInfo->Id == 33206 || m_spellInfo->Id == 47788) && !m_caster->HasAura(63248))
usableInStun = false;
// Check whether the cast should be prevented by any state you might have.
SpellCastResult prevented_reason = SPELL_CAST_OK;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
if (unitflag & UNIT_FLAG_STUNNED)
{
// spell is usable while stunned, check if caster has only mechanic stun auras, another stun types must prevent cast spell
if (usableInStun)
{
bool foundNotStun = false;
Unit::AuraEffectList const& stunAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_STUN);
for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i)
{
if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
{
foundNotStun = true;
break;
}
}
if (foundNotStun && m_spellInfo->Id != 22812)
prevented_reason = SPELL_FAILED_STUNNED;
}
else
prevented_reason = SPELL_FAILED_STUNNED;
}
else if (unitflag & UNIT_FLAG_CONFUSED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_CONFUSED))
prevented_reason = SPELL_FAILED_CONFUSED;
else if (unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_FEARED))
prevented_reason = SPELL_FAILED_FLEEING;
else if (unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
prevented_reason = SPELL_FAILED_SILENCED;
else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED;
// Attr must make flag drop spell totally immune from all effects
if (prevented_reason != SPELL_CAST_OK)
{
if (school_immune || mechanic_immune || dispel_immune)
{
//Checking auras is needed now, because you are prevented by some state but the spell grants immunity.
Unit::AuraApplicationMap const& auras = m_caster->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura const* aura = itr->second->GetBase();
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue;
if (auraInfo->GetDispelMask() & dispel_immune)
continue;
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
//That is needed when your casting is prevented by multiple states and you are only immune to some of them.
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect* part = aura->GetEffect(i))
{
switch (part->GetAuraType())
{
case SPELL_AURA_MOD_STUN:
if (!usableInStun || !(auraInfo->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN)))
return SPELL_FAILED_STUNNED;
break;
case SPELL_AURA_MOD_CONFUSE:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_CONFUSED))
return SPELL_FAILED_CONFUSED;
break;
case SPELL_AURA_MOD_FEAR:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR5_USABLE_WHILE_FEARED))
return SPELL_FAILED_FLEEING;
break;
case SPELL_AURA_MOD_SILENCE:
case SPELL_AURA_MOD_PACIFY:
case SPELL_AURA_MOD_PACIFY_SILENCE:
if (m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY)
return SPELL_FAILED_PACIFIED;
else if (m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED;
break;
default: break;
}
}
}
}
}
// You are prevented from casting and the spell casted does not grant immunity. Return a failed error.
else
return prevented_reason;
}
return SPELL_CAST_OK;
}
SpellCastResult Spell::CheckArenaAndRatedBattlegroundCastRules()
{
bool isRatedBattleground = false; // NYI
bool isArena = !isRatedBattleground;
// check USABLE attributes
// USABLE takes precedence over NOT_USABLE
if (isRatedBattleground && m_spellInfo->AttributesEx9 & SPELL_ATTR9_USABLE_IN_RATED_BATTLEGROUNDS)
return SPELL_CAST_OK;
if (isArena && m_spellInfo->AttributesEx4 & SPELL_ATTR4_USABLE_IN_ARENA)
return SPELL_CAST_OK;
// check NOT_USABLE attributes
if (m_spellInfo->AttributesEx4 & SPELL_ATTR4_NOT_USABLE_IN_ARENA_OR_RATED_BG)
return isArena ? SPELL_FAILED_NOT_IN_ARENA : SPELL_FAILED_NOT_IN_RATED_BATTLEGROUND;
if (isArena && m_spellInfo->AttributesEx9 & SPELL_ATTR9_NOT_USABLE_IN_ARENA)
return SPELL_FAILED_NOT_IN_ARENA;
// check cooldowns
uint32 spellCooldown = m_spellInfo->GetRecoveryTime();
if (isArena && spellCooldown > 10 * MINUTE * IN_MILLISECONDS) // not sure if still needed
return SPELL_FAILED_NOT_IN_ARENA;
if (isRatedBattleground && spellCooldown > 15 * MINUTE * IN_MILLISECONDS)
return SPELL_FAILED_NOT_IN_RATED_BATTLEGROUND;
return SPELL_CAST_OK;
}
bool Spell::CanAutoCast(Unit* target)
{
uint64 targetguid = target->GetGUID();
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (m_spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
{
if (m_spellInfo->StackAmount <= 1)
{
if (target->HasAuraEffect(m_spellInfo->Id, j))
return false;
}
else
{
if (AuraEffect* aureff = target->GetAuraEffect(m_spellInfo->Id, j))
if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount)
return false;
}
}
else if (m_spellInfo->Effects[j].IsAreaAuraEffect())
{
if (target->HasAuraEffect(m_spellInfo->Id, j))
return false;
}
}
SpellCastResult result = CheckPetCast(target);
if (result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT)
{
SelectSpellTargets();
//check if among target units, our WANTED target is as well (->only self cast spells return false)
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetguid)
return true;
}
return false; //target invalid
}
SpellCastResult Spell::CheckRange(bool strict)
{
// Don't check for instant cast spells
if (!strict && m_casttime == 0)
return SPELL_CAST_OK;
uint32 range_type = 0;
if (m_spellInfo->RangeEntry)
{
// check needed by 68766 51693 - both spells are cast on enemies and have 0 max range
// these are triggered by other spells - possibly we should omit range check in that case?
if (m_spellInfo->RangeEntry->ID == 1)
return SPELL_CAST_OK;
range_type = m_spellInfo->RangeEntry->type;
}
Unit* target = m_targets.GetUnitTarget();
float max_range = m_caster->GetSpellMaxRangeForTarget(target, m_spellInfo);
float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo);
if (Player* modOwner = m_caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this);
if (target && target != m_caster)
{
if (range_type == SPELL_RANGE_MELEE)
{
// Because of lag, we can not check too strictly here.
if (!m_caster->IsWithinMeleeRange(target, max_range))
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT;
}
else if (!m_caster->IsWithinCombatRange(target, max_range))
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_OUT_OF_RANGE : SPELL_FAILED_DONT_REPORT; //0x5A;
if (range_type == SPELL_RANGE_RANGED)
{
if (m_caster->IsWithinMeleeRange(target))
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_TOO_CLOSE : SPELL_FAILED_DONT_REPORT;
}
else if (min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_TOO_CLOSE : SPELL_FAILED_DONT_REPORT;
if (m_caster->GetTypeId() == TYPEID_PLAYER &&
(m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(static_cast<float>(M_PI), target))
return !(_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_UNIT_NOT_INFRONT : SPELL_FAILED_DONT_REPORT;
}
if (m_targets.HasDst() && !m_targets.HasTraj())
{
if (!m_caster->IsWithinDist3d(m_targets.GetDstPos(), max_range))
return SPELL_FAILED_OUT_OF_RANGE;
if (min_range && m_caster->IsWithinDist3d(m_targets.GetDstPos(), min_range))
return SPELL_FAILED_TOO_CLOSE;
}
return SPELL_CAST_OK;
}
SpellCastResult Spell::CheckPower()
{
// item cast not used power
if (m_CastItem)
return SPELL_CAST_OK;
// health as power used - need check health amount
if (m_spellInfo->PowerType == POWER_HEALTH)
{
if (int32(m_caster->GetHealth()) <= m_powerCost)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}
// Check valid power type
if (m_spellInfo->PowerType >= MAX_POWERS)
{
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
return SPELL_FAILED_UNKNOWN;
}
//check rune cost only if a spell has PowerType == POWER_RUNES
if (m_spellInfo->PowerType == POWER_RUNES)
{
SpellCastResult failReason = CheckRuneCost(m_spellInfo->RuneCostID);
if (failReason != SPELL_CAST_OK)
return failReason;
}
// Check power amount
Powers powerType = Powers(m_spellInfo->PowerType);
if (int32(m_caster->GetPower(powerType)) < m_powerCost)
return SPELL_FAILED_NO_POWER;
else
return SPELL_CAST_OK;
}
SpellCastResult Spell::CheckItems()
{
Player* player = m_caster->ToPlayer();
if (!player)
return SPELL_CAST_OK;
if (!m_CastItem)
{
if (m_castItemGUID)
return SPELL_FAILED_ITEM_NOT_READY;
}
else
{
uint32 itemid = m_CastItem->GetEntry();
if (!player->HasItemCount(itemid))
return SPELL_FAILED_ITEM_NOT_READY;
ItemTemplate const* proto = m_CastItem->GetTemplate();
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
for (uint8 i = 0; i < MAX_ITEM_SPELLS; ++i)
if (proto->Spells[i].SpellCharges)
if (m_CastItem->GetSpellCharges(i) == 0)
return SPELL_FAILED_NO_CHARGES_REMAIN;
// consumable cast item checks
if (proto->Class == ITEM_CLASS_CONSUMABLE && m_targets.GetUnitTarget())
{
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
SpellCastResult failReason = SPELL_CAST_OK;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// skip check, pet not required like checks, and for TARGET_UNIT_PET m_targets.GetUnitTarget() is not the real target but the caster
if (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_PET)
continue;
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_HEAL)
{
if (m_targets.GetUnitTarget()->IsFullHealth())
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_HEALTH;
continue;
}
else
{
failReason = SPELL_CAST_OK;
break;
}
}
// Mana Potion, Rage Potion, Thistle Tea(Rogue), ...
if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
{
if (m_spellInfo->Effects[i].MiscValue < 0 || m_spellInfo->Effects[i].MiscValue >= int8(MAX_POWERS))
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
}
Powers power = Powers(m_spellInfo->Effects[i].MiscValue);
if (m_targets.GetUnitTarget()->GetPower(power) == m_targets.GetUnitTarget()->GetMaxPower(power))
{
failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
}
else
{
failReason = SPELL_CAST_OK;
break;
}
}
}
if (failReason != SPELL_CAST_OK)
return failReason;
}
}
// check target item
if (m_targets.GetItemTargetGUID())
{
if (!m_targets.GetItemTarget())
return SPELL_FAILED_ITEM_GONE;
if (!m_targets.GetItemTarget()->IsFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// if not item target then required item must be equipped
else
{
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT))
if (!player->HasItemFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// check spell focus object
if (m_spellInfo->RequiresSpellFocus)
{
CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY()));
Cell cell(p);
GameObject* ok = NULL;
Trinity::GameObjectFocusCheck go_check(m_caster, m_spellInfo->RequiresSpellFocus);
Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> checker(m_caster, ok, go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
Map& map = *m_caster->GetMap();
cell.Visit(p, object_checker, map, *m_caster, m_caster->GetVisibilityRange());
if (!ok)
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
focusObject = ok; // game object found in range
}
// do not take reagents for these item casts
if (!(m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
{
bool checkReagents = !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST) && !player->CanNoReagentCast(m_spellInfo);
// Not own traded item (in trader trade slot) requires reagents even if triggered spell
if (!checkReagents)
if (Item* targetItem = m_targets.GetItemTarget())
if (targetItem->GetOwnerGUID() != m_caster->GetGUID())
checkReagents = true;
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
if (checkReagents)
{
for (uint32 i = 0; i < MAX_SPELL_REAGENTS; i++)
{
if (m_spellInfo->Reagent[i] <= 0)
continue;
uint32 itemid = m_spellInfo->Reagent[i];
uint32 itemcount = m_spellInfo->ReagentCount[i];
// if CastItem is also spell reagent
if (m_CastItem && m_CastItem->GetEntry() == itemid)
{
ItemTemplate const* proto = m_CastItem->GetTemplate();
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
for (uint8 s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2)
{
++itemcount;
break;
}
}
}
if (!player->HasItemCount(itemid, itemcount))
return SPELL_FAILED_REAGENTS;
}
}
// check totem-item requirements (items presence in inventory)
uint32 totems = 2;
for (uint8 i = 0; i < 2; ++i)
{
if (m_spellInfo->Totem[i] != 0)
{
if (player->HasItemCount(m_spellInfo->Totem[i]))
{
totems -= 1;
continue;
}
}
else
totems -= 1;
}
if (totems != 0)
return SPELL_FAILED_TOTEMS;
}
// special checks for spell effects
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_CREATE_ITEM_2:
{
if (!IsTriggered() && m_spellInfo->Effects[i].ItemType)
{
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1);
if (msg != EQUIP_ERR_OK)
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType);
/// @todo Needs review
if (pProto && !(pProto->ItemLimitCategory))
{
player->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;
}
else
{
if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
else if (!(player->HasItemCount(m_spellInfo->Effects[i].ItemType)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
else
player->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere
return SPELL_FAILED_DONT_REPORT;
}
}
}
break;
}
case SPELL_EFFECT_ENCHANT_ITEM:
if (m_spellInfo->Effects[i].ItemType && m_targets.GetItemTarget()
&& (m_targets.GetItemTarget()->IsVellum()))
{
// cannot enchant vellum for other player
if (m_targets.GetItemTarget()->GetOwner() != m_caster)
return SPELL_FAILED_NOT_TRADEABLE;
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return SPELL_FAILED_TOTEM_CATEGORY;
ItemPosCountVec dest;
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1);
if (msg != EQUIP_ERR_OK)
{
player->SendEquipError(msg, NULL, NULL, m_spellInfo->Effects[i].ItemType);
return SPELL_FAILED_DONT_REPORT;
}
}
case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
{
Item* targetItem = m_targets.GetItemTarget();
if (!targetItem)
return SPELL_FAILED_ITEM_NOT_FOUND;
if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->BaseLevel)
return SPELL_FAILED_LOWLEVEL;
bool isItemUsable = false;
for (uint8 e = 0; e < MAX_ITEM_PROTO_SPELLS; ++e)
{
ItemTemplate const* proto = targetItem->GetTemplate();
if (proto->Spells[e].SpellId && (
proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE))
{
isItemUsable = true;
break;
}
}
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(m_spellInfo->Effects[i].MiscValue);
// do not allow adding usable enchantments to items that have use effect already
if (pEnchant && isItemUsable)
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
if (pEnchant->type[s] == ITEM_ENCHANTMENT_TYPE_USE_SPELL)
return SPELL_FAILED_ON_USE_ENCHANT;
// Not allow enchant in trade slot for some enchant type
if (targetItem->GetOwner() != m_caster)
{
if (!pEnchant)
return SPELL_FAILED_ERROR;
if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND)
return SPELL_FAILED_NOT_TRADEABLE;
}
break;
}
case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY:
{
Item* item = m_targets.GetItemTarget();
if (!item)
return SPELL_FAILED_ITEM_NOT_FOUND;
// Not allow enchant in trade slot for some enchant type
if (item->GetOwner() != m_caster)
{
uint32 enchant_id = m_spellInfo->Effects[i].MiscValue;
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
return SPELL_FAILED_ERROR;
if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND)
return SPELL_FAILED_NOT_TRADEABLE;
}
break;
}
case SPELL_EFFECT_ENCHANT_HELD_ITEM:
// check item existence in effect code (not output errors at offhand hold item effect to main hand for example
break;
case SPELL_EFFECT_DISENCHANT:
{
if (!m_targets.GetItemTarget())
return SPELL_FAILED_CANT_BE_DISENCHANTED;
// prevent disenchanting in trade slot
if (m_targets.GetItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_DISENCHANTED;
ItemTemplate const* itemProto = m_targets.GetItemTarget()->GetTemplate();
if (!itemProto)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
uint32 item_quality = itemProto->Quality;
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill;
if (item_disenchantskilllevel == uint32(-1))
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (item_disenchantskilllevel > player->GetSkillValue(SKILL_ENCHANTING))
return SPELL_FAILED_LOW_CASTLEVEL;
if (item_quality > 4 || item_quality < 2)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (!itemProto->DisenchantID)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
break;
}
case SPELL_EFFECT_PROSPECTING:
{
if (!m_targets.GetItemTarget())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//ensure item is a prospectable ore
if (!(m_targets.GetItemTarget()->GetTemplate()->Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
return SPELL_FAILED_CANT_BE_PROSPECTED;
//prevent prospecting in trade slot
if (m_targets.GetItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//Check for enough skill in jewelcrafting
uint32 item_prospectingskilllevel = m_targets.GetItemTarget()->GetTemplate()->RequiredSkillRank;
if (item_prospectingskilllevel >player->GetSkillValue(SKILL_JEWELCRAFTING))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required ores in inventory
if (m_targets.GetItemTarget()->GetCount() < 5)
return SPELL_FAILED_NEED_MORE_ITEMS;
if (!LootTemplates_Prospecting.HaveLootFor(m_targets.GetItemTargetEntry()))
return SPELL_FAILED_CANT_BE_PROSPECTED;
break;
}
case SPELL_EFFECT_MILLING:
{
if (!m_targets.GetItemTarget())
return SPELL_FAILED_CANT_BE_MILLED;
//ensure item is a millable herb
if (!(m_targets.GetItemTarget()->GetTemplate()->Flags & ITEM_PROTO_FLAG_MILLABLE))
return SPELL_FAILED_CANT_BE_MILLED;
//prevent milling in trade slot
if (m_targets.GetItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_MILLED;
//Check for enough skill in inscription
uint32 item_millingskilllevel = m_targets.GetItemTarget()->GetTemplate()->RequiredSkillRank;
if (item_millingskilllevel > player->GetSkillValue(SKILL_INSCRIPTION))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required herbs in inventory
if (m_targets.GetItemTarget()->GetCount() < 5)
return SPELL_FAILED_NEED_MORE_ITEMS;
if (!LootTemplates_Milling.HaveLootFor(m_targets.GetItemTargetEntry()))
return SPELL_FAILED_CANT_BE_MILLED;
break;
}
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
{
if (m_attackType != RANGED_ATTACK)
break;
Item* pItem = player->GetWeaponForAttack(m_attackType);
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
switch (pItem->GetTemplate()->SubClass)
{
case ITEM_SUBCLASS_WEAPON_THROWN:
{
uint32 ammo = pItem->GetEntry();
if (!player->HasItemCount(ammo))
return SPELL_FAILED_NO_AMMO;
break;
}
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
case ITEM_SUBCLASS_WEAPON_WAND:
break;
default:
break;
}
break;
}
case SPELL_EFFECT_CREATE_MANA_GEM:
{
uint32 item_id = m_spellInfo->Effects[i].ItemType;
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item_id);
if (!pProto)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
if (Item* pitem = player->GetItemByEntry(item_id))
{
for (int x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
if (pProto->Spells[x].SpellCharges != 0 && pitem->GetSpellCharges(x) == pProto->Spells[x].SpellCharges)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
}
break;
}
default:
break;
}
}
// check weapon presence in slots for main/offhand weapons
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_EQUIPPED_ITEM_REQUIREMENT) && m_spellInfo->EquippedItemClass >=0)
{
// main hand weapon required
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_MAIN_HAND)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
// skip spell if no weapon in slot or broken
if (!item || item->IsBroken())
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
if (!item->IsFitToSpellRequirements(m_spellInfo))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// offhand hand weapon required
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_REQ_OFFHAND)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
// skip spell if no weapon in slot or broken
if (!item || item->IsBroken())
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
if (!item->IsFitToSpellRequirements(m_spellInfo))
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
}
return SPELL_CAST_OK;
}
void Spell::Delayed() // only called in DealDamage()
{
if (!m_caster)// || m_caster->GetTypeId() != TYPEID_PLAYER)
return;
//if (m_spellState == SPELL_STATE_DELAYED)
// return; // spell is active and can't be time-backed
if (isDelayableNoMore()) // Spells may only be delayed twice
return;
// spells not loosing casting time (slam, dynamites, bombs..)
//if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE))
// return;
//check pushback reduce
int32 delaytime = 500; // spellcasting delay is normally 500ms
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
AddPct(delaytime, -delayReduce);
if (m_timer + delaytime > m_casttime)
{
delaytime = m_casttime - m_timer;
m_timer = m_casttime;
}
else
m_timer += delaytime;
TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
WorldPacket data(SMSG_SPELL_DELAYED, 8+4);
data.append(m_caster->GetPackGUID());
data << uint32(delaytime);
m_caster->SendMessageToSet(&data, true);
}
void Spell::DelayedChannel()
{
if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING)
return;
if (isDelayableNoMore()) // Spells may only be delayed twice
return;
//check pushback reduce
int32 delaytime = CalculatePct(m_spellInfo->GetDuration(), 25); // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if (delayReduce >= 100)
return;
AddPct(delaytime, -delayReduce);
if (m_timer <= delaytime)
{
delaytime = m_timer;
m_timer = 0;
}
else
m_timer -= delaytime;
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer);
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
if (Unit* unit = (m_caster->GetGUID() == ihit->targetGUID) ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->DelayOwnedAuras(m_spellInfo->Id, m_originalCasterGUID, delaytime);
// partially interrupt persistent area auras
if (DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id))
dynObj->Delay(delaytime);
SendChannelUpdate(m_timer);
}
void Spell::UpdatePointers()
{
if (m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
else
{
m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID);
if (m_originalCaster && !m_originalCaster->IsInWorld())
m_originalCaster = NULL;
}
if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER)
m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID);
m_targets.Update(m_caster);
// further actions done only for dest targets
if (!m_targets.HasDst())
return;
// cache last transport
WorldObject* transport = NULL;
// update effect destinations (in case of moved transport dest target)
for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
SpellDestination& dest = m_destTargets[effIndex];
if (!dest._transportGUID)
continue;
if (!transport || transport->GetGUID() != dest._transportGUID)
transport = ObjectAccessor::GetWorldObject(*m_caster, dest._transportGUID);
if (transport)
{
dest._position.Relocate(transport);
dest._position.RelocateOffset(dest._transportOffset);
}
}
}
CurrentSpellTypes Spell::GetCurrentContainer() const
{
if (IsNextMeleeSwingSpell())
return(CURRENT_MELEE_SPELL);
else if (IsAutoRepeat())
return(CURRENT_AUTOREPEAT_SPELL);
else if (m_spellInfo->IsChanneled())
return(CURRENT_CHANNELED_SPELL);
else
return(CURRENT_GENERIC_SPELL);
}
bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
{
switch (m_spellInfo->Effects[eff].ApplyAuraName)
{
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_MOD_CHARM:
case SPELL_AURA_MOD_POSSESS_PET:
case SPELL_AURA_AOE_CHARM:
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
return false;
if (target->IsMounted())
return false;
if (target->GetCharmerGUID())
return false;
if (int32 damage = CalculateDamage(eff, target))
if ((int32)target->getLevel() > damage)
return false;
break;
default:
break;
}
if (IsTriggered() || m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS || DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS))
return true;
/// @todo shit below shouldn't be here, but it's temporary
//Check targets for LOS visibility (except spells without range limitations)
switch (m_spellInfo->Effects[eff].Effect)
{
case SPELL_EFFECT_RESURRECT_NEW:
// player far away, maybe his corpse near?
if (target != m_caster && !target->IsWithinLOSInMap(m_caster))
{
if (!m_targets.GetCorpseTargetGUID())
return false;
Corpse* corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.GetCorpseTargetGUID());
if (!corpse)
return false;
if (target->GetGUID() != corpse->GetOwnerGUID())
return false;
if (!corpse->IsWithinLOSInMap(m_caster))
return false;
}
// all ok by some way or another, skip normal check
break;
default: // normal case
// Get GO cast coordinates if original caster -> GO
WorldObject* caster = NULL;
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
if (!caster)
caster = m_caster;
if (target != m_caster && !target->IsWithinLOSInMap(caster))
return false;
break;
}
return true;
}
bool Spell::IsNextMeleeSwingSpell() const
{
return m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING;
}
bool Spell::IsAutoActionResetSpell() const
{
/// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK -> SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
return !IsTriggered() && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT);
}
bool Spell::IsNeedSendToClient() const
{
return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || m_spellInfo->IsChanneled() ||
(m_spellInfo->AttributesEx8 & SPELL_ATTR8_AURA_SEND_AMOUNT) || m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell && !IsTriggered());
}
bool Spell::HaveTargetsForEffect(uint8 effect) const
{
for (std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
if (itr->effectMask & (1 << effect))
return true;
for (std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
if (itr->effectMask & (1 << effect))
return true;
for (std::list<ItemTargetInfo>::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr)
if (itr->effectMask & (1 << effect))
return true;
return false;
}
SpellEvent::SpellEvent(Spell* spell) : BasicEvent()
{
m_Spell = spell;
}
SpellEvent::~SpellEvent()
{
if (m_Spell->getState() != SPELL_STATE_FINISHED)
m_Spell->cancel();
if (m_Spell->IsDeletable())
{
delete m_Spell;
}
else
{
TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
ASSERT(false);
}
}
bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
{
// update spell if it is not finished
if (m_Spell->getState() != SPELL_STATE_FINISHED)
m_Spell->update(p_time);
// check spell state to process
switch (m_Spell->getState())
{
case SPELL_STATE_FINISHED:
{
// spell was finished, check deletable state
if (m_Spell->IsDeletable())
{
// check, if we do have unfinished triggered spells
return true; // spell is deletable, finish event
}
// event will be re-added automatically at the end of routine)
} break;
case SPELL_STATE_DELAYED:
{
// first, check, if we have just started
if (m_Spell->GetDelayStart() != 0)
{
// no, we aren't, do the typical update
// check, if we have channeled spell on our hands
/*
if (m_Spell->m_spellInfo->IsChanneled())
{
// evented channeled spell is processed separately, casted once after delay, and not destroyed till finish
// check, if we have casting anything else except this channeled spell and autorepeat
if (m_Spell->GetCaster()->IsNonMeleeSpellCasted(false, true, true))
{
// another non-melee non-delayed spell is casted now, abort
m_Spell->cancel();
}
else
{
// Set last not triggered spell for apply spellmods
((Player*)m_Spell->GetCaster())->SetSpellModTakingSpell(m_Spell, true);
// do the action (pass spell to channeling state)
m_Spell->handle_immediate();
// And remove after effect handling
((Player*)m_Spell->GetCaster())->SetSpellModTakingSpell(m_Spell, false);
}
// event will be re-added automatically at the end of routine)
}
else
*/
{
// run the spell handler and think about what we can do next
uint64 t_offset = e_time - m_Spell->GetDelayStart();
uint64 n_offset = m_Spell->handle_delayed(t_offset);
if (n_offset)
{
// re-add us to the queue
m_Spell->GetCaster()->m_Events.AddEvent(this, m_Spell->GetDelayStart() + n_offset, false);
return false; // event not complete
}
// event complete
// finish update event will be re-added automatically at the end of routine)
}
}
else
{
// delaying had just started, record the moment
m_Spell->SetDelayStart(e_time);
// re-plan the event for the delay moment
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + m_Spell->GetDelayMoment(), false);
return false; // event not complete
}
} break;
default:
{
// all other states
// event will be re-added automatically at the end of routine)
} break;
}
// spell processing not complete, plan event on the next update interval
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + 1, false);
return false; // event not complete
}
void SpellEvent::Abort(uint64 /*e_time*/)
{
// oops, the spell we try to do is aborted
if (m_Spell->getState() != SPELL_STATE_FINISHED)
m_Spell->cancel();
}
bool SpellEvent::IsDeletable() const
{
return m_Spell->IsDeletable();
}
bool Spell::IsValidDeadOrAliveTarget(Unit const* target) const
{
if (target->IsAlive())
return !m_spellInfo->IsRequiringDeadTarget();
if (m_spellInfo->IsAllowingDeadTarget())
return true;
return false;
}
void Spell::HandleLaunchPhase()
{
// handle effects with SPELL_EFFECT_HANDLE_LAUNCH mode
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// don't do anything for empty effect
if (!m_spellInfo->Effects[i].IsEffect())
continue;
HandleEffects(NULL, NULL, NULL, i, SPELL_EFFECT_HANDLE_LAUNCH);
}
float multiplier[MAX_SPELL_EFFECTS];
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (m_applyMultiplierMask & (1 << i))
multiplier[i] = m_spellInfo->Effects[i].CalcDamageMultiplier(m_originalCaster, this);
bool usesAmmo = m_spellInfo->AttributesCu & SPELL_ATTR0_CU_DIRECT_DAMAGE;
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo& target = *ihit;
uint32 mask = target.effectMask;
if (!mask)
continue;
// do not consume ammo anymore for Hunter's volley spell
if (IsTriggered() && m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->IsTargetingArea())
usesAmmo = false;
if (usesAmmo)
{
bool ammoTaken = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
{
if (!(mask & 1<<i))
continue;
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
ammoTaken=true;
TakeAmmo();
}
if (ammoTaken)
break;
}
}
DoAllEffectOnLaunchTarget(target, multiplier);
}
}
void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
{
Unit* unit = NULL;
// In case spell hit target, do all effect on that target
if (targetInfo.missCondition == SPELL_MISS_NONE)
unit = m_caster->GetGUID() == targetInfo.targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, targetInfo.targetGUID);
// In case spell reflect from target, do all effect on caster (if hit)
else if (targetInfo.missCondition == SPELL_MISS_REFLECT && targetInfo.reflectResult == SPELL_MISS_NONE)
unit = m_caster;
if (!unit)
return;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (targetInfo.effectMask & (1<<i))
{
m_damage = 0;
m_healing = 0;
HandleEffects(unit, NULL, NULL, i, SPELL_EFFECT_HANDLE_LAUNCH_TARGET);
if (m_damage > 0)
{
if (m_spellInfo->Effects[i].IsTargetingArea())
{
m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
if (m_caster->GetTypeId() == TYPEID_UNIT)
m_damage = int32(float(m_damage) * unit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, m_spellInfo->SchoolMask));
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
uint32 targetAmount = m_UniqueTargetInfo.size();
if (targetAmount > 10)
m_damage = m_damage * 10/targetAmount;
}
}
}
if (m_applyMultiplierMask & (1 << i))
{
m_damage = int32(m_damage * m_damageMultipliers[i]);
m_damageMultipliers[i] *= multiplier[i];
}
targetInfo.damage += m_damage;
}
}
targetInfo.crit = m_caster->isSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType);
}
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
{
if (!lockId) // possible case for GO and maybe for items.
return SPELL_CAST_OK;
// Get LockInfo
LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
if (!lockInfo)
return SPELL_FAILED_BAD_TARGETS;
bool reqKey = false; // some locks not have reqs
for (int j = 0; j < MAX_LOCK_CASE; ++j)
{
switch (lockInfo->Type[j])
{
// check key item (many fit cases can be)
case LOCK_KEY_ITEM:
if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry() == lockInfo->Index[j])
return SPELL_CAST_OK;
reqKey = true;
break;
// check key skill (only single first fit case can be)
case LOCK_KEY_SKILL:
{
reqKey = true;
// wrong locktype, skip
if (uint32(m_spellInfo->Effects[effIndex].MiscValue) != lockInfo->Index[j])
continue;
skillId = SkillByLockType(LockType(lockInfo->Index[j]));
if (skillId != SKILL_NONE)
{
reqSkillValue = lockInfo->Skill[j];
// castitem check: rogue using skeleton keys. the skill values should not be added in this case.
skillValue = m_CastItem || m_caster->GetTypeId()!= TYPEID_PLAYER ?
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
// skill bonus provided by casting spell (mostly item spells)
// add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.)
if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
skillValue += m_spellInfo->Effects[effIndex].CalcValue();
if (skillValue < reqSkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
}
return SPELL_CAST_OK;
}
}
}
if (reqKey)
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
}
void Spell::SetSpellValue(SpellValueMod mod, int32 value)
{
switch (mod)
{
case SPELLVALUE_BASE_POINT0:
m_spellValue->EffectBasePoints[0] = m_spellInfo->Effects[EFFECT_0].CalcBaseValue(value);
break;
case SPELLVALUE_BASE_POINT1:
m_spellValue->EffectBasePoints[1] = m_spellInfo->Effects[EFFECT_1].CalcBaseValue(value);
break;
case SPELLVALUE_BASE_POINT2:
m_spellValue->EffectBasePoints[2] = m_spellInfo->Effects[EFFECT_2].CalcBaseValue(value);
break;
case SPELLVALUE_RADIUS_MOD:
m_spellValue->RadiusMod = (float)value / 10000;
break;
case SPELLVALUE_MAX_TARGETS:
m_spellValue->MaxAffectedTargets = (uint32)value;
break;
case SPELLVALUE_AURA_STACK:
m_spellValue->AuraStackAmount = uint8(value);
break;
}
}
void Spell::PrepareTargetProcessing()
{
CheckEffectExecuteData();
}
void Spell::FinishTargetProcessing()
{
SendLogExecute();
}
void Spell::InitEffectExecuteData(uint8 effIndex)
{
ASSERT(effIndex < MAX_SPELL_EFFECTS);
if (!m_effectExecuteData[effIndex])
{
m_effectExecuteData[effIndex] = new ByteBuffer(0x20);
// first dword - target counter
*m_effectExecuteData[effIndex] << uint32(1);
}
else
{
// increase target counter by one
uint32 count = (*m_effectExecuteData[effIndex]).read<uint32>(0);
(*m_effectExecuteData[effIndex]).put<uint32>(0, ++count);
}
}
void Spell::CheckEffectExecuteData()
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
ASSERT(!m_effectExecuteData[i]);
}
void Spell::LoadScripts()
{
sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts);
for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
{
if (!(*itr)->_Load(this))
{
std::list<SpellScript*>::iterator bitr = itr;
++itr;
delete (*bitr);
m_loadedScripts.erase(bitr);
continue;
}
TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
(*itr)->Register();
++itr;
}
}
void Spell::CallScriptBeforeCastHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptOnCastHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptAfterCastHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
SpellCastResult Spell::CallScriptCheckCastHandlers()
{
SpellCastResult retVal = SPELL_CAST_OK;
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST);
std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();
for (; hookItr != hookItrEnd; ++hookItr)
{
SpellCastResult tempResult = (*hookItr).Call(*scritr);
if (retVal == SPELL_CAST_OK)
retVal = tempResult;
}
(*scritr)->_FinishScriptCall();
}
return retVal;
}
void Spell::PrepareScriptHitHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
(*scritr)->_InitHit();
}
bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMode mode)
{
// execute script effect handler hooks and check if effects was prevented
bool preventDefault = false;
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr;
SpellScriptHookType hookType;
switch (mode)
{
case SPELL_EFFECT_HANDLE_LAUNCH:
effItr = (*scritr)->OnEffectLaunch.begin();
effEndItr = (*scritr)->OnEffectLaunch.end();
hookType = SPELL_SCRIPT_HOOK_EFFECT_LAUNCH;
break;
case SPELL_EFFECT_HANDLE_LAUNCH_TARGET:
effItr = (*scritr)->OnEffectLaunchTarget.begin();
effEndItr = (*scritr)->OnEffectLaunchTarget.end();
hookType = SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET;
break;
case SPELL_EFFECT_HANDLE_HIT:
effItr = (*scritr)->OnEffectHit.begin();
effEndItr = (*scritr)->OnEffectHit.end();
hookType = SPELL_SCRIPT_HOOK_EFFECT_HIT;
break;
case SPELL_EFFECT_HANDLE_HIT_TARGET:
effItr = (*scritr)->OnEffectHitTarget.begin();
effEndItr = (*scritr)->OnEffectHitTarget.end();
hookType = SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET;
break;
default:
ASSERT(false);
return false;
}
(*scritr)->_PrepareScriptCall(hookType);
for (; effItr != effEndItr; ++effItr)
// effect execution can be prevented
if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex))
(*effItr).Call(*scritr, effIndex);
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultEffectPrevented(effIndex);
(*scritr)->_FinishScriptCall();
}
return preventDefault;
}
void Spell::CallScriptBeforeHitHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptOnHitHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptAfterHitHandlers()
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex)
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT);
std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();
for (; hookItr != hookItrEnd; ++hookItr)
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
(*hookItr).Call(*scritr, targets);
(*scritr)->_FinishScriptCall();
}
}
void Spell::CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex)
{
for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT);
std::list<SpellScript::ObjectTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin();
for (; hookItr != hookItrEnd; ++hookItr)
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
(*hookItr).Call(*scritr, target);
(*scritr)->_FinishScriptCall();
}
}
bool Spell::CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck)
{
// Skip if there are not any script
if (!m_loadedScripts.size())
return true;
for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
{
std::list<SpellScript::ObjectTargetSelectHandler>::iterator targetSelectHookEnd = (*itr)->OnObjectTargetSelect.end(), targetSelectHookItr = (*itr)->OnObjectTargetSelect.begin();
for (; targetSelectHookItr != targetSelectHookEnd; ++targetSelectHookItr)
if (((*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && !(*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)) ||
(!(*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && (*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)))
return false;
std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator areaTargetSelectHookEnd = (*itr)->OnObjectAreaTargetSelect.end(), areaTargetSelectHookItr = (*itr)->OnObjectAreaTargetSelect.begin();
for (; areaTargetSelectHookItr != areaTargetSelectHookEnd; ++areaTargetSelectHookItr)
if (((*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && !(*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)) ||
(!(*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && (*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)))
return false;
}
return true;
}
bool Spell::CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura) const
{
bool only_on_caster = (triggeredByAura && (triggeredByAura->AttributesEx4 & SPELL_ATTR4_PROC_ONLY_ON_CASTER));
// If triggeredByAura has SPELL_ATTR4_PROC_ONLY_ON_CASTER then it can only proc on a casted spell with TARGET_UNIT_CASTER
for (uint8 i = 0;i < MAX_SPELL_EFFECTS; ++i)
{
if ((effMask & (1 << i)) && (!only_on_caster || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CASTER)))
return true;
}
return false;
}
void Spell::PrepareTriggersExecutedOnHit()
{
/// @todo move this to scripts
if (m_spellInfo->SpellFamilyName)
{
SpellInfo const* excludeCasterSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeCasterAuraSpell);
if (excludeCasterSpellInfo && !excludeCasterSpellInfo->IsPositive())
m_preCastSpell = m_spellInfo->ExcludeCasterAuraSpell;
SpellInfo const* excludeTargetSpellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->ExcludeTargetAuraSpell);
if (excludeTargetSpellInfo && !excludeTargetSpellInfo->IsPositive())
m_preCastSpell = m_spellInfo->ExcludeTargetAuraSpell;
}
/// @todo move this to scripts
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_MAGE:
{
// Permafrost
if (m_spellInfo->SpellFamilyFlags[1] & 0x00001000 || m_spellInfo->SpellFamilyFlags[0] & 0x00100220)
m_preCastSpell = 68391;
break;
}
}
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras:
// save auras which were present on spell caster on cast, to prevent triggered auras from affecting caster
// and to correctly calculate proc chance when combopoints are present
Unit::AuraEffectList const& targetTriggers = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_TARGET_TRIGGER);
for (Unit::AuraEffectList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
{
if (!(*i)->IsAffectingSpell(m_spellInfo))
continue;
SpellInfo const* auraSpellInfo = (*i)->GetSpellInfo();
uint32 auraSpellIdx = (*i)->GetEffIndex();
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(auraSpellInfo->Effects[auraSpellIdx].TriggerSpell))
{
// calculate the chance using spell base amount, because aura amount is not updated on combo-points change
// this possibly needs fixing
int32 auraBaseAmount = (*i)->GetBaseAmount();
// proc chance is stored in effect amount
int32 chance = m_caster->CalculateSpellDamage(NULL, auraSpellInfo, auraSpellIdx, &auraBaseAmount);
// build trigger and add to the list
HitTriggerSpell spellTriggerInfo;
spellTriggerInfo.triggeredSpell = spellInfo;
spellTriggerInfo.triggeredByAura = auraSpellInfo;
spellTriggerInfo.chance = chance * (*i)->GetBase()->GetStackAmount();
m_hitTriggerSpells.push_back(spellTriggerInfo);
}
}
}
// Global cooldowns management
enum GCDLimits
{
MIN_GCD = 1000,
MAX_GCD = 1500
};
bool Spell::HasGlobalCooldown() const
{
// Only player or controlled units have global cooldown
if (m_caster->GetCharmInfo())
return m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
return m_caster->ToPlayer()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
else
return false;
}
void Spell::TriggerGlobalCooldown()
{
int32 gcd = m_spellInfo->StartRecoveryTime;
if (!gcd)
return;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
return;
// Global cooldown can't leave range 1..1.5 secs
// There are some spells (mostly not casted directly by player) that have < 1 sec and > 1.5 sec global cooldowns
// but as tests show are not affected by any spell mods.
if (m_spellInfo->StartRecoveryTime >= MIN_GCD && m_spellInfo->StartRecoveryTime <= MAX_GCD)
{
// gcd modifier auras are applied only to own spells and only players have such mods
if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, gcd, this);
// Apply haste rating
gcd = int32(float(gcd) * m_caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
if (gcd < MIN_GCD)
gcd = MIN_GCD;
else if (gcd > MAX_GCD)
gcd = MAX_GCD;
}
// Only players or controlled units have global cooldown
if (m_caster->GetCharmInfo())
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
}
void Spell::CancelGlobalCooldown()
{
if (!m_spellInfo->StartRecoveryTime)
return;
// Cancel global cooldown when interrupting current cast
if (m_caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) != this)
return;
// Only players or controlled units have global cooldown
if (m_caster->GetCharmInfo())
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
}
namespace Trinity
{
WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),
_targetSelectionType(selectionType), _condList(condList)
{
if (condList)
_condSrcInfo = new ConditionSourceInfo(NULL, caster);
else
_condSrcInfo = NULL;
}
WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck()
{
if (_condSrcInfo)
delete _condSrcInfo;
}
bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
{
if (_spellInfo->CheckTarget(_caster, target, true) != SPELL_CAST_OK)
return false;
Unit* unitTarget = target->ToUnit();
if (Corpse* corpseTarget = target->ToCorpse())
{
// use ofter for party/assistance checks
if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
unitTarget = owner;
else
return false;
}
if (unitTarget)
{
switch (_targetSelectionType)
{
case TARGET_CHECK_ENEMY:
if (unitTarget->IsTotem())
return false;
if (!_caster->_IsValidAttackTarget(unitTarget, _spellInfo))
return false;
break;
case TARGET_CHECK_ALLY:
if (unitTarget->IsTotem())
return false;
if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo))
return false;
break;
case TARGET_CHECK_PARTY:
if (unitTarget->IsTotem())
return false;
if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo))
return false;
if (!_referer->IsInPartyWith(unitTarget))
return false;
break;
case TARGET_CHECK_RAID_CLASS:
if (_referer->getClass() != unitTarget->getClass())
return false;
// nobreak;
case TARGET_CHECK_RAID:
if (unitTarget->IsTotem())
return false;
if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo))
return false;
if (!_referer->IsInRaidWith(unitTarget))
return false;
break;
default:
break;
}
}
if (!_condSrcInfo)
return true;
_condSrcInfo->mConditionTargets[0] = target;
return sConditionMgr->IsObjectMeetToConditions(*_condSrcInfo, *_condList);
}
WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList)
: WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster)
{
}
bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target)
{
float dist = target->GetDistance(*_position);
if (dist < _range && WorldObjectSpellTargetCheck::operator ()(target))
{
_range = dist;
return true;
}
return false;
}
WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster,
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList)
: WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position)
{
}
bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target)
{
if (!target->IsWithinDist3d(_position, _range) && !(target->ToGameObject() && target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range)))
return false;
return WorldObjectSpellTargetCheck::operator ()(target);
}
WorldObjectSpellConeTargetCheck::WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList)
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList), _coneAngle(coneAngle)
{
}
bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target)
{
if (_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_BACK)
{
if (!_caster->isInBack(target, _coneAngle))
return false;
}
else if (_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_LINE)
{
if (!_caster->HasInLine(target, _caster->GetObjectSize()))
return false;
}
else
{
if (!_caster->isInFront(target, _coneAngle))
return false;
}
return WorldObjectSpellAreaTargetCheck::operator ()(target);
}
WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, SpellInfo const* spellInfo)
: WorldObjectSpellAreaTargetCheck(range, position, caster, caster, spellInfo, TARGET_CHECK_DEFAULT, NULL)
{
}
bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target)
{
// return all targets on missile trajectory (0 - size of a missile)
if (!_caster->HasInLine(target, 0))
return false;
return WorldObjectSpellAreaTargetCheck::operator ()(target);
}
} //namespace Trinity
| [
"biditgetit@gmail.com"
] | biditgetit@gmail.com |
9e97d45933591da33eac7a33478e682e15bb963f | 62510fa67d0ca78082109a861b6948206252c885 | /hihope_neptune-oh_hid/00_src/v0.1/test/xts/acts/distributed_schedule_lite/dtbschedmgr_posix/src/utils/DMSTestBase.h | f3a19e8e64db78f23396fd42f2bfcf048e9630f3 | [
"Apache-2.0"
] | permissive | dawmlight/vendor_oh_fun | a869e7efb761e54a62f509b25921e019e237219b | bc9fb50920f06cd4c27399f60076f5793043c77d | refs/heads/master | 2023-08-05T09:25:33.485332 | 2021-09-10T10:57:48 | 2021-09-10T10:57:48 | 406,236,565 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,143 | h | /*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DMS_TEST_UTILS
#define DMS_TEST_UTILS
#include <cstdio>
#include <cstdlib>
#include <string>
#include "samgr_lite.h"
#include "dmslite_msg_parser.h"
#include "dmslite_tlv_common.h"
const int MS2US = 1000;
const int OPER_INTERVAL = 200;
const int PRESSURE_LEVEL0 = 10;
const int PRESSURE_LEVEL1 = 1024;
const int PRESSURE_LEVEL2 = 1024 * 10;
BOOL SystemInitProxy();
long long GetSystemTime();
std::string GetStringByLen(int len);
BOOL InstallHap();
BOOL UninstallHap();
#endif | [
"liu_xiyao@hoperun.com"
] | liu_xiyao@hoperun.com |
8f73d02d25964d9de099b662e84bf36de194b419 | cdb5f96e12e971c43ace20d235ebeef461c10ae0 | /src/game/skirmish/boardbackgroundcomponent.cpp | 38f355de4b84f0727852ed480b980bf9daa33d74 | [
"MIT"
] | permissive | namelessvoid/qrwar | 697ce0fc0a8766730be58cfe174e786705270874 | bbc4036cd3bab6b0edcaccbc95286379ef51f12b | refs/heads/master | 2021-01-17T13:36:14.275781 | 2020-07-21T19:19:50 | 2020-07-21T19:19:50 | 9,718,538 | 3 | 0 | MIT | 2020-07-01T19:35:31 | 2013-04-27T17:35:11 | C++ | UTF-8 | C++ | false | false | 1,749 | cpp | #include "game/skirmish/boardbackgroundcomponent.hpp"
#include <SFML/Graphics/RenderTarget.hpp>
#include "game/constants.hpp"
#include "game/skirmish/isometricconversion.hpp"
#include "game/renderlayers.hpp"
#include "gui/texturemanager.hpp"
namespace qrw
{
BoardBackgroundComponent::BoardBackgroundComponent(Board& owner)
: GameComponent(owner),
Renderable(RENDER_LAYER_BACKGROUND),
board_(owner)
{
plainSquareSprite_.setTexture(*TextureManager::getInstance()->getTexture("plainsquare"));
plainSquareSprite_.setOrigin({SQUARE_DIMENSION, 0});
}
void BoardBackgroundComponent::render(sf::RenderTarget& renderTarget)
{
for(unsigned int x = 0; x < board_.getWidth(); ++x)
{
for(unsigned int y = 0; y < board_.getHeight(); ++y)
{
sf::Vector2f isoPosition = worldToIso(sf::Vector2f(x, y) * SQUARE_DIMENSION);
plainSquareSprite_.setPosition(isoPosition);
renderTarget.draw(plainSquareSprite_);
}
}
}
void BoardBackgroundComponent::setPosition(const sf::Vector2f& position)
{
throw "Not implemented";
}
const sf::Vector2f& BoardBackgroundComponent::getPosition() const
{
throw "Not implemented";
}
sf::Vector2f BoardBackgroundComponent::getViewCenter() const
{
return worldToIso(sf::Vector2f(board_.getWidth(), board_.getHeight()) * 0.5f * SQUARE_DIMENSION);
}
sf::FloatRect BoardBackgroundComponent::getViewBounds() const
{
// a /\
// / \ b
// d \ /
// \/ c
sf::Vector2f a(0, 0);
sf::Vector2f b(worldToIso({board_.getWidth() * SQUARE_DIMENSION, 0}));
sf::Vector2f c(worldToIso(sf::Vector2f(board_.getWidth(), board_.getHeight()) * SQUARE_DIMENSION));
sf::Vector2f d(worldToIso({0, board_.getHeight() * SQUARE_DIMENSION}));
return sf::FloatRect(d.x, a.y, -d.x + b.x, c.y);
}
} // namespace qrw
| [
"pommesdiefritte@gmx.de"
] | pommesdiefritte@gmx.de |
43d8e0c46f4121f59534dea15df4abb288cb61c4 | 4dfa6232cf91f1c04d50809915078dc71fb371b4 | /dnn/src/cuda/warp_affine/opr_impl.cpp | 0bed96bed572529bf52cdffc0dfcad3bcebe7caa | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | hookex/MegEngine | 81c0539a3247873bdabe0e6f22e265e22249e98a | 47fd33880d2db3cae98c55911bb29328cdd5d7e4 | refs/heads/master | 2022-08-01T02:04:06.431689 | 2020-05-22T11:10:17 | 2020-05-22T11:10:17 | 250,200,281 | 1 | 0 | NOASSERTION | 2020-03-26T08:22:39 | 2020-03-26T08:22:39 | null | UTF-8 | C++ | false | false | 6,131 | cpp | /**
* \file dnn/src/cuda/warp_affine/opr_impl.cpp
* MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
*
* Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include "src/cuda/warp_affine/opr_impl.h"
#include "src/cuda/warp_affine/warp_affine_cv.cuh"
#include "src/cuda/warp_affine/helper.h"
#include "src/cuda/warp_affine/common.h"
#include "src/cuda/handle.h"
#include "src/cuda/utils.h"
#include "src/common/cv/common.h"
#include "src/common/cv/helper.h"
#include "src/common/cv/enums.h"
#include "src/common/utils.h"
#include <cstring>
namespace megdnn {
namespace cuda {
namespace warp_affine {
void warp_affine_cv_exec(_megdnn_tensor_in src, _megdnn_tensor_in mat,
_megdnn_tensor_in dst, float border_val,
BorderMode bmode, InterpolationMode imode,
_megdnn_workspace workspace, cudaStream_t stream) {
using namespace megcv;
megdnn_assert(src.layout[3] == 1 || src.layout[3] == 3,
"unsupported src channel");
using namespace megcv;
const float* trans_ptr = mat.ptr<dt_float32>();
double *workspace_ptr = workspace.ptr<double>();
for (size_t i = 0; i < src.layout.shape[0]; ++i) {
if (dst.layout.dtype == dtype::Float32()) {
Mat<float> src_mat = TensorND2Mat<float>(src, i);
Mat<float> dst_mat = TensorND2Mat<float>(dst, i);
if (src_mat.channels() == 1) {
warp_affine_cv_proxy<float, 1>(
src_mat.ptr(), dst_mat.ptr(), src_mat.rows(),
src_mat.cols(), dst_mat.rows(), dst_mat.cols(),
src_mat.step(), dst_mat.step(), bmode, imode,
trans_ptr, border_val, workspace_ptr, stream);
} else {
warp_affine_cv_proxy<float, 3>(
src_mat.ptr(), dst_mat.ptr(), src_mat.rows(),
src_mat.cols(), dst_mat.rows(), dst_mat.cols(),
src_mat.step(), dst_mat.step(), bmode, imode,
trans_ptr, border_val, workspace_ptr, stream);
}
} else if (dst.layout.dtype == dtype::Uint8()) {
Mat<uchar> src_mat = TensorND2Mat<uchar>(src, i);
Mat<uchar> dst_mat = TensorND2Mat<uchar>(dst, i);
if (src_mat.channels() == 1) {
warp_affine_cv_proxy<uchar, 1>(
src_mat.ptr(), dst_mat.ptr(), src_mat.rows(),
src_mat.cols(), dst_mat.rows(), dst_mat.cols(),
src_mat.step(), dst_mat.step(), bmode, imode, trans_ptr,
static_cast<uchar>(border_val), workspace_ptr, stream);
} else {
warp_affine_cv_proxy<uchar, 3>(
src_mat.ptr(), dst_mat.ptr(), src_mat.rows(),
src_mat.cols(), dst_mat.rows(), dst_mat.cols(),
src_mat.step(), dst_mat.step(), bmode, imode, trans_ptr,
static_cast<uchar>(border_val), workspace_ptr, stream);
}
} else {
megdnn_throw(
megdnn_mangle("Unsupported datatype of Warpaffine optr."));
}
trans_ptr += 2 * 3;
workspace_ptr += 2 * 3;
}
}
} // warp_affine
void WarpAffineImpl::exec(_megdnn_tensor_in src, _megdnn_tensor_in mat,
_megdnn_tensor_out dst, _megdnn_workspace workspace) {
using namespace megcv;
check_exec(src.layout, mat.layout, dst.layout, workspace.size);
auto stream = cuda_stream(this->handle());
bool is_nhwc = param().format == param::WarpAffine::Format::NHWC;
size_t C, IH, IW, OH, OW;
if (is_nhwc) {
if (param().imode != Param::InterpolationMode::LINEAR) {
warp_affine::warp_affine_cv_exec(
src, mat, dst, param().border_val,
warp_affine::get_bmode(param().border_mode),
warp_affine::get_imode(param().imode), workspace, stream);
return;
}
C = src.layout.shape[3];
IH = src.layout.shape[1];
IW = src.layout.shape[2];
OH = dst.layout.shape[1];
OW = dst.layout.shape[2];
} else {
megdnn_assert(param().format == param::WarpAffine::Format::NCHW,
"invalid warp_affine format");
C = src.layout.shape[1];
IH = src.layout.shape[2];
IW = src.layout.shape[3];
OH = dst.layout.shape[2];
OW = dst.layout.shape[3];
}
megdnn_assert(param().imode == Param::InterpolationMode::LINEAR,
"unsupported interpolation mode for NCHW format");
auto bval = param().border_val;
auto bmode = warp_affine::get_bmode(param().border_mode);
if (src.layout.dtype == dtype::Float32{}) {
warp_affine::forward_proxy(is_nhwc, src.ptr<dt_float32>(),
mat.ptr<dt_float32>(), dst.ptr<dt_float32>(),
src.layout[0], C, IH, IW, OH, OW, bval,
bmode, stream);
} else if (src.layout.dtype == dtype::Uint8()) {
warp_affine::forward_proxy<dt_uint8>(
is_nhwc, src.ptr<dt_uint8>(), mat.ptr<dt_float32>(),
dst.ptr<dt_uint8>(), src.layout[0], C, IH, IW, OH, OW, bval,
bmode, stream);
} else if (src.layout.dtype == dtype::Int8()) {
megdnn_assert(!is_nhwc,
"WarpPerspective on CUDA does not support NHWC + Int8");
warp_affine::forward_proxy<dt_int8>(
is_nhwc, src.ptr<dt_int8>(), mat.ptr<dt_float32>(),
dst.ptr<dt_int8>(), src.layout[0], C, IH, IW, OH, OW, bval,
bmode, stream);
} else {
megdnn_throw(
ssprintf("unsupported dtype: %s", src.layout.dtype.name()));
}
}
} // namespace cuda
} // namespace megdnn
// vim: syntax=cpp.doxygen
| [
"megengine@megvii.com"
] | megengine@megvii.com |
86ea4b9a822ea5d27705b01cc1b08bd9f9b277bf | 0a9ce9c99f8b20cd6118b74181850660d584020a | /maple/src/systematic/PCTSet.cc | 5d377cb29cc8c36acbca664a03f41ba6b98167f0 | [
"MIT",
"Apache-2.0"
] | permissive | mc-imperial/sctbench | 1d1538006c43453eaef44d926835f757d6989266 | d59ab26ddaedcd575ffb6a1f5e9711f7d6d2d9f2 | refs/heads/master | 2021-12-28T03:59:51.971648 | 2021-12-16T11:51:24 | 2021-12-16T11:51:24 | 69,858,388 | 24 | 12 | null | null | null | null | UTF-8 | C++ | false | false | 47 | cc | /*
* PCTSet.cc
*
*/
#include "PCTSet.h"
| [
"paul.thomson11@imperial.ac.uk"
] | paul.thomson11@imperial.ac.uk |
f7be6ac485100f6778c3a5dce5c73b7ff2f37606 | e428638df7c259a9da2b4a8856008da8251aa388 | /Include/Graphics/GteLightingEffect.h | 122144423253bd15d47c20524eaedbfbdedf5135 | [
"BSL-1.0"
] | permissive | vehsakul/gtl | 22a9ee057a282d3edbb99eaa30ad6e68773c768e | 498bb20947e9ff21c08dd5a884ac3dc6f8313bb9 | refs/heads/master | 2020-12-24T06:41:48.314735 | 2016-11-14T18:16:36 | 2016-11-14T18:16:36 | 73,462,121 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,500 | h | // David Eberly, Geometric Tools, Redmond WA 98052
// Copyright (c) 1998-2016
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
// File Version: 3.0.0 (2016/06/19)
#pragma once
#include <Graphics/GteVisualEffect.h>
#include <Graphics/GteMaterial.h>
#include <Graphics/GteLighting.h>
#include <Graphics/GteLightCameraGeometry.h>
namespace gte
{
class GTE_IMPEXP LightingEffect : public VisualEffect
{
protected:
// Construction (abstract base class). The shader source code string
// arrays must contain strings for any supported graphics API.
LightingEffect(std::shared_ptr<ProgramFactory> const& factory,
BufferUpdater const& updater, std::string const* vsSource[],
std::string const* psSource[], std::shared_ptr<Material> const& material,
std::shared_ptr<Lighting> const& lighting,
std::shared_ptr<LightCameraGeometry> const& geometry);
public:
// Member access.
inline void SetMaterial(std::shared_ptr<Material> const& material);
inline void SetLighting(std::shared_ptr<Lighting> const& lighting);
inline void SetGeometry(std::shared_ptr<LightCameraGeometry> const& geometry);
inline std::shared_ptr<Material> const& GetMaterial() const;
inline std::shared_ptr<Lighting> const& GetLighting() const;
inline std::shared_ptr<LightCameraGeometry> const& GetGeometry() const;
inline std::shared_ptr<ConstantBuffer> const& GetPVWMatrixConstant() const;
inline std::shared_ptr<ConstantBuffer> const& GetMaterialConstant() const;
inline std::shared_ptr<ConstantBuffer> const& GetLightingConstant() const;
inline std::shared_ptr<ConstantBuffer> const& GetGeometryConstant() const;
// After you set or modify 'material', 'light', or 'geometry', call the update
// to inform any listener that the corresponding constant buffer has changed.
// The derived classes construct the constant buffers to store the minimal
// information from Material, Light, or Camera. The pvw-matrix constant update
// requires knowledge of the world transform of the object to which the effect
// is attached, so its update must occur outside of this class. Derived
// classes update the system memory of the constant buffers and the base class
// updates video memory.
virtual void UpdateMaterialConstant();
virtual void UpdateLightingConstant();
virtual void UpdateGeometryConstant();
protected:
std::shared_ptr<Material> mMaterial;
std::shared_ptr<Lighting> mLighting;
std::shared_ptr<LightCameraGeometry> mGeometry;
std::shared_ptr<ConstantBuffer> mPVWMatrixConstant;
// The derived-class constructors are responsible for creating these
// according to their needs.
std::shared_ptr<ConstantBuffer> mMaterialConstant;
std::shared_ptr<ConstantBuffer> mLightingConstant;
std::shared_ptr<ConstantBuffer> mGeometryConstant;
// HLSL has a shader intrinsic lit() function.
// This inline string of code reproduces that function for GLSL.
// Static method used here because this string needs to be generated
// before code (which may also be in global initializers) tries to use it.
static std::string GetShaderSourceLitFunctionGLSL();
};
inline void LightingEffect::SetMaterial(std::shared_ptr<Material> const& material)
{
mMaterial = material;
}
inline void LightingEffect::SetLighting(std::shared_ptr<Lighting> const& lighting)
{
mLighting = lighting;
}
inline void LightingEffect::SetGeometry(std::shared_ptr<LightCameraGeometry> const& geometry)
{
mGeometry = geometry;
}
inline std::shared_ptr<Material> const& LightingEffect::GetMaterial() const
{
return mMaterial;
}
inline std::shared_ptr<Lighting> const& LightingEffect::GetLighting() const
{
return mLighting;
}
inline std::shared_ptr<LightCameraGeometry> const& LightingEffect::GetGeometry() const
{
return mGeometry;
}
inline std::shared_ptr<ConstantBuffer> const& LightingEffect::GetPVWMatrixConstant() const
{
return mPVWMatrixConstant;
}
inline std::shared_ptr<ConstantBuffer> const& LightingEffect::GetMaterialConstant() const
{
return mMaterialConstant;
}
inline std::shared_ptr<ConstantBuffer> const& LightingEffect::GetLightingConstant() const
{
return mLightingConstant;
}
inline std::shared_ptr<ConstantBuffer> const& LightingEffect::GetGeometryConstant() const
{
return mGeometryConstant;
}
}
| [
"lukashev.s@ya.ru"
] | lukashev.s@ya.ru |
7094f6ba8d520c0b3110845e8272cbeb5e8f31ff | a3d6556180e74af7b555f8d47d3fea55b94bcbda | /ash/system/network/network_list_mobile_header_view.h | 461b8f4da4aab7428cda0a2d00a3bc34d293e48d | [
"BSD-3-Clause"
] | permissive | chromium/chromium | aaa9eda10115b50b0616d2f1aed5ef35d1d779d6 | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | refs/heads/main | 2023-08-24T00:35:12.585945 | 2023-08-23T22:01:11 | 2023-08-23T22:01:11 | 120,360,765 | 17,408 | 7,102 | BSD-3-Clause | 2023-09-10T23:44:27 | 2018-02-05T20:55:32 | null | UTF-8 | C++ | false | false | 1,202 | 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 ASH_SYSTEM_NETWORK_NETWORK_LIST_MOBILE_HEADER_VIEW_H_
#define ASH_SYSTEM_NETWORK_NETWORK_LIST_MOBILE_HEADER_VIEW_H_
#include "ash/ash_export.h"
#include "ash/system/network/network_list_network_header_view.h"
#include "ui/base/metadata/metadata_impl_macros.h"
namespace ash {
// This class is the interface used to create network list header for Mobile
// networks, and is responsible for the creation of mobile-specific buttons.
class ASH_EXPORT NetworkListMobileHeaderView
: public NetworkListNetworkHeaderView {
public:
METADATA_HEADER(NetworkListMobileHeaderView);
explicit NetworkListMobileHeaderView(
NetworkListNetworkHeaderView::Delegate* delegate);
NetworkListMobileHeaderView(const NetworkListMobileHeaderView&) = delete;
NetworkListMobileHeaderView& operator=(const NetworkListMobileHeaderView&) =
delete;
~NetworkListMobileHeaderView() override;
virtual void SetAddESimButtonState(bool enabled, bool visible) = 0;
};
} // namespace ash
#endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_MOBILE_HEADER_VIEW_H_
| [
"chromium-scoped@luci-project-accounts.iam.gserviceaccount.com"
] | chromium-scoped@luci-project-accounts.iam.gserviceaccount.com |
d806763ae6a9f6e5604d72a66758402d64816fc8 | 97848959c72a3f8c4cf0e06ba8a03824c00e3f7c | /src/scrypt.cpp | 3c58d40a210c48051e84fe9685b3dc9f65fda0a3 | [
"MIT"
] | permissive | Stirling/aur | 627f9fbf44971aa0fd5e44d4845951e5f1da2795 | 826680f139576a4d8b99fd700acac2fef0322eb0 | refs/heads/master | 2020-04-16T00:26:34.830990 | 2015-02-01T22:08:37 | 2015-02-06T01:35:47 | 30,809,783 | 0 | 1 | null | 2015-02-14T21:46:47 | 2015-02-14T21:46:46 | null | UTF-8 | C++ | false | false | 10,057 | cpp | /*
* Copyright 2009 Colin Percival, 2011 ArtForz, 2012-2013 pooler
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#include "scrypt.h"
#include "util.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
#if defined(USE_SSE2) && !defined(USE_SSE2_ALWAYS)
#ifdef _MSC_VER
// MSVC 64bit is unable to use inline asm
#include <intrin.h>
#else
// GCC Linux or i686-w64-mingw32
#include <cpuid.h>
#endif
#endif
static inline uint32_t be32dec(const void *pp)
{
const uint8_t *p = (uint8_t const *)pp;
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
}
static inline void be32enc(void *pp, uint32_t x)
{
uint8_t *p = (uint8_t *)pp;
p[3] = x & 0xff;
p[2] = (x >> 8) & 0xff;
p[1] = (x >> 16) & 0xff;
p[0] = (x >> 24) & 0xff;
}
typedef struct HMAC_SHA256Context {
SHA256_CTX ictx;
SHA256_CTX octx;
} HMAC_SHA256_CTX;
/* Initialize an HMAC-SHA256 operation with the given key. */
static void
HMAC_SHA256_Init(HMAC_SHA256_CTX *ctx, const void *_K, size_t Klen)
{
unsigned char pad[64];
unsigned char khash[32];
const unsigned char *K = (const unsigned char *)_K;
size_t i;
/* If Klen > 64, the key is really SHA256(K). */
if (Klen > 64) {
SHA256_Init(&ctx->ictx);
SHA256_Update(&ctx->ictx, K, Klen);
SHA256_Final(khash, &ctx->ictx);
K = khash;
Klen = 32;
}
/* Inner SHA256 operation is SHA256(K xor [block of 0x36] || data). */
SHA256_Init(&ctx->ictx);
memset(pad, 0x36, 64);
for (i = 0; i < Klen; i++)
pad[i] ^= K[i];
SHA256_Update(&ctx->ictx, pad, 64);
/* Outer SHA256 operation is SHA256(K xor [block of 0x5c] || hash). */
SHA256_Init(&ctx->octx);
memset(pad, 0x5c, 64);
for (i = 0; i < Klen; i++)
pad[i] ^= K[i];
SHA256_Update(&ctx->octx, pad, 64);
/* Clean the stack. */
memset(khash, 0, 32);
}
/* Add bytes to the HMAC-SHA256 operation. */
static void
HMAC_SHA256_Update(HMAC_SHA256_CTX *ctx, const void *in, size_t len)
{
/* Feed data to the inner SHA256 operation. */
SHA256_Update(&ctx->ictx, in, len);
}
/* Finish an HMAC-SHA256 operation. */
static void
HMAC_SHA256_Final(unsigned char digest[32], HMAC_SHA256_CTX *ctx)
{
unsigned char ihash[32];
/* Finish the inner SHA256 operation. */
SHA256_Final(ihash, &ctx->ictx);
/* Feed the inner hash to the outer SHA256 operation. */
SHA256_Update(&ctx->octx, ihash, 32);
/* Finish the outer SHA256 operation. */
SHA256_Final(digest, &ctx->octx);
/* Clean the stack. */
memset(ihash, 0, 32);
}
/**
* PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen):
* Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and
* write the output to buf. The value dkLen must be at most 32 * (2^32 - 1).
*/
void
PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt,
size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen)
{
HMAC_SHA256_CTX PShctx, hctx;
size_t i;
uint8_t ivec[4];
uint8_t U[32];
uint8_t T[32];
uint64_t j;
int k;
size_t clen;
/* Compute HMAC state after processing P and S. */
HMAC_SHA256_Init(&PShctx, passwd, passwdlen);
HMAC_SHA256_Update(&PShctx, salt, saltlen);
/* Iterate through the blocks. */
for (i = 0; i * 32 < dkLen; i++) {
/* Generate INT(i + 1). */
be32enc(ivec, (uint32_t)(i + 1));
/* Compute U_1 = PRF(P, S || INT(i)). */
memcpy(&hctx, &PShctx, sizeof(HMAC_SHA256_CTX));
HMAC_SHA256_Update(&hctx, ivec, 4);
HMAC_SHA256_Final(U, &hctx);
/* T_i = U_1 ... */
memcpy(T, U, 32);
for (j = 2; j <= c; j++) {
/* Compute U_j. */
HMAC_SHA256_Init(&hctx, passwd, passwdlen);
HMAC_SHA256_Update(&hctx, U, 32);
HMAC_SHA256_Final(U, &hctx);
/* ... xor U_j ... */
for (k = 0; k < 32; k++)
T[k] ^= U[k];
}
/* Copy as many bytes as necessary into buf. */
clen = dkLen - i * 32;
if (clen > 32)
clen = 32;
memcpy(&buf[i * 32], T, clen);
}
/* Clean PShctx, since we never called _Final on it. */
memset(&PShctx, 0, sizeof(HMAC_SHA256_CTX));
}
#define ROTL(a, b) (((a) << (b)) | ((a) >> (32 - (b))))
static inline void xor_salsa8(uint32_t B[16], const uint32_t Bx[16])
{
uint32_t x00,x01,x02,x03,x04,x05,x06,x07,x08,x09,x10,x11,x12,x13,x14,x15;
int i;
x00 = (B[ 0] ^= Bx[ 0]);
x01 = (B[ 1] ^= Bx[ 1]);
x02 = (B[ 2] ^= Bx[ 2]);
x03 = (B[ 3] ^= Bx[ 3]);
x04 = (B[ 4] ^= Bx[ 4]);
x05 = (B[ 5] ^= Bx[ 5]);
x06 = (B[ 6] ^= Bx[ 6]);
x07 = (B[ 7] ^= Bx[ 7]);
x08 = (B[ 8] ^= Bx[ 8]);
x09 = (B[ 9] ^= Bx[ 9]);
x10 = (B[10] ^= Bx[10]);
x11 = (B[11] ^= Bx[11]);
x12 = (B[12] ^= Bx[12]);
x13 = (B[13] ^= Bx[13]);
x14 = (B[14] ^= Bx[14]);
x15 = (B[15] ^= Bx[15]);
for (i = 0; i < 8; i += 2) {
/* Operate on columns. */
x04 ^= ROTL(x00 + x12, 7); x09 ^= ROTL(x05 + x01, 7);
x14 ^= ROTL(x10 + x06, 7); x03 ^= ROTL(x15 + x11, 7);
x08 ^= ROTL(x04 + x00, 9); x13 ^= ROTL(x09 + x05, 9);
x02 ^= ROTL(x14 + x10, 9); x07 ^= ROTL(x03 + x15, 9);
x12 ^= ROTL(x08 + x04, 13); x01 ^= ROTL(x13 + x09, 13);
x06 ^= ROTL(x02 + x14, 13); x11 ^= ROTL(x07 + x03, 13);
x00 ^= ROTL(x12 + x08, 18); x05 ^= ROTL(x01 + x13, 18);
x10 ^= ROTL(x06 + x02, 18); x15 ^= ROTL(x11 + x07, 18);
/* Operate on rows. */
x01 ^= ROTL(x00 + x03, 7); x06 ^= ROTL(x05 + x04, 7);
x11 ^= ROTL(x10 + x09, 7); x12 ^= ROTL(x15 + x14, 7);
x02 ^= ROTL(x01 + x00, 9); x07 ^= ROTL(x06 + x05, 9);
x08 ^= ROTL(x11 + x10, 9); x13 ^= ROTL(x12 + x15, 9);
x03 ^= ROTL(x02 + x01, 13); x04 ^= ROTL(x07 + x06, 13);
x09 ^= ROTL(x08 + x11, 13); x14 ^= ROTL(x13 + x12, 13);
x00 ^= ROTL(x03 + x02, 18); x05 ^= ROTL(x04 + x07, 18);
x10 ^= ROTL(x09 + x08, 18); x15 ^= ROTL(x14 + x13, 18);
}
B[ 0] += x00;
B[ 1] += x01;
B[ 2] += x02;
B[ 3] += x03;
B[ 4] += x04;
B[ 5] += x05;
B[ 6] += x06;
B[ 7] += x07;
B[ 8] += x08;
B[ 9] += x09;
B[10] += x10;
B[11] += x11;
B[12] += x12;
B[13] += x13;
B[14] += x14;
B[15] += x15;
}
void scrypt_1024_1_1_256_sp_generic(const char *input, char *output, char *scratchpad)
{
uint8_t B[128];
uint32_t X[32];
uint32_t *V;
uint32_t i, j, k;
V = (uint32_t *)(((uintptr_t)(scratchpad) + 63) & ~ (uintptr_t)(63));
PBKDF2_SHA256((const uint8_t *)input, 80, (const uint8_t *)input, 80, 1, B, 128);
for (k = 0; k < 32; k++)
X[k] = le32dec(&B[4 * k]);
for (i = 0; i < 1024; i++) {
memcpy(&V[i * 32], X, 128);
xor_salsa8(&X[0], &X[16]);
xor_salsa8(&X[16], &X[0]);
}
for (i = 0; i < 1024; i++) {
j = 32 * (X[16] & 1023);
for (k = 0; k < 32; k++)
X[k] ^= V[j + k];
xor_salsa8(&X[0], &X[16]);
xor_salsa8(&X[16], &X[0]);
}
for (k = 0; k < 32; k++)
le32enc(&B[4 * k], X[k]);
PBKDF2_SHA256((const uint8_t *)input, 80, B, 128, 1, (uint8_t *)output, 32);
}
#if defined(USE_SSE2)
// By default, set to generic scrypt function. This will prevent crash in case when scrypt_detect_sse2() wasn't called
void (*scrypt_1024_1_1_256_sp_detected)(const char *input, char *output, char *scratchpad) = &scrypt_1024_1_1_256_sp_generic;
void scrypt_detect_sse2()
{
#if defined(USE_SSE2_ALWAYS)
printf("scrypt: using scrypt-sse2 as built.\n");
#else // USE_SSE2_ALWAYS
// 32bit x86 Linux or Windows, detect cpuid features
unsigned int cpuid_edx=0;
#if defined(_MSC_VER)
// MSVC
int x86cpuid[4];
__cpuid(x86cpuid, 1);
cpuid_edx = (unsigned int)buffer[3];
#else // _MSC_VER
// Linux or i686-w64-mingw32 (gcc-4.6.3)
unsigned int eax, ebx, ecx;
__get_cpuid(1, &eax, &ebx, &ecx, &cpuid_edx);
#endif // _MSC_VER
if (cpuid_edx & 1<<26)
{
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_sse2;
printf("scrypt: using scrypt-sse2 as detected.\n");
}
else
{
scrypt_1024_1_1_256_sp_detected = &scrypt_1024_1_1_256_sp_generic;
printf("scrypt: using scrypt-generic, SSE2 unavailable.\n");
}
#endif // USE_SSE2_ALWAYS
}
#endif
void scrypt_1024_1_1_256(const char *input, char *output)
{
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
scrypt_1024_1_1_256_sp(input, output, scratchpad);
}
| [
"joiblumen@gmail.com"
] | joiblumen@gmail.com |
9a0aed92934c769039d0337d2454e97ce0ea894c | 307b386840876d95453211afa1e9d8394e9c86d4 | /evilOLED.h | dfb7babbac38a33988392e10e87e9bdd836a980b | [
"MIT"
] | permissive | albrgbrg/evilOLED | efc23e633ff91c577acc4968161dd1a1172a47cf | 82b744ee857105d785a8c9d958138f85ad98f29a | refs/heads/master | 2020-09-17T03:53:24.715523 | 2019-11-27T21:58:30 | 2019-11-27T21:58:30 | 223,979,564 | 0 | 0 | MIT | 2019-11-25T15:21:45 | 2019-11-25T15:21:44 | null | UTF-8 | C++ | false | false | 1,936 | h | /*
evilOLED is an Arduino library for efficient use of SSD1306 based
displays, specifically 128x64 pixel ones using the I2C 2-wire
interface. This driver does not use a framebuffer, therefore
leaving you with plenty of dynamic memory for your own code!
Written by Nick Veitch, 2014 <veryevilnick@gmail.com>
Released under MIT license
Latest versions available at https://github.com/evilnick/evilOLED/
*/
#ifndef _EVILOLED_
#define _EVILOLED_
using namespace std;
#include "Arduino.h"
#include <avr/pgmspace.h>
#define BLACK 0
#define WHITE 1
#define _slave_address 0x78
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_FBSIZE 1024
#define PAGE0 0xB0
#define PAGE1 0xB1
#define PAGE2 0xB2
#define PAGE3 0xB3
#define PAGE4 0xB4
#define PAGE5 0xB5
#define PAGE6 0xB6
#define PAGE7 0xB7
class evilOLED {
public:
evilOLED(char sda, char scl);
void dataStart(); //initiate data transfer mode (low level)
void dataStop(); //finish data transfer mode (low level)
void sendByte(unsigned char data); //send a single byte to device (low level)
void sendCmd(unsigned char cmd); //send a single command (see datasheet)
void init(); //initialise display
void cls(char); //clear the display (optionally with specific byte value)
void setCursor(char x, char y); //set the text cursor position (0-15,0-7)
void putChar(char); //write a single character to the display
void putString(char*); //write a string to the display
void putString(int s); //write a number to the display
void splash(); //display the splash screen
void flash(int d); //flash the display (with specified delay)
void alert(int d=200); //rapid flash the screen to alert user (with optional delay)
private:
char _sda;
char _scl;
char _row;
char _col;
};
#endif
| [
"nick.veitch@canonical.com"
] | nick.veitch@canonical.com |
8db56f404de21a9cd826d8da71b7a25de90fb987 | 41b4adb10cc86338d85db6636900168f55e7ff18 | /aws-cpp-sdk-cognito-identity/source/model/ListIdentityPoolsResult.cpp | b06c793b9c7a4807887459f76242dc01f14360bd | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | totalkyos/AWS | 1c9ac30206ef6cf8ca38d2c3d1496fa9c15e5e80 | 7cb444814e938f3df59530ea4ebe8e19b9418793 | refs/heads/master | 2021-01-20T20:42:09.978428 | 2016-07-16T00:03:49 | 2016-07-16T00:03:49 | 63,465,708 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,743 | cpp | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/cognito-identity/model/ListIdentityPoolsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::CognitoIdentity::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
ListIdentityPoolsResult::ListIdentityPoolsResult()
{
}
ListIdentityPoolsResult::ListIdentityPoolsResult(const AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
ListIdentityPoolsResult& ListIdentityPoolsResult::operator =(const AmazonWebServiceResult<JsonValue>& result)
{
const JsonValue& jsonValue = result.GetPayload();
if(jsonValue.ValueExists("IdentityPools"))
{
Array<JsonValue> identityPoolsJsonList = jsonValue.GetArray("IdentityPools");
for(unsigned identityPoolsIndex = 0; identityPoolsIndex < identityPoolsJsonList.GetLength(); ++identityPoolsIndex)
{
m_identityPools.push_back(identityPoolsJsonList[identityPoolsIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextToken"))
{
m_nextToken = jsonValue.GetString("NextToken");
}
return *this;
}
| [
"henso@amazon.com"
] | henso@amazon.com |
9045bb6595ab442434e949679128095ca620f92c | 76f0efb245ff0013e0428ee7636e72dc288832ab | /out/Default/gen/chrome/browser/jni_headers/chrome/jni/ChromeMediaRouterDialogController_jni.h | 22e8ca4151dc80b16c1f821b78b31e86de06d95d | [] | no_license | dckristiono/chromium | e8845d2a8754f39e0ca1d3d3d44d01231957367c | 8ad7c1bd5778bfda3347cf6b30ef60d3e4d7c0b9 | refs/heads/master | 2020-04-22T02:34:41.775069 | 2016-08-24T14:05:09 | 2016-08-24T14:05:09 | 66,465,243 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 8,701 | 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.
// This file is autogenerated by
// base/android/jni_generator/jni_generator.py
// For
//
// org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController
#ifndef org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_JNI
#define org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_JNI
#include <jni.h>
#include "../../../../../../../../base/android/jni_generator/jni_generator_helper.h"
#include "base/android/jni_int_wrapper.h"
// Step 1: forward declarations.
namespace {
const char kChromeMediaRouterDialogControllerClassPath[] =
"org/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController";
// Leaking this jclass as we cannot use LazyInstance from some threads.
base::subtle::AtomicWord g_ChromeMediaRouterDialogController_clazz
__attribute__((unused)) = 0;
#define ChromeMediaRouterDialogController_clazz(env) base::android::LazyGetClass(env, kChromeMediaRouterDialogControllerClassPath, &g_ChromeMediaRouterDialogController_clazz)
} // namespace
namespace media_router {
// Step 2: method stubs.
extern "C" __attribute__((visibility("default")))
void
Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnDialogCancelled(JNIEnv*
env,
jobject jcaller,
jlong nativeMediaRouterDialogControllerAndroid) {
MediaRouterDialogControllerAndroid* native =
reinterpret_cast<MediaRouterDialogControllerAndroid*>(nativeMediaRouterDialogControllerAndroid);
CHECK_NATIVE_PTR(env, jcaller, native, "OnDialogCancelled");
return native->OnDialogCancelled(env,
base::android::JavaParamRef<jobject>(env, jcaller));
}
extern "C" __attribute__((visibility("default")))
void
Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnSinkSelected(JNIEnv*
env,
jobject jcaller,
jlong nativeMediaRouterDialogControllerAndroid,
jstring sinkId) {
MediaRouterDialogControllerAndroid* native =
reinterpret_cast<MediaRouterDialogControllerAndroid*>(nativeMediaRouterDialogControllerAndroid);
CHECK_NATIVE_PTR(env, jcaller, native, "OnSinkSelected");
return native->OnSinkSelected(env, base::android::JavaParamRef<jobject>(env,
jcaller), base::android::JavaParamRef<jstring>(env, sinkId));
}
extern "C" __attribute__((visibility("default")))
void
Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnRouteClosed(JNIEnv*
env,
jobject jcaller,
jlong nativeMediaRouterDialogControllerAndroid,
jstring routeId) {
MediaRouterDialogControllerAndroid* native =
reinterpret_cast<MediaRouterDialogControllerAndroid*>(nativeMediaRouterDialogControllerAndroid);
CHECK_NATIVE_PTR(env, jcaller, native, "OnRouteClosed");
return native->OnRouteClosed(env, base::android::JavaParamRef<jobject>(env,
jcaller), base::android::JavaParamRef<jstring>(env, routeId));
}
static base::subtle::AtomicWord g_ChromeMediaRouterDialogController_create = 0;
static base::android::ScopedJavaLocalRef<jobject>
Java_ChromeMediaRouterDialogController_create(JNIEnv* env, jlong
nativeDialogController,
const base::android::JavaRefOrBare<jobject>& context) {
CHECK_CLAZZ(env, ChromeMediaRouterDialogController_clazz(env),
ChromeMediaRouterDialogController_clazz(env), NULL);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
env, ChromeMediaRouterDialogController_clazz(env),
"create",
"("
"J"
"Landroid/content/Context;"
")"
"Lorg/chromium/chrome/browser/media/router/ChromeMediaRouterDialogController;",
&g_ChromeMediaRouterDialogController_create);
jobject ret =
env->CallStaticObjectMethod(ChromeMediaRouterDialogController_clazz(env),
method_id, nativeDialogController, context.obj());
jni_generator::CheckException(env);
return base::android::ScopedJavaLocalRef<jobject>(env, ret);
}
static base::subtle::AtomicWord
g_ChromeMediaRouterDialogController_openRouteChooserDialog = 0;
static void
Java_ChromeMediaRouterDialogController_openRouteChooserDialog(JNIEnv* env,
const base::android::JavaRefOrBare<jobject>& obj, const
base::android::JavaRefOrBare<jstring>& sourceUrn) {
CHECK_CLAZZ(env, obj.obj(),
ChromeMediaRouterDialogController_clazz(env));
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, ChromeMediaRouterDialogController_clazz(env),
"openRouteChooserDialog",
"("
"Ljava/lang/String;"
")"
"V",
&g_ChromeMediaRouterDialogController_openRouteChooserDialog);
env->CallVoidMethod(obj.obj(),
method_id, sourceUrn.obj());
jni_generator::CheckException(env);
}
static base::subtle::AtomicWord
g_ChromeMediaRouterDialogController_openRouteControllerDialog = 0;
static void
Java_ChromeMediaRouterDialogController_openRouteControllerDialog(JNIEnv*
env, const base::android::JavaRefOrBare<jobject>& obj, const
base::android::JavaRefOrBare<jstring>& sourceUrn,
const base::android::JavaRefOrBare<jstring>& mediaRouteId) {
CHECK_CLAZZ(env, obj.obj(),
ChromeMediaRouterDialogController_clazz(env));
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, ChromeMediaRouterDialogController_clazz(env),
"openRouteControllerDialog",
"("
"Ljava/lang/String;"
"Ljava/lang/String;"
")"
"V",
&g_ChromeMediaRouterDialogController_openRouteControllerDialog);
env->CallVoidMethod(obj.obj(),
method_id, sourceUrn.obj(), mediaRouteId.obj());
jni_generator::CheckException(env);
}
static base::subtle::AtomicWord g_ChromeMediaRouterDialogController_closeDialog
= 0;
static void Java_ChromeMediaRouterDialogController_closeDialog(JNIEnv* env,
const base::android::JavaRefOrBare<jobject>& obj) {
CHECK_CLAZZ(env, obj.obj(),
ChromeMediaRouterDialogController_clazz(env));
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, ChromeMediaRouterDialogController_clazz(env),
"closeDialog",
"("
")"
"V",
&g_ChromeMediaRouterDialogController_closeDialog);
env->CallVoidMethod(obj.obj(),
method_id);
jni_generator::CheckException(env);
}
static base::subtle::AtomicWord
g_ChromeMediaRouterDialogController_isShowingDialog = 0;
static jboolean Java_ChromeMediaRouterDialogController_isShowingDialog(JNIEnv*
env, const base::android::JavaRefOrBare<jobject>& obj) {
CHECK_CLAZZ(env, obj.obj(),
ChromeMediaRouterDialogController_clazz(env), false);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, ChromeMediaRouterDialogController_clazz(env),
"isShowingDialog",
"("
")"
"Z",
&g_ChromeMediaRouterDialogController_isShowingDialog);
jboolean ret =
env->CallBooleanMethod(obj.obj(),
method_id);
jni_generator::CheckException(env);
return ret;
}
// Step 3: RegisterNatives.
static const JNINativeMethod kMethodsChromeMediaRouterDialogController[] = {
{ "nativeOnDialogCancelled",
"("
"J"
")"
"V",
reinterpret_cast<void*>(Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnDialogCancelled)
},
{ "nativeOnSinkSelected",
"("
"J"
"Ljava/lang/String;"
")"
"V",
reinterpret_cast<void*>(Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnSinkSelected)
},
{ "nativeOnRouteClosed",
"("
"J"
"Ljava/lang/String;"
")"
"V",
reinterpret_cast<void*>(Java_org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_nativeOnRouteClosed)
},
};
static bool RegisterNativesImpl(JNIEnv* env) {
if (base::android::IsManualJniRegistrationDisabled()) return true;
const int kMethodsChromeMediaRouterDialogControllerSize =
arraysize(kMethodsChromeMediaRouterDialogController);
if (env->RegisterNatives(ChromeMediaRouterDialogController_clazz(env),
kMethodsChromeMediaRouterDialogController,
kMethodsChromeMediaRouterDialogControllerSize) < 0) {
jni_generator::HandleRegistrationError(
env, ChromeMediaRouterDialogController_clazz(env), __FILE__);
return false;
}
return true;
}
} // namespace media_router
#endif // org_chromium_chrome_browser_media_router_ChromeMediaRouterDialogController_JNI
| [
"dckristiono@gmail.com"
] | dckristiono@gmail.com |
ebcbb0f56839726529c3377b8e9aef8e6a107454 | 125ad2b0dd64d837ee9e9957dc456bf1e0c6b5f7 | /Dialog/tabwidget.cpp | 0246abb3f510eeaca50ccbd3ae6da816a65b8fe6 | [] | no_license | kingctan/iynaur-s-vector-drawing | 51064aae74d627a2f7be8f492261d51c68c7edbf | 9c72deca52e44760b246d7076a61982636691257 | refs/heads/master | 2022-03-28T17:01:54.548495 | 2020-01-07T15:16:42 | 2020-01-07T15:16:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 538 | cpp | #include "tabwidget.h"
//#include "ui_tabwidget.h"
TabWidget::TabWidget(QWidget *parent) :
QTabWidget(parent)//,
//ui(new Ui::TabWidget)
{
//ui->setupUi(this);
fdlg=new MyFontDialog;
fdlg->setOption(QFontDialog::NoButtons);
fdlg->setOption(QFontDialog::DontUseNativeDialog);
//resize(fdlg->size());
addTab(fdlg,tr("Font"));
gtdlg=new GetTextDialog;
gtdlg->hidebuttonBox();
addTab(gtdlg,tr("Content"));
}
TabWidget::~TabWidget()
{
//delete ui;
delete fdlg;
delete gtdlg;
}
| [
"iynaur87@gmail.com"
] | iynaur87@gmail.com |
bbc7abe253d827dba74e06f48305e69dac2f3c5a | bdd9f3cdabe0c768641cf61855a6f24174735410 | /src/game/client/library/swgClientUserInterface/src/shared/page/SwgCuiService_KnownIssues.h | 97ddb6a3fd3b013d4fe0428204f0c3ff8c0edce4 | [] | no_license | SWG-Source/client-tools | 4452209136b376ab369b979e5c4a3464be28257b | 30ec3031184243154c3ba99cedffb2603d005343 | refs/heads/master | 2023-08-31T07:44:22.692402 | 2023-08-28T04:34:07 | 2023-08-28T04:34:07 | 159,086,319 | 15 | 47 | null | 2022-04-15T16:20:34 | 2018-11-25T23:57:31 | C++ | UTF-8 | C++ | false | false | 1,473 | h | // ======================================================================
//
// SwgCuiService_KnownIssues.h
// Copyright Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_SwgCuiService_KnownIssues_H
#define INCLUDED_SwgCuiService_KnownIssues_H
#include "clientUserInterface/CuiMediator.h"
#include "swgClientUserInterface/SwgCuiService.h"
#include "UIEventCallback.h"
class UIText;
//-----------------------------------------------------------------
namespace MessageDispatch
{
class Callback;
}
//-----------------------------------------------------------------
class SwgCuiService::KnownIssues : public CuiMediator
, public UIEventCallback
{
public:
KnownIssues(UIPage &page, SwgCuiService &communityMediator);
virtual void performActivate();
virtual void performDeactivate();
virtual void update(float deltaTimeSecs);
void onGetFixedArticleResponse(std::pair<bool, Unicode::String> const &result);
private:
MessageDispatch::Callback *m_callBack;
SwgCuiService &m_serviceMediator;
UIText *m_listBoxText;
void initializeListBox();
// Disabled
~KnownIssues();
KnownIssues(KnownIssues const &rhs);
KnownIssues &operator =(KnownIssues const &rhs);
void getKnownIssuesArticle();
};
// ======================================================================
#endif // INCLUDED_SwgCuiService_KnownIssues_H
| [
"swgmaster@india.com"
] | swgmaster@india.com |
a272790a393dc828d35e7ddab13f944b7f23cf23 | e763b855be527d69fb2e824dfb693d09e59cdacb | /aws-cpp-sdk-codecommit/source/model/BatchGetRepositoriesResult.cpp | d9b942234704a567084a837550f3afa1692417c9 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | 34234344543255455465/aws-sdk-cpp | 47de2d7bde504273a43c99188b544e497f743850 | 1d04ff6389a0ca24361523c58671ad0b2cde56f5 | refs/heads/master | 2023-06-10T16:15:54.618966 | 2018-05-07T23:32:08 | 2018-05-07T23:32:08 | 132,632,360 | 1 | 0 | Apache-2.0 | 2023-06-01T23:20:47 | 2018-05-08T15:56:35 | C++ | UTF-8 | C++ | false | false | 2,118 | cpp | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <aws/codecommit/model/BatchGetRepositoriesResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::CodeCommit::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
BatchGetRepositoriesResult::BatchGetRepositoriesResult()
{
}
BatchGetRepositoriesResult::BatchGetRepositoriesResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
BatchGetRepositoriesResult& BatchGetRepositoriesResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
const JsonValue& jsonValue = result.GetPayload();
if(jsonValue.ValueExists("repositories"))
{
Array<JsonValue> repositoriesJsonList = jsonValue.GetArray("repositories");
for(unsigned repositoriesIndex = 0; repositoriesIndex < repositoriesJsonList.GetLength(); ++repositoriesIndex)
{
m_repositories.push_back(repositoriesJsonList[repositoriesIndex].AsObject());
}
}
if(jsonValue.ValueExists("repositoriesNotFound"))
{
Array<JsonValue> repositoriesNotFoundJsonList = jsonValue.GetArray("repositoriesNotFound");
for(unsigned repositoriesNotFoundIndex = 0; repositoriesNotFoundIndex < repositoriesNotFoundJsonList.GetLength(); ++repositoriesNotFoundIndex)
{
m_repositoriesNotFound.push_back(repositoriesNotFoundJsonList[repositoriesNotFoundIndex].AsString());
}
}
return *this;
}
| [
"henso@amazon.com"
] | henso@amazon.com |
a930ed484f61ed7ebd366bc611fa63c286a0a188 | 6247b03513b5f7fc92e06e8efade1d31560c9b23 | /Nurn/Include/Nurn.hpp | 397adf15ffeb70af98f46fadc40ac5feae0f4b3b | [
"MIT"
] | permissive | Micadurp/Nurn | 1bd7fa0af0439085a48569e234087281a074873c | 8892ecfed827e4d1c8208882f0eedb440559cdf9 | refs/heads/master | 2021-01-18T22:26:49.834913 | 2018-03-27T21:05:20 | 2018-03-27T21:05:20 | 87,054,322 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,881 | hpp | #pragma once
#include "NetworkDefines.hpp"
#if PLATFORM == PLATFORM_WINDOWS
#include <winsock2.h>
#pragma comment( lib, "ws2_32.lib" )
#else PLATFORM == PLATFORM_MAC || PLATFORM == PLATFORM_UNIX
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#endif
#include <iostream>
#include <assert.h>
#include "Address.hpp"
#include "Packager.hpp"
#include "PacketFilter.hpp"
#include "PacketEnums.hpp"
#include "Packets/AIStatePacket.hpp"
#include "Packets/TransformPacket.hpp"
#include "Packets/AnimationPacket.hpp"
#include "Packets/MetaDataPacket.hpp"
#include "Packets/SpellPacket.hpp"
#include "Packets/ChargingPacket.hpp"
#include "Packets/QuickBlendPacket.hpp"
#include "Packets/DamagePacket.hpp"
#include "Packets/ChangeSpellsPacket.hpp"
#include "Packets/EventPacket.hpp"
#include "Packets/HealthPacket.hpp"
#include "Packets/DashPacket.hpp"
#ifdef DEBUGGING_NETWORK
#include "DebugNetwork.hpp"
#endif
#ifdef USING_UDP
#include "UDPCommunication.hpp"
#elif USING_TCP
#include "TCPCommunication.hpp"
#endif
namespace Nurn
{
class NurnEngine
{
public:
NURN_API NurnEngine();
NURN_API virtual ~NurnEngine();
NURN_API bool InitializeHost(uint16_t port = 35500);
// Takes an ipv4 address with each of the 255 values seperated by commas, for example ( 127, 0, 0, 1 )
NURN_API bool InitializeClient(uint8_t ip1, uint8_t ip2, uint8_t ip3, uint8_t ip4, uint16_t destPort = 35500, uint16_t origPort = 35500);
NURN_API bool AcceptCommunication();
NURN_API bool Send(const void * data, int size);
NURN_API bool Send(const Address & destination, const void * data, int size);
NURN_API bool Send();
// Returns 1 or 0 if a byte has been recieved or not. Then returns the data through the void *
NURN_API int Receive(void * data, int size);
NURN_API bool Receive();
NURN_API void Shutdown();
NURN_API void pushTransformPacket(const Packet::TransformPacket& packet);
NURN_API bool fetchTransformPacket(Packet::TransformPacket& packet);
NURN_API void pushAnimationPacket(const Packet::AnimationPacket& packet);
NURN_API bool fetchAnimationPacket(Packet::AnimationPacket& packet);
NURN_API void pushAIStatePacket(const Packet::AIStatePacket& packet);
NURN_API bool fetchAIPacket(Packet::AIStatePacket& packet);
NURN_API void pushSpellPacket(const Packet::SpellPacket& packet);
NURN_API bool fetchSpellPacket(Packet::SpellPacket& packet);
NURN_API void pushAITransformPacket(const Packet::TransformPacket& packet);
NURN_API bool fetchAITransformPacket(Packet::TransformPacket& packet);
NURN_API void pushChargingPacket(const Packet::ChargingPacket& packet);
NURN_API bool fetchChargingPacket(Packet::ChargingPacket& packet);
NURN_API void pushQuickBlendPacket(const Packet::QuickBlendPacket& packet);
NURN_API bool fetchQuickBlendPacket(Packet::QuickBlendPacket& packet);
NURN_API void pushDamagePacket(const Packet::DamagePacket& packet);
NURN_API bool fetchDamagePacket(Packet::DamagePacket& packet);
NURN_API void pushChangeSpellsPacket(const Packet::ChangeSpellsPacket& packet);
NURN_API bool fetchChangeSpellsPacket(Packet::ChangeSpellsPacket& packet);
NURN_API void pushPlayerEventPacket(const Packet::EventPacket& packet);
NURN_API bool fetchPlayerEventPacket(Packet::EventPacket& packet);
NURN_API void pushAIHealthPacket(const Packet::HealthPacket& packet);
NURN_API bool fetchAIHealthPacket(Packet::HealthPacket& packet);
NURN_API void pushDashPacket(const Packet::DashPacket& packet);
NURN_API bool fetchDashPacket(Packet::DashPacket& packet);
NURN_API void pushEndEventPacket(const Packet::EventPacket& packet);
NURN_API bool fetchEndEventPacket(Packet::EventPacket& packet);
NURN_API void pushPlayerHealthPacket(const Packet::HealthPacket& packet);
NURN_API bool fetchPlayerHealthPacket(Packet::HealthPacket& packet);
NURN_API void pushRessurectionPacket(const Packet::HealthPacket& packet);
NURN_API bool fetchRessurectionPacket(Packet::HealthPacket& packet);
NURN_API void pushAIDamageTextPacket(const Packet::DamagePacket& packet);
NURN_API bool fetchAIDamageTextPacket(Packet::DamagePacket& packet);
NURN_API void pushBossDamageTextPacket(const Packet::DamagePacket& packet);
NURN_API bool fetchBossDamageTextPacket(Packet::DamagePacket& packet);
NURN_API void pushBossHealthPacket(const Packet::HealthPacket& packet);
NURN_API bool fetchBossHealthPacket(Packet::HealthPacket& packet);
#ifdef DEBUGGING_NETWORK
NURN_API float getPing();
#endif
private:
void initPacketHandling();
template<class packetType>
void initQueues(const int & size);
Address address;
Packager * packager = nullptr;
PacketFilter * packetFilter = nullptr;
#ifdef USING_UDP
UDPCommunication netCommunication;
#elif USING_TCP
TCPCommunication netCommunication;
#endif
#ifdef DEBUGGING_NETWORK
DebugNetwork debugNetwork;
#endif
};
} | [
"Nicholas.r.DeYoung@gmail.com"
] | Nicholas.r.DeYoung@gmail.com |
6d9c701524ab2250e7316dab2dc23be567647600 | 776d5e2a3d9414e3ce83644326883a6b69e1b113 | /GG/DailyReward/dialog/RscRewardDefines.hpp | 4da80dfc0a3c100da9f2de566731fdadcd142973 | [] | no_license | aussie-battler/ExileMod | da02f9e8c7e4a8aa5dd450175d4e7444940c28f3 | 6e91e65eada49a8c8b604e937657605e0af2d8fd | refs/heads/master | 2020-03-10T16:16:16.743021 | 2016-11-10T12:55:10 | 2016-11-10T12:55:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,809 | hpp | #define GUI_GRID_X (0)
#define GUI_GRID_Y (0)
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)
#define GUI_GRID_WAbs (1)
#define GUI_GRID_HAbs (1)
class RscRewardText
{
deletable = 0;
fade = 0;
access = 0;
type = 0;
idc = -1;
colorBackground[] ={0,0,0,0};
colorText[] ={1,1,1,1};
text = "";
fixedWidth = 0;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
style = 0;
shadow = 0;
colorShadow[] ={0,0,0,0.5};
font = "RobotoCondensed";
SizeEx = "(((((safezoneW / safezoneH) min 0.9) / 1.2) / 25) * 1)";
linespacing = 1;
tooltipColorText[] ={1,1,1,1};
tooltipColorBox[] ={1,1,1,1};
tooltipColorShade[] ={0,0,0,0.65};
};
class RscRewardStructuredText
{
deletable = 0;
fade = 0;
access = 0;
type = 13;
idc = -1;
style = 0;
colorText[] ={1,1,1,1};
class Attributes
{
font = "RobotoCondensed";
color = "#ffffff";
colorLink = "#D09B43";
align = "left";
shadow = 1;
};
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
shadow = 1;
};
class RscRewardPicture
{
deletable = 0;
fade = 0;
access = 0;
type = 0;
idc = -1;
style = 48;
colorBackground[] ={0,0,0,0};
colorText[] ={1,1,1,1};
font = "TahomaB";
sizeEx = 0;
lineSpacing = 0;
text = "";
fixedWidth = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.2;
h = 0.15;
tooltipColorText[] ={1,1,1,1};
tooltipColorBox[] ={1,1,1,1};
tooltipColorShade[] ={0,0,0,0.65};
};
class RscRewardButton
{
deletable = 0;
fade = 0;
access = 0;
type = 1;
text = "";
colorText[] ={1,1,1,1};
colorDisabled[] ={1,1,1,0.25};
colorBackground[] ={0,0,0,0.2};
colorBackgroundDisabled[] ={0,0,0,0.5};
colorBackgroundActive[] ={1,1,1,0.05};
colorFocused[] ={1,1,1,0};
colorShadow[] ={0,0,0,0};
colorBorder[] ={0,0,0,1};
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
style = 2;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
shadow = 2;
font = "OrbitronLight";
sizeEx = "(((((safezoneW / safezoneH) min 1) / 1.2) / 25) * 1)";
offsetX = 0;
offsetY = 0;
offsetPressedX = 0;
offsetPressedY = 0;
borderSize = 0;
};
class RscRewardButtonMenuOK : RscRewardButton
{
idc = 1;
shortcuts[] ={
"0x00050000 + 0",
28,
57,
156
};
default = 1;
text = "OK";
soundPush[] =
{
"\A3\ui_f\data\sound\RscButtonMenuOK\soundPush",
0.09,
1
};
};
class RscRewardButtonMenuCancel : RscRewardButton
{
idc = 2;
shortcuts[] =
{
"0x00050000 + 1"
};
text = "Cancel";
}; | [
"gr8_boi52@yahoo.com"
] | gr8_boi52@yahoo.com |
e48cd28e76dc55647b379d99f52e88a736c2b752 | f2c8cbbec093acbc5989a0a59bc98b4f5890bb52 | /Source.cpp | 9cfd8e1a1820ca3c0a4e9f305dd64232329fc690 | [] | no_license | safak17/Term-Project-Computer-Programming | 12a6acf7feb49b02429c5505c833a7bf52303a27 | ebac51288684635e7d241f66194417ee7c577e4e | refs/heads/master | 2020-05-05T05:22:06.012219 | 2019-04-05T20:56:40 | 2019-04-05T20:56:40 | 179,747,802 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,697 | cpp |
#include <iostream> // cout
#include <stdlib.h> // srand, rand
#include <time.h> // time
#include <iomanip> // setw
#include <vector> // vector<>
#include <string> // string
#include <tuple> // tuple, make_tuple()
#include <fstream> // ofstream: Stream class to write on files
#include <conio.h> // getch() to capture character immediately from the standard input.
#include <algorithm> // find()
#include "Constants.h"
using namespace std;
/* GLOBAL VARIABLES */
vector<tuple<int, int>> forbiddenPoints;
vector<tuple<int, int>> visitedPoints;
vector<tuple<int, int>> goldPoints;
int collectedGold = 0;
int catchedMonster = 0;
int rowSize, colSize;
int currentRow, currentCol;
char player;
string gameScoresFileName = "game_scores.txt";
/* GET FUNCTIONS */
void getRowAndColumn();
char getDirectionFromUser();
int getRandomNumberBetween(int, int);
int** getMazeMatrix();
int getRandomDirection(string);
int getMoveableDirection(int**);
tuple<int, int> getCurrentPosition();
vector<tuple<int, int>> createPath(tuple<int, int>, tuple<int, int>);
char whoIsPlayer();
/* CONTROL FUNCTIONS */
bool isInInterval(int, int, int);
bool isThereAWall(int**, int);
bool isForbidden(int, int);
bool canMove(int);
bool countGold();
/* SET FUNCTIONS */
void fillMazeMatrix(int**, int, int);
void drawPath(int**, vector<tuple<int, int>>, int);
tuple<int, int> move(int**, int);
void writeScoresToFile();
/* PRINT FUNCTIONS */
void printCurrentPosition();
void printDirection(char);
void explainDirections();
void explainObjects();
void explainAim();
void printMazeMatrix(int**);
void printScores();
void printFinalPath();
/* GAME FUNCTIONS */
void initializeGame(int** );
void initializeConstants();
void user(int**);
void computer(int**);
int main() {
// initialize random seed:
srand(time(NULL));
getRowAndColumn();
int** maze = getMazeMatrix();
int randomNumberFrom = 0, randomNumberTo = 4;
fillMazeMatrix(maze, randomNumberFrom, randomNumberTo);
tuple<int, int> startPosition = make_tuple(0, 0);
tuple<int, int> finalPosition = make_tuple(rowSize - 1, colSize - 1);
vector<tuple<int, int>> path = createPath(startPosition, finalPosition);
drawPath(maze, path, ROAD);
explainAim();
explainObjects();
player = whoIsPlayer();
player == 'U' ? user(maze) : computer(maze);
printScores();
writeScoresToFile();
system("pause");
return 0;
}
char whoIsPlayer() {
char player;
cout
<< endl
<< "Who will play the game ? (U)ser or (C)omputer ?" << setw(10) << " ";
cin >> player;
return player;
}
void user(int** maze) {
explainDirections();
cout << "Press any key to start...";
_getch();
initializeGame(maze);
char direction;
while (currentRow != rowSize - 1 || currentCol != colSize - 1){
direction = getDirectionFromUser();
if (direction == 0) continue;
system("cls");
if (canMove(direction) && !isThereAWall(maze, direction)){
move(maze, direction);
printMazeMatrix(maze);
visitedPoints.push_back(getCurrentPosition());
if (maze[currentRow][currentCol] == GOLD && countGold()) {
printDirection(direction);
cout << setw(10) << " " << "COLLECTED GOLD: " << collectedGold << setw(14) << " ";
printCurrentPosition();
}
else if (maze[currentRow][currentCol] == MONSTER){
cout << "MONSTEEEEER ! Press any key to restart...";
_getch();
_getch();
initializeGame(maze);
}
else{
printDirection(direction);
cout << setw(10) << " " << "MOVED" << setw(26) << " ";
printCurrentPosition();
}
}
else {
printMazeMatrix(maze);
printDirection(direction);
cout << setw(10) << " " << "CANNOT MOVE" << setw(20) << " ";
printCurrentPosition();
}
}
}
bool countGold() {
tuple<int, int> currentPosition = make_tuple(currentRow, currentCol);
// Reference: https://stackoverflow.com/questions/3450860/check-if-a-stdvector-contains-a-certain-object
if (find(goldPoints.begin(), goldPoints.end(), currentPosition) != goldPoints.end())
return false;
collectedGold++;
goldPoints.push_back(currentPosition);
return true;
}
void computer(int** maze) {
initializeGame(maze);
int direction = getMoveableDirection(maze);
cout << "Computer is trying to find a path..." << endl;
while (currentRow != rowSize - 1 || currentCol != colSize - 1) {
if (direction == 0) { // stucked
forbiddenPoints.push_back(getCurrentPosition());
try{
tuple<int, int> previousPosition = visitedPoints.back();
currentRow = get<0>(previousPosition);
currentCol = get<1>(previousPosition);
visitedPoints.pop_back();
}catch (const exception&){}
}
else {
move(maze, direction);
visitedPoints.push_back(getCurrentPosition());
if (maze[currentRow][currentCol] == GOLD) {
collectedGold++;
}
else if( maze[currentRow][currentCol] == MONSTER )
{
forbiddenPoints.push_back(getCurrentPosition());
catchedMonster++;
initializeConstants();
visitedPoints.clear();
}
}
direction = getMoveableDirection(maze);
}
}
// Reference: http://www.cplusplus.com/doc/tutorial/files/
void writeScoresToFile() {
ofstream gameScoresFile;
try
{
gameScoresFile.open(gameScoresFileName);
gameScoresFile
<< "Number of collected gold:" << string(10, ' ') << collectedGold << endl;
if (player != 'U')
gameScoresFile << "Number of catched monster:" << string(10, ' ') << catchedMonster << endl << endl;
gameScoresFile
<< string((colSize - 4) * 2 + 1, '-') << " FINAL PATH " << string((colSize - 4) * 2 + 1, '-') << endl;
vector<tuple<int, int>>::iterator it;
int row, col;
for (it = visitedPoints.begin(); it != visitedPoints.end(); it++) {
row = get<0>(*it);
col = get<1>(*it);
gameScoresFile << string((colSize - 4) * 2 + 3, ' ') << "[ " << row << " , " << col << "]" << endl;
}
}
catch (const std::exception&)
{
cout << "Error writing to " + gameScoresFileName << endl;
}
gameScoresFile.close();
}
void printScores() {
cout
<< endl
<< "Number of collected gold:" << setw(10) << collectedGold << endl;
if (player != 'U')
cout<< "Number of catched monster:" << setw(10) << catchedMonster << endl;
// The starting point is added to the beginning of the list
visitedPoints.insert(visitedPoints.begin(), make_tuple(0, 0));
printFinalPath();
}
void printFinalPath() {
cout << endl << string((colSize - 4) * 2 + 1, '-') << " FINAL PATH " << string((colSize - 4) * 2 + 1, '-') << endl;
vector<tuple<int, int>>::iterator it; // Iterator
int row, col;
for (it = visitedPoints.begin(); it != visitedPoints.end(); it++) {
row = get<0>(*it);
col = get<1>(*it);
cout << string((colSize - 4) * 2 + 3, ' ') << "[ " << row << " , " << col << "]" << endl;
}
}
void initializeGame(int** maze) {
system("cls");
visitedPoints.clear();
goldPoints.clear();
initializeConstants();
printMazeMatrix(maze);
}
void initializeConstants() {
collectedGold = 0;
currentRow = 0;
currentCol = 0;
}
tuple<int, int> getCurrentPosition() {
return make_tuple(currentRow, currentCol);
}
bool isThereAWall(int** maze, int direction) {
int row = currentRow, col = currentCol;
if (direction == UP)
row--;
else if (direction == LEFT)
col--;
else if (direction == DOWN)
row++;
else if (direction == RIGHT)
col++;
return maze[row][col] == WALL;
}
bool canMove(int direction) {
if (currentRow == 0 && currentCol == 0) // top left
return (direction == DOWN || direction == RIGHT) ? true : false;
if (currentRow == 0 && currentCol == colSize - 1) // top right
return (direction == DOWN || direction == LEFT) ? true : false;
if (currentRow == rowSize - 1 && currentCol == 0) // bottom left
return (direction == UP || direction == RIGHT) ? true : false;
if (currentRow == rowSize - 1 && currentCol == colSize - 1) // bottom right
return (direction == UP || direction == LEFT) ? true : false;
if (currentCol == 0) // the most left column
return (direction != LEFT) ? true : false;
if (currentCol == colSize - 1) // the most right column
return (direction != RIGHT) ? true : false;
if (currentRow == 0) // top row
return (direction != UP) ? true : false;
if (currentRow == rowSize - 1) // bottom row
return (direction != DOWN) ? true : false;
return true;
}
tuple<int, int> move(int** maze, int direction) {
if (direction == DOWN)
currentRow++;
else if (direction == RIGHT)
currentCol++;
else if (direction == UP)
currentRow--;
else if (direction == LEFT)
currentCol--;
return make_tuple(currentRow, currentCol);
}
int getRandomDirection(string possibleDirections) {
int possibleDirectionCount = (int)possibleDirections.length();
int randomPositionInString = getRandomNumberBetween(0, possibleDirectionCount);
return possibleDirections.at(randomPositionInString);
}
int getMoveableDirection(int** maze) {
int row = currentRow, col = currentCol;
int randomNumber = getRandomNumberBetween(0, 2);
if (randomNumber == 0) {
if (canMove(RIGHT) && !isThereAWall(maze, RIGHT) && !isForbidden(row, col++))
return RIGHT;
if (canMove(DOWN) && !isThereAWall(maze, DOWN) && !isForbidden(row++, col))
return DOWN;
}
else {
if (canMove(DOWN) && !isThereAWall(maze, DOWN) && !isForbidden(row++, col))
return DOWN;
if (canMove(RIGHT) && !isThereAWall(maze, RIGHT) && !isForbidden(row, col++))
return RIGHT;
}
return 0;
}
bool isForbidden(int row, int col) {
tuple<int, int> point = make_tuple(row, col);
return find(forbiddenPoints.begin(), forbiddenPoints.end(), point) != forbiddenPoints.end();
}
vector<tuple<int, int>> createPath(tuple<int, int> beginningPoint, tuple<int, int> endPoint) {
int startingRow = get<0>(beginningPoint), startingCol = get<1>(beginningPoint);
int endRow = get<0>(endPoint), endCol = get<1>(endPoint);
vector<tuple<int, int>> path;
path.push_back(beginningPoint);
int currentRow = startingRow, currentCol = startingCol, randomDirection;
while (currentRow != endRow || currentCol != endCol) {
if (currentRow != endRow && currentCol != endCol)
randomDirection = getRandomDirection("sd");
else if (currentRow != endRow && currentCol == endCol)
randomDirection = getRandomDirection("s");
else // ( currentRow == endRow && currentCol != endCol)
randomDirection = getRandomDirection("d");
if (randomDirection == DOWN && currentRow <= endRow) {
currentRow++;
path.push_back(make_tuple(currentRow, currentCol));
}
else if (randomDirection == RIGHT && currentCol <= endCol) {
currentCol++;
path.push_back(make_tuple(currentRow, currentCol));
}
}
path.push_back(endPoint);
return path;
}
// Reference: http://www.math.uaa.alaska.edu/~afkjm/csce211/handouts/ReadingLineOfText
// Reference: https://stackoverflow.com/questions/35098211/how-do-i-return-two-values-from-a-function
char getDirectionFromUser() {
char direction = _getch();
return (direction == RANDOM) ? getRandomDirection("wasd") : direction;
}
int** getMazeMatrix() {
int** maze = new int*[rowSize];
for (int i = 0; i < rowSize; i++)
maze[i] = new int[colSize];
return maze;
}
void fillMazeMatrix(int** maze, int randomFrom, int randomTo) {
for (int r = 0; r < rowSize; r++)
for (int c = 0; c < colSize; c++)
maze[r][c] = getRandomNumberBetween(randomFrom, randomTo);
}
void printMazeMatrix(int** maze) {
cout << endl << string((colSize - 2) * 2, '-') << " MAZE " << string((colSize - 2) * 2, '-') << endl;
for (int r = 0; r<rowSize; r++) {
for (int c = 0; c<colSize; c++) {
cout << (r == currentRow && c == currentCol ? "x" : to_string(maze[r][c])) << setw(3) << " ";
}
cout << endl;
}
cout << endl;
}
int getRandomNumberBetween(int from, int to) {
return rand() % to + from;
}
void getRowAndColumn() {
cout
<< "Please, enter row and column number of the maze." << endl
<< "They both must be between " << MIN_ROW_NUMBER << " and " << MAX_ROW_NUMBER << "." << endl << endl;
int row = -1, col = -1;
while (1) {
cout << "Row" << setw(33) << " ";
cin >> row;
cout << "Column" << setw(30) << " ";
cin >> col;
if ((!isInInterval(MIN_ROW_NUMBER, row, MAX_ROW_NUMBER)) ||
(!isInInterval(MIN_COL_NUMBER, col, MAX_COL_NUMBER)))
cout
<< "They both must be between " << MIN_ROW_NUMBER << " and " << MAX_ROW_NUMBER << "." << endl
<< "Please, re-enter row and column number of the maze." << endl;
else {
rowSize = row;
colSize = col;
return;
}
}
}
bool isInInterval(int min, int number, int max) {
return (max >= number && number >= min) ? true : false; // 10 > 8 > 2 true; 10 > 11 > 2 false.
}
void explainDirections() {
cout
<< endl
<< string(13, '-') << " DIRECTIONS " << string(13, '-') << endl
<< "w" << setw(37) << "UP" << endl
<< "a" << setw(37) << "LEFT" << endl
<< "s" << setw(37) << "DOWN" << endl
<< "d" << setw(37) << "RIGHT" << endl
<< "r" << setw(37) << "COMPUTER CHOICE RANDOMLY" << endl
<< string(38, '-') << endl;
}
void explainObjects() {
cout
<< endl
<< string(14, '-') << " OBJECTS " << string(15, '-') << endl
<< ROAD << setw(37) << "ROAD" << endl
<< WALL << setw(37) << "WALL" << endl
<< GOLD << setw(37) << "GOLD" << endl
<< MONSTER << setw(37) << "MONSTER" << endl
<< string(38, '-') << endl;
}
void explainAim() {
cout
<< endl
<< "Find the exit of the maze." << endl
<< "Maze entrance:" << setw(24) << "[ 0, 0 ]" << endl
<< "Maze exit: " << setw(18) << "[ " << rowSize - 1 << ", " << colSize - 1 << " ]" << endl;
}
void printDirection(char direction) {
cout << "Direction:" << setw(2) << " " << direction << setw(10) << " ";
}
void printCurrentPosition() {
cout << "Current Position: " << "[" << currentRow << " , " << currentCol << "]" << endl;
}
void drawPath(int** maze, vector<tuple<int, int>> path, int objectId) {
tuple<int, int> point;
int r, c;
for (int i = 0; i<path.size(); i++) {
point = path[i];
r = get<0>(point);
c = get<1>(point);
maze[r][c] = objectId;
}
}
| [
"safakakinci17@gmail.com"
] | safakakinci17@gmail.com |
e54d4c3bed6c60c282b9a941f73beb4a3a05233e | cbc89f82c84f2628406c17c8161db10950d35af0 | /arena.h | 0e182ff017608adb851d9acec021465f129a84f0 | [] | no_license | pierok/StarWarsTD | ca65a793155acdcff43bd0f33e7c6fed08bd651f | a5f4b5ed9547d4d01da15ad767b8b3a1006da2a6 | refs/heads/master | 2021-01-01T18:18:24.981921 | 2012-07-03T15:25:34 | 2012-07-03T15:25:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,787 | h | #ifndef ARENA_H
#define ARENA_H
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QList>
#include <QQueue>
#include <QSet>
#include <QVector>
#include "factory.h"
//#include "tower.h"
#include "deathstar.h"
#include "generator.h"
#include "deploy.h"
#include "AI/includes/algorytmGenetyczny.h"
class Tower;
class Deploy;
class Enemy;
class Factory;
class Explosion;
class Missile;
enum GUNS {A_NONE, A_PRISM, A_PLASMA, A_HUNTER};
enum Mode {GAME, LEARN, LEARN2, M_STOP};
class Arena: public QGraphicsScene
{
public:
Arena(QPixmap *p);
void step();
void towerOperation();
void enemyOperation();
void missilesOperation();
void explosionsOperation();
void deathStarOperatin();
void hideElements();
void showElements();
void init();
void directions();
Deploy* deploy1;
Deploy* deploy2;
QVector<Deploy*> deploys;
static Mode mode;
static bool Hide;
//static int enemySize;
static Factory factoy;
static QQueue<Enemy*> spawnEnemy;
static QQueue<Explosion*> spawnExplosion;
static QQueue<Missile*> spawnMissile;
static QQueue<Tower*>spawnTower;
static QQueue<Deploy*>factoryDeploys;
inline void setGun(GUNS g)
{
gun=g;
}
inline void setInfo(QString* s)
{
info=s;
}
inline void setInfoOs(QString* s)
{
infoOs=s;
}
inline void setInfoPokolenie(QString* s)
{
infoPokolenie=s;
}
inline void setInfoOs2(QString* s)
{
infoOs2=s;
}
inline void setInfoPokolenie2(QString* s)
{
infoPokolenie2=s;
}
inline void setAmount(int i)
{
amountSize=i;
amount=amountSize;
}
inline int getAmount()
{
return amountSize;
}
inline int getEpoka()
{
return epoka;
}
void addTower(int x, int y);
void addDeploy(int X, int Y, int type, int target);
void nastepnyOsobnik();
void nastepnyOsobnikOf();
Populacja* nPopulacja;
PopulacjaOf* nPopulacjaOf;
AlgorytmGenetyczny* ag;
private:
GUNS gun;
QPixmap* qp;
DeathStar* deathStar;
Generator* gen1;
Generator* gen2;
QString* info;
QString* infoOs;
QString* infoPokolenie;
QString* infoOs2;
QString* infoPokolenie2;
QSet<Tower*> towers;
QSet<Enemy*> enemys;
QSet<Missile*> missiles;
QList<Explosion*> explosions;
//Target* target;
int amount;
int amountSize;
int time;
int osobnik;
int epoka;
int wagaStarLife;
int wagaGen1Life;
int wagaGen2Life;
int wagaAmountLife;
public slots:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void wheelEvent( QGraphicsSceneWheelEvent *event);
};
#endif // ARENA_H
| [
"pierok@gmail.com"
] | pierok@gmail.com |
0654a5ccdb1331c320859c11acd4af88a90c8d31 | 72ed63c92ff6b2c66eb26f9bb8fe42f9c30b6dcc | /C/82 指针的间接赋值.cpp | df6a0fe09af97b4d3ee1762e3c333f3d99216310 | [] | no_license | wangjunjie1107/CodeTesting | ceee7adbf73d357cb3b93e751682e05b83b54328 | 2e614831877f30db109e5b669a1d77bb17208a5a | refs/heads/master | 2020-07-15T04:59:36.138974 | 2019-10-30T00:39:29 | 2019-10-30T00:39:29 | 205,484,180 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 456 | cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stddef.h>
//1 一个普通变量和一个指针变量或者一个形参和一个实参
//2 建立关系
//3 通过 * 进行赋值
void changeValue(int * p)
{
*p = 1000;
}
void test01()
{
int a = 10;
int * p = NULL;
p = &a;
* p = 100; //修改a的值
int a2 = 10;
changeValue(&a2);
printf("%d\n",a2);
}
int main()
{
test01();
return 0;
}
| [
"980353691@qq.com"
] | 980353691@qq.com |
4e0fd8e690a838c305082d8951c3c1d8b7b3336b | fc74c5c7f44fbdff161b94a9bb3e2913a350a713 | /Classes/Junior Year/January 2019/Project/FlowContraction v2/0.02/phi | 66d229a4c248d2502039bfa6206e209c8fba2ff2 | [] | no_license | cjn1012/Charlie | 1158a2e1322904b28e9f523dc21048f148a14fcf | 738acb4c7a8330a64619d049ae81cfefdff7b367 | refs/heads/master | 2021-07-17T10:53:19.810054 | 2020-05-03T20:40:46 | 2020-05-03T20:40:46 | 146,947,278 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,047 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
/* Windows 32 and 64 bit porting by blueCAPE: http://www.bluecape.com.pt *\
| Based on Windows porting (2.0.x v4) by Symscape: http://www.symscape.com |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.02";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
1430
(
5.0090334e-006
-7.7530364e-009
5.0486786e-006
-3.9645258e-008
5.0283373e-006
2.0341365e-008
5.062921e-006
-3.4583787e-008
5.061279e-006
1.6420721e-009
5.0796374e-006
-1.8358443e-008
5.091043e-006
-1.1405511e-008
5.1080131e-006
-1.6970144e-008
5.1280285e-006
-2.0015373e-008
5.1541295e-006
-2.6100984e-008
5.1886909e-006
-3.4561374e-008
5.2353074e-006
-4.6616522e-008
5.2989379e-006
-6.3630513e-008
5.3865647e-006
-8.7626812e-008
5.5081894e-006
-1.2162466e-007
5.6783775e-006
-1.7018808e-007
5.9186947e-006
-2.4031721e-007
6.2624733e-006
-3.4377864e-007
6.758694e-006
-4.9622065e-007
7.4966105e-006
-7.3791646e-007
8.5827935e-006
-1.0861829e-006
1.0275001e-005
-1.692207e-006
1.2752045e-005
-2.4770443e-006
1.6350577e-005
-3.598531e-006
-4.1743319e-006
2.0524909e-005
5.0169089e-006
-2.3381491e-008
5.0385736e-006
-6.1310087e-008
5.036354e-006
2.2561018e-008
5.0572368e-006
-5.5466569e-008
5.064527e-006
-5.6481434e-009
5.0780078e-006
-3.1839239e-008
5.0914669e-006
-2.4864517e-008
5.1075988e-006
-3.3102065e-008
5.1276878e-006
-4.0104347e-008
5.1535806e-006
-5.199379e-008
5.1879117e-006
-6.8892527e-008
5.2342057e-006
-9.2910511e-008
5.2973775e-006
-1.2680229e-007
5.3843464e-006
-1.7459572e-007
5.5050069e-006
-2.4228516e-007
5.6737451e-006
-3.3892618e-007
5.9119316e-006
-4.7850373e-007
6.2519122e-006
-6.8375926e-007
6.7439998e-006
-9.8830815e-007
7.4688855e-006
-1.4628021e-006
8.5526351e-006
-2.1699324e-006
1.0205534e-005
-3.3451058e-006
1.2724644e-005
-4.9961539e-006
1.6302514e-005
-7.1764001e-006
-8.5407861e-006
2.0668969e-005
5.0154797e-006
-3.7580794e-008
5.0392391e-006
-8.5069587e-008
5.035685e-006
2.6115199e-008
5.0574137e-006
-7.7195312e-008
5.0644399e-006
-1.2674371e-008
5.0778185e-006
-4.5217755e-008
5.0911483e-006
-3.8194363e-008
5.1070882e-006
-4.9041973e-008
5.126933e-006
-5.9949068e-008
5.1524904e-006
-7.7551268e-008
5.1863657e-006
-1.0276776e-007
5.2320223e-006
-1.385671e-007
5.2942938e-006
-1.8907381e-007
5.3799707e-006
-2.602726e-007
5.4987429e-006
-3.6105735e-007
5.6646643e-006
-5.0484757e-007
5.8985562e-006
-7.1239571e-007
6.2318397e-006
-1.0170427e-006
6.7132888e-006
-1.4697572e-006
7.4212223e-006
-2.1707356e-006
8.4785224e-006
-3.2272324e-006
1.0101449e-005
-4.968032e-006
1.2614815e-005
-7.5095206e-006
1.6342307e-005
-1.0903892e-005
-1.309671e-005
2.089823e-005
5.0145155e-006
-5.0815908e-008
5.0397021e-006
-1.1025623e-007
5.0351293e-006
3.0688026e-008
5.0575415e-006
-9.9607549e-008
5.0643249e-006
-1.9457799e-008
5.0775163e-006
-5.8409088e-008
5.090677e-006
-5.1355046e-008
5.1063305e-006
-6.4695525e-008
5.1258089e-006
-7.9427467e-008
5.1508682e-006
-1.0261053e-007
5.1840626e-006
-1.359622e-007
5.2287702e-006
-1.8327468e-007
5.2897019e-006
-2.5000551e-007
5.3734576e-006
-3.4402826e-007
5.4894245e-006
-4.7702429e-007
5.651166e-006
-6.6658903e-007
5.8786845e-006
-9.3991417e-007
6.2020168e-006
-1.3403751e-006
6.6676988e-006
-1.9354392e-006
7.350315e-006
-2.8533518e-006
8.367137e-006
-4.2440544e-006
9.9405365e-006
-6.5414315e-006
1.244677e-005
-1.0015754e-005
1.6444931e-005
-1.4902053e-005
-1.8077968e-005
2.1426188e-005
5.0135535e-006
-6.3089044e-008
5.0405478e-006
-1.3725064e-007
5.0343512e-006
3.6884707e-008
5.057779e-006
-1.2303533e-007
5.0641475e-006
-2.5826297e-008
5.0771225e-006
-7.1384096e-008
5.0900457e-006
-6.4278245e-008
5.1053331e-006
-7.9982922e-008
5.1243226e-006
-9.8416993e-008
5.1487247e-006
-1.2701255e-007
5.1810186e-006
-1.6825613e-007
5.2244733e-006
-2.267294e-007
5.283638e-006
-3.0917016e-007
5.3648621e-006
-4.2525242e-007
5.4771376e-006
-5.8929981e-007
5.633387e-006
-8.2283834e-007
5.852538e-006
-1.1590653e-006
6.1628117e-006
-1.6506487e-006
6.6077702e-006
-2.3803976e-006
7.2570632e-006
-3.5026448e-006
8.2189793e-006
-5.2059705e-006
9.7197164e-006
-8.0421686e-006
1.2203724e-005
-1.2499762e-005
1.65722e-005
-1.9270529e-005
-2.3765564e-005
2.2259797e-005
5.0122965e-006
-7.4105206e-008
5.0418376e-006
-1.6679174e-007
5.033355e-006
4.5367268e-008
5.0581023e-006
-1.4778255e-007
5.0639361e-006
-3.1660153e-008
5.0766365e-006
-8.4084423e-008
5.0892663e-006
-7.6908121e-008
5.1041009e-006
-9.4817471e-008
5.1224846e-006
-1.1680065e-007
5.1460738e-006
-1.5060176e-007
5.1772545e-006
-1.9943689e-007
5.2191625e-006
-2.6863737e-007
5.2761488e-006
-3.6615647e-007
5.354257e-006
-5.0336062e-007
5.4619978e-006
-6.9704053e-007
5.6115152e-006
-9.7235581e-007
5.8204319e-006
-1.3679819e-006
6.1147548e-006
-1.9449716e-006
6.5343567e-006
-2.7999996e-006
7.1423432e-006
-4.1106313e-006
8.0342146e-006
-6.0978418e-006
9.4341714e-006
-9.4421254e-006
1.1848984e-005
-1.4914574e-005
1.6550115e-005
-2.397166e-005
-3.0230857e-005
2.3015408e-005
5.0104071e-006
-8.3231998e-008
5.043418e-006
-1.998026e-007
5.0322263e-006
5.6558937e-008
5.0584326e-006
-1.7398883e-007
5.0637251e-006
-3.6952676e-008
5.0760649e-006
-9.6424151e-008
5.0883464e-006
-8.9189605e-008
5.1026418e-006
-1.0911295e-007
5.1203062e-006
-1.3446503e-007
5.1429313e-006
-1.7322681e-007
5.1727938e-006
-2.2929944e-007
5.2128728e-006
-3.0871631e-007
5.2672874e-006
-4.2057105e-007
5.3417244e-006
-5.7779769e-007
5.4441357e-006
-7.9945184e-007
5.5857645e-006
-1.1139846e-006
5.7827248e-006
-1.5649422e-006
6.0584538e-006
-2.2207005e-006
6.4483977e-006
-3.1899435e-006
7.0073302e-006
-4.6695638e-006
7.8142761e-006
-6.9047876e-006
9.0793686e-006
-1.0707218e-005
1.1329982e-005
-1.7165187e-005
1.609942e-005
-2.8741098e-005
-3.6978614e-005
2.2847177e-005
5.0073018e-006
-8.9253462e-008
5.0452152e-006
-2.3771608e-007
5.0309731e-006
7.0801103e-008
5.0586735e-006
-2.0168922e-007
5.0635966e-006
-4.1875773e-008
5.0754012e-006
-1.0822874e-007
5.087289e-006
-1.0107743e-007
5.1009647e-006
-1.2278859e-007
5.1178001e-006
-1.5130046e-007
5.1393134e-006
-1.9474011e-007
5.1676593e-006
-2.5764533e-007
5.205639e-006
-3.4669603e-007
5.2571046e-006
-4.720366e-007
5.327341e-006
-6.4803416e-007
5.42367e-006
-8.9578083e-007
5.5563227e-006
-1.2466372e-006
5.7397252e-006
-1.7483447e-006
5.9944239e-006
-2.4753992e-006
6.3506654e-006
-3.546185e-006
6.8532289e-006
-5.1721273e-006
7.5614205e-006
-7.6129792e-006
8.6516731e-006
-1.1797471e-005
1.0605475e-005
-1.9118989e-005
1.5021201e-005
-3.3156824e-005
-4.2836996e-005
2.0879583e-005
5.0021944e-006
-9.0167489e-008
5.0475169e-006
-2.8303862e-007
5.0293226e-006
8.8995444e-008
5.0588774e-006
-2.3124407e-007
5.06363e-006
-4.6628356e-008
5.0746092e-006
-1.1920788e-007
5.086095e-006
-1.1256321e-007
5.0990809e-006
-1.3577446e-007
5.1149814e-006
-1.6720103e-007
5.1352429e-006
-2.1500163e-007
5.1618796e-006
-2.8428197e-007
5.1975052e-006
-3.8232164e-007
5.2456668e-006
-5.2019816e-007
5.3112067e-006
-7.1357405e-007
5.4007548e-006
-9.8532899e-007
5.5234352e-006
-1.3693176e-006
5.691839e-006
-1.9167486e-006
5.9233577e-006
-2.7069179e-006
6.2423257e-006
-3.865153e-006
6.6819947e-006
-5.6117962e-006
7.2795018e-006
-8.2104863e-006
8.1556688e-006
-1.2673637e-005
9.6565383e-006
-2.0619859e-005
1.3246093e-005
-3.6746379e-005
-4.6391937e-005
1.6801033e-005
5.0009374e-006
-8.9824533e-008
5.044305e-006
-3.2640624e-007
5.0314992e-006
1.0180127e-007
5.0566152e-006
-2.5636001e-007
5.0649217e-006
-5.4934902e-008
5.0732812e-006
-1.275673e-007
5.0848832e-006
-1.2416526e-007
5.0969922e-006
-1.4788345e-007
5.1118728e-006
-1.8208159e-007
5.130755e-006
-2.3388378e-007
5.1555031e-006
-3.0903007e-007
5.1885342e-006
-4.1535272e-007
5.2330671e-006
-5.6473106e-007
5.2934613e-006
-7.7396831e-007
5.3756041e-006
-1.0674718e-006
5.4874403e-006
-1.4811538e-006
5.6396253e-006
-2.0689335e-006
5.8461485e-006
-2.9134411e-006
6.1254271e-006
-4.1444315e-006
6.4964566e-006
-5.9828258e-006
6.9786492e-006
-8.6926788e-006
7.6014297e-006
-1.3296418e-005
8.5281708e-006
-2.15466e-005
1.0683551e-005
-3.8901759e-005
1.0729923e-005
-4.6438311e-005
2.1921517e-005
-1.3966078e-006
2.2460161e-005
-5.3864347e-007
2.2665787e-005
-2.0562598e-007
2.2706216e-005
-4.0429492e-008
2.2729844e-005
-2.3627324e-008
2.2733396e-005
-3.5526202e-009
2.2734828e-005
-1.43161e-009
2.2735262e-005
-4.3392517e-010
2.2735283e-005
-2.1000853e-011
2.2735306e-005
-2.332172e-011
2.2735305e-005
1.3132174e-012
2.2735302e-005
2.9928276e-012
2.2735301e-005
1.0405612e-012
2.27353e-005
6.8633255e-013
2.27353e-005
3.0410525e-013
2.27353e-005
1.2733104e-013
2.27353e-005
5.1486009e-014
2.27353e-005
8.9057969e-015
2.27353e-005
-2.2141727e-014
2.27353e-005
-3.8310479e-014
2.27353e-005
-2.5863289e-014
2.27353e-005
3.2394725e-014
2.27353e-005
8.2141817e-014
2.2735299e-005
9.5518761e-013
9.9907239e-013
2.1873099e-005
-2.6007373e-006
2.2461176e-005
-1.1267201e-006
2.2595792e-005
-3.4024184e-007
2.2654923e-005
-9.9561103e-008
2.2668158e-005
-3.6862249e-008
2.2672821e-005
-8.2157683e-009
2.2673956e-005
-2.5656774e-009
2.2674189e-005
-6.6693225e-010
2.2674263e-005
-9.5701388e-011
2.2674267e-005
-2.7484342e-011
2.2674266e-005
2.9552832e-012
2.2674264e-005
5.0604327e-012
2.2674262e-005
2.3926981e-012
2.2674262e-005
1.2716032e-012
2.2674261e-005
5.7159284e-013
2.2674261e-005
2.4799066e-013
2.2674261e-005
9.9659706e-014
2.2674261e-005
2.2214847e-014
2.2674261e-005
-2.9082627e-014
2.2674261e-005
-5.7686835e-014
2.2674261e-005
-4.1247776e-014
2.2674261e-005
7.9295396e-014
2.2674261e-005
1.4200395e-013
2.2674261e-005
1.1244077e-012
1.308837e-012
2.2027452e-005
-3.7299586e-006
2.2521341e-005
-1.6206093e-006
2.2615712e-005
-4.3461271e-007
2.2660489e-005
-1.4433867e-007
2.2669298e-005
-4.5670429e-008
2.2672538e-005
-1.1455792e-008
2.2673179e-005
-3.2070519e-009
2.2673279e-005
-7.6673856e-010
2.2673316e-005
-1.3293829e-010
2.267331e-005
-2.1003898e-011
2.2673305e-005
7.2036903e-012
2.2673303e-005
7.7010827e-012
2.2673301e-005
3.819167e-012
2.2673301e-005
1.842664e-012
2.26733e-005
8.2551761e-013
2.26733e-005
3.6266263e-013
2.26733e-005
1.4460595e-013
2.26733e-005
3.3933424e-014
2.26733e-005
-3.8848626e-014
2.26733e-005
-8.4465788e-014
2.26733e-005
-7.1714664e-014
2.26733e-005
1.0366108e-013
2.26733e-005
1.5002006e-013
2.2673301e-005
9.3236489e-013
1.2894395e-012
2.2549389e-005
-4.8531596e-006
2.2912773e-005
-1.9839932e-006
2.2930055e-005
-4.5189415e-007
2.2950153e-005
-1.6443704e-007
2.2952054e-005
-4.7571232e-008
2.2953373e-005
-1.2775253e-008
2.2953307e-005
-3.1410914e-009
2.2953201e-005
-6.600914e-010
2.295318e-005
-1.1241055e-010
2.2953157e-005
2.0466321e-012
2.2953149e-005
1.5500553e-011
2.2953145e-005
1.124187e-011
2.2953144e-005
5.4267194e-012
2.2953143e-005
2.4266619e-012
2.2953143e-005
1.0727796e-012
2.2953143e-005
4.6956604e-013
2.2953143e-005
1.8653721e-013
2.2953143e-005
4.3326888e-014
2.2953143e-005
-5.3419358e-014
2.2953143e-005
-1.2198612e-013
2.2953143e-005
-1.2077154e-013
2.2953143e-005
7.7971535e-014
2.2953143e-005
1.0975953e-013
2.2953142e-005
1.5748143e-012
2.1308288e-012
2.3517139e-005
-6.1105021e-006
2.3729293e-005
-2.196147e-006
2.3639945e-005
-3.6254666e-007
2.3627472e-005
-1.5196364e-007
2.3620868e-005
-4.0966976e-008
2.3620172e-005
-1.2079344e-008
2.3619314e-005
-2.2832917e-009
2.3618971e-005
-3.1728781e-010
2.3618886e-005
-2.7309124e-011
2.3618845e-005
4.3597205e-011
2.3618832e-005
2.7989486e-011
2.3618828e-005
1.563803e-011
2.3618826e-005
7.2014683e-012
2.3618825e-005
3.0136219e-012
2.3618825e-005
1.304227e-012
2.3618825e-005
5.6300861e-013
2.3618825e-005
2.2312385e-013
2.3618825e-005
5.0507681e-014
2.3618825e-005
-7.0388887e-014
2.3618825e-005
-1.6523484e-013
2.3618825e-005
-1.8514555e-013
2.3618825e-005
-2.9288428e-014
2.3618825e-005
5.3135653e-014
2.3618822e-005
4.3884291e-012
5.1194596e-012
2.4413648e-005
-7.5087424e-006
2.4456354e-005
-2.238853e-006
2.4273305e-005
-1.7949736e-007
2.4232688e-005
-1.1134609e-007
2.4218276e-005
-2.6555744e-008
2.4216068e-005
-9.8709486e-009
2.421459e-005
-8.0566352e-010
2.4214096e-005
1.7737255e-010
2.4213973e-005
9.5618452e-011
2.4213921e-005
9.5033561e-011
2.4213908e-005
4.1535734e-011
2.4213904e-005
1.9790988e-011
2.4213902e-005
8.7312934e-012
2.4213902e-005
3.4580684e-012
2.4213901e-005
1.4601366e-012
2.4213901e-005
6.1927595e-013
2.4213901e-005
2.4404762e-013
2.4213901e-005
5.4338939e-014
2.4213901e-005
-8.0569336e-014
2.4213901e-005
-1.9369397e-013
2.4213902e-005
-2.3558613e-013
2.4213902e-005
-1.8663073e-013
2.4213902e-005
-3.2558121e-015
2.4213897e-005
9.4306619e-012
1.0284042e-011
2.3918874e-005
-8.5804391e-006
2.3729279e-005
-2.0492583e-006
2.3532481e-005
1.7301126e-008
2.3483448e-005
-6.2313354e-008
2.3465779e-005
-8.886972e-009
2.3462914e-005
-7.0051466e-009
2.3461326e-005
7.8200158e-010
2.3460913e-005
5.9041917e-010
2.3460815e-005
1.9376063e-010
2.3460777e-005
1.3319557e-010
2.346077e-005
4.8577938e-011
2.3460768e-005
2.1350548e-011
2.3460768e-005
9.0543988e-012
2.3460768e-005
3.4354051e-012
2.3460768e-005
1.4225066e-012
2.3460768e-005
5.9099773e-013
2.3460768e-005
2.295467e-013
2.3460768e-005
5.0707788e-014
2.3460768e-005
-7.3665677e-014
2.3460768e-005
-1.8106783e-013
2.3460768e-005
-2.2556641e-013
2.3460768e-005
-2.9191489e-013
2.3460768e-005
-1.2605329e-013
2.3460764e-005
1.3805011e-011
1.4755384e-011
2.0535636e-005
-8.2364917e-006
2.0001524e-005
-1.5151465e-006
1.9902081e-005
1.1674424e-007
1.9866459e-005
-2.6691683e-008
1.9853533e-005
4.0397344e-009
1.9850665e-005
-4.1377044e-009
1.9849769e-005
1.6782403e-009
1.9849713e-005
6.4635802e-010
1.9849704e-005
2.028304e-010
1.984971e-005
1.2725548e-010
1.9849718e-005
4.0646023e-011
1.9849722e-005
1.7603515e-011
1.9849724e-005
7.1741062e-012
1.9849724e-005
2.6177218e-012
1.9849725e-005
1.0775159e-012
1.9849725e-005
4.3438686e-013
1.9849725e-005
1.6336001e-013
1.9849725e-005
3.4433984e-014
1.9849725e-005
-5.0156816e-014
1.9849725e-005
-1.2431607e-013
1.9849725e-005
-1.506721e-013
1.9849725e-005
-2.6365184e-013
1.9849725e-005
-3.4324118e-013
1.9849726e-005
1.3081845e-011
1.4079051e-011
1.3916779e-005
-5.352238e-006
1.3066883e-005
-6.6525059e-007
1.3098718e-005
8.4908173e-008
1.3082603e-005
-1.0576096e-008
1.3080416e-005
6.2265741e-009
1.307793e-005
-1.651211e-009
1.3078386e-005
1.2219808e-009
1.3078712e-005
3.2050597e-010
1.3078806e-005
1.0875158e-010
1.3078867e-005
6.6123175e-011
1.3078889e-005
1.8502149e-011
1.3078898e-005
8.3365161e-012
1.3078902e-005
3.252152e-012
1.3078904e-005
1.1401774e-012
1.3078904e-005
4.7035265e-013
1.3078904e-005
1.799078e-013
1.3078905e-005
6.2637892e-014
1.3078905e-005
8.8687525e-015
1.3078905e-005
-2.3123799e-014
1.3078905e-005
-5.4716502e-014
1.3078904e-005
-7.2890469e-014
1.3078904e-005
-1.560836e-013
1.3078905e-005
-5.0533273e-013
1.3078912e-005
6.0456922e-012
6.8519264e-012
5.3776838e-006
4.7124335e-006
4.7973417e-006
4.7867656e-006
4.7929922e-006
4.791341e-006
4.792563e-006
4.7928835e-006
4.7929922e-006
4.7930584e-006
4.7930769e-006
4.7930852e-006
4.7930884e-006
4.7930896e-006
4.79309e-006
4.7930902e-006
4.7930903e-006
4.7930903e-006
4.7930903e-006
4.7930902e-006
4.7930902e-006
4.7930901e-006
4.7930896e-006
4.7930957e-006
1.5064873e-005
-1.5085665e-007
1.5049017e-005
-3.105499e-007
1.5157392e-005
-6.5735222e-009
1.5133707e-005
-2.3267547e-007
1.5198896e-005
-1.2012382e-007
1.5215033e-005
-1.4370381e-007
1.5246196e-005
-1.5532822e-007
1.5277479e-005
-1.7916689e-007
1.5315232e-005
-2.1983414e-007
1.536282e-005
-2.8147233e-007
1.5424688e-005
-3.7089787e-007
1.5506786e-005
-4.974509e-007
1.5616721e-005
-6.7466629e-007
1.5764491e-005
-9.2173794e-007
1.5963078e-005
-1.2660586e-006
1.6228997e-005
-1.7470725e-006
1.6582256e-005
-2.4221929e-006
1.7044792e-005
-3.3759767e-006
1.763594e-005
-4.7355801e-006
1.8340908e-005
-6.6877933e-006
1.9121755e-005
-9.4735255e-006
1.9512723e-005
-1.3687386e-005
1.8968852e-005
-2.1002728e-005
1.4598696e-005
-3.4531603e-005
-3.1839615e-005
1.5061469e-005
-2.0848459e-007
1.5052316e-005
-3.0139696e-007
1.5163557e-005
-1.1781475e-007
1.5146814e-005
-2.1593266e-007
1.5190724e-005
-1.6403366e-007
1.5210527e-005
-1.6350616e-007
1.5231508e-005
-1.7630955e-007
1.5253753e-005
-2.0141176e-007
1.5279277e-005
-2.4535814e-007
1.5310721e-005
-3.1291652e-007
1.5350917e-005
-4.1109356e-007
1.5403425e-005
-5.4995878e-007
1.547253e-005
-7.4377203e-007
1.5563363e-005
-1.0125708e-006
1.5681749e-005
-1.3844446e-006
1.583348e-005
-1.8988034e-006
1.602235e-005
-2.6110626e-006
1.6245625e-005
-3.5992519e-006
1.6483459e-005
-4.973414e-006
1.6677467e-005
-6.8818014e-006
1.6709884e-005
-9.5059422e-006
1.619733e-005
-1.3174832e-005
1.4125277e-005
-1.8930675e-005
7.3277535e-006
-2.773408e-005
-2.4511861e-005
1.5059781e-005
-2.6442462e-007
1.5079367e-005
-3.2098278e-007
1.5157482e-005
-1.9592967e-007
1.516328e-005
-2.2173114e-007
1.5188889e-005
-1.896423e-007
1.5204712e-005
-1.7932956e-007
1.5216852e-005
-1.8844898e-007
1.5228301e-005
-2.1286105e-007
1.52402e-005
-2.5725706e-007
1.5253826e-005
-3.2654228e-007
1.5270331e-005
-4.2759849e-007
1.5290803e-005
-5.7043146e-007
1.5316146e-005
-7.6911508e-007
1.5346776e-005
-1.0432005e-006
1.5381875e-005
-1.4195435e-006
1.5417884e-005
-1.9348128e-006
1.5445526e-005
-2.6387042e-006
1.5444175e-005
-3.5979011e-006
1.5370838e-005
-4.9000765e-006
1.5142256e-005
-6.6532194e-006
1.4610159e-005
-8.9738457e-006
1.3458529e-005
-1.2023202e-005
1.0890555e-005
-1.6362701e-005
5.244967e-006
-2.2088492e-005
-1.9266894e-005
1.5065742e-005
-3.2632525e-007
1.5105987e-005
-3.6122781e-007
1.5164577e-005
-2.5452022e-007
1.5178448e-005
-2.3560177e-007
1.5192172e-005
-2.0336617e-007
1.5199908e-005
-1.8706625e-007
1.5202522e-005
-1.9106281e-007
1.5202341e-005
-2.1267982e-007
1.5199872e-005
-2.5478757e-007
1.519503e-005
-3.2170109e-007
1.518723e-005
-4.1979839e-007
1.5175201e-005
-5.5840185e-007
1.5156671e-005
-7.505855e-007
1.5127803e-005
-1.0143326e-006
1.5082104e-005
-1.3738442e-006
1.5008575e-005
-1.8612839e-006
1.4888502e-005
-2.5186315e-006
1.4689914e-005
-3.3993125e-006
1.4358481e-005
-4.5686435e-006
1.3803789e-005
-6.0985278e-006
1.287905e-005
-8.0491069e-006
1.1340808e-005
-1.048496e-005
8.7056855e-006
-1.3727578e-005
4.2482079e-006
-1.7631014e-005
-1.5018687e-005
1.5073309e-005
-3.9579347e-007
1.5127835e-005
-4.1575408e-007
1.5174801e-005
-3.0148539e-007
1.5187646e-005
-2.4844719e-007
1.5191447e-005
-2.0716658e-007
1.5189226e-005
-1.8484566e-007
1.5181501e-005
-1.8333743e-007
1.5169418e-005
-2.0059679e-007
1.515261e-005
-2.3798026e-007
1.5129696e-005
-2.9878707e-007
1.5098395e-005
-3.8849713e-007
1.5055293e-005
-5.1529955e-007
1.4995341e-005
-6.9063396e-007
1.4911109e-005
-9.3010006e-007
1.4791602e-005
-1.2543375e-006
1.4620383e-005
-1.6900646e-006
1.4372612e-005
-2.2708606e-006
1.4010598e-005
-3.0372992e-006
1.3477212e-005
-4.0352574e-006
1.2687366e-005
-5.3086813e-006
1.1518526e-005
-6.880267e-006
9.7977131e-006
-8.7641476e-006
7.2288073e-006
-1.1158672e-005
3.4688476e-006
-1.3871055e-005
-1.1549839e-005
1.5079316e-005
-4.7126861e-007
1.5146623e-005
-4.8306137e-007
1.5184196e-005
-3.3905833e-007
1.518887e-005
-2.5312083e-007
1.5181516e-005
-1.9981262e-007
1.5168242e-005
-1.7157181e-007
1.514975e-005
-1.6484501e-007
1.5126055e-005
-1.7690177e-007
1.5095737e-005
-2.07662e-007
1.5056159e-005
-2.5920914e-007
1.5003508e-005
-3.3584664e-007
1.4932474e-005
-4.4426593e-007
1.4835697e-005
-5.9385625e-007
1.470292e-005
-7.9732304e-007
1.4519802e-005
-1.0712201e-006
1.4266208e-005
-1.4364703e-006
1.3913854e-005
-1.9185062e-006
1.3423118e-005
-2.5465636e-006
1.2738984e-005
-3.3511231e-006
1.1786933e-005
-4.3566302e-006
1.0471887e-005
-5.5652213e-006
8.6753126e-006
-6.9675729e-006
6.2055945e-006
-8.6889542e-006
2.8972154e-006
-1.0562675e-005
-8.6526235e-006
1.5201411e-005
-6.688388e-007
1.5308494e-005
-5.9014455e-007
1.5333565e-005
-3.6412924e-007
1.5322574e-005
-2.4212957e-007
1.5301111e-005
-1.7834934e-007
1.5275544e-005
-1.4600536e-007
1.5245962e-005
-1.3526239e-007
1.5211188e-005
-1.4212851e-007
1.5168519e-005
-1.6499284e-007
1.5114036e-005
-2.04726e-007
1.5042522e-005
-2.6433287e-007
1.4947048e-005
-3.4879137e-007
1.4818342e-005
-4.6514997e-007
1.4643914e-005
-6.2289546e-007
1.440693e-005
-8.3423645e-007
1.4084776e-005
-1.1143163e-006
1.3647267e-005
-1.4809965e-006
1.3054541e-005
-1.9538377e-006
1.2255139e-005
-2.551721e-006
1.1185268e-005
-3.2867595e-006
9.7722125e-006
-4.152166e-006
7.9364785e-006
-5.1318389e-006
5.5518467e-006
-6.3043224e-006
2.5371012e-006
-7.5479299e-006
-6.1155224e-006
1.5850092e-005
-1.5150903e-006
1.6050175e-005
-7.9022736e-007
1.6019083e-005
-3.3303695e-007
1.5968257e-005
-1.9130401e-007
1.5925252e-005
-1.3534348e-007
1.5884528e-005
-1.0528199e-007
1.5842935e-005
-9.3669392e-008
1.5797106e-005
-9.6299318e-008
1.5742476e-005
-1.103629e-007
1.5673711e-005
-1.3596052e-007
1.5584204e-005
-1.7482627e-007
1.5465484e-005
-2.3007175e-007
1.5306475e-005
-3.061407e-007
1.5092619e-005
-4.0903886e-007
1.4804793e-005
-5.4641062e-007
1.4418058e-005
-7.2758183e-007
1.3900344e-005
-9.6328254e-007
1.3211301e-005
-1.2647948e-006
1.2301822e-005
-1.6422415e-006
1.1115513e-005
-2.1004505e-006
9.5947726e-006
-2.6314255e-006
7.6844153e-006
-3.2214815e-006
5.2960247e-006
-3.9159318e-006
2.3875984e-006
-4.6395036e-006
-3.727924e-006
1.6452803e-005
-2.9640526e-006
1.6510138e-005
-8.4756217e-007
1.63686e-005
-1.9149864e-007
1.6279458e-005
-1.0216238e-007
1.621487e-005
-7.0755305e-008
1.6159353e-005
-4.9764718e-008
1.6107654e-005
-4.1970236e-008
1.6053307e-005
-4.1952218e-008
1.5990028e-005
-4.7084072e-008
1.5911366e-005
-5.7298773e-008
1.5809704e-005
-7.3164573e-008
1.5675514e-005
-9.5881825e-008
1.549659e-005
-1.2721645e-007
1.5257123e-005
-1.6957212e-007
1.4936696e-005
-2.259838e-007
1.450922e-005
-3.00105e-007
1.3941981e-005
-3.9604403e-007
1.3195149e-005
-5.1796297e-007
1.2222216e-005
-6.6930813e-007
1.0972951e-005
-8.5118592e-007
9.4007871e-006
-1.0592613e-006
7.4651697e-006
-1.2858641e-006
5.0971961e-006
-1.5479582e-006
2.2757779e-006
-1.8180854e-006
-1.4521461e-006
1.2039788e-005
1.1192226e-005
1.1000728e-005
1.0898565e-005
1.082781e-005
1.0778045e-005
1.0736075e-005
1.0694123e-005
1.0647039e-005
1.058974e-005
1.0516575e-005
1.0420693e-005
1.0293477e-005
1.0123905e-005
9.8979211e-006
9.5978161e-006
9.201772e-006
8.6838091e-006
8.014501e-006
7.163315e-006
6.1040537e-006
4.8181896e-006
3.2702315e-006
1.4521461e-006
)
;
boundaryField
{
inlet
{
type calculated;
value nonuniform List<scalar>
20
(
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-5.0012803e-006
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
-1.5003841e-005
)
;
}
walls
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value nonuniform List<scalar> 10(2.2735297e-005 2.2674261e-005 2.2673301e-005 2.2953142e-005 2.3618819e-005 2.4213892e-005 2.3460759e-005 1.9849727e-005 1.3078919e-005 4.7931027e-006);
}
centreline
{
type symmetryPlane;
value uniform 0;
}
frontAndBack
{
type empty;
value nonuniform 0();
}
}
// ************************************************************************* //
| [
"39833752+cjn1012@users.noreply.github.com"
] | 39833752+cjn1012@users.noreply.github.com | |
7887063ad8cb37b59c3eff51e1e0348123636fb7 | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/rarefied-flows/impingment/sims/test/nozzle1/8.78/Ma | 06de76fee4cc3614def20193f6b4ab1be2d512da | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,301 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "8.78";
object Ma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
1900
(
0.163677
0.129522
0.132678
0.123811
0.117612
0.115876
0.113116
0.110167
0.107217
0.0936986
0.16368
0.12952
0.132671
0.123805
0.117594
0.11582
0.112967
0.109818
0.107103
0.10699
0.163682
0.129518
0.132667
0.123799
0.117568
0.115759
0.11282
0.109985
0.108759
0.113973
0.16368
0.12952
0.132671
0.123805
0.117594
0.11582
0.112967
0.109818
0.107103
0.10699
0.163677
0.129522
0.132678
0.123811
0.117612
0.115876
0.113116
0.110167
0.107217
0.0936986
0.102937
0.142605
0.195321
0.281291
0.430048
0.122433
0.146731
0.178741
0.245373
0.391028
0.12964
0.152505
0.184328
0.24813
0.387666
0.122433
0.146731
0.178741
0.245373
0.391028
0.102937
0.142605
0.195321
0.281291
0.430048
0.947192
1.34173
1.61322
1.79075
1.97838
0.906624
1.34095
1.63414
1.81075
2.00345
0.902274
1.34984
1.63451
1.80518
2.00162
0.906624
1.34095
1.63414
1.81075
2.00345
0.947192
1.34173
1.61322
1.79075
1.97838
2.0594
2.12517
2.15919
2.20298
2.23193
2.27458
2.32209
2.37472
2.41952
2.46133
2.54231
2.59731
2.57001
2.37552
1.93299
1.71472
1.68169
1.67207
1.65689
1.60553
1.52817
1.44604
1.37818
1.32138
1.25879
1.18589
1.08661
0.62395
0.107407
0.421722
0.467756
0.495741
0.520814
0.535894
0.544015
0.55156
0.563696
0.577144
0.585478
0.591621
2.03941
2.00081
1.98882
2.04631
2.09181
2.14793
2.20917
2.27653
2.33165
2.38416
2.47613
2.541
2.52223
2.31956
1.88223
1.68442
1.66116
1.6607
1.65476
1.61771
1.55428
1.46516
1.37764
1.31319
1.25388
1.18759
1.09377
0.630459
0.102618
0.420827
0.466881
0.494433
0.519221
0.534262
0.542787
0.551417
0.565044
0.579468
0.588039
0.594073
2.03458
1.99823
1.94296
1.99904
2.03913
2.09933
2.1677
2.24107
2.29953
2.35619
2.45149
2.52017
2.50364
2.29864
1.86378
1.67441
1.65475
1.65731
1.6553
1.62006
1.55503
1.46235
1.38232
1.32094
1.26043
1.19496
1.10194
0.62961
0.103535
0.420839
0.466749
0.494083
0.518664
0.533524
0.541847
0.550232
0.563704
0.578211
0.587059
0.593476
2.03941
2.00081
1.98882
2.04631
2.09181
2.14793
2.20917
2.27653
2.33165
2.38416
2.47613
2.541
2.52223
2.31956
1.88223
1.68442
1.66116
1.6607
1.65476
1.61771
1.55428
1.46516
1.37764
1.31319
1.25388
1.18759
1.09377
0.630459
0.102618
0.420827
0.466881
0.494433
0.519221
0.534262
0.542787
0.551417
0.565044
0.579468
0.588039
0.594073
2.0594
2.12517
2.15919
2.20298
2.23193
2.27458
2.32209
2.37472
2.41952
2.46133
2.54231
2.59731
2.57001
2.37552
1.93299
1.71472
1.68169
1.67207
1.65689
1.60553
1.52817
1.44604
1.37818
1.32138
1.25879
1.18589
1.08661
0.62395
0.107407
0.421722
0.467756
0.495741
0.520814
0.535894
0.544015
0.55156
0.563696
0.577144
0.585478
0.591621
2.48751
2.5146
2.54637
2.55994
2.56712
2.58194
2.59259
2.60488
2.6153
2.63075
2.67969
2.72258
2.68352
2.51083
2.04274
1.79467
1.73375
1.7007
1.66893
1.60888
1.52646
1.44422
1.38151
1.32781
1.26685
1.19676
1.09604
0.610168
0.123205
0.42314
0.467568
0.495766
0.520804
0.535852
0.543757
0.550404
0.560691
0.572312
0.579853
0.585967
2.95056
2.9549
2.96615
2.97135
2.9732
2.95944
2.93822
2.91747
2.88639
2.86543
2.87965
2.89467
2.83764
2.66265
2.16106
1.89596
1.79756
1.73854
1.68447
1.60451
1.51849
1.44367
1.37965
1.32192
1.25697
1.18281
1.07291
0.580179
0.149118
0.425749
0.467987
0.496534
0.521141
0.535748
0.543346
0.549547
0.558857
0.569495
0.576935
0.583778
3.06957
3.05829
3.03741
3.02747
3.02477
3.02037
3.01136
2.99664
2.97443
2.96142
2.95797
2.9545
2.89167
2.68555
2.16461
1.92299
1.81673
1.75122
1.68654
1.59026
1.49624
1.41355
1.35034
1.29431
1.23165
1.15992
1.04343
0.535977
0.183463
0.427516
0.467936
0.496959
0.521259
0.535743
0.543587
0.550029
0.559052
0.569027
0.576072
0.582828
3.05412
3.05531
3.05229
3.04273
3.03071
3.0227
3.01802
3.0073
3.00311
3.00743
2.99283
2.913
2.82949
2.56124
2.128
1.94125
1.83041
1.7429
1.63729
1.52647
1.43706
1.36749
1.31647
1.26565
1.20574
1.13457
1.00202
0.48061
0.223252
0.431072
0.471671
0.501542
0.525845
0.540561
0.548821
0.555252
0.563691
0.572738
0.578963
0.584853
2.96147
2.96448
2.97213
2.97678
2.97569
2.97844
2.97787
2.97143
2.98068
2.99679
2.91897
2.83947
2.72643
2.42244
2.11112
1.95771
1.82341
1.70337
1.57242
1.46024
1.381
1.32675
1.28476
1.23766
1.17981
1.10566
0.946074
0.421087
0.257383
0.431455
0.47229
0.501838
0.525235
0.53973
0.548343
0.554803
0.563043
0.571302
0.576954
0.582034
2.85967
2.85977
2.86442
2.8698
2.87314
2.88084
2.88625
2.89147
2.9189
2.92111
2.82971
2.7375
2.58414
2.30963
2.0729
1.92145
1.77627
1.62837
1.49133
1.39776
1.33727
1.29737
1.25986
1.21191
1.15112
1.06813
0.867328
0.345029
0.284376
0.430042
0.470729
0.499684
0.522815
0.538007
0.548141
0.557697
0.568622
0.577239
0.582621
0.586816
2.75027
2.7506
2.75362
2.75769
2.76311
2.77218
2.77682
2.78215
2.80833
2.79406
2.68623
2.58726
2.39811
2.16799
1.99238
1.83292
1.67007
1.52026
1.41536
1.3491
1.30525
1.26853
1.22182
1.16251
1.08875
0.980234
0.722203
0.235439
0.278295
0.402657
0.436997
0.46273
0.48725
0.510623
0.529503
0.545402
0.561368
0.575424
0.583367
0.587292
2.63141
2.63216
2.63382
2.63548
2.63983
2.64446
2.64561
2.64534
2.65791
2.60525
2.51542
2.38415
2.20595
2.0205
1.85082
1.68524
1.53557
1.42306
1.35001
1.30353
1.26186
1.20541
1.12523
1.02463
0.912387
0.769173
0.45518
0.196736
0.366595
0.420077
0.425244
0.42364
0.42806
0.444185
0.467785
0.500143
0.534956
0.565208
0.582778
0.591111
2.47941
2.48035
2.48171
2.48343
2.4865
2.48739
2.48646
2.48267
2.46548
2.39783
2.30247
2.16377
1.9901
1.82151
1.6658
1.50742
1.39544
1.33322
1.28193
1.21625
1.11704
0.993936
0.882602
0.787986
0.701128
0.582199
0.419199
0.364989
0.434668
0.445862
0.430895
0.407012
0.391972
0.389283
0.396224
0.425006
0.468124
0.523741
0.56575
0.590069
2.28149
2.28303
2.28579
2.29035
2.29743
2.30225
2.29968
2.27908
2.22755
2.14838
2.04476
1.9194
1.7726
1.61037
1.42492
1.34374
1.27999
1.18676
1.06124
0.9317
0.821689
0.746414
0.68666
0.637239
0.5846
0.500952
0.450446
0.410878
0.432878
0.435636
0.415727
0.38686
0.357529
0.349858
0.341911
0.357823
0.389949
0.454267
0.521114
0.577432
2.03634
2.0381
2.04424
2.05749
2.06967
2.07481
2.06457
2.03074
1.97498
1.89904
1.78412
1.62891
1.47427
1.3384
1.21956
1.07738
0.942117
0.83069
0.743666
0.688199
0.636365
0.60535
0.590026
0.546003
0.484507
0.46769
0.474255
0.421085
0.41061
0.405817
0.381316
0.350741
0.313604
0.29952
0.28642
0.294766
0.322805
0.380625
0.455475
0.531935
1.73633
1.74389
1.75354
1.76558
1.76535
1.74866
1.7127
1.65687
1.58443
1.49231
1.36673
1.21353
1.0192
0.868572
0.76341
0.699612
0.638573
0.613124
0.577007
0.559219
0.548622
0.519118
0.481178
0.444057
0.453086
0.484849
0.493394
0.430481
0.39224
0.373911
0.348225
0.318237
0.276888
0.253912
0.232802
0.237357
0.268418
0.327328
0.390826
0.454955
1.36381
1.36625
1.32371
1.2642
1.20942
1.14672
1.07161
0.977403
0.87199
0.77016
0.686123
0.619961
0.563849
0.539997
0.528242
0.527814
0.510692
0.500128
0.486845
0.467058
0.445389
0.416954
0.396847
0.42659
0.476893
0.505566
0.506196
0.448767
0.391436
0.359117
0.316811
0.281541
0.233014
0.200184
0.170296
0.177015
0.208232
0.272217
0.324219
0.37382
0.944926
0.893283
0.806827
0.717875
0.642324
0.574258
0.511834
0.455222
0.413122
0.399958
0.40442
0.412428
0.421004
0.431828
0.433729
0.429535
0.417925
0.404872
0.389412
0.366265
0.351488
0.354657
0.395619
0.46053
0.496557
0.51313
0.51531
0.472216
0.401345
0.353583
0.309543
0.263972
0.206479
0.158485
0.109272
0.110865
0.155039
0.235389
0.286779
0.320052
0.632833
0.581072
0.510187
0.446489
0.398611
0.368885
0.354337
0.347762
0.342831
0.341356
0.342041
0.344696
0.356295
0.358577
0.350691
0.335834
0.321815
0.303534
0.292542
0.291594
0.30827
0.367107
0.439347
0.481598
0.502274
0.518954
0.522811
0.495599
0.422193
0.356514
0.298977
0.246346
0.183965
0.119375
0.0516159
0.0508685
0.124758
0.205835
0.255295
0.277471
0.625862
0.58506
0.533509
0.487789
0.451778
0.420932
0.393628
0.365506
0.336008
0.315854
0.309178
0.304046
0.297623
0.284147
0.265685
0.243541
0.225567
0.218013
0.229422
0.270707
0.349841
0.422892
0.463066
0.490125
0.506625
0.5243
0.529816
0.51765
0.457826
0.38313
0.316109
0.256894
0.196243
0.130876
0.0725037
0.0541479
0.138584
0.22573
0.285443
0.300414
0.691277
0.639729
0.591406
0.5514
0.508421
0.466437
0.422487
0.376129
0.330881
0.2965
0.276419
0.259959
0.239993
0.210997
0.175554
0.149146
0.151413
0.187136
0.258262
0.348113
0.415207
0.453551
0.480474
0.500183
0.514333
0.532608
0.541034
0.538127
0.495736
0.422637
0.348895
0.29145
0.233421
0.180328
0.14244
0.143806
0.19737
0.271291
0.331167
0.334963
0.714069
0.684939
0.651463
0.615656
0.573118
0.527041
0.479641
0.428701
0.377326
0.328237
0.279404
0.227996
0.176023
0.121321
0.0812808
0.109779
0.186019
0.276284
0.360706
0.417213
0.454244
0.47859
0.49561
0.51216
0.523961
0.540721
0.55044
0.554083
0.53586
0.482863
0.408034
0.346943
0.2934
0.255169
0.218607
0.229611
0.269842
0.340072
0.403821
0.404191
0.760326
0.74222
0.700062
0.663067
0.621179
0.580052
0.537088
0.488329
0.433226
0.370512
0.303459
0.2225
0.122766
0.0165436
0.0990196
0.205406
0.301442
0.37742
0.42451
0.455502
0.476343
0.492758
0.507524
0.52232
0.532042
0.546912
0.556233
0.565204
0.561389
0.535293
0.479543
0.414936
0.347184
0.30418
0.264729
0.286113
0.325737
0.399319
0.475226
0.49355
0.793171
0.747949
0.696871
0.670591
0.66243
0.647475
0.633075
0.603617
0.558507
0.484314
0.366955
0.217865
0.0724817
0.127922
0.249261
0.343559
0.4071
0.443239
0.465211
0.477881
0.491772
0.506773
0.520266
0.532677
0.540046
0.552244
0.560058
0.569714
0.57499
0.57522
0.547986
0.48196
0.399697
0.338717
0.287301
0.30326
0.33025
0.399315
0.492463
0.498829
0.793171
0.747949
0.696871
0.670591
0.66243
0.647475
0.633075
0.603617
0.558507
0.484314
0.366955
0.217865
0.0724817
0.127922
0.249261
0.343559
0.4071
0.443239
0.465211
0.477881
0.491772
0.506773
0.520266
0.532677
0.540046
0.552244
0.560058
0.569714
0.57499
0.57522
0.547986
0.48196
0.399697
0.338717
0.287301
0.30326
0.33025
0.399315
0.492463
0.498829
0.760326
0.74222
0.700062
0.663067
0.621179
0.580052
0.537088
0.488329
0.433226
0.370512
0.303459
0.2225
0.122766
0.0165436
0.0990196
0.205406
0.301442
0.37742
0.42451
0.455502
0.476343
0.492758
0.507524
0.52232
0.532042
0.546912
0.556233
0.565204
0.561389
0.535293
0.479543
0.414936
0.347184
0.30418
0.264729
0.286113
0.325737
0.399319
0.475226
0.49355
0.714069
0.684939
0.651463
0.615656
0.573118
0.527041
0.479641
0.428701
0.377326
0.328237
0.279404
0.227996
0.176023
0.121321
0.0812808
0.109779
0.186019
0.276284
0.360706
0.417213
0.454244
0.47859
0.49561
0.51216
0.523961
0.540721
0.55044
0.554083
0.53586
0.482863
0.408034
0.346943
0.2934
0.255169
0.218607
0.229611
0.269842
0.340072
0.403821
0.404191
0.691277
0.639729
0.591406
0.5514
0.508421
0.466437
0.422487
0.376129
0.330881
0.2965
0.276419
0.259959
0.239993
0.210997
0.175554
0.149146
0.151413
0.187136
0.258262
0.348113
0.415207
0.453551
0.480474
0.500183
0.514333
0.532608
0.541034
0.538127
0.495736
0.422637
0.348895
0.29145
0.233421
0.180328
0.14244
0.143806
0.19737
0.271291
0.331167
0.334963
0.625862
0.58506
0.533509
0.487789
0.451778
0.420932
0.393628
0.365506
0.336008
0.315854
0.309178
0.304046
0.297623
0.284147
0.265685
0.243541
0.225567
0.218013
0.229422
0.270707
0.349841
0.422892
0.463066
0.490125
0.506625
0.5243
0.529816
0.51765
0.457826
0.38313
0.316109
0.256894
0.196243
0.130876
0.0725037
0.0541479
0.138584
0.22573
0.285443
0.300414
0.632833
0.581072
0.510187
0.446489
0.398611
0.368885
0.354337
0.347762
0.342831
0.341356
0.342041
0.344696
0.356295
0.358577
0.350691
0.335834
0.321815
0.303534
0.292542
0.291594
0.30827
0.367107
0.439347
0.481598
0.502274
0.518954
0.522811
0.495599
0.422193
0.356514
0.298977
0.246346
0.183965
0.119375
0.0516159
0.0508685
0.124758
0.205835
0.255295
0.277471
0.944926
0.893283
0.806827
0.717875
0.642324
0.574258
0.511834
0.455222
0.413122
0.399958
0.40442
0.412428
0.421004
0.431828
0.433729
0.429535
0.417925
0.404872
0.389412
0.366265
0.351488
0.354657
0.395619
0.46053
0.496557
0.51313
0.51531
0.472216
0.401345
0.353583
0.309543
0.263972
0.206479
0.158485
0.109272
0.110865
0.155039
0.235389
0.286779
0.320052
1.36381
1.36625
1.32371
1.2642
1.20942
1.14672
1.07161
0.977403
0.87199
0.77016
0.686123
0.619961
0.563849
0.539997
0.528242
0.527814
0.510692
0.500128
0.486845
0.467058
0.445389
0.416954
0.396847
0.42659
0.476893
0.505566
0.506196
0.448767
0.391436
0.359117
0.316811
0.281541
0.233014
0.200184
0.170296
0.177015
0.208232
0.272217
0.324219
0.37382
1.73633
1.74389
1.75354
1.76558
1.76535
1.74866
1.7127
1.65687
1.58443
1.49231
1.36673
1.21353
1.0192
0.868572
0.76341
0.699612
0.638573
0.613124
0.577007
0.559219
0.548622
0.519118
0.481178
0.444057
0.453086
0.484849
0.493394
0.430481
0.39224
0.373911
0.348225
0.318237
0.276888
0.253912
0.232802
0.237357
0.268418
0.327328
0.390826
0.454955
2.03634
2.0381
2.04424
2.05749
2.06967
2.07481
2.06457
2.03074
1.97498
1.89904
1.78412
1.62891
1.47427
1.3384
1.21956
1.07738
0.942117
0.83069
0.743666
0.688199
0.636365
0.60535
0.590026
0.546003
0.484507
0.46769
0.474255
0.421085
0.41061
0.405817
0.381316
0.350741
0.313604
0.29952
0.28642
0.294766
0.322805
0.380625
0.455475
0.531935
2.28149
2.28303
2.28579
2.29035
2.29743
2.30225
2.29968
2.27908
2.22755
2.14838
2.04476
1.9194
1.7726
1.61037
1.42492
1.34374
1.27999
1.18676
1.06124
0.9317
0.821689
0.746414
0.68666
0.637239
0.5846
0.500952
0.450446
0.410878
0.432878
0.435636
0.415727
0.38686
0.357529
0.349858
0.341911
0.357823
0.389949
0.454267
0.521114
0.577432
2.47941
2.48035
2.48171
2.48343
2.4865
2.48739
2.48646
2.48267
2.46548
2.39783
2.30247
2.16377
1.9901
1.82151
1.6658
1.50742
1.39544
1.33322
1.28193
1.21625
1.11704
0.993936
0.882602
0.787986
0.701128
0.582199
0.419199
0.364989
0.434668
0.445862
0.430895
0.407012
0.391972
0.389283
0.396224
0.425006
0.468124
0.523741
0.56575
0.590069
2.63141
2.63216
2.63382
2.63548
2.63983
2.64446
2.64561
2.64534
2.65791
2.60525
2.51542
2.38415
2.20595
2.0205
1.85082
1.68524
1.53557
1.42306
1.35001
1.30353
1.26186
1.20541
1.12523
1.02463
0.912387
0.769173
0.45518
0.196736
0.366595
0.420077
0.425244
0.42364
0.42806
0.444185
0.467785
0.500143
0.534956
0.565208
0.582778
0.591111
2.75027
2.7506
2.75362
2.75769
2.76311
2.77218
2.77682
2.78215
2.80833
2.79406
2.68623
2.58726
2.39811
2.16799
1.99238
1.83292
1.67007
1.52026
1.41536
1.3491
1.30525
1.26853
1.22182
1.16251
1.08875
0.980234
0.722203
0.235439
0.278295
0.402657
0.436997
0.46273
0.48725
0.510623
0.529503
0.545402
0.561368
0.575424
0.583367
0.587292
2.85967
2.85977
2.86442
2.8698
2.87314
2.88084
2.88625
2.89147
2.9189
2.92111
2.82971
2.7375
2.58414
2.30963
2.0729
1.92145
1.77627
1.62837
1.49133
1.39776
1.33727
1.29737
1.25986
1.21191
1.15112
1.06813
0.867328
0.345029
0.284376
0.430042
0.470729
0.499684
0.522815
0.538007
0.548141
0.557697
0.568622
0.577239
0.582621
0.586816
2.96147
2.96448
2.97213
2.97678
2.97569
2.97844
2.97787
2.97143
2.98068
2.99679
2.91897
2.83947
2.72643
2.42244
2.11112
1.95771
1.82341
1.70337
1.57242
1.46024
1.381
1.32675
1.28476
1.23766
1.17981
1.10566
0.946074
0.421087
0.257383
0.431455
0.47229
0.501838
0.525235
0.53973
0.548343
0.554803
0.563043
0.571302
0.576954
0.582034
3.05412
3.05531
3.05229
3.04273
3.03071
3.0227
3.01802
3.0073
3.00311
3.00743
2.99283
2.913
2.82949
2.56124
2.128
1.94125
1.83041
1.7429
1.63729
1.52647
1.43706
1.36749
1.31647
1.26565
1.20574
1.13457
1.00202
0.48061
0.223252
0.431072
0.471671
0.501542
0.525845
0.540561
0.548821
0.555252
0.563691
0.572738
0.578963
0.584853
3.06957
3.05829
3.03741
3.02747
3.02477
3.02037
3.01136
2.99664
2.97443
2.96142
2.95797
2.9545
2.89167
2.68555
2.16461
1.92299
1.81673
1.75122
1.68654
1.59026
1.49624
1.41355
1.35034
1.29431
1.23165
1.15992
1.04343
0.535977
0.183463
0.427516
0.467936
0.496959
0.521259
0.535743
0.543587
0.550029
0.559052
0.569027
0.576072
0.582828
2.95056
2.9549
2.96615
2.97135
2.9732
2.95944
2.93822
2.91747
2.88639
2.86543
2.87965
2.89467
2.83764
2.66265
2.16106
1.89596
1.79756
1.73854
1.68447
1.60451
1.51849
1.44367
1.37965
1.32192
1.25697
1.18281
1.07291
0.580179
0.149118
0.425749
0.467987
0.496534
0.521141
0.535748
0.543346
0.549547
0.558857
0.569495
0.576935
0.583778
2.48751
2.5146
2.54637
2.55994
2.56712
2.58194
2.59259
2.60488
2.6153
2.63075
2.67969
2.72258
2.68352
2.51083
2.04274
1.79467
1.73375
1.7007
1.66893
1.60888
1.52646
1.44422
1.38151
1.32781
1.26685
1.19676
1.09604
0.610168
0.123205
0.42314
0.467568
0.495766
0.520804
0.535852
0.543757
0.550404
0.560691
0.572312
0.579853
0.585967
)
;
boundaryField
{
inlet
{
type calculated;
value uniform 0;
}
outlet
{
type calculated;
value nonuniform List<scalar>
165
(
2.48751
2.95056
3.06957
3.05412
2.96147
2.85967
2.75027
2.63141
2.47941
2.28149
2.03634
1.73633
1.36381
0.944926
0.632833
0.625862
0.691277
0.714069
0.760326
0.793171
0.793171
0.747949
0.696871
0.670591
0.66243
0.647475
0.633075
0.603617
0.558507
0.484314
0.366955
0.217865
0.0724817
0.127922
0.249261
0.343559
0.4071
0.443239
0.465211
0.477881
0.491772
0.506773
0.520266
0.532677
0.540046
0.552244
0.560058
0.569714
0.57499
0.57522
0.547986
0.48196
0.399697
0.338717
0.287301
0.30326
0.33025
0.399315
0.492463
0.498829
0.585967
0.583778
0.582828
0.584853
0.582034
0.586816
0.587292
0.591111
0.590069
0.577432
0.531935
0.454955
0.37382
0.320052
0.277471
0.300414
0.334963
0.404191
0.49355
0.498829
0.591621
0.594073
0.593476
0.594073
0.591621
0.498829
0.49355
0.404191
0.334963
0.300414
0.277471
0.320052
0.37382
0.454955
0.531935
0.577432
0.590069
0.591111
0.587292
0.586816
0.582034
0.584853
0.582828
0.583778
0.585967
0.793171
0.747949
0.696871
0.670591
0.66243
0.647475
0.633075
0.603617
0.558507
0.484314
0.366955
0.217865
0.0724817
0.127922
0.249261
0.343559
0.4071
0.443239
0.465211
0.477881
0.491772
0.506773
0.520266
0.532677
0.540046
0.552244
0.560058
0.569714
0.57499
0.57522
0.547986
0.48196
0.399697
0.338717
0.287301
0.30326
0.33025
0.399315
0.492463
0.498829
0.793171
0.760326
0.714069
0.691277
0.625862
0.632833
0.944926
1.36381
1.73633
2.03634
2.28149
2.47941
2.63141
2.75027
2.85967
2.96147
3.05412
3.06957
2.95056
2.48751
)
;
}
obstacle
{
type calculated;
value nonuniform List<scalar>
40
(
0.163677
0.129522
0.132678
0.123811
0.117612
0.115876
0.113116
0.110167
0.107144
0.0929409
0.163677
0.129522
0.132678
0.123811
0.117612
0.115876
0.113116
0.110167
0.107144
0.0929409
0.100678
0.139519
0.192084
0.278038
0.423445
0.100678
0.139519
0.192084
0.278038
0.423445
0.937229
1.33901
1.61158
1.78932
1.977
0.937229
1.33901
1.61158
1.78932
1.977
)
;
}
empty
{
type empty;
}
}
// ************************************************************************* //
| [
"andytorrestb@gmail.com"
] | andytorrestb@gmail.com | |
79fae3b6c440694953a5e4283547b7f28f7080ed | 733ac1930072d493b0ae9c60c752b10ee60b7415 | /src/qt/splashscreen.cpp | c1894ad9d924711127acea506d7e405f73b3b3de | [
"MIT"
] | permissive | Rockeronhunt/ICC | ab174a79c7a5cd617c0998954c7b74febbe37857 | 7ae71bd66b79f97aba06312dfa913eb96c99a2cf | refs/heads/master | 2020-03-16T10:46:52.315129 | 2018-05-08T16:53:17 | 2018-05-08T16:53:17 | 132,638,503 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,070 | cpp | #include "splashscreen.h"
#include "clientversion.h"
#include "util.h"
#include <QApplication>
#include <QPainter>
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
QSplashScreen(pixmap, f)
{
// set reference point, paddings
int paddingRight = 50;
int paddingTop = 50;
int titleVersionVSpace = 17;
int titleCopyrightVSpace = 40;
float fontFactor = 1.0;
// define text to place
QString titleText = QString(QApplication::applicationName()).replace(QString("-testnet"), QString(""), Qt::CaseSensitive); // cut of testnet, place it as single object further down
QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The ICCCOIN developers"));
QString testnetAddText = QString(tr("[testnet]")); // define text to place as single text object
QString font = "Arial";
// load the bitmap for writing some text over it
QPixmap newPixmap;
if(GetBoolArg("-testnet", false)) {
newPixmap = QPixmap(":/images/splash_testnet");
}
else {
newPixmap = QPixmap(":/images/splash");
}
QPainter pixPaint(&newPixmap);
pixPaint.setPen(QColor(100,100,100));
// check font size and drawing with
pixPaint.setFont(QFont(font, 33*fontFactor));
QFontMetrics fm = pixPaint.fontMetrics();
int titleTextWidth = fm.width(titleText);
if(titleTextWidth > 160) {
// strange font rendering, Arial probably not found
fontFactor = 0.75;
}
pixPaint.setFont(QFont(font, 33*fontFactor));
fm = pixPaint.fontMetrics();
titleTextWidth = fm.width(titleText);
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop,titleText);
pixPaint.setFont(QFont(font, 15*fontFactor));
// if the version string is to long, reduce size
fm = pixPaint.fontMetrics();
int versionTextWidth = fm.width(versionText);
if(versionTextWidth > titleTextWidth+paddingRight-10) {
pixPaint.setFont(QFont(font, 10*fontFactor));
titleVersionVSpace -= 5;
}
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 10*fontFactor));
pixPaint.drawText(newPixmap.width()-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText);
// draw testnet string if -testnet is on
if(QApplication::applicationName().contains(QString("-testnet"))) {
// draw copyright stuff
QFont boldFont = QFont(font, 10*fontFactor);
boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont);
fm = pixPaint.fontMetrics();
int testnetAddTextWidth = fm.width(testnetAddText);
pixPaint.drawText(newPixmap.width()-testnetAddTextWidth-10,15,testnetAddText);
}
pixPaint.end();
this->setPixmap(newPixmap);
}
| [
""
] | |
88b815d19fa747b90f8e69eb387f0be12c09a143 | 6e995d4587d4c59559dd56bc385ef3936d96416a | /libs/xml-operations/include/xml_operations.h | db3a2c0001b74d30c1e52b7985fe0e469eada799 | [
"MIT"
] | permissive | 867698505/anno1800-mod-loader | 176b9b3b373fa54c6344a639b1f7504c8ed5f86d | 8b1419fc04f04daa286272f5e890e8f84aca8690 | refs/heads/master | 2021-04-23T08:05:56.926074 | 2020-02-02T23:23:34 | 2020-02-02T23:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,177 | h | #include "pugixml.hpp"
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
namespace fs = std::filesystem;
class XmlOperation
{
public:
enum Type { Add, AddNextSibling, AddPrevSibling, Remove, Replace, Merge };
XmlOperation(std::shared_ptr<pugi::xml_document> doc, pugi::xml_node node);
XmlOperation(std::shared_ptr<pugi::xml_document> doc, pugi::xml_node node, std::string guid);
void ReadPath();
pugi::xml_object_range<pugi::xml_node_iterator> GetContentNode()
{
return *nodes_;
}
Type GetType() const
{
return type_;
}
std::string GetPath()
{
return path_;
}
void Apply(std::shared_ptr<pugi::xml_document> doc, std::string mod_name = "",
fs::path game_path = {}, fs::path mod_path = {});
static std::vector<XmlOperation> GetXmlOperations(std::shared_ptr<pugi::xml_document> doc);
static std::vector<XmlOperation> GetXmlOperationsFromFile(fs::path path);
private:
Type type_;
std::string path_;
std::string speculative_path_;
std::string guid_;
std::optional<pugi::xml_object_range<pugi::xml_node_iterator>> nodes_;
std::shared_ptr<pugi::xml_document> doc_;
pugi::xml_node node_;
/*static inline std::string to_string(xmlChar *str)
{
int charLength = xmlStrlen(str);
return std::string{reinterpret_cast<const char *>(str), size_t(charLength)};
}*/
static std::string GetXmlPropString(pugi::xml_node node, std::string prop_name)
{
return node.attribute(prop_name.c_str()).as_string();
}
void RecursiveMerge(pugi::xml_node root_game_node, pugi::xml_node game_node,
pugi::xml_node patching_node);
void ReadPath(pugi::xml_node node, std::string guid = "");
void ReadType(pugi::xml_node node);
};
| [
"alexander@guettler.io"
] | alexander@guettler.io |
d20a25b97527c6553a9de977a5167693b6ba02c4 | 18a234c96d923ce0ea0d8bef9a1a7ce9c7bc224b | /ShooterImpactEffect.cpp | 9508d6aa7cbdfa5df89ae131261e6b188b07c154 | [] | no_license | fkkcloud/fxpipeline | f3e8b0c264aeeacfc1628224d67514f46c7de74d | 15ad327323976cd4ddcf7f536b685e80d7f870c8 | refs/heads/master | 2021-01-01T05:29:30.015766 | 2016-05-03T23:11:50 | 2016-05-03T23:11:50 | 58,006,886 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,939 | cpp | // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "ShooterGame.h"
#include "ShooterImpactEffect.h"
AShooterImpactEffect::AShooterImpactEffect(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
bAutoDestroyWhenFinished = true;
}
void AShooterImpactEffect::PostInitializeComponents()
{
Super::PostInitializeComponents();
UPhysicalMaterial* HitPhysMat = SurfaceHit.PhysMaterial.Get();
EPhysicalSurface HitSurfaceType = UPhysicalMaterial::DetermineSurfaceType(HitPhysMat);
// show particles
UParticleSystem* ImpactFX = GetImpactFX(HitSurfaceType);
if (ImpactFX)
{
UGameplayStatics::SpawnEmitterAtLocation(this, ImpactFX, GetActorLocation(), GetActorRotation());
}
// play sound
USoundCue* ImpactSound = GetImpactSound(HitSurfaceType);
if (ImpactSound)
{
UGameplayStatics::PlaySoundAtLocation(this, ImpactSound, GetActorLocation());
}
if (DefaultDecal.DecalMaterial)
{
FRotator RandomDecalRotation = SurfaceHit.ImpactNormal.Rotation();
RandomDecalRotation.Roll = FMath::FRandRange(-180.0f, 180.0f);
UGameplayStatics::SpawnDecalAttached(DefaultDecal.DecalMaterial, FVector(DefaultDecal.DecalSize, DefaultDecal.DecalSize, 1.0f),
SurfaceHit.Component.Get(), SurfaceHit.BoneName,
SurfaceHit.ImpactPoint, RandomDecalRotation, EAttachLocation::KeepWorldPosition,
DefaultDecal.LifeSpan);
}
}
UParticleSystem* AShooterImpactEffect::GetImpactFX(TEnumAsByte<EPhysicalSurface> SurfaceType) const
{
UParticleSystem* ImpactFX = NULL;
switch (SurfaceType)
{
case SHOOTER_SURFACE_Concrete: ImpactFX = ConcreteFX; break;
case SHOOTER_SURFACE_Dirt: ImpactFX = DirtFX; break;
case SHOOTER_SURFACE_Water: ImpactFX = WaterFX; break;
case SHOOTER_SURFACE_Metal: ImpactFX = MetalFX; break;
case SHOOTER_SURFACE_Wood: ImpactFX = WoodFX; break;
case SHOOTER_SURFACE_Grass: ImpactFX = GrassFX; break;
case SHOOTER_SURFACE_Glass: ImpactFX = GlassFX; break;
case SHOOTER_SURFACE_Flesh: ImpactFX = FleshFX; break;
case SHOOTER_SURFACE_Cloth: ImpactFX = ClothFX; break;
default: ImpactFX = DefaultFX; break;
}
return ImpactFX;
}
USoundCue* AShooterImpactEffect::GetImpactSound(TEnumAsByte<EPhysicalSurface> SurfaceType) const
{
USoundCue* ImpactSound = NULL;
switch (SurfaceType)
{
case SHOOTER_SURFACE_Concrete: ImpactSound = ConcreteSound; break;
case SHOOTER_SURFACE_Dirt: ImpactSound = DirtSound; break;
case SHOOTER_SURFACE_Water: ImpactSound = WaterSound; break;
case SHOOTER_SURFACE_Metal: ImpactSound = MetalSound; break;
case SHOOTER_SURFACE_Wood: ImpactSound = WoodSound; break;
case SHOOTER_SURFACE_Grass: ImpactSound = GrassSound; break;
case SHOOTER_SURFACE_Glass: ImpactSound = GlassSound; break;
case SHOOTER_SURFACE_Flesh: ImpactSound = FleshSound; break;
case SHOOTER_SURFACE_Cloth: ImpactSound = ClothSound; break;
default: ImpactSound = DefaultSound; break;
}
return ImpactSound;
}
| [
"fkkcloud@gmail.com"
] | fkkcloud@gmail.com |
332998d0f7033670239f19d1bde81cc6567ceeee | 8c66d1fe6ecde6f66f3eaf5b5db220da3930c7ab | /codeforces/1253/B.cpp | d72a5566e37691d77f9658d097ad96d069330cca | [] | no_license | Hasanul-Bari/codeforces | 0af70eda9dee3e7ddefc63560538e986dda0c141 | 1a074980ccdc2cd97a0a6a85f1f89da0343407b3 | refs/heads/master | 2023-06-03T07:52:28.584598 | 2021-04-12T14:39:00 | 2021-06-17T18:08:03 | 334,670,088 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,840 | cpp | #include<bits/stdc++.h>
#define faster ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;
int main()
{
faster
int n,x;
cin>>n;
map<int,int> m;
vector<int> v;
int c=0,cc=0;
bool hp=true;
for(int i=1; i<=n; i++)
{
cin>>x;
if(x>0)
{
if(m[x]==0)
{
m[x]++;
c++;
cc++;
}
else
{
if(c==0)
{
v.pb(cc);
cc=0;
m.clear();
m[x]++;
c++;
cc++;
}
else
{
hp=false;
}
}
}
else if(x<0)
{
//cout<<-x<<" "<<m[-x]<<endl;
x=-x;
if(m[x]==0)
hp=false;
else
{
if(m[x]==2)
hp=false;
else
{
c--;
cc++;
m[x]++;
if(c==0)
{
v.pb(cc);
cc=0;
m.clear();
}
}
}
}
//cout<<c<<endl;
}
if(c!=0)
hp=false;
if(hp==false)
{
cout<<-1<<endl;
return 0;
}
cout<<v.size()<<endl;
for(int i=0; i<v.size(); i++)
cout<<v[i]<<" ";
cout<<endl;
return 0;
}
| [
"hasanul.bari.hasan96@gmail.com"
] | hasanul.bari.hasan96@gmail.com |
3892a713491efc8902866b16754ac6d35930d6e3 | 97613d7604c3f534ec7821f4e315ebc08c8fb1fd | /kineticTheoryModels/granularPressureModel/SyamlalRogersOBrien/SyamlalRogersOBrienPressure.H | de63fc914b29127ae1068277bc8d4db529ed6d18 | [] | no_license | gudaxia/twoPhaseEulerPimpleFoamPU | 9bd682ad67f2beb6dbd01c410fece935ff018815 | 9c01e930aedced59408774964c601c11dcdfc471 | refs/heads/master | 2020-05-23T10:10:20.881944 | 2015-05-05T18:07:32 | 2015-05-05T18:07:32 | 28,421,633 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,872 | h | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::SyamlalRogersOBrienPressure
Description
SourceFiles
SyamlalRogersOBrienPressure.C
\*---------------------------------------------------------------------------*/
#ifndef SyamlalRogersOBrienPressure_H
#define SyamlalRogersOBrienPressure_H
#include "granularPressureModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class SyamlalRogersOBrienPressure Declaration
\*---------------------------------------------------------------------------*/
class SyamlalRogersOBrienPressure
:
public granularPressureModel
{
public:
//- Runtime type information
TypeName("SyamlalRogersOBrien");
// Constructors
//- Construct from components
SyamlalRogersOBrienPressure(const dictionary& dict);
//- Destructor
virtual ~SyamlalRogersOBrienPressure();
// Member Functions
tmp<volScalarField> granularPressureCoeff
(
const volScalarField& alpha,
const volScalarField& g0,
const dimensionedScalar& rhoa,
const dimensionedScalar& e
) const;
tmp<volScalarField> granularPressureCoeffPrime
(
const volScalarField& alpha,
const volScalarField& g0,
const volScalarField& g0prime,
const dimensionedScalar& rhoa,
const dimensionedScalar& e
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| [
"aliozel@gmail.com"
] | aliozel@gmail.com |
788f2ea0673ebacda7fcb05d49c51072b80aa61c | 236d1c4d5bf5f3c666701e0830425f18468f1622 | /chapter04/scenerefractcube.cpp | da000ed0508ce5ccbd7c33daeda7a67d4d01c24c | [] | no_license | hisupersylar/glslcookbook | 5608779cd9346e7fa582f92299fa1f735d9212c1 | 4f20fc6845f115f29572bf7c4c3547526822704e | refs/heads/master | 2021-05-28T22:22:14.736155 | 2012-03-29T04:50:27 | 2012-03-29T04:50:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,817 | cpp | #include "scenerefractcube.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
using std::cout;
using std::endl;
#include <glimg/glimg.h>
#include "glutils.h"
#include "defines.h"
using glm::vec3;
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform2.hpp>
SceneRefractCube::SceneRefractCube()
{
}
void SceneRefractCube::initScene()
{
compileAndLinkShader();
glEnable(GL_DEPTH_TEST);
teapot = new VBOTeapot(14, mat4(1.0f));
sky = new SkyBox();
plane = new VBOPlane(1.0f,1.0f,1,1);
float c = 3.5f;
torus = new VBOTorus(0.7f * c, 0.3f * c, 50, 50);
projection = mat4(1.0f);
angle = (float)( TO_RADIANS(90.0) );
loadCubeMap("../media/texture/cubemap_night/night");
}
void SceneRefractCube::loadCubeMap( const char * baseFileName )
{
glActiveTexture(GL_TEXTURE0);
GLuint texID;
glGenTextures(1, &texID);
glBindTexture(GL_TEXTURE_CUBE_MAP, texID);
const char * suffixes[] = { "posx", "negx", "posy", "negy", "posz", "negz" };
GLuint targets[] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
};
for( int i = 0; i < 6; i++ ) {
string texName = string(baseFileName) + "_" + suffixes[i] + ".png";
cout << "Loading: " << texName << endl;
try {
glimg::ImageSet * imgSet;
imgSet = glimg::loaders::stb::LoadFromFile(texName.c_str());
glimg::SingleImage &img = imgSet->GetImage(0);
glimg::OpenGLPixelTransferParams params = glimg::GetUploadFormatType(img.GetFormat(), 0);
glimg::Dimensions dims = img.GetDimensions();
glPixelStorei(GL_UNPACK_ALIGNMENT, img.GetFormat().LineAlign());
glTexImage2D(targets[i], 0, GL_RGBA, dims.width, dims.height, 0,
params.format, params.type, img.GetImageData());
delete imgSet;
} catch( glimg::loaders::stb::StbLoaderException &e ) {
fprintf(stderr, "Unable to load texture %s: %s\n", texName.c_str(), e.what());
exit(1);
}
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
prog.setUniform("CubeMapTex", 0);
}
void SceneRefractCube::update( float t )
{
angle += 0.0001f;
if( angle > TWOPI) angle -= TWOPI;
}
void SceneRefractCube::render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
vec3 cameraPos = vec3( 7.0f * cos(angle), 2.0f, 7.0f * sin(angle));
view = glm::lookAt(cameraPos, vec3(0.0f,0.0f,0.0f), vec3(0.0f,1.0f,0.0f));
prog.setUniform("WorldCameraPosition", cameraPos);
//view = glm::lookAt(vec3(0.0f,2.0f,0.0f), vec3(0.0f,0.0f,0.0f), vec3(0.0f,0.0f,1.0f));
prog.setUniform("DrawSkyBox", true);
model = mat4(1.0f);
setMatrices();
sky->render();
prog.setUniform("DrawSkyBox", false);
prog.setUniform("Material.Eta", 0.94f);
prog.setUniform("Material.ReflectionFactor", 0.1f);
model = mat4(1.0f);
model *= glm::translate(vec3(0.0f,-1.0f,0.0f));
model *= glm::rotate(-90.0f, vec3(1.0f,0.0f,0.0f));
setMatrices();
teapot->render();
}
void SceneRefractCube::setMatrices()
{
mat4 mv = view * model;
prog.setUniform("ModelMatrix", model);
// prog.setUniform("ModelViewMatrix", mv);
//prog.setUniform("NormalMatrix",
// mat3( vec3(mv[0]), vec3(mv[1]), vec3(mv[2]) ));
prog.setUniform("MVP", projection * mv);
}
void SceneRefractCube::resize(int w, int h)
{
glViewport(0,0,w,h);
width = w;
height = h;
projection = glm::perspective(50.0f, (float)w/h, 0.3f, 100.0f);
//float c = 2.0f;
//projection = glm::ortho( -0.4f * c, 0.4f * c, -0.3f * c, 0.3f * c, 0.1f, 100.0f);
}
void SceneRefractCube::compileAndLinkShader()
{
if( ! prog.compileShaderFromFile("shader/cubemap_refract.vs",GLSLShader::VERTEX) )
{
printf("Vertex shader failed to compile!\n%s",
prog.log().c_str());
exit(1);
}
if( ! prog.compileShaderFromFile("shader/cubemap_refract.fs",GLSLShader::FRAGMENT))
{
printf("Fragment shader failed to compile!\n%s",
prog.log().c_str());
exit(1);
}
if( ! prog.link() )
{
printf("Shader program failed to link!\n%s",
prog.log().c_str());
exit(1);
}
prog.use();
}
| [
"davidwolff@siggraph.org"
] | davidwolff@siggraph.org |
5a8605477c12fb26a80b1de0b710b17588c2abc9 | b9d4b8041724807be5ef99e6038551cabc27eb0d | /second/x^y/x^y/x^y.cpp | 7711f229385a28dcc1b15dcdb9ec989a25082ef3 | [] | no_license | 2012060100030/secondwork | 4e093ad155d326a13144337623487cd46a650126 | 32606757fe629901459f640c2e5e891857e8beb2 | refs/heads/master | 2021-01-01T06:33:12.067063 | 2013-09-26T14:53:22 | 2013-09-26T14:53:22 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 297 | cpp | #include"stdafx.h"
#include<iostream>
using namespace std;
int f(int x,int n){
if(n==1){
return x;
}
else{
return (x*f(x,n-1));
}
}
int main(){
int x,y;
cout<<"请输入底数x:";
cin>>x;
cout<<"请输入指数y:";
cin>>y;
cout<<"x的y次幂的结果是"<<f(x,y)<<endl;
return 0;
}
| [
"1728368345@qq.com"
] | 1728368345@qq.com |
6313c0403d7050fa3ef663800dfdf2eadd7fde5b | 121c587d63d74ce4c54ebe5a1aa162b6f985b701 | /src/renderer/Constants.hpp | e528450167586a2d8c03026a4f6577f3b90e7f7b | [] | no_license | mlu1109/fps_game | 7ccf6af58c1b5c94d995c32a0b014863b8acc70c | 1c7ee1f50cf8066855f228ee783bd730207c5fa6 | refs/heads/master | 2020-03-10T07:05:51.680214 | 2018-05-16T05:34:50 | 2018-05-16T05:34:50 | 129,254,852 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 878 | hpp | #pragma once
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cmath>
const GLuint ATTRIB_POSITION = 0;
const GLuint ATTRIB_NORMAL = 1;
const GLuint ATTRIB_TEX_COORD = 2;
const GLuint UNIFORM_MODEL_WORLD = 0;
const GLuint UNIFORM_WORLD_VIEW = 1;
const GLuint UNIFORM_VIEW_SCREEN = 2;
const GLuint UNIFORM_MODEL_VIEW_NORMAL = 3;
const GLuint UNIFORM_LIGHT_POSITION = 4;
const GLuint UNIFORM_LIGHT_COLOR = 5;
const GLuint UNIFORM_CAMERA_POSITION = 6;
const GLuint UNIFORM_MATERIAL_AMBIENT = 7;
const GLuint UNIFORM_MATERIAL_DIFFUSE = 8;
const GLuint UNIFORM_MATERIAL_SPECULAR = 9;
const GLuint UNIFORM_MATERIAL_SHINE = 10;
const GLuint UNIFORM_TIME = 11;
const GLuint UNIFORM_TEXTURE_UNIT = 12;
const GLuint UNIFORM_ACTIVE_POINTLIGHTS = 13;
const GLuint UNIFORM_POINTLIGHT_POSITIONS = 14;
const GLuint UNIFORM_POINTLIGHT_COLORS = 34;
const double M_HALF_PI = M_PI/2; | [
"mattilundgren@gmail.com"
] | mattilundgren@gmail.com |
57d0db8c647977f061beea25ce2fcbd5cefe5d35 | 7680b82e6a1caf7e81ebaae6fde6b415ee4b2c8b | /ddzAlrogithm.h | 7427d6157a7a4333cb57ef870e56190e13334995 | [] | no_license | githubMayajie/ddzalgorithm | da1817fd94843b288b26011e52b66505833e6e79 | 106a045e0e5fe9190470dab8a3504e7b408d7353 | refs/heads/master | 2023-06-24T06:44:22.104915 | 2021-07-26T15:38:36 | 2021-07-26T15:38:36 | 387,544,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,693 | h | #ifndef __DDZ_ALROGITHM_H__
#define __DDZ_ALROGITHM_H__
#include <cstdint>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <tuple>
namespace ddzalgorithm{
enum class CardNum : std::uint8_t{
THREE = 0x0,
FOUR = 0x1,
FIVE = 0x2,
SIX = 0x3,
SEVEN = 0x4,
EIGHT = 0x5,
NINE = 0x6,
TEN = 0x7,
JACK = 0x8,
QUEEN = 0x9,
KING = 0xa,
ACE = 0xb,
TWO = 0xc,
};
enum class CardType : std::uint8_t{
HEART = 0x0,
SPADE = 0x1,
CLUB = 0x2,
DIAMONAD = 0x3,
LAIZI = 0x4,
SMALL_JOKER = 0x5,
BIG_JOKER = 0x6,
};
struct Card{
Card(uint8_t input){
origin = input;
type = static_cast<CardType>((input & 0xf0 >> 8));
num = static_cast<CardNum>(input & 0x0f);
}
uint8_t origin;
CardType type;
CardNum num;
//get card only card code(normal use num as code,laizi joker use specifical code)
int getRecordCode() const {
if(static_cast<int>(type) < static_cast<int>(CardType::LAIZI)){
return static_cast<int>(num);
}else if(type == CardType::LAIZI){
return 0xd;
}else if(type == CardType::SMALL_JOKER){
return 0xe;
}else{
return 0xf;
}
}
};
enum class Illegal : std::uint8_t{
//rocket
ROCKET = 0xff,
//bomb (include pure laizi bomb and comb bomb and not laizi bomb)
BOMB_8_PURE_JOKER = 0xef,
BOMB_8_COMB = 0xee,
BOMB_7_PURE_JOKER = 0xed,
BOMB_7_COMB = 0xec,
BOMB_6_PURE_JOKER = 0xeb,
BOMB_6_COMB = 0xea,
BOMB_5_PURE_JOKER = 0xe9,
BOMB_5_COMB = 0xe8,
BOMB_4_PURE_JOKER = 0xe7,
BOMB_4_COMB = 0xe6,
BOMB_4_WITHOU_JOKER = 0xe5,
//single
SINGLE = 0x10,
//pair
PAIR = 0x20,
//triple
TRIPLE_PURE = 0x30,
TRIPLE_WITH_SINGLE = 0x31,
TRIPLE_WITH_PAIR = 0x31,
//single chains
CHAIN_5 = 0x40,
CHAIN_6 = 0x41,
CHAIN_7 = 0x42,
CHAIN_8 = 0x43,
CHAIN_9 = 0x44,
CHAIN_10 = 0x45,
CHAIN_11 = 0x46,
CHAIN_12 = 0x47, //3 ~ ACE 12cards
//pair chains
PAIR_CHAIN_3 = 0x50,
PAIR_CHAIN_4 = 0x51,
PAIR_CHAIN_5 = 0x52,
PAIR_CHAIN_6 = 0x53,
PAIR_CHAIN_7 = 0x54,
PAIR_CHAIN_8 = 0x55,
PAIR_CHAIN_9 = 0x56,
PAIR_CHAIN_10 = 0x57, // 20 cards
//four
FOUR_WITH_TWO_SINGLES = 0x60, //6
FOUR_WITH_TWO_PAIRS = 0x60, //8
//airplane
AIRPLANE_2_NOT_SWINGS = 0x70, //6
AIRPLANE_3_NOT_SWINGS = 0x71,
AIRPLANE_4_NOT_SWINGS = 0x72,
AIRPLANE_5_NOT_SWINGS = 0x73, //15 cards
AIRPLANE_6_NOT_SWINGS = 0x74, //18 cards
AIRPLANE_2_WITH_SMALL_SWINGS = 0x75, //8 cards
AIRPLANE_3_WITH_SMALL_SWINGS = 0x76, //12 cards
AIRPLANE_4_WITH_SMALL_SWINGS = 0x77, //16 cards
AIRPLANE_5_WITH_SMALL_SWINGS = 0x78, //20 cards
AIRPLANE_2_WITH_BIG_SWINGS = 0x79, // 10 cards
AIRPLANE_3_WITH_BIG_SWINGS = 0x7a, // 15 cards
AIRPLANE_4_WITH_BIG_SWINGS = 0x7b, // 20 cards
//space shuttle
SPACE_SHUTTLE_2_NOT_SWINGS = 0x80,//3333 4444
SPACE_SHUTTLE_3_NOT_SWINGS = 0x81,//
SPACE_SHUTTLE_4_NOT_SWINGS = 0x82,//16 cards
SPACE_SHUTTLE_2_WITH_SWINGS = 0x83,//3333 4444 5678
SPACE_SHUTTLE_3_WITH_SWINGS = 0x84,//16 cards
};
struct Token{
Token(Illegal p1,std::vector<uint8_t> p2):
type(p1),
data(p2){}
Illegal type;
std::vector<uint8_t> data;
};
/**
* @return
* illegal token vector
*
* "*" represent laizi
* @input
* input cards
* @maxAirPlane
* max airplane three part value(defualt enable)
* 任何情況下,其三條部分都不能有2 from wikipedia ,i dont know
* @supportShuttle
* support space shuttle
*
*/
std::vector<Token> getToken(std::vector<uint8_t> input,
int maxAirplane = 12,
bool supportShuttle = false
)
{
std::vector<Token> result;
auto totalCardNum = input.size();
std::vector<Card> parseCard(totalCardNum);
for(const auto& one : input)
{
parseCard.emplace_back(one);
}
// get info 3 4 5 6 7, 8 9 10j q k A 2
// int cardNums[13] = {0,0,0,0,0, 0,0,0,0,0, 0,0,0};
const Card* smallJoker = nullptr;
const Card* bigJoker = nullptr;
const Card* laiziCards[2 * 4] = {nullptr};
const Card* normalCards[13][4] = {nullptr};
int normalCardsNum[13] = {0};
int laiziCardsNum = 0;
for(const auto& one: parseCard)
{
if(one.type == CardType::LAIZI){
laiziCards[laiziCardsNum++] = &one;
}else if(one.type == CardType::SMALL_JOKER){
smallJoker = &one;
}else if(one.type == CardType::BIG_JOKER){
bigJoker = &one;
}else{
int num = static_cast<int>(one.num);
normalCards[num][normalCardsNum[num]++] = &one;
}
}
int maxNormalCardsNum = 0;
for(int i = 0; i < 13; i++){
auto num = normalCardsNum[i];
if(num > maxNormalCardsNum){
maxNormalCardsNum = num;
}
}
// 天地癞子
const Card* firstLaiziCards[4];
const Card* secondLaiziCards[4];
int firstLaiziCardsNum = 0;
int secondLaiziCardsNum = 0;
if(laiziCardsNum > 0){
const CardNum cardNum = laiziCards[0]->num;
firstLaiziCards[firstLaiziCardsNum++] = laiziCards[0];
for(int i = 1; i < laiziCardsNum; i++){
const auto& card = laiziCards[i];
if(cardNum == card->num){
firstLaiziCards[firstLaiziCardsNum++] = card;
}else{
secondLaiziCards[secondLaiziCardsNum++] = card;
}
}
}
//rocket
if(smallJoker != nullptr && bigJoker != nullptr){
std::vector<uint8_t> rocket{smallJoker->origin,bigJoker->origin};
result.emplace_back(Illegal::ROCKET,rocket);
}
//bomb max 13 * 5 == 65 loop
if(maxNormalCardsNum + laiziCardsNum >= 4){
int illegal = static_cast<int>(Illegal::BOMB_4_WITHOU_JOKER);
for(int i = 4; i <= 8; i++){
//bomb pure joker,no need to select use those laizi card combination
bool findBomb = false;
if(i <= laiziCardsNum){
std::vector<uint8_t> bomb;
for(int j = 0; j < i; j++){
bomb.emplace_back(laiziCards[j]->origin);
}
result.emplace_back(static_cast<Illegal>(illegal + 2),bomb);
findBomb = true;
}
//bomb combination (soft bomb or not laizi bomb)
auto calcBomb = [&](int useNormalNum,const const Card** normal){
std::vector<uint8_t> bomb;
int j = 0;
for (j = 0; j < useNormalNum; j++){
bomb.emplace_back(normal[j]->origin);
}
for(int k = 0; k < i - useNormalNum; k++){
bomb.emplace_back(laiziCards[k]->origin);
}
//特殊情况,当没有使用癞子,则为正常炸弹
if(useNormalNum == 4 && i == 4){
result.emplace_back(static_cast<Illegal>(illegal),bomb);
}else{
result.emplace_back(static_cast<Illegal>(illegal + 1),bomb);
}
};
if(maxNormalCardsNum + laiziCardsNum >= i){
for(int j = 0; j < 13; j++){
auto normalNum = normalCardsNum[j];
if(normalNum > 0 && normalNum + laiziCardsNum >= i){
findBomb = true;
auto normal = normalCards[j];
//4软炸这里不会生成,只会生成无癞子炸弹,需要手动补上,因为4软炸比4无癞子炸弹大
if(normalNum == 4 && i == 4 && laiziCardsNum >= 1){
calcBomb(3,normal);
}
calcBomb(normalNum,normal);
}
}
}
illegal = illegal + 2;
if(!findBomb){
break;
}
}
}
//single max 13 + 2 = 15 loop
if (totalCardNum >= 1){
std::vector<uint8_t> tempSingles;
for(int i = 0; i < 13; i++){
if(normalCardsNum[i] > 0){
tempSingles.emplace_back(normalCards[i][0]->origin);
}
}
if(laiziCardsNum > 0){
if(firstLaiziCardsNum > 0){
tempSingles.emplace_back(firstLaiziCards[0]->origin);
}
if(secondLaiziCardsNum > 0){
tempSingles.emplace_back(secondLaiziCards[0]->origin);
}
}
if(smallJoker != nullptr){
tempSingles.emplace_back(smallJoker->origin);
}
if(bigJoker != nullptr){
tempSingles.emplace_back(bigJoker->origin);
}
for(const auto& one : tempSingles){
std::vector<uint8_t> single{one};
result.emplace_back(Illegal::SINGLE,single);
}
}
//pair max 13 loop
if(maxNormalCardsNum + laiziCardsNum >= 2){
for(int i = 0; i < 13; i++){
int num = normalCardsNum[i];
if(num > 0 && num + laiziCardsNum >= 2){
const auto& one = normalCards[i];
std::vector<uint8_t> pair(2);
pair.emplace_back(one[0]->origin);
if(num == 1){
pair.emplace_back(laiziCards[0]->origin);
}else{
pair.emplace_back(one[1]->origin);
}
result.emplace_back(Illegal::PAIR,pair);
}
}
if(firstLaiziCardsNum >= 2){
std::vector<uint8_t> pair{firstLaiziCards[0]->origin,firstLaiziCards[1]->origin};
result.emplace_back(Illegal::PAIR,pair);
}
if(secondLaiziCardsNum >= 2){
std::vector<uint8_t> pair{secondLaiziCards[0]->origin,secondLaiziCards[1]->origin};
result.emplace_back(Illegal::PAIR,pair);
}
}
//triple max 13 * (12 + 12) = 312 loop
if(maxNormalCardsNum + laiziCardsNum >= 3){
//1. normal as triple(exclude pure laizi as triple)
for(int i = 0; i < 13; i++){
int num = normalCardsNum[i];
if(num > 0 && num + laiziCardsNum >= 3){
const auto& one = normalCards[i];
std::vector<uint8_t> triple(3);
int useLaiziNum = 0;
if(num == 1){
triple.emplace_back(one[0]->origin);
triple.emplace_back(laiziCards[0]->origin);
triple.emplace_back(laiziCards[1]->origin);
useLaiziNum = 2;
}else if(num == 2){
triple.emplace_back(one[0]->origin);
triple.emplace_back(one[1]->origin);
triple.emplace_back(laiziCards[0]->origin);
useLaiziNum = 1;
}else{
triple.emplace_back(one[0]->origin);
triple.emplace_back(one[1]->origin);
triple.emplace_back(one[2]->origin);
}
result.emplace_back(Illegal::TRIPLE_PURE,triple);
//triple with one
if(totalCardNum >= 4){
std::vector<uint8_t> tempSingles;
for(int j = 0; j < 13; j++){
if(normalCardsNum[j] > 0 && j != i){
tempSingles.emplace_back(normalCards[j][0]->origin);
}
}
if(smallJoker != nullptr){
tempSingles.emplace_back(smallJoker->origin);
}
if(bigJoker != nullptr){
tempSingles.emplace_back(bigJoker->origin);
}
//it's become 4 bomb
// if(laiziCardsNum - useLaiziNum >= 1){
// tempSingles.emplace_back(laiziCards[useLaiziNum]);
// }
for(const auto& one: tempSingles){
std::vector<uint8_t> copyTriple(triple);
copyTriple.emplace_back(one);
result.emplace_back(Illegal::TRIPLE_WITH_SINGLE,copyTriple);
}
}
//triple with pair
int leftLaizi = laiziCardsNum - useLaiziNum;
if(maxNormalCardsNum + leftLaizi >= 2 && totalCardNum >= 5){
std::vector<std::tuple<uint8_t,uint8_t>> tempPairs;
for(int j = 0; j < 13; j++){
int num2 = normalCardsNum[j];
if(num2 > 0 && i != j && num2 + leftLaizi >= 2){
const auto& one = normalCards[j];
if(num2 == 1){
tempPairs.emplace_back(one[0]->origin,laiziCards[useLaiziNum]->origin);
}else{
tempPairs.emplace_back(one[0]->origin,one[1]->origin);
}
}
}
for(const auto& one : tempPairs){
std::vector<uint8_t> copyTriple(triple);
copyTriple.emplace_back(std::get<0>(one));
copyTriple.emplace_back(std::get<1>(one));
result.emplace_back(Illegal::TRIPLE_WITH_PAIR,copyTriple);
}
//it's become 5 comb bomb
// if(leftLaizi >= 2){
// if(firstLaiziCardsNum >= 2){
// calcTriplePair(secondLaiziCardsNum,secondLaiziCards,firstLaiziCardsNum,firstLaiziCards);
// }else if(secondLaiziCardsNum >= 2){
// calcTriplePair(firstLaiziCardsNum,firstLaiziCards,secondLaiziCardsNum,secondLaiziCards);
// }
// }
}
}
}
//2. laizi as triple eg 222 8(*)88 888 as triple
if(laiziCardsNum >= 3){
auto calcLaiziTriple = [&](int firstNum,const Card** first,int secondNum, const Card** second){
int canUserLaiziNum = secondNum;
std::vector<uint8_t> triple{first[0]->origin,first[1]->origin,first[2]->origin};
result.emplace_back(Illegal::TRIPLE_PURE,triple);
if(totalCardNum >= 4){
std::vector<uint8_t> tempSingles;
// it's become 4 comb bomb
if(smallJoker != nullptr){
tempSingles.emplace_back(smallJoker->origin);
}
if(bigJoker != nullptr){
tempSingles.emplace_back(bigJoker->origin);
}
for(const auto& one : tempSingles){
std::vector<uint8_t> copyTriple(triple);
copyTriple.emplace_back(one);
result.emplace_back(Illegal::TRIPLE_WITH_SINGLE,copyTriple);
}
}
// it's become 5 comb bomb or pure laizi bomb
};
if(firstLaiziCardsNum >= 3){
calcLaiziTriple(firstLaiziCardsNum,firstLaiziCards,secondLaiziCardsNum,secondLaiziCards);
}else if(secondLaiziCardsNum >= 3){
calcLaiziTriple(secondLaiziCardsNum,secondLaiziCards,firstLaiziCardsNum,firstLaiziCards);
}
}
}
if(totalCardNum >= 5){
for(int i = 5; i < 13; i++){ //5 - 12
if(i > totalCardNum){
break;
}
bool hasChains = false;
//j表示i链条从哪里开始
for(int j = 0; j < 13 - i; j++){ //0 ~ 8 0 ~ 1
std::vector<uint8_t> chains(i);
std::vector<int> emptyParts;
// 获取链条的数据 从j开始的i链条
for(int k = j; k < i + j; k++){
//kIndex表示chains中的位置
int kIndex = k - j;
if(normalCardsNum[k] > 0){
chains[kIndex] = normalCards[k][0]->origin;
}else{
emptyParts.emplace_back(kIndex);
}
}
int needLaiziNum = emptyParts.size();
if(needLaiziNum <= laiziCardsNum){
for(int k = 0; k < needLaiziNum; k++){
chains[emptyParts[k]] = laiziCards[k]->origin;
}
result.emplace_back(static_cast<Illegal>(static_cast<int>(Illegal::CHAIN_5) + i - 5),chains);
hasChains = true;
}
}
if(!hasChains){
break;
}
}
}
if(totalCardNum >= 6){
//pair chain
for(int i = 3; i < 11; i++){ //3 - 10
int needCardNum = 2 * i;
if(needCardNum > totalCardNum){
break;
}
bool hasChains = false;
for(int j = 0; j < 13 - i; j++){ //0 ~ 8 0 ~ 3
std::vector<uint8_t> chains(needCardNum);
std::vector<int> emptyParts;
for(int k = j; k < i + j; k++){
const auto& one = normalCards[k];
int oneNum = normalCardsNum[k];
int kIndex = 2 * (k - j);
if(oneNum > 1){
chains[kIndex] = one[0]->origin;
chains[kIndex + 1] = one[1]->origin;
}else if(oneNum > 0){
chains[kIndex] = one[0]->origin;
emptyParts.emplace_back(kIndex + 1);
}
else{
emptyParts.emplace_back(kIndex);
emptyParts.emplace_back(kIndex + 1);
}
}
int needLaiziNum = emptyParts.size();
if(needLaiziNum <= laiziCardsNum){
for(int k = 0; k < needLaiziNum; k++){
chains[emptyParts[k]] = laiziCards[k]->origin;
}
result.emplace_back(static_cast<Illegal>(static_cast<int>(Illegal::PAIR_CHAIN_3) + i - 3),chains);
hasChains = true;
}
}
if(!hasChains){
break;
}
}
}
//max 13 * 13 * 6 == 1014 loop
if(totalCardNum >= 6 && maxNormalCardsNum + laiziCardsNum >= 4){
// four with two singles
for(int i = 0; i < 13; i++){
int num = normalCardsNum[i];
if(num > 0 && num + laiziCardsNum >= 4){
const auto& one = normalCards[i];
std::vector<uint8_t> four;
int fourUseLaizi = 0;
for(int j = 0; j < num; j++){
four.emplace_back(one[j]->origin);
}
for(int j = num; j < 4; j++){
four.emplace_back(laiziCards[fourUseLaizi++]->origin);
}
{
//with two singles
std::vector<const Card*> tempSingles;
for(int j = 0; j < 13; j++){
int num2 = normalCardsNum[j];
if(j != i && num2 > 0){
const auto& one2 = normalCards[j];
tempSingles.emplace_back(one2[0]);
//max record two
if(num2 > 1){
tempSingles.emplace_back(one2[1]);
}
}
}
//max 1 laizi,otherwise become 5 soft bomb
if(laiziCardsNum - fourUseLaizi > 0){
tempSingles.emplace_back(laiziCards[fourUseLaizi]);
}
if(smallJoker != nullptr){
tempSingles.emplace_back(smallJoker);
}
if(bigJoker != nullptr){
tempSingles.emplace_back(bigJoker);
}
//unique code map,reduce same result
unsigned char record[16 * 16] = {'\0'};
//remove rocket situation
record[15 * 15 + 15] = '\1';
auto p2Size = tempSingles.size();
if(p2Size >= 2){
for(int i = 0; i < p2Size; i++){
for(int j = i + 1; j < p2Size; j++){
const Card* first = tempSingles[i];
const Card* second = tempSingles[j];
int firstKey = first->getRecordCode();
int secondKey = second->getRecordCode();
int key1 = firstKey * 16 + secondKey;
int key2 = secondKey * 16 + firstKey;
if(record[key1] == '\0' && record[key2] == '\0'){
record[key1] = '\1';
record[key2] = '\1';
std::vector<uint8_t> copyFour(four);
copyFour.emplace_back(first->origin);
copyFour.emplace_back(second->origin);
result.emplace_back(Illegal::FOUR_WITH_TWO_SINGLES,copyFour);
}
}
}
}
}
if(totalCardNum >= 8){
//find first pair
const Card* first[2];
const Card* second[2];
int leftLaiziNum = laiziCardsNum - fourUseLaizi;
for(int j = 0; j < 13; j++){
int firstNum = normalCardsNum[j];
if(firstNum > 0 && firstNum + leftLaiziNum >= 2 && j != i){
int firstUseLaizi = 0;
const auto& firstCards = normalCards[j];
first[0] = firstCards[0];
if(firstNum == 1){
first[1] = laiziCards[fourUseLaizi + (firstUseLaizi++)];
}else{
first[1] = firstCards[1];
}
for(int k = j + 1; k < 13; k++){
int secondNum = normalCardsNum[k];
if(secondNum > 0 && secondNum + (leftLaiziNum - firstUseLaizi) >= 2 && k != i){
const auto& secondCards = normalCards[k];
second[0] = secondCards[0];
if(secondNum == 1){
second[1] = laiziCards[fourUseLaizi + firstUseLaizi];
}else{
second[1] = secondCards[1];
}
std::vector<uint8_t> copyFour(four);
copyFour.emplace_back(first[0]);
copyFour.emplace_back(first[1]);
copyFour.emplace_back(second[0]);
copyFour.emplace_back(second[1]);
result.emplace_back(Illegal::FOUR_WITH_TWO_PAIRS,copyFour);
}
}
// spec: twoPairs(second is same with first)
// 28(*)88 or 2228 all include
if(firstNum + leftLaiziNum >= 4){
const Card* twoPairs[4];
twoPairs[0] = firstCards[0];
int k = 1;
for(k = 1; k < firstNum;k++){
twoPairs[k] = firstCards[k];
}
int pairUseLaiziNum = 0;
for(;k < 4; k++){
twoPairs[k] = laiziCards[fourUseLaizi + pairUseLaiziNum];
++pairUseLaiziNum;
}
std::vector<uint8_t> copyFour(four);
for(k = 0; k < 4; k++){
copyFour.emplace_back(twoPairs[k]);
}
result.emplace_back(Illegal::FOUR_WITH_TWO_PAIRS,copyFour);
}
}
}
//it will beecome 8 comb bomb
// if(leftLaiziNum >= 4){
// }
}
}
}
}
if(totalCardNum >= 6 ){
//airplane without swings
for(int i = 2; i < 7; i++){
int condition = 3 * i;
if(condition > totalCardNum){
break;
}
bool findAirplane = false;
for(int j = 0; j < 13 - i; j++){
std::vector<int> emptyParts;
std::vector<uint8_t> airplane(condition);
std::vector<int> emptyParts;
for(int k = j; k < i + j; k++){
int kIndex = 3 * (k - j);
const auto& one = normalCards[k];
int oneNum = normalCardsNum[k];
if(oneNum >= 3){
airplane[kIndex + 0] = one[0]->origin;
airplane[kIndex + 1] = one[1]->origin;
airplane[kIndex + 2] = one[2]->origin;
}else if(oneNum == 2){
airplane[kIndex + 0] = one[0]->origin;
airplane[kIndex + 1] = one[1]->origin;
emptyParts.emplace_back(kIndex + 2);
}else if(oneNum == 1){
airplane[kIndex + 0] = one[0]->origin;
emptyParts.emplace_back(kIndex + 1);
emptyParts.emplace_back(kIndex + 2);
}else{
emptyParts.emplace_back(kIndex + 0);
emptyParts.emplace_back(kIndex + 1);
emptyParts.emplace_back(kIndex + 2);
}
}
int useLaiziNum = emptyParts.size();
if(useLaiziNum <= laiziCardsNum){
findAirplane = true;
for(int k = 0; k < useLaiziNum; k++){
airplane[emptyParts[k]] = laiziCards[k]->origin;
}
result.emplace_back(static_cast<Illegal>(static_cast<int>(Illegal::AIRPLANE_2_NOT_SWINGS) + i - 2),airplane);
}
//with small wings
if(findAirplane && totalCardNum >= condition + i){
//too many choice,its exhausted
//2 3 4 5
}
if(findAirplane && totalCardNum >= condition + 2 * i){
}
}
if(!findAirplane){
break;
}
}
}
}
}
#endif//__DDZ_ALGORITHM_H__ | [
"work_mayajie@163.com"
] | work_mayajie@163.com |
62458c0b38ae18b79f1f632b95a8ba81018b124a | d9f66c812c7287187563a15d1dc72e08cf1eaa91 | /Source/Core/OpenNI.cpp | 8c4e608fde47bc4ea641b8e5b11f9d85724b3158 | [
"Apache-2.0",
"IJG",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Delicode/OpenNI2 | 9c722138a9e45a887dda93b8522a523c59f3376d | 99dd4e7d9f3c08a8e31b9dc9c0fd4d7448bc6ea0 | refs/heads/master | 2021-06-06T00:19:11.533537 | 2021-04-28T08:33:33 | 2021-04-28T08:33:33 | 362,108,942 | 0 | 0 | Apache-2.0 | 2021-04-27T12:44:15 | 2021-04-27T12:44:14 | null | UTF-8 | C++ | false | false | 15,898 | cpp | /*****************************************************************************
* *
* OpenNI 2.x Alpha *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* 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 "OniContext.h"
#include "OniVersion.h"
#include "OniProperties.h"
#include "OniInternal.h"
#include <XnLog.h>
oni::implementation::Context g_Context;
ONI_C_API OniStatus oniInitialize(int /*apiVersion*/)
{
g_Context.clearErrorLogger();
OniStatus rc = g_Context.initialize();
return rc;
}
ONI_C_API void oniShutdown()
{
g_Context.clearErrorLogger();
g_Context.shutdown();
}
ONI_C_API OniStatus oniGetDeviceList(OniDeviceInfo** pDevices, int* pDeviceCount)
{
g_Context.clearErrorLogger();
return g_Context.getDeviceList(pDevices, pDeviceCount);
}
ONI_C_API OniStatus oniReleaseDeviceList(OniDeviceInfo* pDevices)
{
g_Context.clearErrorLogger();
return g_Context.releaseDeviceList(pDevices);
}
struct DeviceHandles
{
OniCallbackHandle deviceConnectedHandle;
OniCallbackHandle deviceDisconnectedHandle;
OniCallbackHandle deviceStateChangedHandle;
void* pCookie;
};
ONI_C_API OniStatus oniRegisterDeviceCallbacks(OniDeviceCallbacks* pCallbacks, void* pCookie, OniCallbackHandle* pHandle)
{
g_Context.clearErrorLogger();
DeviceHandles* pDeviceHandles = XN_NEW(DeviceHandles);
XN_VALIDATE_PTR(pDeviceHandles, ONI_STATUS_ERROR);
pDeviceHandles->deviceConnectedHandle = NULL;
pDeviceHandles->deviceDisconnectedHandle = NULL;
pDeviceHandles->deviceStateChangedHandle = NULL;
pDeviceHandles->pCookie = pCookie;
g_Context.registerDeviceConnectedCallback(pCallbacks->deviceConnected, pCookie, pDeviceHandles->deviceConnectedHandle);
g_Context.registerDeviceDisconnectedCallback(pCallbacks->deviceDisconnected, pCookie, pDeviceHandles->deviceDisconnectedHandle);
g_Context.registerDeviceStateChangedCallback(pCallbacks->deviceStateChanged, pCookie, pDeviceHandles->deviceStateChangedHandle);
*pHandle = (OniCallbackHandle)pDeviceHandles;
return ONI_STATUS_OK;
}
ONI_C_API void oniUnregisterDeviceCallbacks(OniCallbackHandle handle)
{
g_Context.clearErrorLogger();
DeviceHandles* pDevicesHandles = (DeviceHandles*)handle;
if (pDevicesHandles == NULL)
{
return;
}
g_Context.unregisterDeviceConnectedCallback(pDevicesHandles->deviceConnectedHandle);
g_Context.unregisterDeviceDisconnectedCallback(pDevicesHandles->deviceDisconnectedHandle);
g_Context.unregisterDeviceStateChangedCallback(pDevicesHandles->deviceStateChangedHandle);
XN_DELETE(pDevicesHandles);
}
ONI_C_API OniStatus oniWaitForAnyStream(OniStreamHandle* pStreams, int streamCount, int* pStreamIndex, int timeout)
{
g_Context.clearErrorLogger();
return g_Context.waitForStreams(pStreams, streamCount, pStreamIndex, timeout);
}
ONI_C_API const char* oniGetExtendedError()
{
return g_Context.getExtendedError();
}
ONI_C_API OniVersion oniGetVersion()
{
g_Context.clearErrorLogger();
OniVersion version;
version.major = ONI_VERSION_MAJOR;
version.minor = ONI_VERSION_MINOR;
version.maintenance = ONI_VERSION_MAINTENANCE;
version.build = ONI_VERSION_BUILD;
return version;
}
ONI_C_API int oniFormatBytesPerPixel(OniPixelFormat format)
{
g_Context.clearErrorLogger();
switch (format)
{
case ONI_PIXEL_FORMAT_GRAY8:
return 1;
case ONI_PIXEL_FORMAT_DEPTH_1_MM:
case ONI_PIXEL_FORMAT_DEPTH_100_UM:
case ONI_PIXEL_FORMAT_SHIFT_9_2:
case ONI_PIXEL_FORMAT_SHIFT_9_3:
case ONI_PIXEL_FORMAT_GRAY16:
return 2;
case ONI_PIXEL_FORMAT_RGB888:
return 3;
case ONI_PIXEL_FORMAT_YUV422:
case ONI_PIXEL_FORMAT_YUYV:
return 2;
case ONI_PIXEL_FORMAT_JPEG:
return 1;
default:
XN_ASSERT(FALSE);
return 0;
}
}
/////////
ONI_C_API OniStatus oniDeviceOpen(const char* uri, OniDeviceHandle* pDevice)
{
return oniDeviceOpenEx(uri, NULL, pDevice);
}
ONI_C_API OniStatus oniDeviceOpenEx(const char* uri, const char* mode, OniDeviceHandle* pDevice)
{
g_Context.clearErrorLogger();
return g_Context.deviceOpen(uri, mode, pDevice);
}
ONI_C_API OniStatus oniDeviceClose(OniDeviceHandle device)
{
g_Context.clearErrorLogger();
if (!oni::implementation::Context::s_valid)
{
return ONI_STATUS_ERROR;
}
return g_Context.deviceClose(device);
}
ONI_C_API OniStatus oniDeviceGetInfo(OniDeviceHandle device, OniDeviceInfo* pInfo)
{
g_Context.clearErrorLogger();
const OniDeviceInfo* pDeviceInfo = device->pDevice->getInfo();
xnOSMemCopy(pInfo, pDeviceInfo, sizeof(OniDeviceInfo));
return ONI_STATUS_OK;
}
ONI_C_API const OniSensorInfo* oniDeviceGetSensorInfo(OniDeviceHandle device, OniSensorType sensorType)
{
g_Context.clearErrorLogger();
return g_Context.getSensorInfo(device, sensorType);
}
ONI_C_API OniStatus oniDeviceCreateStream(OniDeviceHandle device, OniSensorType sensorType, OniStreamHandle* pStream)
{
g_Context.clearErrorLogger();
return g_Context.createStream(device, sensorType, pStream);
}
ONI_C_API OniStatus oniDeviceEnableDepthColorSync(OniDeviceHandle device)
{
g_Context.clearErrorLogger();
return device->pDevice->enableDepthColorSync(&g_Context);
}
ONI_C_API void oniDeviceDisableDepthColorSync(OniDeviceHandle device)
{
g_Context.clearErrorLogger();
device->pDevice->disableDepthColorSync();
}
ONI_C_API OniBool oniDeviceGetDepthColorSyncEnabled(OniDeviceHandle device)
{
g_Context.clearErrorLogger();
return device->pDevice->isDepthColorSyncEnabled();
}
ONI_C_API OniStatus oniDeviceSetProperty(OniDeviceHandle device, int propertyId, const void* data, int dataSize)
{
g_Context.clearErrorLogger();
return device->pDevice->setProperty(propertyId, data, dataSize);
}
ONI_C_API OniStatus oniDeviceGetProperty(OniDeviceHandle device, int propertyId, void* data, int* pDataSize)
{
g_Context.clearErrorLogger();
return device->pDevice->getProperty(propertyId, data, pDataSize);
}
ONI_C_API OniBool oniDeviceIsPropertySupported(OniDeviceHandle device, int propertyId)
{
g_Context.clearErrorLogger();
return device->pDevice->isPropertySupported(propertyId);
}
ONI_C_API OniStatus oniDeviceInvoke(OniDeviceHandle device, int commandId, void* data, int dataSize)
{
g_Context.clearErrorLogger();
return device->pDevice->invoke(commandId, data, dataSize);
}
ONI_C_API OniBool oniDeviceIsCommandSupported(OniDeviceHandle device, int commandId)
{
g_Context.clearErrorLogger();
return device->pDevice->isCommandSupported(commandId);
}
ONI_C_API OniBool oniDeviceIsImageRegistrationModeSupported(OniDeviceHandle device, OniImageRegistrationMode mode)
{
g_Context.clearErrorLogger();
return device->pDevice->isImageRegistrationModeSupported(mode);
}
/////////
ONI_C_API void oniStreamDestroy(OniStreamHandle stream)
{
g_Context.clearErrorLogger();
if (!oni::implementation::Context::s_valid)
{
return;
}
g_Context.streamDestroy(stream);
}
ONI_C_API const OniSensorInfo* oniStreamGetSensorInfo(OniStreamHandle stream)
{
g_Context.clearErrorLogger();
return g_Context.getSensorInfo(stream);
}
ONI_C_API OniStatus oniStreamStart(OniStreamHandle stream)
{
g_Context.clearErrorLogger();
return stream->pStream->start();
}
ONI_C_API void oniStreamStop(OniStreamHandle stream)
{
g_Context.clearErrorLogger();
if (stream == NULL || !oni::implementation::Context::s_valid)
{
return;
}
stream->pStream->stop();
}
ONI_C_API OniStatus oniStreamReadFrame(OniStreamHandle stream, OniFrame** pFrame)
{
g_Context.clearErrorLogger();
return g_Context.readFrame(stream, pFrame);
}
struct OniNewFrameCookie
{
OniStreamHandle streamHandle;
OniNewFrameCallback handler;
void* pCookie;
XnCallbackHandle handle;
};
void ONI_CALLBACK_TYPE OniNewFrameTranslationHandler(void* pCookie)
{
OniNewFrameCookie* pNewFrameCookie = (OniNewFrameCookie*)pCookie;
(*pNewFrameCookie->handler)(pNewFrameCookie->streamHandle, pNewFrameCookie->pCookie);
}
ONI_C_API OniStatus oniStreamRegisterNewFrameCallback(OniStreamHandle stream, OniNewFrameCallback handler, void* pCookie, OniCallbackHandle* pHandle)
{
g_Context.clearErrorLogger();
if (*pHandle != NULL)
{
// Already registered to something
g_Context.addToLogger("Can't register same listener instance to multiple events");
return ONI_STATUS_ERROR;
}
OniNewFrameCookie* pNewFrameCookie = XN_NEW(OniNewFrameCookie);
XN_VALIDATE_PTR(pNewFrameCookie, ONI_STATUS_ERROR);
pNewFrameCookie->streamHandle = stream;
pNewFrameCookie->handler = handler;
pNewFrameCookie->pCookie = pCookie;
*pHandle = (OniCallbackHandle)pNewFrameCookie;
return stream->pStream->registerNewFrameCallback(OniNewFrameTranslationHandler, pNewFrameCookie, &(pNewFrameCookie->handle));
}
ONI_C_API void oniStreamUnregisterNewFrameCallback(OniStreamHandle stream, OniCallbackHandle handle)
{
g_Context.clearErrorLogger();
OniNewFrameCookie* pNewFrameCookie = (OniNewFrameCookie*)handle;
if (pNewFrameCookie == NULL)
{
return;
}
if (oni::implementation::Context::s_valid)
{
stream->pStream->unregisterNewFrameCallback(pNewFrameCookie->handle);
}
XN_DELETE(pNewFrameCookie);
}
ONI_C_API OniStatus oniStreamSetProperty(OniStreamHandle stream, int propertyId, const void* data, int dataSize)
{
g_Context.clearErrorLogger();
return stream->pStream->setProperty(propertyId, data, dataSize);
}
ONI_C_API OniStatus oniStreamGetProperty(OniStreamHandle stream, int propertyId, void* data, int* pDataSize)
{
g_Context.clearErrorLogger();
return stream->pStream->getProperty(propertyId, data, pDataSize);
}
ONI_C_API OniBool oniStreamIsPropertySupported(OniStreamHandle stream, int propertyId)
{
g_Context.clearErrorLogger();
return stream->pStream->isPropertySupported(propertyId);
}
ONI_C_API OniStatus oniStreamInvoke(OniStreamHandle stream, int commandId, void* data, int dataSize)
{
g_Context.clearErrorLogger();
return stream->pStream->invoke(commandId, data, dataSize);
}
ONI_C_API OniBool oniStreamIsCommandSupported(OniStreamHandle stream, int commandId)
{
g_Context.clearErrorLogger();
return stream->pStream->isCommandSupported(commandId);
}
ONI_C_API OniStatus oniStreamSetFrameBuffersAllocator(OniStreamHandle stream, OniFrameAllocBufferCallback alloc, OniFrameFreeBufferCallback free, void* pCookie)
{
g_Context.clearErrorLogger();
return stream->pStream->setFrameBufferAllocator(alloc, free, pCookie);
}
////
ONI_C_API void oniFrameRelease(OniFrame* pFrame)
{
g_Context.clearErrorLogger();
if (!oni::implementation::Context::s_valid)
{
return;
}
g_Context.frameRelease(pFrame);
}
ONI_C_API void oniFrameAddRef(OniFrame* pFrame)
{
g_Context.clearErrorLogger();
g_Context.frameAddRef(pFrame);
}
//////////////////////////////////////////////////////////////////////////
// Recorder
//////////////////////////////////////////////////////////////////////////
ONI_C_API OniStatus oniCreateRecorder(
const char* fileName,
OniRecorderHandle* pRecorder)
{
g_Context.clearErrorLogger();
return g_Context.recorderOpen(fileName, pRecorder);
}
ONI_C_API OniStatus oniRecorderAttachStream(
OniRecorderHandle recorder,
OniStreamHandle stream,
OniBool allowLossyCompression)
{
g_Context.clearErrorLogger();
// Validate parameters.
if (NULL == recorder || NULL == recorder->pRecorder ||
NULL == stream || NULL == stream->pStream)
{
return ONI_STATUS_BAD_PARAMETER;
}
// Attach a stream to the recorder.
return recorder->pRecorder->attachStream(
*stream->pStream, allowLossyCompression);
}
ONI_C_API OniStatus oniRecorderStart(OniRecorderHandle recorder)
{
g_Context.clearErrorLogger();
// Validate parameters.
if (NULL == recorder || NULL == recorder->pRecorder)
{
return ONI_STATUS_BAD_PARAMETER;
}
return recorder->pRecorder->start();
}
ONI_C_API void oniRecorderStop(OniRecorderHandle recorder)
{
g_Context.clearErrorLogger();
// Validate parameters.
if (NULL == recorder || NULL == recorder->pRecorder)
{
return;
}
recorder->pRecorder->stop();
}
ONI_C_API OniStatus oniRecorderDestroy(OniRecorderHandle* pRecorder)
{
g_Context.clearErrorLogger();
return g_Context.recorderClose(pRecorder);
}
ONI_C_API void oniWriteLogEntry(const char* mask, int severity, const char* message)
{
xnLogWrite(mask, (XnLogSeverity)severity, "External", 0, message);
}
ONI_C_API OniStatus oniSetLogOutputFolder(const char* strOutputFolder)
{
XnStatus rc = xnLogSetOutputFolder((XnChar*)strOutputFolder);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
ONI_C_API OniStatus oniGetLogFileName(char* strFileName, int nBufferSize)
{
XnStatus rc = xnLogGetFileName((XnChar*)strFileName, (XnUInt32)nBufferSize);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
ONI_C_API OniStatus oniSetLogMinSeverity(int nMinSeverity)
{
XnStatus rc = xnLogSetMaskMinSeverity(XN_LOG_MASK_ALL, (XnLogSeverity)nMinSeverity);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
ONI_C_API OniStatus oniSetLogConsoleOutput(OniBool bConsoleOutput)
{
XnStatus rc = xnLogSetConsoleOutput(bConsoleOutput);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
ONI_C_API OniStatus oniSetLogFileOutput(OniBool bFileOutput)
{
XnStatus rc = xnLogSetFileOutput(bFileOutput);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
#if ONI_PLATFORM == ONI_PLATFORM_ANDROID_ARM
ONI_C_API OniStatus oniSetLogAndroidOutput(OniBool bAndroidOutput)
{
XnStatus rc = xnLogSetAndroidOutput((XnBool)bAndroidOutput);
if (rc != XN_STATUS_OK)
return ONI_STATUS_ERROR;
return ONI_STATUS_OK;
}
#endif
ONI_C_API OniStatus oniCoordinateConverterDepthToWorld(OniStreamHandle depthStream, float depthX, float depthY, float depthZ, float* pWorldX, float* pWorldY, float* pWorldZ)
{
g_Context.clearErrorLogger();
return depthStream->pStream->convertDepthToWorldCoordinates(depthX, depthY, depthZ, pWorldX, pWorldY, pWorldZ);
}
ONI_C_API OniStatus oniCoordinateConverterWorldToDepth(OniStreamHandle depthStream, float worldX, float worldY, float worldZ, float* pDepthX, float* pDepthY, float* pDepthZ)
{
g_Context.clearErrorLogger();
return depthStream->pStream->convertWorldToDepthCoordinates(worldX, worldY, worldZ, pDepthX, pDepthY, pDepthZ);
}
ONI_C_API OniStatus oniCoordinateConverterDepthToColor(OniStreamHandle depthStream, OniStreamHandle colorStream, int depthX, int depthY, OniDepthPixel depthZ, int* pColorX, int* pColorY)
{
g_Context.clearErrorLogger();
return depthStream->pStream->convertDepthToColorCoordinates(colorStream->pStream, depthX, depthY, depthZ, pColorX, pColorY);
}
XN_API_EXPORT_INIT() | [
"eddie.cohen@primesense.com"
] | eddie.cohen@primesense.com |
dce5f05e8a78fdb377ed293d9589f4f9fd41d323 | de738ce5da87cb540384405407a210d4b37aeddf | /II/doble/supernodo.cpp | fa799941ce9114a36fbbb32dc73869405fc016a4 | [] | no_license | rherdez/clase_Algoritmos | ff66f61b166b55f63d40b49e6662da6e7801a82f | 50af6f47c35976ba7af39d31bf9d93eee7cef966 | refs/heads/master | 2023-08-24T19:12:16.518569 | 2021-11-11T01:58:07 | 2021-11-11T01:58:07 | 417,285,721 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23 | cpp | #include "supernodo.h"
| [
"roberto.herna@gmail.com"
] | roberto.herna@gmail.com |
963d5ca2458c33a0ca4b2d5a7a1c7b410a6cc760 | 64fe4f897f21a075e27b3c05b736b2fd70329e6b | /WordSearch.cpp | 21152f4b5fab5cdb02a41109180f990f283295d5 | [] | no_license | re3el/LeetCode | ec70383adc0455b7582674aa95695251ce5b5854 | 82a4ba979cc7cb3d3ddb726a5084a3362d2d6993 | refs/heads/master | 2023-06-09T15:45:52.804579 | 2018-01-27T22:07:05 | 2018-01-27T22:07:05 | 104,426,137 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,117 | cpp | class Solution {
int m,n;
public:
bool checkNow(vector<vector<char>>& board, string word, int i, int j)
{
if(word.size() == 0) return true;
if(i < 0 || j < 0 || i >=m || j >= n || board[i][j] == ' ' || board[i][j] != word[0]) return false;
char a = board[i][j];
board[i][j] = ' ';
string sub = word.substr(1);
bool res = (checkNow(board,sub,i+1,j) || checkNow(board,sub,i-1,j)
|| checkNow(board,sub,i,j+1) || checkNow(board,sub,i,j-1));
board[i][j] = a;
return res;
}
bool exist(vector<vector<char>>& board, string word)
{
m = board.size();
if(m == 0) return false;
n = board[0].size();
for(int i=0; i<m; i++)
{
for(int j=0; j<n; j++)
{
if(board[i][j] == word[0])
{
if (checkNow(board,word,i,j) == true)
return true;
}
}
}
return false;
}
}; | [
"re3el@users.noreply.github.com"
] | re3el@users.noreply.github.com |
4ee887632348cd4cca2ebb963b33b5b567284926 | a0b5c81aecb51ee35d8bc22458fb75b0d8575e46 | /TypeSystem/GoalType.h | 71c456a3b357f93a130a8af680b80ced75abc7b0 | [] | no_license | open-goal/jak-disassembler | 0b5c72e51dd1e8bd90dfbdcb5b5a73b1979208e0 | bd3f664fd9131d92a7185a24264cb3b88b00a44c | refs/heads/master | 2023-03-21T06:35:55.471958 | 2022-07-27T16:34:28 | 2022-07-27T16:34:28 | 282,662,400 | 15 | 4 | null | 2022-07-27T16:34:29 | 2020-07-26T14:05:47 | C++ | UTF-8 | C++ | false | false | 517 | h | #ifndef JAK_DISASSEMBLER_GOALTYPE_H
#define JAK_DISASSEMBLER_GOALTYPE_H
#include <string>
class GoalType {
public:
GoalType() = default;
GoalType(std::string name) : m_name(std::move(name)) { }
bool has_info() const {
return m_has_info;
}
bool has_method_count() const {
return m_method_count_set;
}
void set_methods(int n);
private:
std::string m_name;
bool m_has_info = false;
bool m_method_count_set = false;
int m_method_count = -1;
};
#endif // JAK_DISASSEMBLER_GOALTYPE_H
| [
"awaterford111445@gmail.com"
] | awaterford111445@gmail.com |
fa0c32152475564061f87a49d56e36d22f82fcd4 | 60a4d423afbe8340decbed593a85585fd0ab5b4c | /Source/LoggingWrapper/NativeLoggerWrapper.cpp | 339b590b3bf2c03741c9e198bdde0fa0a4aabcf2 | [] | no_license | Lukemtesta/LoggingWrapper | 2317cd1098d0af036e325ea8674fd903489be9d9 | e6d9001584d34cee6a85fd3e79d24565bca8a008 | refs/heads/master | 2023-06-28T23:16:59.978828 | 2016-05-03T07:21:39 | 2016-05-03T07:21:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,210 | cpp | #include "stdafx.h"
#include "NativeLoggerWrapper.h"
NativeLoggingWrapper::~NativeLoggingWrapper()
{
m_Logger->LogDebugHigh("Logger destroyed.");
delete m_Logger;
}
NativeLoggingWrapper::NativeLoggingWrapper(const char *typeName)
{
m_Logger = gcnew Logger(gcnew String(typeName));
}
/// <summary>
/// Determines if the current logger will log for the specified level.
/// </summary>
/// <param name="nLevel">Numeric representation of a logging level.</param>
bool NativeLoggingWrapper::WillLog(UNSIGNED32 nLevel)
{
auto level = GetLevel(nLevel);
bool bRtn = m_Logger->WillLog(*level);
delete level;
return bRtn;
}
/// <summary>
/// Changes the logging level of the current logger dynamically.
/// If you don't know you need to use it, it's preferable not to.
/// </summary>
/// <param name="nLevel">Numeric representation of a logging level.</param>
void NativeLoggingWrapper::SetLoggerLevel(UNSIGNED32 nLevel)
{
auto level = GetLevel(nLevel);
m_Logger->SetLoggingLevel(*level);
delete level;
}
/// <summary>
/// Logs the message to the specified level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::Log(UNSIGNED32 nLevel, const char* message)
{
auto level = GetLevel(nLevel);
m_Logger->Log(*level, gcnew String(message));
}
/// <summary>
/// Logs the message to the specified level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogFormat(UNSIGNED32 nLevel, char* message, ...)
{
va_list params;
va_start(params, message);
LogFormatEx(nLevel, message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the specified level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogFormatEx(UNSIGNED32 nLevel, char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
Log(nLevel, temp);
delete temp;
}
/// <summary>
/// Logs the message to the Emergency level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogEmergency(char* message)
{
m_Logger->LogEmergency(gcnew String(message));
}
/// <summary>
/// Logs the message to the Emergency level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogEmergencyFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogEmergencyFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Emergency level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogEmergencyFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogEmergency(temp);
delete temp;
}
/// <summary>
/// Logs the message to the Fatal level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogFatal(char* message)
{
m_Logger->LogFatal(gcnew String(message));
}
/// <summary>
/// Logs the message to the Fatal level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogFatalFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogFatalFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Fatal level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogFatalFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogFatal(temp);
delete temp;
}
/// <summary>
/// Logs the message to the Error level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogError(char* message)
{
m_Logger->LogError(gcnew String(message));
}
/// <summary>
/// Logs the message to the Error level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogErrorFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogErrorFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Error level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogErrorFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogError(temp);
delete temp;
}
/// <summary>
/// Logs the message to the warning level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogWarning(char* message)
{
m_Logger->LogWarning(gcnew String(message));
}
/// <summary>
/// Logs the message to the warning level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogWarningFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogWarningFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the warning level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogWarningFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogWarning(temp);
delete temp;
}
/// <summary>
/// Logs the message to the Information level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogInfo(char* message)
{
m_Logger->LogInfo(gcnew String(message));
}
/// <summary>
/// Logs the message to the Information level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogInfoFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogInfoFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Information level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogInfoFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogInfo(temp);
delete temp;
}
/// <summary>
/// Logs the message to the Notice level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogNotice(char* message)
{
m_Logger->LogNotice(gcnew String(message));
}
/// <summary>
/// Logs the message to the Notice level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogNoticeFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogNoticeFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Notice level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogNoticeFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogNotice(temp);
delete temp;
}
/// <summary>
/// Logs the message to the Debug level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebug(char* message)
{
m_Logger->LogDebug(gcnew String(message));
}
/// <summary>
/// Logs the message to the Debug level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogDebugFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the Debug level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format params</param>
void NativeLoggingWrapper::LogDebugFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogDebug(temp);
delete temp;
}
/// <summary>
/// Logs the message to the DebugMedium level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugMedium(char* message)
{
m_Logger->LogDebugMedium(gcnew String(message));
}
/// <summary>
/// Logs the message to the DebugMedium level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugMediumFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogDebugMediumFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the DebugMedium level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogDebugMediumFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogDebugMedium(temp);
delete temp;
}
/// <summary>
/// Logs the message to the DebugHigh level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugHigh(char* message)
{
m_Logger->LogDebugHigh(gcnew String(message));
}
/// <summary>
/// Logs the message to the DebugHigh level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugHighFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogDebugHighFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the DebugHigh level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format parameters</param>
void NativeLoggingWrapper::LogDebugHighFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogDebugHigh(temp);
delete temp;
}
/// <summary>
/// Logs the message to the DebugAll level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugAll(char* message)
{
m_Logger->LogDebugAll(gcnew String(message));
}
/// <summary>
/// Logs the message to the DebugAll level.
/// </summary>
/// <param name="message">The message.</param>
void NativeLoggingWrapper::LogDebugAllFormat(char* message, ...)
{
va_list params;
va_start(params, message);
LogDebugAllFormatEx(message, params);
va_end(params);
}
/// <summary>
/// Logs the message to the DebugAll level.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="params">format params</param>
void NativeLoggingWrapper::LogDebugAllFormatEx(char* message, va_list params)
{
char *temp = GetFormattedStr(message, params);
LogDebugAll(temp);
delete temp;
}
char* NativeLoggingWrapper::GetFormattedStr(char* message, va_list params)
{
int size = _vscprintf(message, params);
char *temp = (char*)malloc(size+1);
vsnprintf_s(temp, size + 1, size + 1, message, params);
return temp;
}
gcroot<Level^>* NativeLoggingWrapper::GetLevel(UNSIGNED32 nLevel)
{
Level^ level;
switch (nLevel)
{
case LOGGING_LEVEL_NONE:
level = Level::Off;
break;
case LOGGING_LEVEL_FATAL:
level = Level::Fatal;
break;
case LOGGING_LEVEL_ERROR:
level = Level::Error;
break;
case LOGGING_LEVEL_WARNING:
level = Level::Warn;
break;
case LOGGING_LEVEL_INFO:
level = Level::Info;
break;
case LOGGING_LEVEL_DEBUGLOW:
level = Level::Debug;
break;
case LOGGING_LEVEL_DEBUGMEDIUM:
level = Level::Trace;
break;
case LOGGING_LEVEL_DEBUGHIGH:
level = Level::Verbose;
break;
case LOGGING_LEVEL_DEBUGALL:
level = Level::Finest;
break;
default:
level = Level::Error;
break;
}
return new gcroot<Level^>(level);
}
/// <summary>
/// Creates an instance of the wrapper implementation.
/// </summary>
/// <param name="typeName">Name of the type that will be logged for.</param>
/// <returns>A new instance of INativeLoggingWrapper.</returns>
INativeLoggingWrapper *INativeLoggingWrapper::CreateWrapper(const char *typeName)
{
return ((INativeLoggingWrapper *)new NativeLoggingWrapper(typeName));
} | [
"ahunn@surgeforward.com"
] | ahunn@surgeforward.com |
9ac31b302c37689c6465d8fb311d756d3d6ff9eb | 5fee446e64cf465011fe9a350b19667845f8c0fa | /week-02/day-3/write_multiple_lines/main.cpp | 01a4ae5bd7721cee98e7021d67ab548b3d205ffc | [] | no_license | green-fox-academy/Gabikka | 4ca5373845ae0ad3c0f44419c1b7d5b36c2ac5ef | 5caea171d969eceb569566c7143f77578cae7410 | refs/heads/master | 2020-04-16T11:56:47.388641 | 2019-02-05T16:22:58 | 2019-02-05T16:22:58 | 165,558,287 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,482 | cpp | #include <iostream>
#include <fstream>
#include <string>
int myFunction (std::string, std::string, int);
// Create a function that takes 3 parameters: a path, a word and a number,
// than it should write to a file.
// The path parameter should describes the location of the file.
// The word parameter should be a string, that will be written to the file as lines
// The number paramter should describe how many lines the file should have.
// So if the word is "apple" and the number is 5, than it should write 5 lines
// to the file and each line should be "apple"
int main() {
std::string userPath;
std::string userLines;
int userNumber;
std::cout << "Let's create a file!\n Please write a name for the file:" << std::endl;
std:: cin >> userPath;
std::cout << "Great!\n Now write something we should put in it:" << std::endl;
std::cin >> userLines;
std::cout << "Awesome!˛\n Please give a number how many time we should add your world to the file" << std::endl;
std::cin >> userNumber;
/*std::string myPath ("write_multiple_lines.txt");
std::string myLines ("Nem adom fel!");
int a = 3;
myFunction (myPath, myLines, a);*/
myFunction (userPath, userLines, userNumber);
std::cout << "Awesome, uh?";
return 0;
}
int myFunction (std::string path, std::string lines, int numberOfLines){
std::ofstream myFile;
myFile.open(path);
for(int i = 0; i < 3; i++) {
myFile << lines << "\n";
}
} | [
"levelgabonak@gmail.com"
] | levelgabonak@gmail.com |
4cd5033df37acc9daca5582b9129b6dd89f00efd | 8bc6ae4181d8dd7c305532c85dcff4609405bd99 | /Overmind/Dll.cpp | 820af9a8e4779bbdc2cba4f4b8b72a356dfa3af7 | [] | no_license | pokenshin/BWAPI_Bots | c6eee5d2d6264ef3963ef8f40e9b7322070ef40c | c46f888b24e0f460df09bd032bd2035040b19dcc | refs/heads/master | 2021-01-09T06:00:01.808326 | 2017-02-12T23:27:23 | 2017-02-12T23:27:23 | 80,866,912 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 439 | cpp | #include <BWAPI.h>
#include "Overmind.h"
extern "C" __declspec(dllexport) void gameInit(BWAPI::Game* game) { BWAPI::BroodwarPtr = game; }
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
extern "C" __declspec(dllexport) BWAPI::AIModule* newAIModule()
{
return new Overmind();
}
| [
"pokenshin@hotmail.com"
] | pokenshin@hotmail.com |
89025ef87c86109b3586e206b1e65eef1f28e85c | 088e000eb5f16e6d0d56c19833b37de4e67d1097 | /inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/binary_convolution/binary_convolution_params.cpp | 93a103eff8f737a282a4780935ea9f2c56bd8d8e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | projectceladon/dldt | 614ba719a428cbb46d64ab8d1e845ac25e85a53e | ba6e22b1b5ee4cbefcc30e8d9493cddb0bb3dfdf | refs/heads/2019 | 2022-11-24T10:22:34.693033 | 2019-08-09T16:02:42 | 2019-08-09T16:02:42 | 204,383,002 | 1 | 1 | Apache-2.0 | 2022-11-22T04:06:09 | 2019-08-26T02:48:52 | C++ | UTF-8 | C++ | false | false | 1,579 | cpp | /*
// Copyright (c) 2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/
#include "binary_convolution_params.h"
#include <sstream>
#include <string>
namespace kernel_selector {
std::string binary_convolution_params::to_string() const {
std::stringstream s;
s << base_params::to_string() << "_";
s << filterSize.x << "_" << filterSize.y << "_";
s << stride.x << "_" << stride.y << "_";
s << dilation.x << "_" << dilation.y << "_";
s << padding.x << "_" << padding.y << "_";
s << split;
s << groups;
return s.str();
}
ParamsKey binary_convolution_params::GetParamsKey() const {
ParamsKey k = weight_bias_params::GetParamsKey();
if (split > 1) {
k.EnableSplitSupport();
}
if (dilation.x != 1 ||
dilation.y != 1) {
k.EnableDilation();
}
if (depthwise_separable_opt) {
k.EnableDepthwiseSeparableOpt();
}
if (groups > 1 && !depthwise_separable_opt) {
k.EnableGroupedConvolution();
}
return k;
}
} // namespace kernel_selector
| [
"44090433+openvino-pushbot@users.noreply.github.com"
] | 44090433+openvino-pushbot@users.noreply.github.com |
84130aca09b35ae5932c095ff8477591f899171e | e2fbc89de64a9e7e3e62fafaf3ab2b917977e9ab | /Plugins/VRExpansionPlugin/Intermediate/Build/Win64/UE4Editor/Inc/VRExpansionPlugin/VRExpansionPlugin.init.gen.cpp | f70d88b7aa6191465db05e7626763e9f2bc79bd9 | [
"MIT"
] | permissive | jacksoncougar/Experiments-2018- | 5fd2493b10198a8ddc1e8a398ef1e2ca3370475f | 3430cca7656496d9045b237180c3d4d6447b9505 | refs/heads/master | 2020-04-06T07:43:50.332671 | 2018-11-12T22:14:09 | 2018-11-12T22:14:09 | 157,283,210 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,199 | cpp | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "GeneratedCppIncludes.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeVRExpansionPlugin_init() {}
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGripControllerOnGripSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGripControllerOnDropSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRButtonStateChangedSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRDialStateChangedSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRLeverStateChangedSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRSliderHitPointSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRSeatThresholdChangedSignature__DelegateSignature();
VREXPANSIONPLUGIN_API UFunction* Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGestureDetectedSignature__DelegateSignature();
UPackage* Z_Construct_UPackage__Script_VRExpansionPlugin()
{
static UPackage* ReturnPackage = nullptr;
if (!ReturnPackage)
{
static UObject* (*const SingletonFuncArray[])() = {
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGripControllerOnGripSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGripControllerOnDropSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRButtonStateChangedSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRDialStateChangedSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRLeverStateChangedSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRSliderHitPointSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRSeatThresholdChangedSignature__DelegateSignature,
(UObject* (*)())Z_Construct_UDelegateFunction_VRExpansionPlugin_VRGestureDetectedSignature__DelegateSignature,
};
static const UE4CodeGen_Private::FPackageParams PackageParams = {
"/Script/VRExpansionPlugin",
PKG_CompiledIn | 0x00000000,
0xAD5DF40C,
0x6DA98628,
SingletonFuncArray, ARRAY_COUNT(SingletonFuncArray),
METADATA_PARAMS(nullptr, 0)
};
UE4CodeGen_Private::ConstructUPackage(ReturnPackage, PackageParams);
}
return ReturnPackage;
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif
| [
"jacksoncougar@gmail.com"
] | jacksoncougar@gmail.com |
f7ef8bdd615e01adba9980d401df6cecfe7e6742 | b193a4bf6ab67851256cca7f2f3259a5c57d7180 | /ololo.cpp | 55fe4197d835baa1a62e2b0928f8833906c40d98 | [] | no_license | kaushik12048/Spoj_Solutions | ec133fb82bd6b1e9fe20a156183d111d42b21f07 | 20a893fd5ea9bd108ec367ddce71d3092ab63a4c | refs/heads/master | 2016-08-10T11:56:05.796740 | 2015-05-25T06:56:24 | 2015-05-25T06:56:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 395 | cpp | #include<bits/stdc++.h>
using namespace std;
void inp(long long int &x)
{
register long long int c = getchar_unlocked();
x = 0;
for(;(c<48 || c>57);c = getchar_unlocked());
for(;c>47 && c<58;c = getchar_unlocked())
{
x = (x<<1) + (x<<3) + c - 48;
}
}
int main()
{
long long int t,i,arr=0,j;
inp(t);
for(i=0;i<t;i++)
{
inp(j);
arr=arr^j;
}
printf("%lld\n",arr);
return 0;
}
| [
"kaushik12048@iiitd.ac.in"
] | kaushik12048@iiitd.ac.in |
f2e13c88ef915d1117ae634a78a051e1e04d8fb5 | cf0ca99d2db32d391adb332862f38cb86c1e4bf0 | /chefwords/chefwords.cpp | ffa92191c9927f822a36869105b42a3d800dd7f1 | [] | no_license | Ankurrana/Codechef | b213b4355f3c4f2bfa475b65a98c7a03e2e88664 | 088e4a23f00be0a368c4928c45bd8fb507188b04 | refs/heads/master | 2020-04-26T23:29:34.212998 | 2015-01-14T14:51:38 | 2015-01-14T14:51:38 | 19,064,764 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,820 | cpp | #include "bits/stdc++.h"
#include "string"
using namespace std;
typedef vector<int> vi;
typedef vector< int >::iterator vit;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef long long int lld;
#define iterate(n) for(int qwe=0;qwe<n;i++)
#define getw getchar_unlocked
#define get(a) geta(&a)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,it) for(typeof((c).begin()) it = c.begin();it!= (c).end();it++)
#define show(a) tr(a,it){ cout << *it << endl; }
#define rep(n,i) for(int (i)=0;(i)<(n);(i)++)
template < typename T >
inline void geta(T *a){
T n=0,s=1;
char p=getw();
if(p=='-') s=-1;
while((p<'0'||p>'9')&&p!=EOF&&p!='-') p=getw();
if(p=='-') s=-1,p=getw();
while(p>='0'&&p<='9') { n = (n<< 3) + (n<< 1) + (p - '0'); p=getw(); }
*a = n*s;
}
void fill(vector<int> &a, int n){
a.resize(n);
rep(n,i) get(a[i]);
}
void solve(){
lld n,k,i,j,z;
string str;
string temp;
vector< string > strings;
get(n); get(k);
cin >> str;
long double dp[30][30];
long double p[30][30];
set< string > myset;
int numberOfCharacters = 26;
rep(numberOfCharacters,i){
rep(numberOfCharacters,j){
cin >> p[i][j];
}
}
int len = str.length();
rep(n,i){
cin >> temp;
if( temp.length() == len && myset.find(temp) == myset.end() ){
strings.push_back(temp);
myset.insert(temp);
}
}
double ans[26][26];
rep(26,i){
rep(26,j){
if( i==j ) ans[i][i] = 1;
else ans[i][j] = 0;
}
}
while(k){
if(k&1){
double temp[26][26];
rep(26,i){
rep(26,j){
double qwe = 0.0;
rep(26,z){
qwe += ans[i][z]*p[z][j];
}
temp[i][j] = qwe;
}
}
rep(26,i){
rep(26,j){
ans[i][j] = temp[i][j];
}
}
}
if(1){
double a[26][26];
double b[26][26];
rep(26,i){
rep(26,j){
a[i][j] = p[i][j];
b[i][j] = p[i][j];
}
}
rep(26,i){
rep(26,j){
double qwe = 0.0;
rep(26,z){
qwe += a[i][z]*b[z][j];
}
p[i][j] = qwe;
}
}
}
k = k/2;
}
double finalAns = 0.0;
for(int i=0;i<strings.size();i++){
temp = strings[i];
double inter = 1.00000L;
for(int j=0;j<str.length();j++){
inter *= ans[ (int)(str[j]-'a') ][ (int)(temp[j]-'a') ] ;
}
finalAns += inter;
}
cout << finalAns << "\n";
}
int main(){
lld n,m,i,j,l,r,k,p,d,t;
get(t);
while(t--){
solve();
}
return 0;
}
// for(int l=2;l<=k;l++){
// for(i=0;i<numberOfCharacters;i++){
// for(j=0;j<numberOfCharacters;j++){
// double ans = 0.0;
// for(z=0;z<numberOfCharacters;z++){
// double temp = ans[i][k][l]*p[k][j];
// ans += dp[i][k][l]*p[k][j];
// // if(i==0 && j==0) cout << temp << " for k = " << k << endl ;
// }
// dp[i][j][l+1] = ans;
// }
// }
| [
"ankurofficial@hotmail.com"
] | ankurofficial@hotmail.com |
c1344608fd23d049382165c97f02915ecd0e2c1b | 801ea2db8d6be6c0d5a79d3d48348b9fae14bb47 | /kernel/source/vmm/vm.cpp | 0d305e2b3c820cee9266b9f04f1575e1caeeaceb | [] | no_license | xmduke/Luna | 8a0d07cc33d705bf12246c2c34cd1becf1790200 | 1f47b4dc32f71e1a36d4cf40e7d9e190e913f8e8 | refs/heads/master | 2023-06-20T23:27:36.916709 | 2021-08-01T12:18:01 | 2021-08-01T12:18:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,896 | cpp | #include <Luna/vmm/vm.hpp>
#include <Luna/misc/log.hpp>
#include <Luna/cpu/intel/vmx.hpp>
#include <Luna/cpu/amd/svm.hpp>
#include <Luna/vmm/emulate.hpp>
void vm::init() {
if(vmx::is_supported()) {
get_cpu().cpu.vm.vendor = CpuVendor::Intel;
vmx::init();
} else if(svm::is_supported()) {
get_cpu().cpu.vm.vendor = CpuVendor::AMD;
svm::init();
} else
PANIC("Unknown virtualization vendor");
}
vm::VCPU::VCPU(vm::Vm* vm, uint8_t id): vm{vm}, lapic{id} {
switch (get_cpu().cpu.vm.vendor) {
case CpuVendor::Intel:
vcpu = new vmx::Vm{vm->mm, this};
cr0_constraint = vmx::get_cr0_constraint();
cr4_constraint = vmx::get_cr4_constraint();
break;
case CpuVendor::AMD:
vcpu = new svm::Vm{vm->mm, this};
cr0_constraint = svm::get_cr0_constraint();
efer_constraint = svm::get_efer_constraint();
break;
default:
PANIC("Unknown virtualization vendor");
}
vm::RegisterState regs{};
regs.cs = {.selector = 0xF000, .base = 0xFFFF'0000, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.ds = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.es = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.ss = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.fs = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.gs = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 0b11, .s = 1, .present = 1}};
regs.ldtr = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 2, .present = 1}};
regs.tr = {.selector = 0, .base = 0, .limit = 0xFFFF, .attrib = {.type = 3, .present = 1}};
regs.idtr = {.base = 0, .limit = 0xFFFF};
regs.gdtr = {.base = 0, .limit = 0xFFFF};
regs.dr6 = 0xFFFF0FF0;
regs.dr7 = 0x400;
regs.rsp = 0;
regs.rip = 0xFFF0;
regs.rflags = (1 << 1);
regs.cr0 = (cr0_constraint & ~((1 << 0) | (1u << 31))); // Clear PE and PG;
regs.cr4 = cr4_constraint;
regs.cr3 = 0;
regs.efer = efer_constraint;
vcpu->set_regs(regs, VmRegs::General | VmRegs::Segment | VmRegs::Control);
auto& simd = vcpu->get_guest_simd_context();
simd.data()->fcw = 0x40;
simd.data()->mxcsr = 0x1F80;
// MSR init
apicbase = 0xFEE0'0000 | (1 << 11) | ((id == 0) << 8); // xAPIC enable, If id == 0 set BSP bit too
lapic.update_apicbase(apicbase);
smbase = 0x3'0000;
}
void vm::VCPU::exit() {
should_exit = true;
}
void vm::VCPU::get_regs(vm::RegisterState& regs, uint64_t flags) const { vcpu->get_regs(regs, flags); }
void vm::VCPU::set_regs(const vm::RegisterState& regs, uint64_t flags) { vcpu->set_regs(regs, flags); }
void vm::VCPU::set(VmCap cap, bool value) { vcpu->set(cap, value); }
void vm::VCPU::set(VmCap cap, void (*fn)(VCPU*, void*), void* userptr) {
if(cap == VmCap::SMMEntryCallback) {
smm_entry_callback = fn;
smm_entry_userptr = userptr;
} else if(cap == VmCap::SMMLeaveCallback) {
smm_leave_callback = fn;
smm_leave_userptr = userptr;
} else if(cap == VmCap::HypercallCallback) {
hypercall_callback = fn;
hypercall_userptr = userptr;
} else
PANIC("Unknown cap");
}
bool vm::VCPU::run() {
while(true) {
if(should_exit)
return true;
vm::RegisterState regs{};
vm::VmExit exit{};
if(!vcpu->run(exit))
return false;
switch (exit.reason) {
case VmExit::Reason::Vmcall:
if(hypercall_callback)
hypercall_callback(this, hypercall_userptr);
else // If no handler, exit
return true;
break;
case VmExit::Reason::MMUViolation: {
get_regs(regs);
auto grip = regs.cs.base + regs.rip;
auto emulate_mmio = [&](AbstractMMIODriver* driver, uintptr_t gpa, uintptr_t base, size_t size) {
uint8_t instruction[max_x86_instruction_size];
mem_read(grip, {instruction, 15});
vm::emulate::emulate_instruction(this, gpa, {base, size}, instruction, regs, driver);
set_regs(regs);
};
if((exit.mmu.gpa & ~0xFFF) == (apicbase & ~0xFFF)) {
emulate_mmio(&lapic, exit.mmu.gpa, apicbase & ~0xFFF, 0x1000);
goto did_mmio;
}
for(const auto [base, driver] : vm->mmio_map) {
if(exit.mmu.gpa >= base && exit.mmu.gpa <= (base + driver.second)) {
// Access is in an MMIO region
emulate_mmio(driver.first, exit.mmu.gpa, base, driver.second);
goto did_mmio;
}
}
// No MMIO region, so a page violation
print("vm: MMU Violation\n");
print(" gRIP: {:#x}, gPA: {:#x}\n", grip, exit.mmu.gpa);
print(" Access: {:s}{:s}{:s}, {:s}\n", exit.mmu.access.r ? "R" : "", exit.mmu.access.w ? "W" : "", exit.mmu.access.x ? "X" : "", exit.mmu.access.user ? "User" : "Supervisor");
if(exit.mmu.page.present)
print(" Page: {:s}{:s}{:s}, {:s}\n", exit.mmu.page.r ? "R" : "", exit.mmu.page.w ? "W" : "", exit.mmu.page.x ? "X" : "", exit.mmu.page.user ? "User" : "Supervisor");
else
print(" Page: Not present\n");
if(exit.mmu.reserved_bits_set)
print(" Reserved bits set\n");
return false;
did_mmio:
break;
}
case VmExit::Reason::PIO: {
get_regs(regs);
ASSERT(!exit.pio.rep); // TODO
ASSERT(!exit.pio.string);
auto reg_clear = [&]<typename T>(T& value) {
switch(exit.pio.size) {
case 1: value &= 0xFF; break;
case 2: value &= 0xFFFF; break;
case 4: value &= 0xFFFF'FFFF; break;
default: PANIC("Unknown PIO Size");
}
};
if(!vm->pio_map.contains(exit.pio.port)) {
print("vcpu: Unhandled PIO Access to port {:#x}\n", exit.pio.port);
if(!exit.pio.write) {
switch(exit.pio.size) {
case 1: regs.rax &= ~0xFF; break;
case 2: regs.rax &= ~0xFFFF; break;
case 4: regs.rax &= ~0xFFFF'FFFF; break;
default: PANIC("Unknown PIO Size");
}
}
set_regs(regs);
break;
}
auto* driver = vm->pio_map[exit.pio.port];
if(exit.pio.write) {
auto value = regs.rax;
reg_clear(value);
driver->pio_write(exit.pio.port, value, exit.pio.size);
} else {
auto value = driver->pio_read(exit.pio.port, exit.pio.size);
switch(exit.pio.size) {
case 1: regs.rax &= ~0xFF; break;
case 2: regs.rax &= ~0xFFFF; break;
case 4: regs.rax &= ~0xFFFF'FFFF; break;
default: PANIC("Unknown PIO Size");
}
reg_clear(value);
regs.rax |= value;
set_regs(regs);
}
break;
}
case VmExit::Reason::CPUID: {
get_regs(regs);
auto write_low32 = [&](uint64_t& reg, uint32_t val) { reg &= ~0xFFFF'FFFF; reg |= val; };
auto leaf = regs.rax & 0xFFFF'FFFF;
auto subleaf = regs.rcx & 0xFFFF'FFFF;
constexpr uint32_t luna_sig = 0x616E754C; // Luna in ASCII
auto passthrough = [&]() {
uint32_t a, b, c, d;
ASSERT(cpu::cpuid(leaf, subleaf, a, b, c, d));
write_low32(regs.rax, a);
write_low32(regs.rbx, b);
write_low32(regs.rcx, c);
write_low32(regs.rdx, d);
};
auto os_support_bit = [&](uint64_t& reg, uint8_t cr4_bit, uint8_t bit) {
reg &= ~(1 << bit);
bool os = (regs.cr4 >> cr4_bit) & 1;
reg |= (os << bit);
};
if(leaf == 0) {
passthrough();
} else if(leaf == 1) {
passthrough();
regs.rcx |= (1u << 31); // Set Hypervisor Present bit
os_support_bit(regs.rdx, 9, 24);
os_support_bit(regs.rcx, 18, 27); // Only set OSXSAVE bit if actually enabled by OS
} else if(leaf == 7) {
if(subleaf == 0) {
passthrough();
os_support_bit(regs.rcx, 22, 4);
} else {
print("vcpu: Unhandled CPUID 0x7 subleaf {:#x}\n", subleaf);
}
} else if(leaf == 0x4000'0000) {
write_low32(regs.rax, 0);
write_low32(regs.rbx, luna_sig);
write_low32(regs.rcx, luna_sig);
write_low32(regs.rdx, luna_sig);
} else if(leaf == 0x8000'0000) {
passthrough();
} else if(leaf == 0x8000'0001) {
passthrough();
os_support_bit(regs.rdx, 9, 24);
} else if(leaf == 0x8000'0008) {
passthrough(); // TODO: Do we want this to be passthrough?
write_low32(regs.rcx, 0); // Clear out core info
} else {
print("vcpu: Unhandled CPUID: {:#x}:{}\n", leaf, subleaf);
}
set_regs(regs);
break;
}
case VmExit::Reason::MSR: {
get_regs(regs);
auto index = regs.rcx & 0xFFFF'FFFF;
auto value = (regs.rax & 0xFFFF'FFFF) | (regs.rdx << 32);
auto write_low32 = [&](uint64_t& reg, uint32_t val) { reg &= ~0xFFFF'FFFF; reg |= val; };
if(index == msr::ia32_tsc) {
if(exit.msr.write)
tsc = value;
else
value = tsc;
} else if(index == msr::ia32_mtrr_cap) {
if(exit.msr.write)
vcpu->inject_int(AbstractVm::InjectType::Exception, 13, true, 0); // Inject #GP(0)
value = (1 << 10) | (1 << 8) | 8; // WC valid, Fixed MTRRs valid, 8 Variable MTRRs
} else if(index == msr::ia32_apic_base) {
if(exit.msr.write) {
apicbase = value;
lapic.update_apicbase(apicbase);
} else {
value = apicbase;
}
} else if(index >= 0x200 && index <= 0x2FF) {
update_mtrr(exit.msr.write, index, value);
} else if(index == msr::ia32_efer) {
if(exit.msr.write)
regs.efer = value | efer_constraint;
else
value = regs.efer;
} else {
if(exit.msr.write) {
print("vcpu: Unhandled wrmsr({:#x}, {:#x})\n", index, value);
} else {
print("vcpu: Unhandled rdmsr({:#x})\n", index);
value = 0;
}
}
if(!exit.msr.write) {
write_low32(regs.rax, value & 0xFFFF'FFFF);
write_low32(regs.rdx, value >> 32);
}
set_regs(regs);
break;
}
case VmExit::Reason::RSM: {
if(is_in_smm)
handle_rsm();
else
vcpu->inject_int(vm::AbstractVm::InjectType::Exception, 6); // Inject a UD
break;
}
case VmExit::Reason::Hlt: {
print("vm: HLT\n");
return false;
}
case VmExit::Reason::CrMov: {
get_regs(regs);
uint64_t value = 0;
if(exit.cr.write)
value = vm::emulate::read_r64(regs, (vm::emulate::r64)exit.cr.gpr, 8);
if(exit.cr.cr == 0) {
if(exit.cr.write)
regs.cr0 = value;
else
PANIC("TODO");
} else if(exit.cr.cr == 3) {
if(exit.cr.write) {
regs.cr3 = value;
guest_tlb.invalidate();
} else
value = regs.cr3;
} else {
PANIC("TODO");
}
if(!exit.cr.write)
vm::emulate::write_r64(regs, (vm::emulate::r64)exit.cr.gpr, value, 8);
set_regs(regs);
break;
}
default:
print("vcpu: Exit due to {:s}\n", exit.reason_to_string(exit.reason));
if(exit.instruction_len != 0) {
print(" Opcode: ");
for(size_t i = 0; i < exit.instruction_len; i++)
print("{:#x} ", (uint64_t)exit.instruction[i]);
print("\n");
}
break;
}
}
return true;
}
void vm::VCPU::update_mtrr(bool write, uint32_t index, uint64_t& value) {
auto update = [this](){
// We can mostly just ignore MTRRs and whatever guests want for paging, as we force WB
// However when VT-d doesn't support snooping, it's needed to mark pages as UC, when passing through devices
// AMD-Vi always supports snooping, and this is always forced on, so no such thing is needed
// Debug code for printing MTRRs
/*print("vm::mtrr: Update, Enable: {}, Fixed Enable: {}, Default Type: {}\n", mtrr.enable, mtrr.fixed_enable, (uint16_t)mtrr.default_type);
for(size_t i = 0; i < 8; i++) {
auto var = mtrr.var[i];
if(!(var.mask & 0x800)) // Valid
continue;
var.mask &= ~0x800;
auto physical_bits = 36;
{
uint32_t a, b, c, d;
if(cpu::cpuid(0x8000'0008, a, b, c, d))
physical_bits = a & 0xFF;
}
auto size = -var.mask & ((1ull << physical_bits) - 1);
auto start = var.base & ~0xFFF;
auto type = var.base & 0xFF;
print("vm::mtrr: Var{}: {:#x} -> {:#x} => Type: {}\n", i, start, start + size - 1, type);
}
if(mtrr.fixed_enable) {
print("vm::mtrr: fix64K_00000: {:#x}\n", mtrr.fix[0]);
print("vm::mtrr: fix16K_80000: {:#x}\n", mtrr.fix[1]);
print("vm::mtrr: fix16K_A0000: {:#x}\n", mtrr.fix[2]);
print("vm::mtrr: fix4K_C0000: {:#x}\n", mtrr.fix[3]);
print("vm::mtrr: fix4K_C8000: {:#x}\n", mtrr.fix[4]);
print("vm::mtrr: fix4K_D0000: {:#x}\n", mtrr.fix[5]);
print("vm::mtrr: fix4K_D8000: {:#x}\n", mtrr.fix[6]);
print("vm::mtrr: fix4K_E0000: {:#x}\n", mtrr.fix[7]);
print("vm::mtrr: fix4K_E8000: {:#x}\n", mtrr.fix[8]);
print("vm::mtrr: fix4K_F0000: {:#x}\n", mtrr.fix[9]);
print("vm::mtrr: fix4K_F8000: {:#x}\n", mtrr.fix[10]);
}*/
};
if(index == msr::ia32_mtrr_def_type) {
if(write) {
mtrr.cmd = value;
mtrr.enable = (value >> 11) & 1;
mtrr.fixed_enable = (value >> 10) & 1;
mtrr.default_type = value & 0xFF;
update();
} else {
value = mtrr.cmd;
}
} else if(index >= msr::ia32_mtrr_physbase0 && index <= msr::ia32_mtrr_physmask7) {
size_t i = ((index - msr::ia32_mtrr_physbase0) & ~1) / 2;
size_t mask = index & 1;
if(write) {
if(mask)
mtrr.var[i].mask = value;
else
mtrr.var[i].base = value;
update();
} else {
if(mask)
value = mtrr.var[i].mask;
else
value = mtrr.var[i].base;
}
} else if(index == msr::ia32_mtrr_fix64K_00000) {
if(write) {
mtrr.fix[0] = value;
update();
} else {
value = mtrr.fix[0];
}
} else if(index == msr::ia32_mtrr_fix16K_80000 || index == msr::ia32_mtrr_fix16K_A0000) {
size_t i = (index - msr::ia32_mtrr_fix16K_80000) + 1;
if(write) {
mtrr.fix[i] = value;
update();
} else {
value = mtrr.fix[i];
}
} else if(index >= msr::ia32_mtrr_fix4K_C0000 && index <= msr::ia32_mtrr_fix4K_F8000) {
size_t i = (index - msr::ia32_mtrr_fix4K_C0000) + 3;
if(write) {
mtrr.fix[i] = value;
update();
} else {
value = mtrr.fix[i];
}
} else {
print("vm::mtrr: Unknown MTRR MSR {:#x}\n", index);
}
}
void vm::VCPU::enter_smm() {
vm::RegisterState regs{};
get_regs(regs);
uint8_t save[512] = {};
auto put = [&](uint8_t sz, uint16_t offset, uint64_t value) {
if(sz == 2)
*(uint16_t*)(save + offset - 0x7E00) = value;
else if(sz == 4)
*(uint32_t*)(save + offset - 0x7E00) = value;
else if(sz == 8)
*(uint64_t*)(save + offset - 0x7E00) = value;
else
PANIC("Unknown size");
};
auto segment_flags = [](const RegisterState::Segment& seg) -> uint32_t {
return (seg.attrib.g << 23) | (seg.attrib.db << 22) | (seg.attrib.l << 21) | \
(seg.attrib.avl << 20) | (seg.attrib.present << 15) | (seg.attrib.dpl << 13) | \
(seg.attrib.s << 12) | (seg.attrib.type << 8);
};
// Save CPU State
{
put(8, 0x7FF8, regs.rax);
put(8, 0x7FF0, regs.rcx);
put(8, 0x7FE8, regs.rdx);
put(8, 0x7FE0, regs.rbx);
put(8, 0x7FD8, regs.rsp);
put(8, 0x7FD0, regs.rbp);
put(8, 0x7FC8, regs.rsi);
put(8, 0x7FC0, regs.rdi);
put(8, 0x7FB8, regs.r8);
put(8, 0x7FB0, regs.r9);
put(8, 0x7FA8, regs.r10);
put(8, 0x7FA0, regs.r11);
put(8, 0x7F98, regs.r12);
put(8, 0x7F90, regs.r13);
put(8, 0x7F88, regs.r14);
put(8, 0x7F80, regs.r15);
put(8, 0x7F78, regs.rip);
put(8, 0x7F70, regs.rflags);
put(8, 0x7F68, regs.dr6);
put(8, 0x7F60, regs.dr7);
put(8, 0x7F58, regs.cr0);
put(8, 0x7F50, regs.cr3);
put(8, 0x7F48, regs.cr4);
put(4, 0x7F00, smbase);
put(4, 0x7EFC, 0x00020064); // Revision ID
put(8, 0x7ED0, regs.efer);
put(4, 0x7E84, regs.idtr.limit);
put(8, 0x7E88, regs.idtr.base);
put(4, 0x7E64, regs.gdtr.limit);
put(8, 0x7E68, regs.gdtr.base);
#define PUT_SEGMENT(i, name) \
put(2, 0x7E00 + (i * 0x10), regs.name.selector); \
put(2, 0x7E02 + (i * 0x10), segment_flags(regs.name) >> 8); \
put(4, 0x7E04 + (i * 0x10), regs.name.limit); \
put(8, 0x7E08 + (i * 0x10), regs.name.base)
PUT_SEGMENT(0, es);
PUT_SEGMENT(1, cs);
PUT_SEGMENT(2, ss);
PUT_SEGMENT(3, ds);
PUT_SEGMENT(4, fs);
PUT_SEGMENT(5, gs);
PUT_SEGMENT(7, ldtr);
PUT_SEGMENT(9, tr);
}
auto* dst = (uint8_t*)(vm->mm->get_phys(smbase + 0xFE00) + phys_mem_map);
memcpy(dst, save, 512);
regs.rflags = (1 << 1);
regs.rip = 0x8000;
regs.cr0 &= ~((1 << 0) | (1 << 2) | (1 << 3) | (1u << 31));
regs.cr4 = cr4_constraint;
regs.efer = efer_constraint;
regs.idtr = {.base = 0, .limit = 0};
regs.dr7 = 0x400;
regs.cs = {.selector = (uint16_t)((smbase >> 4) & 0xFFFF), .base = smbase, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
regs.ds = {.selector = 0, .base = 0, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
regs.es = {.selector = 0, .base = 0, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
regs.ss = {.selector = 0, .base = 0, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
regs.fs = {.selector = 0, .base = 0, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
regs.gs = {.selector = 0, .base = 0, .limit = 0xFFFF'FFFF, .attrib = {.type = 0b11, .s = 1, .present = 1, .g = 1}};
set_regs(regs);
smm_entry_callback(this, smm_entry_userptr);
is_in_smm = true;
}
void vm::VCPU::handle_rsm() {
ASSERT(is_in_smm);
uint8_t buf[512] = {};
auto* src = (uint8_t*)(vm->mm->get_phys(smbase + 0xFE00) + phys_mem_map);
memcpy(buf, src, 512);
RegisterState rregs{};
get_regs(rregs);
// Allow CPU to return to real mode
rregs.cr4 &= ~(1 << 17); // Clear cr4.PCIDE, before cr0.PG
rregs.cs = {.selector = 0, .base = 0, .limit = 0, .attrib = {.type = 0xB, .s = 1, .present = 1, .g = 1}}; // 32bit CS is required to clear LMA
if(rregs.cr0 & (1 << 0))
rregs.cr0 &= ~((1 << 0) | (1u << 31)); // Clear cr0.PE and cr0.PG
rregs.cr4 &= ~(1 << 5); // Clear cr4.PAE
rregs.efer = efer_constraint;
auto get = [&]<typename T>(uint8_t sz, uint16_t offset, T& value) {
if(sz == 2)
value = *(uint16_t*)(buf + offset - 0x7E00);
else if(sz == 4)
value = *(uint32_t*)(buf + offset - 0x7E00);
else if(sz == 8)
value = *(uint64_t*)(buf + offset - 0x7E00);
else
PANIC("Unknown size");
};
get(8, 0x7FF8, rregs.rax);
get(8, 0x7FF0, rregs.rcx);
get(8, 0x7FE8, rregs.rdx);
get(8, 0x7FE0, rregs.rbx);
get(8, 0x7FD8, rregs.rsp);
get(8, 0x7FD0, rregs.rbp);
get(8, 0x7FC8, rregs.rsi);
get(8, 0x7FC0, rregs.rdi);
get(8, 0x7FB8, rregs.r8);
get(8, 0x7FB0, rregs.r9);
get(8, 0x7FA8, rregs.r10);
get(8, 0x7FA0, rregs.r11);
get(8, 0x7F98, rregs.r12);
get(8, 0x7F90, rregs.r13);
get(8, 0x7F88, rregs.r14);
get(8, 0x7F80, rregs.r15);
get(8, 0x7F78, rregs.rip);
get(8, 0x7F70, rregs.rflags); rregs.rflags |= (1 << 1);
uint32_t dr6 = 0;
get(4, 0x7F68, dr6);
rregs.dr6 = (dr6 & 0x1'E00F) | 0xFFFE'0FF0;
uint32_t dr7 = 0;
get(4, 0x7F60, dr7);
rregs.dr7 = (dr7 & 0xFFFF'2BFF) | 0x400;
uint64_t cr0 = 0, cr3 = 0, cr4 = 0;
get(8, 0x7F58, cr0);
get(8, 0x7F50, cr3);
get(8, 0x7F48, cr4);
get(4, 0x7F00, smbase);
get(8, 0x7ED0, rregs.efer); rregs.efer = (rregs.efer & (1 << 10)) | efer_constraint; // Make sure constrained bits are set, and LMA which is RO is clear
#define GET_SEGMENT(i, name) \
{ \
get(2, 0x7E00 + (i * 0x10), rregs.name.selector); \
get(4, 0x7E04 + (i * 0x10), rregs.name.limit); \
get(8, 0x7E08 + (i * 0x10), rregs.name.base); \
uint32_t flags = 0; \
get(2, 0x7E02 + (i * 0x10), flags); \
flags <<= 8; \
rregs.name.attrib.g = (flags >> 23) & 1; \
rregs.name.attrib.db = (flags >> 22) & 1; \
rregs.name.attrib.l = (flags >> 21) & 1; \
rregs.name.attrib.avl = (flags >> 20) & 1; \
rregs.name.attrib.present = (flags >> 15) & 1; \
rregs.name.attrib.dpl = (flags >> 13) & 3; \
rregs.name.attrib.s = (flags >> 12) & 1; \
rregs.name.attrib.type = (flags >> 8) & 15; \
}
GET_SEGMENT(7, ldtr);
GET_SEGMENT(9, tr);
get(4, 0x7E84, rregs.idtr.limit);
get(8, 0x7E88, rregs.idtr.base);
get(4, 0x7E64, rregs.gdtr.limit);
get(8, 0x7E68, rregs.gdtr.base);
uint16_t pcid = 0;
if(cr4 & (1 << 17)) {
pcid = cr3 & 0xFFF;
cr3 &= ~0xFFF;
}
rregs.cr3 = cr3;
rregs.cr4 = (cr4 & ~(1 << 17)) | cr4_constraint;
rregs.cr0 = cr0;
if(cr4 & (1 << 17)) {
rregs.cr4 = cr4;
rregs.cr3 = cr3 | pcid;
}
GET_SEGMENT(0, es);
GET_SEGMENT(1, cs);
GET_SEGMENT(2, ss);
GET_SEGMENT(3, ds);
GET_SEGMENT(4, fs);
GET_SEGMENT(5, gs);
set_regs(rregs);
smm_leave_callback(this, smm_leave_userptr);
is_in_smm = false;
}
void vm::VCPU::dma_read(uintptr_t gpa, std::span<uint8_t> buf) {
uintptr_t curr = 0;
while(curr != buf.size_bytes()) {
auto va = vm->mm->get_phys(gpa + curr) + phys_mem_map;
auto top = align_up(va, pmm::block_size);
auto chunk = min(top - va + 1, buf.size_bytes() - curr);
memcpy(buf.data() + curr, (uint8_t*)va, chunk);
curr += chunk;
}
}
void vm::VCPU::dma_write(uintptr_t gpa, std::span<uint8_t> buf) {
uintptr_t curr = 0;
while(curr != buf.size_bytes()) {
auto va = vm->mm->get_phys(gpa + curr) + phys_mem_map;
auto top = align_up(va, pmm::block_size);
auto chunk = min(top - va + 1, buf.size_bytes() - curr);
memcpy((uint8_t*)va, buf.data() + curr, chunk);
curr += chunk;
}
}
vm::PageWalkInfo vm::VCPU::walk_guest_paging(uintptr_t gva) {
vm::RegisterState regs{};
get_regs(regs, VmRegs::Control); // We only really care about cr0, cr3, cr4, and efer here
if(!(regs.cr0 & (1u << 31)))
return {.found = true, .is_write = true, .is_user = true, .is_execute = true, .gpa = gva};
// Paging is enabled, we can assume cr0.PE is true too, now figure out the various paging modes
// But first look in the TLB
auto off = gva & 0xFFF;
auto page = gva & 0xFFFF'F000;
if(auto info = guest_tlb.lookup(page); info.found) {
info.gpa += off;
return info;
}
if(!(regs.efer & (1 << 10) && !(regs.cr4 & (1 << 5)))) { // No long mode and no PAE, thus normal 32bit paging
bool write = true, user = true;
auto pml2_i = (gva >> 22) & 0x3FF;
auto pml1_i = (gva >> 12) & 0x3FF;
uint32_t pml2_addr = regs.cr3 & 0xFFFF'F000;
auto* pml2 = (uint32_t*)(vm->mm->get_phys(pml2_addr) + phys_mem_map); // Page tables are always in 1 page so this is fine
uint32_t pml2_entry = pml2[pml2_i];
ASSERT(pml2_entry & (1 << 0)); // Assert its present
write = write && (pml2_entry >> 1) & 1;
user = user && (pml2_entry >> 2) & 1;
uint32_t pml1_addr = pml2_entry & 0xFFFF'F000;
auto* pml1 = (uint32_t*)(vm->mm->get_phys(pml1_addr) + phys_mem_map); // Page tables are always in 1 page so this is fine
uint32_t pml1_entry = pml1[pml1_i];
ASSERT(pml1_entry & (1 << 0)); // Assert its present
write = write && (pml1_entry >> 1) & 1;
user = user && (pml1_entry >> 2) & 1;
uint32_t gpa = pml1_entry & 0xFFFF'F000;
guest_tlb.add(page, {.found = true, .is_write = write, .is_user = user, .is_execute = true, .gpa = gpa});
return {.found = true, .is_write = write, .is_user = user, .is_execute = true, .gpa = gpa + off};
} else {
print("cr0: {:#x} cr4: {:#x} efer: {:#x}\n", regs.cr0, regs.cr4, regs.efer);
PANIC("TODO");
}
}
void vm::VCPU::mem_read(uintptr_t gva, std::span<uint8_t> buf) {
uintptr_t curr = 0;
while(curr != buf.size_bytes()) {
auto gpa = walk_guest_paging(gva + curr).gpa;
auto hpa = vm->mm->get_phys(gpa);
auto hva = hpa + phys_mem_map;
auto top = align_up(hva, pmm::block_size);
auto chunk = min(top - hva + 1, buf.size_bytes() - curr);
memcpy(buf.data() + curr, (uint8_t*)hva, chunk);
curr += chunk;
}
}
void vm::VCPU::mem_write(uintptr_t gva, std::span<uint8_t> buf) {
uintptr_t curr = 0;
while(curr != buf.size_bytes()) {
auto res = walk_guest_paging(gva + curr);
ASSERT(res.is_write);
auto hpa = vm->mm->get_phys(res.gpa);
auto hva = hpa + phys_mem_map;
auto top = align_up(hva, pmm::block_size);
auto chunk = min(top - hva + 1, buf.size_bytes() - curr);
memcpy((uint8_t*)hva, buf.data() + curr, chunk);
curr += chunk;
}
}
vm::Vm::Vm(uint8_t n_cpus) {
switch (get_cpu().cpu.vm.vendor) {
case CpuVendor::Intel:
mm = vmx::create_ept();
break;
case CpuVendor::AMD:
mm = svm::create_npt();
break;
default:
PANIC("Unknown virtualization vendor");
}
ASSERT(n_cpus > 0); // Make sure there's at least 1 VCPU
for(uint8_t i = 0; i < n_cpus; i++)
cpus.emplace_back(this, i);
}
void vm::Vm::set_irq(uint8_t irq, bool level) {
for(auto& listener : irq_listeners)
listener->irq_set(irq, level);
} | [
"twoertman@gmail.com"
] | twoertman@gmail.com |
a5da3f68acb6157f5aae4e08470d88c3f4dae316 | 093df6cf938afc1f0af9f7120e2b48112cde7e36 | /libstd_cpp/map/empty.cpp | b279e52f2eb3e3199189e535c700fcce04dcf46e | [] | no_license | hexu1985/cpp_code | 6487e19563ed2a751f889cb81ad724c40b442097 | 1cdbe297dec47cdd11f9e5d28e6caa2971b469bb | refs/heads/master | 2020-06-25T22:19:55.409303 | 2019-02-19T03:29:49 | 2019-02-19T03:29:49 | 96,992,341 | 3 | 0 | null | 2017-07-12T09:54:11 | 2017-07-12T09:54:11 | null | UTF-8 | C++ | false | false | 350 | cpp | // map::empty
#include <iostream>
#include "map.h"
int main ()
{
Hx::map<char,int> mymap;
mymap['a']=10;
mymap['b']=20;
mymap['c']=30;
while (!mymap.empty())
{
std::cout << mymap.begin()->first << " => " << mymap.begin()->second << '\n';
mymap.erase(mymap.begin());
}
return 0;
}
/*
Output:
a => 10
b => 20
c => 30
*/
| [
"hexu@a.com"
] | hexu@a.com |
2733b9dcb3b2737ff3e9ec8dd95c14f8afe34a31 | e341a11b8d34306798b5c62e281c3b9b453a73e1 | /czlogi/czlogi/main.cpp | 534db44b0ec024793546094fc9e6dd7ad5814a15 | [] | no_license | Podmuch/stareczolgi | e70011cfc38a7681402725251918d68bbeb9aec6 | 0b5d61bb9698ff5f16a4a458910ae7112ce41371 | refs/heads/master | 2020-06-06T08:43:43.515803 | 2014-05-08T09:39:48 | 2014-05-08T09:39:48 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 5,005 | cpp | #include <SFML/Graphics.hpp>
#include <iostream>
#include "Mapa.h"
#include "Gracz.h"
#include "Pocisk.h"
#include <cstdio>
#include <cstdlib>
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
using namespace sf;
using namespace std;
//mapa 25x27
int main()
{
std::string komenda;
cout << "chcesz zalozyc serwer (komenda 'serwer', czy dolaczyc do istniejacego (komenda 'klient portserwera')?" << endl;
cin >> komenda;
if (komenda == "serwer"){
//wczytanie mapy
Mapa mapa;
mapa.wczytaniemapy(1);
//wczytanie gracza
Gracz *gracze[4];
for (int i = 0; i < 4; i++){
gracze[i] = NULL;
}
//tablica pociskow
Pocisk *pociski[40];
for (int i = 0; i < 40; i++){
pociski[i] = NULL;
}
//postawienie serwera
}
else {
if (komenda == "klient") {
//odczytanie portu
cin >> komenda;
int port = atoi(komenda.c_str());
//pociski
CircleShape pocisk;
pocisk.setFillColor(Color(255, 255, 255, 255));
pocisk.setRadius(3);
Vector2f polozeniepociskow[40];
for (int i = 0; i < 40; i++){
polozeniepociskow[i].x = 0;
polozeniepociskow[i].y = 0;
}
//inni gracze
Sprite *gracze[3];
gracze[0] = NULL;
gracze[1] = NULL;
gracze[2] = NULL;
//gracz
Gracz *gracz1;
//mapa
Mapa mapa;
///////////////////////////////////////////////////////////////////////////////////
//laczenie z serwerem
WSADATA wsas;
int result;
WORD wersja;
wersja = MAKEWORD(2, 2);
result = WSAStartup(wersja, &wsas);
if (result != NO_ERROR) printf("Initialization error.\n");
SOCKET s;
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == INVALID_SOCKET)
{
printf("Error creating socket: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}
sockaddr_in sa;
memset(&sa, 0, sizeof(sa));
sa.sin_family = AF_INET;
//sa.sin_addr.s_addr = htonl(INADDR_ANY);
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
sa.sin_port = htons(port);
if (connect(s, (SOCKADDR *)& sa, sizeof(sa)) == SOCKET_ERROR)
{
printf("Failed to connect.\n");
WSACleanup();
return 1;
}
char sendbuf[] = "polacz";
send(s, sendbuf, strlen(sendbuf), 0);
//odbieranie danych
char buf[936]; //1(id)+25*27(mapa)+3*80(3 chary na wspolrzedna*2 wspolrzedne 40 pociskow)+3*6+2(pozycja graczy, id i kierunek)=936
while (recv(s, buf, 934, 0) > 0)
{
printf("\n%s", buf);
};
if (buf[0] == -1){
cout << "brak miejsca" << endl;
system("pause");
return 0;
}
else {
gracz1 = new Gracz(buf[0] - 48);
mapa.mapazserwera(buf);//1+25*27=676
for (int i = 0; i < 40; i++){
char x[3], y[3];
x[0] = buf[676 + 6 * i];
x[1] = buf[677 + 6 * i];
x[2] = buf[678 + 6 * i];
y[0] = buf[679 + 6 * i];
y[1] = buf[680 + 6 * i];
y[2] = buf[681 + 6 * i];
polozeniepociskow[i].x = atoi(x);
polozeniepociskow[i].y = atoi(y);
}//1+25*27+3*80=916
for (int i = 0, j = i; i < 3; i++, j++){
if (buf[916+8*i] != -1){
if (i == buf[0] - 48) j = i + 1;
gracze[i] = new Sprite();
gracze[i]->setTexture(gracz1->texczolg);
gracze[i]->setTextureRect(IntRect(0/*+26 %206*/, j * 26, 25, 25));
switch (buf[917 + i * 8]){
case 'u':
gracze[i]->setRotation(270);
break;
case 'd':
gracze[i]->setRotation(90);
break;
case 'l':
gracze[i]->setRotation(180);
break;
case 'r':
gracze[i]->setRotation(0);
break;
}
char x[3], y[3];
x[0] = buf[918 + i * 8];
x[1] = buf[919 + i * 8];
x[2] = buf[920 + i * 8];
y[0] = buf[921 + i * 8];
y[1] = buf[922 + i * 8];
y[2] = buf[923 + i * 8];
gracze[i]->setPosition(Vector2f(atoi(x), atoi(y)));
}
}
}
//okno gry
RenderWindow window(VideoMode(640, 480), "Czolgi");
//otoczka mapy
RectangleShape rectangle(Vector2f(625, 337));
rectangle.setFillColor(Color(0, 0, 0, 0));
rectangle.setOutlineColor(Color(0, 255, 0, 255));
rectangle.setOutlineThickness(5);
rectangle.setPosition(Vector2f(7, 53));
//główna petla programu
while (window.isOpen())
{
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed)
window.close();
if (event.type == Event::KeyPressed){
gracz1->ruch(event, mapa);
if (event.key.code == Keyboard::Space) {
gracz1->strzal();
}
}
}
window.clear();
int i;
for (i = 0; i < 40; i++){
pocisk.setPosition(Vector2f(polozeniepociskow[i].x, polozeniepociskow[i].y));
window.draw(pocisk);
}
gracz1->rysujgracza(window);
window.draw(rectangle);
for (int i = 0; i < 3; i++){
if (gracze[i] != NULL) window.draw(*gracze[i]);
}
mapa.rysowaniemapy(window);
window.display();
}
}
}
return 0;
}
//serwer wysyla mape, pozycje graczy, pociskow
//gracz wysyla pozycje i czy oddal strzal
//gracz ma: sprite'y na graczy i circleshape na pocisk i zbior punktow gdzie je malowac | [
"dominikpielak@gmail.com"
] | dominikpielak@gmail.com |
a4df22db56df7c155c5f8ea66c634a69d57b3eec | f4e8ec8acf97cb3e01810091876d12b4ebea7fe6 | /SetupHltTree.h | df8d23e413bef6caf3c95653fdcbfb9a226fc6fb | [] | no_license | jazzitup/HiForestAnalysis | 7fec4677ccd1205b1f5873087d33ab20c5bde56a | dffe588110356b55cb4c4946aeac26ecb355346a | refs/heads/master | 2021-01-18T09:34:39.320422 | 2013-07-25T15:42:39 | 2013-07-25T15:42:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 168,600 | h | //////////////////////////////////////////////////////////
// This class has been automatically generated on
// Wed Jan 23 16:17:05 2013 by ROOT version 5.32/00
// from TTree HltTree/
// found on file: root://eoscms//eos/cms/store/caf/user/velicanu/PA2013_merged/pPb_hiForest2_monster_logerrevent_HI2013_express_v1_210634_210635_v14.root
//////////////////////////////////////////////////////////
#include "commonSetup.h"
#include <iostream>
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <TBranch.h>
using namespace std;
class Hlts {
public :
Hlts(){};
~Hlts(){};
// Declaration of leaf types
Int_t NL1IsolEm;
Float_t L1IsolEmEt[8]; //[NL1IsolEm]
Float_t L1IsolEmE[8]; //[NL1IsolEm]
Float_t L1IsolEmEta[8]; //[NL1IsolEm]
Float_t L1IsolEmPhi[8]; //[NL1IsolEm]
Int_t NL1NIsolEm;
Float_t L1NIsolEmEt[8]; //[NL1NIsolEm]
Float_t L1NIsolEmE[8]; //[NL1NIsolEm]
Float_t L1NIsolEmEta[8]; //[NL1NIsolEm]
Float_t L1NIsolEmPhi[8]; //[NL1NIsolEm]
Int_t NL1Mu;
Float_t L1MuPt[8]; //[NL1Mu]
Float_t L1MuE[8]; //[NL1Mu]
Float_t L1MuEta[8]; //[NL1Mu]
Float_t L1MuPhi[8]; //[NL1Mu]
Int_t L1MuIsol[8]; //[NL1Mu]
Int_t L1MuMip[8]; //[NL1Mu]
Int_t L1MuFor[8]; //[NL1Mu]
Int_t L1MuRPC[8]; //[NL1Mu]
Int_t L1MuQal[8]; //[NL1Mu]
Int_t L1MuChg[8]; //[NL1Mu]
Int_t NL1CenJet;
Float_t L1CenJetEt[8]; //[NL1CenJet]
Float_t L1CenJetE[8]; //[NL1CenJet]
Float_t L1CenJetEta[8]; //[NL1CenJet]
Float_t L1CenJetPhi[8]; //[NL1CenJet]
Int_t NL1ForJet;
Float_t L1ForJetEt[8]; //[NL1ForJet]
Float_t L1ForJetE[8]; //[NL1ForJet]
Float_t L1ForJetEta[8]; //[NL1ForJet]
Float_t L1ForJetPhi[8]; //[NL1ForJet]
Int_t NL1Tau;
Float_t L1TauEt[8]; //[NL1Tau]
Float_t L1TauE[8]; //[NL1Tau]
Float_t L1TauEta[8]; //[NL1Tau]
Float_t L1TauPhi[8]; //[NL1Tau]
Float_t L1Met;
Float_t L1MetPhi;
Float_t L1EtTot;
Float_t L1Mht;
Float_t L1MhtPhi;
Float_t L1EtHad;
Int_t L1HfRing1EtSumPositiveEta;
Int_t L1HfRing2EtSumPositiveEta;
Int_t L1HfRing1EtSumNegativeEta;
Int_t L1HfRing2EtSumNegativeEta;
Int_t L1HfTowerCountPositiveEtaRing1;
Int_t L1HfTowerCountNegativeEtaRing1;
Int_t L1HfTowerCountPositiveEtaRing2;
Int_t L1HfTowerCountNegativeEtaRing2;
Int_t Run;
Int_t Event;
Int_t LumiBlock;
Int_t Bx;
Int_t Orbit;
Double_t AvgInstDelLumi;
Int_t HLTriggerFirstPath;
Int_t HLTriggerFirstPath_Prescl;
Int_t HLT_Activity_Ecal_SC7_v13;
Int_t HLT_Activity_Ecal_SC7_v13_Prescl;
Int_t HLT_BeamGas_HF_Beam1_v5;
Int_t HLT_BeamGas_HF_Beam1_v5_Prescl;
Int_t HLT_BeamGas_HF_Beam2_v5;
Int_t HLT_BeamGas_HF_Beam2_v5_Prescl;
Int_t HLT_BeamHalo_v13;
Int_t HLT_BeamHalo_v13_Prescl;
Int_t HLT_PAHcalUTCA_v1;
Int_t HLT_PAHcalUTCA_v1_Prescl;
Int_t HLT_PAHcalPhiSym_v1;
Int_t HLT_PAHcalPhiSym_v1_Prescl;
Int_t HLT_PAHcalNZS_v1;
Int_t HLT_PAHcalNZS_v1_Prescl;
Int_t HLT_GlobalRunHPDNoise_v8;
Int_t HLT_GlobalRunHPDNoise_v8_Prescl;
Int_t HLT_Physics_v5;
Int_t HLT_Physics_v5_Prescl;
Int_t DST_Physics_v5;
Int_t DST_Physics_v5_Prescl;
Int_t HLT_DTCalibration_v2;
Int_t HLT_DTCalibration_v2_Prescl;
Int_t HLT_EcalCalibration_v3;
Int_t HLT_EcalCalibration_v3_Prescl;
Int_t HLT_HcalCalibration_v3;
Int_t HLT_HcalCalibration_v3_Prescl;
Int_t HLT_TrackerCalibration_v3;
Int_t HLT_TrackerCalibration_v3_Prescl;
Int_t HLT_L1SingleMuOpen_AntiBPTX_v7;
Int_t HLT_L1SingleMuOpen_AntiBPTX_v7_Prescl;
Int_t HLT_L1TrackerCosmics_v7;
Int_t HLT_L1TrackerCosmics_v7_Prescl;
Int_t AlCa_PAEcalPi0EBonly_v1;
Int_t AlCa_PAEcalPi0EBonly_v1_Prescl;
Int_t AlCa_PAEcalPi0EEonly_v1;
Int_t AlCa_PAEcalPi0EEonly_v1_Prescl;
Int_t AlCa_PAEcalEtaEBonly_v1;
Int_t AlCa_PAEcalEtaEBonly_v1_Prescl;
Int_t AlCa_PAEcalEtaEEonly_v1;
Int_t AlCa_PAEcalEtaEEonly_v1_Prescl;
Int_t AlCa_EcalPhiSym_v13;
Int_t AlCa_EcalPhiSym_v13_Prescl;
Int_t AlCa_RPCMuonNoTriggers_v9;
Int_t AlCa_RPCMuonNoTriggers_v9_Prescl;
Int_t AlCa_RPCMuonNoHits_v9;
Int_t AlCa_RPCMuonNoHits_v9_Prescl;
Int_t AlCa_RPCMuonNormalisation_v9;
Int_t AlCa_RPCMuonNormalisation_v9_Prescl;
Int_t AlCa_LumiPixels_v8;
Int_t AlCa_LumiPixels_v8_Prescl;
Int_t AlCa_LumiPixels_ZeroBias_v4;
Int_t AlCa_LumiPixels_ZeroBias_v4_Prescl;
Int_t AlCa_LumiPixels_Random_v1;
Int_t AlCa_LumiPixels_Random_v1_Prescl;
Int_t HLT_PAL1SingleJet16_v1;
Int_t HLT_PAL1SingleJet16_v1_Prescl;
Int_t HLT_PAL1SingleJet36_v1;
Int_t HLT_PAL1SingleJet36_v1_Prescl;
Int_t HLT_PASingleForJet15_v1;
Int_t HLT_PASingleForJet15_v1_Prescl;
Int_t HLT_PASingleForJet25_v1;
Int_t HLT_PASingleForJet25_v1_Prescl;
Int_t HLT_PAJet20_NoJetID_v1;
Int_t HLT_PAJet20_NoJetID_v1_Prescl;
Int_t HLT_PAJet40_NoJetID_v1;
Int_t HLT_PAJet40_NoJetID_v1_Prescl;
Int_t HLT_PAJet60_NoJetID_v1;
Int_t HLT_PAJet60_NoJetID_v1_Prescl;
Int_t HLT_PAJet80_NoJetID_v1;
Int_t HLT_PAJet80_NoJetID_v1_Prescl;
Int_t HLT_PAJet100_NoJetID_v1;
Int_t HLT_PAJet100_NoJetID_v1_Prescl;
Int_t HLT_PAJet120_NoJetID_v1;
Int_t HLT_PAJet120_NoJetID_v1_Prescl;
Int_t HLT_PAForJet20Eta2_v1;
Int_t HLT_PAForJet20Eta2_v1_Prescl;
Int_t HLT_PAForJet40Eta2_v1;
Int_t HLT_PAForJet40Eta2_v1_Prescl;
Int_t HLT_PAForJet60Eta2_v1;
Int_t HLT_PAForJet60Eta2_v1_Prescl;
Int_t HLT_PAForJet80Eta2_v1;
Int_t HLT_PAForJet80Eta2_v1_Prescl;
Int_t HLT_PAForJet100Eta2_v1;
Int_t HLT_PAForJet100Eta2_v1_Prescl;
Int_t HLT_PAForJet20Eta3_v1;
Int_t HLT_PAForJet20Eta3_v1_Prescl;
Int_t HLT_PAForJet40Eta3_v1;
Int_t HLT_PAForJet40Eta3_v1_Prescl;
Int_t HLT_PAForJet60Eta3_v1;
Int_t HLT_PAForJet60Eta3_v1_Prescl;
Int_t HLT_PAForJet80Eta3_v1;
Int_t HLT_PAForJet80Eta3_v1_Prescl;
Int_t HLT_PAForJet100Eta3_v1;
Int_t HLT_PAForJet100Eta3_v1_Prescl;
Int_t HLT_PATripleJet20_20_20_v1;
Int_t HLT_PATripleJet20_20_20_v1_Prescl;
Int_t HLT_PATripleJet40_20_20_v1;
Int_t HLT_PATripleJet40_20_20_v1_Prescl;
Int_t HLT_PATripleJet60_20_20_v1;
Int_t HLT_PATripleJet60_20_20_v1_Prescl;
Int_t HLT_PATripleJet80_20_20_v1;
Int_t HLT_PATripleJet80_20_20_v1_Prescl;
Int_t HLT_PATripleJet100_20_20_v1;
Int_t HLT_PATripleJet100_20_20_v1_Prescl;
Int_t HLT_PAJet40ETM30_v1;
Int_t HLT_PAJet40ETM30_v1_Prescl;
Int_t HLT_PAJet60ETM30_v1;
Int_t HLT_PAJet60ETM30_v1_Prescl;
Int_t HLT_PAL1DoubleMu0_v1;
Int_t HLT_PAL1DoubleMu0_v1_Prescl;
Int_t HLT_PADimuon0_NoVertexing_v1;
Int_t HLT_PADimuon0_NoVertexing_v1_Prescl;
Int_t HLT_PAL1DoubleMu0_HighQ_v1;
Int_t HLT_PAL1DoubleMu0_HighQ_v1_Prescl;
Int_t HLT_PAL1DoubleMuOpen_v1;
Int_t HLT_PAL1DoubleMuOpen_v1_Prescl;
Int_t HLT_PAL2DoubleMu3_v1;
Int_t HLT_PAL2DoubleMu3_v1_Prescl;
Int_t HLT_PAMu3_v1;
Int_t HLT_PAMu3_v1_Prescl;
Int_t HLT_PAMu7_v1;
Int_t HLT_PAMu7_v1_Prescl;
Int_t HLT_PAMu12_v1;
Int_t HLT_PAMu12_v1_Prescl;
Int_t HLT_PABTagMu_Jet20_Mu4_v1;
Int_t HLT_PABTagMu_Jet20_Mu4_v1_Prescl;
Int_t HLT_PAMu3PFJet20_v1;
Int_t HLT_PAMu3PFJet20_v1_Prescl;
Int_t HLT_PAMu3PFJet40_v1;
Int_t HLT_PAMu3PFJet40_v1_Prescl;
Int_t HLT_PAMu7PFJet20_v1;
Int_t HLT_PAMu7PFJet20_v1_Prescl;
Int_t HLT_PAPhoton10_NoCaloIdVL_v1;
Int_t HLT_PAPhoton10_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton15_NoCaloIdVL_v1;
Int_t HLT_PAPhoton15_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton20_NoCaloIdVL_v1;
Int_t HLT_PAPhoton20_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton30_NoCaloIdVL_v1;
Int_t HLT_PAPhoton30_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton40_NoCaloIdVL_v1;
Int_t HLT_PAPhoton40_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton60_NoCaloIdVL_v1;
Int_t HLT_PAPhoton60_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton10_TightCaloIdVL_v1;
Int_t HLT_PAPhoton10_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton15_TightCaloIdVL_v1;
Int_t HLT_PAPhoton15_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton20_TightCaloIdVL_v1;
Int_t HLT_PAPhoton20_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton30_TightCaloIdVL_v1;
Int_t HLT_PAPhoton30_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton40_TightCaloIdVL_v1;
Int_t HLT_PAPhoton40_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton10_TightCaloIdVL_Iso50_v1;
Int_t HLT_PAPhoton10_TightCaloIdVL_Iso50_v1_Prescl;
Int_t HLT_PAPhoton15_TightCaloIdVL_Iso50_v1;
Int_t HLT_PAPhoton15_TightCaloIdVL_Iso50_v1_Prescl;
Int_t HLT_PAPhoton20_TightCaloIdVL_Iso50_v1;
Int_t HLT_PAPhoton20_TightCaloIdVL_Iso50_v1_Prescl;
Int_t HLT_PAPhoton30_TightCaloIdVL_Iso50_v1;
Int_t HLT_PAPhoton30_TightCaloIdVL_Iso50_v1_Prescl;
Int_t HLT_PAPhoton10_Photon10_NoCaloIdVL_v1;
Int_t HLT_PAPhoton10_Photon10_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton15_Photon10_NoCaloIdVL_v1;
Int_t HLT_PAPhoton15_Photon10_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton20_Photon15_NoCaloIdVL_v1;
Int_t HLT_PAPhoton20_Photon15_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton20_Photon20_NoCaloIdVL_v1;
Int_t HLT_PAPhoton20_Photon20_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton30_Photon30_NoCaloIdVL_v1;
Int_t HLT_PAPhoton30_Photon30_NoCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton10_Photon10_TightCaloIdVL_v1;
Int_t HLT_PAPhoton10_Photon10_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1;
Int_t HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1_Prescl;
Int_t HLT_PAPhoton15_Photon10_TightCaloIdVL_v1;
Int_t HLT_PAPhoton15_Photon10_TightCaloIdVL_v1_Prescl;
Int_t HLT_PAPhoton20_Photon15_TightCaloIdVL_v1;
Int_t HLT_PAPhoton20_Photon15_TightCaloIdVL_v1_Prescl;
Int_t HLT_PASingleEle6_CaloIdT_TrkIdVL_v1;
Int_t HLT_PASingleEle6_CaloIdT_TrkIdVL_v1_Prescl;
Int_t HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1;
Int_t HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1_Prescl;
Int_t HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1;
Int_t HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1_Prescl;
Int_t HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1;
Int_t HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1_Prescl;
Int_t HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1;
Int_t HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1_Prescl;
Int_t HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1;
Int_t HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1_Prescl;
Int_t HLT_PAPixelTracks_Multiplicity100_v1;
Int_t HLT_PAPixelTracks_Multiplicity100_v1_Prescl;
Int_t HLT_PAPixelTracks_Multiplicity130_v1;
Int_t HLT_PAPixelTracks_Multiplicity130_v1_Prescl;
Int_t HLT_PAPixelTracks_Multiplicity160_v1;
Int_t HLT_PAPixelTracks_Multiplicity160_v1_Prescl;
Int_t HLT_PAPixelTracks_Multiplicity190_v1;
Int_t HLT_PAPixelTracks_Multiplicity190_v1_Prescl;
Int_t HLT_PAPixelTracks_Multiplicity220_v1;
Int_t HLT_PAPixelTracks_Multiplicity220_v1_Prescl;
Int_t HLT_PAPixelTrackMultiplicity100_FullTrack12_v1;
Int_t HLT_PAPixelTrackMultiplicity100_FullTrack12_v1_Prescl;
Int_t HLT_PAPixelTrackMultiplicity130_FullTrack12_v1;
Int_t HLT_PAPixelTrackMultiplicity130_FullTrack12_v1_Prescl;
Int_t HLT_PAPixelTrackMultiplicity160_FullTrack12_v1;
Int_t HLT_PAPixelTrackMultiplicity160_FullTrack12_v1_Prescl;
Int_t HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1;
Int_t HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1_Prescl;
Int_t HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1;
Int_t HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1_Prescl;
Int_t HLT_PATech35_v1;
Int_t HLT_PATech35_v1_Prescl;
Int_t HLT_PATech35_HFSumET100_v1;
Int_t HLT_PATech35_HFSumET100_v1_Prescl;
Int_t HLT_PAFullTrack12_v1;
Int_t HLT_PAFullTrack12_v1_Prescl;
Int_t HLT_PAFullTrack20_v1;
Int_t HLT_PAFullTrack20_v1_Prescl;
Int_t HLT_PAFullTrack30_v1;
Int_t HLT_PAFullTrack30_v1_Prescl;
Int_t HLT_PAFullTrack50_v1;
Int_t HLT_PAFullTrack50_v1_Prescl;
Int_t HLT_PAHFSumET100_v1;
Int_t HLT_PAHFSumET100_v1_Prescl;
Int_t HLT_PAHFSumET140_v1;
Int_t HLT_PAHFSumET140_v1_Prescl;
Int_t HLT_PAHFSumET170_v1;
Int_t HLT_PAHFSumET170_v1_Prescl;
Int_t HLT_PAHFSumET210_v1;
Int_t HLT_PAHFSumET210_v1_Prescl;
Int_t HLT_PARomanPots_Tech52_v1;
Int_t HLT_PARomanPots_Tech52_v1_Prescl;
Int_t HLT_PAL1Tech53_MB_v1;
Int_t HLT_PAL1Tech53_MB_v1_Prescl;
Int_t HLT_PAL1Tech53_MB_SingleTrack_v1;
Int_t HLT_PAL1Tech53_MB_SingleTrack_v1_Prescl;
Int_t HLT_PAL1Tech54_ZeroBias_v1;
Int_t HLT_PAL1Tech54_ZeroBias_v1_Prescl;
Int_t HLT_PAT1minbias_Tech55_v1;
Int_t HLT_PAT1minbias_Tech55_v1_Prescl;
Int_t HLT_PAL1Tech_HBHEHO_totalOR_v1;
Int_t HLT_PAL1Tech_HBHEHO_totalOR_v1_Prescl;
Int_t HLT_PAL1Tech63_CASTORHaloMuon_v1;
Int_t HLT_PAL1Tech63_CASTORHaloMuon_v1_Prescl;
Int_t HLT_PACastorEmTotemLowMultiplicity_v1;
Int_t HLT_PACastorEmTotemLowMultiplicity_v1_Prescl;
Int_t HLT_PACastorEmNotHfCoincidencePm_v1;
Int_t HLT_PACastorEmNotHfCoincidencePm_v1_Prescl;
Int_t HLT_PACastorEmNotHfSingleChannel_v1;
Int_t HLT_PACastorEmNotHfSingleChannel_v1_Prescl;
Int_t HLT_PAL1CastorTotalTotemLowMultiplicity_v1;
Int_t HLT_PAL1CastorTotalTotemLowMultiplicity_v1_Prescl;
Int_t HLT_PAMinBiasHF_v1;
Int_t HLT_PAMinBiasHF_v1_Prescl;
Int_t HLT_PAMinBiasHF_OR_v1;
Int_t HLT_PAMinBiasHF_OR_v1_Prescl;
Int_t HLT_PAMinBiasBHC_v1;
Int_t HLT_PAMinBiasBHC_v1_Prescl;
Int_t HLT_PAMinBiasBHC_OR_v1;
Int_t HLT_PAMinBiasBHC_OR_v1_Prescl;
Int_t HLT_PAMinBiasHfOrBHC_v1;
Int_t HLT_PAMinBiasHfOrBHC_v1_Prescl;
Int_t HLT_PABptxPlusNotBptxMinus_v1;
Int_t HLT_PABptxPlusNotBptxMinus_v1_Prescl;
Int_t HLT_PABptxMinusNotBptxPlus_v1;
Int_t HLT_PABptxMinusNotBptxPlus_v1_Prescl;
Int_t HLT_PAZeroBias_v1;
Int_t HLT_PAZeroBias_v1_Prescl;
Int_t HLT_PAZeroBiasPixel_SingleTrack_v1;
Int_t HLT_PAZeroBiasPixel_SingleTrack_v1_Prescl;
Int_t HLT_PAHFOR_SingleTrack_v1;
Int_t HLT_PAHFOR_SingleTrack_v1_Prescl;
Int_t HLT_PAZeroBiasPixel_DoubleTrack_v1;
Int_t HLT_PAZeroBiasPixel_DoubleTrack_v1_Prescl;
Int_t HLT_PADoubleMu4_Acoplanarity03_v1;
Int_t HLT_PADoubleMu4_Acoplanarity03_v1_Prescl;
Int_t HLT_PAExclDijet35_HFAND_v1;
Int_t HLT_PAExclDijet35_HFAND_v1_Prescl;
Int_t HLT_PAL1DoubleEG3_FwdVeto_v1;
Int_t HLT_PAL1DoubleEG3_FwdVeto_v1_Prescl;
Int_t HLT_PAL1DoubleJet20_TotemDiffractive_v1;
Int_t HLT_PAL1DoubleJet20_TotemDiffractive_v1_Prescl;
Int_t HLT_PADoubleJet20_ForwardBackward_v1;
Int_t HLT_PADoubleJet20_ForwardBackward_v1_Prescl;
Int_t HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1;
Int_t HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1_Prescl;
Int_t HLT_PAUpcSingleEG5Pixel_TrackVeto_v1;
Int_t HLT_PAUpcSingleEG5Pixel_TrackVeto_v1_Prescl;
Int_t HLT_PAUpcSingleEG5Full_TrackVeto7_v1;
Int_t HLT_PAUpcSingleEG5Full_TrackVeto7_v1_Prescl;
Int_t HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1;
Int_t HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1_Prescl;
Int_t HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1;
Int_t HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1_Prescl;
Int_t HLT_PAUpcSingleMuOpenTkMu_Onia_v1;
Int_t HLT_PAUpcSingleMuOpenTkMu_Onia_v1_Prescl;
Int_t HLT_PARandom_v1;
Int_t HLT_PARandom_v1_Prescl;
Int_t DQM_FEDIntegrity_v11;
Int_t DQM_FEDIntegrity_v11_Prescl;
Int_t HLT_LogMonitor_v4;
Int_t HLT_LogMonitor_v4_Prescl;
Int_t HLTriggerFinalPath;
Int_t HLTriggerFinalPath_Prescl;
Int_t L1_AlwaysTrue;
Int_t L1_AlwaysTrue_Prescl;
Int_t L1_BeamGas_Hf_BptxMinusPostQuiet;
Int_t L1_BeamGas_Hf_BptxMinusPostQuiet_Prescl;
Int_t L1_BeamGas_Hf_BptxPlusPostQuiet;
Int_t L1_BeamGas_Hf_BptxPlusPostQuiet_Prescl;
Int_t L1_BeamHalo;
Int_t L1_BeamHalo_Prescl;
Int_t L1_BptxMinus_NotBptxPlus;
Int_t L1_BptxMinus_NotBptxPlus_Prescl;
Int_t L1_BptxPlus_NotBptxMinus;
Int_t L1_BptxPlus_NotBptxMinus_Prescl;
Int_t L1_BscHighMultiplicity_BptxAND;
Int_t L1_BscHighMultiplicity_BptxAND_Prescl;
Int_t L1_BscMinBiasOR_BptxAND;
Int_t L1_BscMinBiasOR_BptxAND_Prescl;
Int_t L1_BscMinBiasThreshold1_BptxAND;
Int_t L1_BscMinBiasThreshold1_BptxAND_Prescl;
Int_t L1_BscMinBiasThreshold2_BptxAND;
Int_t L1_BscMinBiasThreshold2_BptxAND_Prescl;
Int_t L1_CastorEm_NotHcalHfCoincidencePm;
Int_t L1_CastorEm_NotHcalHfCoincidencePm_Prescl;
Int_t L1_CastorEm_NotHcalHfSingleChannel;
Int_t L1_CastorEm_NotHcalHfSingleChannel_Prescl;
Int_t L1_CastorEm_TotemLowMultiplicity;
Int_t L1_CastorEm_TotemLowMultiplicity_Prescl;
Int_t L1_CastorTotalEnergy_TotemLowMultiplicity;
Int_t L1_CastorTotalEnergy_TotemLowMultiplicity_Prescl;
Int_t L1_DoubleEG3_FwdVeto;
Int_t L1_DoubleEG3_FwdVeto_Prescl;
Int_t L1_DoubleEG5;
Int_t L1_DoubleEG5_Prescl;
Int_t L1_DoubleEG5_TotemDiffractive;
Int_t L1_DoubleEG5_TotemDiffractive_Prescl;
Int_t L1_DoubleEG6_HTT100;
Int_t L1_DoubleEG6_HTT100_Prescl;
Int_t L1_DoubleEG6_HTT125;
Int_t L1_DoubleEG6_HTT125_Prescl;
Int_t L1_DoubleEG_13_7;
Int_t L1_DoubleEG_13_7_Prescl;
Int_t L1_DoubleForJet16_EtaOpp;
Int_t L1_DoubleForJet16_EtaOpp_Prescl;
Int_t L1_DoubleJet20;
Int_t L1_DoubleJet20_Prescl;
Int_t L1_DoubleJet20_TotemDiffractive;
Int_t L1_DoubleJet20_TotemDiffractive_Prescl;
Int_t L1_DoubleJet24_v1;
Int_t L1_DoubleJet24_v1_Prescl;
Int_t L1_DoubleJet36_Central;
Int_t L1_DoubleJet36_Central_Prescl;
Int_t L1_DoubleJet52_Central;
Int_t L1_DoubleJet52_Central_Prescl;
Int_t L1_DoubleJetC36_TotemDiffractive;
Int_t L1_DoubleJetC36_TotemDiffractive_Prescl;
Int_t L1_DoubleJetC44_ETM30;
Int_t L1_DoubleJetC44_ETM30_Prescl;
Int_t L1_DoubleJetC56;
Int_t L1_DoubleJetC56_Prescl;
Int_t L1_DoubleJetC56_Eta1p74_WdEta4;
Int_t L1_DoubleJetC56_Eta1p74_WdEta4_Prescl;
Int_t L1_DoubleMu0;
Int_t L1_DoubleMu0_Prescl;
Int_t L1_DoubleMu0_HighQ_EtaCuts;
Int_t L1_DoubleMu0_HighQ_EtaCuts_Prescl;
Int_t L1_DoubleMu3p5_EG5;
Int_t L1_DoubleMu3p5_EG5_Prescl;
Int_t L1_DoubleMu5_EG5;
Int_t L1_DoubleMu5_EG5_Prescl;
Int_t L1_DoubleMu5_TotemDiffractive;
Int_t L1_DoubleMu5_TotemDiffractive_Prescl;
Int_t L1_DoubleMu5_v1;
Int_t L1_DoubleMu5_v1_Prescl;
Int_t L1_DoubleMuOpen_BptxAND;
Int_t L1_DoubleMuOpen_BptxAND_Prescl;
Int_t L1_DoubleMu_10_3p5;
Int_t L1_DoubleMu_10_3p5_Prescl;
Int_t L1_DoubleMu_10_Open;
Int_t L1_DoubleMu_10_Open_Prescl;
Int_t L1_DoubleMu_12_5;
Int_t L1_DoubleMu_12_5_Prescl;
Int_t L1_DoubleMu_3er_0er_HighQ_WdEta22;
Int_t L1_DoubleMu_3er_0er_HighQ_WdEta22_Prescl;
Int_t L1_DoubleMu_5er_0er_HighQ_WdEta22;
Int_t L1_DoubleMu_5er_0er_HighQ_WdEta22_Prescl;
Int_t L1_EG8_DoubleJetC20;
Int_t L1_EG8_DoubleJetC20_Prescl;
Int_t L1_ETM100;
Int_t L1_ETM100_Prescl;
Int_t L1_ETM30;
Int_t L1_ETM30_Prescl;
Int_t L1_ETM36;
Int_t L1_ETM36_Prescl;
Int_t L1_ETM40;
Int_t L1_ETM40_Prescl;
Int_t L1_ETM50;
Int_t L1_ETM50_Prescl;
Int_t L1_ETM70;
Int_t L1_ETM70_Prescl;
Int_t L1_ETT140;
Int_t L1_ETT140_Prescl;
Int_t L1_ETT20_BptxAND;
Int_t L1_ETT20_BptxAND_Prescl;
Int_t L1_ETT300;
Int_t L1_ETT300_Prescl;
Int_t L1_ETT40;
Int_t L1_ETT40_Prescl;
Int_t L1_ETT60;
Int_t L1_ETT60_Prescl;
Int_t L1_ETT80;
Int_t L1_ETT80_Prescl;
Int_t L1_HTT100;
Int_t L1_HTT100_Prescl;
Int_t L1_HTT125;
Int_t L1_HTT125_Prescl;
Int_t L1_HTT150;
Int_t L1_HTT150_Prescl;
Int_t L1_HTT175;
Int_t L1_HTT175_Prescl;
Int_t L1_HTT200;
Int_t L1_HTT200_Prescl;
Int_t L1_HTT50;
Int_t L1_HTT50_Prescl;
Int_t L1_HTT75;
Int_t L1_HTT75_Prescl;
Int_t L1_HcalHfCoincidencePm_BptxAND_v1;
Int_t L1_HcalHfCoincidencePm_BptxAND_v1_Prescl;
Int_t L1_HcalHfSingleChannel_BptxAND;
Int_t L1_HcalHfSingleChannel_BptxAND_Prescl;
Int_t L1_Mu10er_JetC32;
Int_t L1_Mu10er_JetC32_Prescl;
Int_t L1_Mu12_EG7;
Int_t L1_Mu12_EG7_Prescl;
Int_t L1_Mu3_Jet16;
Int_t L1_Mu3_Jet16_Prescl;
Int_t L1_Mu3_Jet36;
Int_t L1_Mu3_Jet36_Prescl;
Int_t L1_Mu3_JetC16_WdEtaPhi2;
Int_t L1_Mu3_JetC16_WdEtaPhi2_Prescl;
Int_t L1_Mu3_JetC52_WdEtaPhi2;
Int_t L1_Mu3_JetC52_WdEtaPhi2_Prescl;
Int_t L1_Mu5_DoubleEG5;
Int_t L1_Mu5_DoubleEG5_Prescl;
Int_t L1_Mu5_DoubleEG6;
Int_t L1_Mu5_DoubleEG6_Prescl;
Int_t L1_Mu7_Jet16;
Int_t L1_Mu7_Jet16_Prescl;
Int_t L1_Mu8_DoubleJetC20;
Int_t L1_Mu8_DoubleJetC20_Prescl;
Int_t L1_MuOpen_EG12;
Int_t L1_MuOpen_EG12_Prescl;
Int_t L1_MuOpen_EG5;
Int_t L1_MuOpen_EG5_Prescl;
Int_t L1_QuadJetC32;
Int_t L1_QuadJetC32_Prescl;
Int_t L1_QuadJetC36;
Int_t L1_QuadJetC36_Prescl;
Int_t L1_QuadJetC40;
Int_t L1_QuadJetC40_Prescl;
Int_t L1_SingleEG12;
Int_t L1_SingleEG12_Prescl;
Int_t L1_SingleEG18er;
Int_t L1_SingleEG18er_Prescl;
Int_t L1_SingleEG20;
Int_t L1_SingleEG20_Prescl;
Int_t L1_SingleEG20_TotemDiffractive;
Int_t L1_SingleEG20_TotemDiffractive_Prescl;
Int_t L1_SingleEG22;
Int_t L1_SingleEG22_Prescl;
Int_t L1_SingleEG24;
Int_t L1_SingleEG24_Prescl;
Int_t L1_SingleEG30;
Int_t L1_SingleEG30_Prescl;
Int_t L1_SingleEG5_BptxAND;
Int_t L1_SingleEG5_BptxAND_Prescl;
Int_t L1_SingleEG7;
Int_t L1_SingleEG7_Prescl;
Int_t L1_SingleForJet16;
Int_t L1_SingleForJet16_Prescl;
Int_t L1_SingleIsoEG18er;
Int_t L1_SingleIsoEG18er_Prescl;
Int_t L1_SingleIsoEG20er;
Int_t L1_SingleIsoEG20er_Prescl;
Int_t L1_SingleJet128;
Int_t L1_SingleJet128_Prescl;
Int_t L1_SingleJet12_BptxAND;
Int_t L1_SingleJet12_BptxAND_Prescl;
Int_t L1_SingleJet16_BptxAND;
Int_t L1_SingleJet16_BptxAND_Prescl;
Int_t L1_SingleJet16_FwdVeto5;
Int_t L1_SingleJet16_FwdVeto5_Prescl;
Int_t L1_SingleJet20_Central_NotBptxOR;
Int_t L1_SingleJet20_Central_NotBptxOR_Prescl;
Int_t L1_SingleJet36;
Int_t L1_SingleJet36_Prescl;
Int_t L1_SingleJet36_FwdVeto5;
Int_t L1_SingleJet36_FwdVeto5_Prescl;
Int_t L1_SingleJet52;
Int_t L1_SingleJet52_Prescl;
Int_t L1_SingleJet52_TotemDiffractive;
Int_t L1_SingleJet52_TotemDiffractive_Prescl;
Int_t L1_SingleJet68;
Int_t L1_SingleJet68_Prescl;
Int_t L1_SingleJet92;
Int_t L1_SingleJet92_Prescl;
Int_t L1_SingleJetC32_NotBptxOR;
Int_t L1_SingleJetC32_NotBptxOR_Prescl;
Int_t L1_SingleMu12;
Int_t L1_SingleMu12_Prescl;
Int_t L1_SingleMu12er;
Int_t L1_SingleMu12er_Prescl;
Int_t L1_SingleMu14_Eta2p1;
Int_t L1_SingleMu14_Eta2p1_Prescl;
Int_t L1_SingleMu16;
Int_t L1_SingleMu16_Prescl;
Int_t L1_SingleMu16_Eta2p1;
Int_t L1_SingleMu16_Eta2p1_Prescl;
Int_t L1_SingleMu18er;
Int_t L1_SingleMu18er_Prescl;
Int_t L1_SingleMu20;
Int_t L1_SingleMu20_Prescl;
Int_t L1_SingleMu20_TotemDiffractive;
Int_t L1_SingleMu20_TotemDiffractive_Prescl;
Int_t L1_SingleMu20er;
Int_t L1_SingleMu20er_Prescl;
Int_t L1_SingleMu25er;
Int_t L1_SingleMu25er_Prescl;
Int_t L1_SingleMu3;
Int_t L1_SingleMu3_Prescl;
Int_t L1_SingleMu6_NotBptxOR;
Int_t L1_SingleMu6_NotBptxOR_Prescl;
Int_t L1_SingleMu7;
Int_t L1_SingleMu7_Prescl;
Int_t L1_SingleMuBeamHalo;
Int_t L1_SingleMuBeamHalo_Prescl;
Int_t L1_SingleMuOpen;
Int_t L1_SingleMuOpen_Prescl;
Int_t L1_TripleEG7;
Int_t L1_TripleEG7_Prescl;
Int_t L1_TripleEG_12_7_5;
Int_t L1_TripleEG_12_7_5_Prescl;
Int_t L1_TripleJetC_52_28_28;
Int_t L1_TripleJetC_52_28_28_Prescl;
Int_t L1_TripleJet_64_44_24_VBF;
Int_t L1_TripleJet_64_44_24_VBF_Prescl;
Int_t L1_TripleJet_64_48_28_VBF;
Int_t L1_TripleJet_64_48_28_VBF_Prescl;
Int_t L1_ZdcCaloPlus_TotemDiffractive_QElastic;
Int_t L1_ZdcCaloPlus_TotemDiffractive_QElastic_Prescl;
Int_t L1_ZeroBias;
Int_t L1_ZeroBias_Prescl;
Int_t L1Tech_BPTX_PreBPTX_v0;
Int_t L1Tech_BPTX_PreBPTX_v0_Prescl;
Int_t L1Tech_BPTX_minus_v0;
Int_t L1Tech_BPTX_minus_v0_Prescl;
Int_t L1Tech_BPTX_minus_AND_not_plus_v0;
Int_t L1Tech_BPTX_minus_AND_not_plus_v0_Prescl;
Int_t L1Tech_BPTX_plus_v0;
Int_t L1Tech_BPTX_plus_v0_Prescl;
Int_t L1Tech_BPTX_plus_AND_NOT_minus_v0;
Int_t L1Tech_BPTX_plus_AND_NOT_minus_v0_Prescl;
Int_t L1Tech_BPTX_plus_AND_minus_v0;
Int_t L1Tech_BPTX_plus_AND_minus_v0_Prescl;
Int_t L1Tech_BPTX_plus_AND_minus_instance1_v0;
Int_t L1Tech_BPTX_plus_AND_minus_instance1_v0_Prescl;
Int_t L1Tech_BPTX_plus_OR_minus_v0;
Int_t L1Tech_BPTX_plus_OR_minus_v0_Prescl;
Int_t L1Tech_BPTX_quiet_v0;
Int_t L1Tech_BPTX_quiet_v0_Prescl;
Int_t L1Tech_BSC_HighMultiplicity_v0;
Int_t L1Tech_BSC_HighMultiplicity_v0_Prescl;
Int_t L1Tech_BSC_halo_beam1_inner_v0;
Int_t L1Tech_BSC_halo_beam1_inner_v0_Prescl;
Int_t L1Tech_BSC_halo_beam1_outer_v0;
Int_t L1Tech_BSC_halo_beam1_outer_v0_Prescl;
Int_t L1Tech_BSC_halo_beam2_inner_v0;
Int_t L1Tech_BSC_halo_beam2_inner_v0_Prescl;
Int_t L1Tech_BSC_halo_beam2_outer_v0;
Int_t L1Tech_BSC_halo_beam2_outer_v0_Prescl;
Int_t L1Tech_BSC_minBias_OR_v0;
Int_t L1Tech_BSC_minBias_OR_v0_Prescl;
Int_t L1Tech_BSC_minBias_inner_threshold1_v0;
Int_t L1Tech_BSC_minBias_inner_threshold1_v0_Prescl;
Int_t L1Tech_BSC_minBias_inner_threshold2_v0;
Int_t L1Tech_BSC_minBias_inner_threshold2_v0_Prescl;
Int_t L1Tech_BSC_minBias_threshold1_v0;
Int_t L1Tech_BSC_minBias_threshold1_v0_Prescl;
Int_t L1Tech_BSC_minBias_threshold2_v0;
Int_t L1Tech_BSC_minBias_threshold2_v0_Prescl;
Int_t L1Tech_BSC_splash_beam1_v0;
Int_t L1Tech_BSC_splash_beam1_v0_Prescl;
Int_t L1Tech_BSC_splash_beam2_v0;
Int_t L1Tech_BSC_splash_beam2_v0_Prescl;
Int_t L1Tech_CASTOR_0_v0;
Int_t L1Tech_CASTOR_0_v0_Prescl;
Int_t L1Tech_CASTOR_EM_v0;
Int_t L1Tech_CASTOR_EM_v0_Prescl;
Int_t L1Tech_CASTOR_HaloMuon_v0;
Int_t L1Tech_CASTOR_HaloMuon_v0_Prescl;
Int_t L1Tech_CASTOR_TotalEnergy_v0;
Int_t L1Tech_CASTOR_TotalEnergy_v0_Prescl;
Int_t L1Tech_DT_GlobalOR_v0;
Int_t L1Tech_DT_GlobalOR_v0_Prescl;
Int_t L1Tech_FSC_St3Sect45_downLeft_v0;
Int_t L1Tech_FSC_St3Sect45_downLeft_v0_Prescl;
Int_t L1Tech_FSC_St3Sect45_downRight_v0;
Int_t L1Tech_FSC_St3Sect45_downRight_v0_Prescl;
Int_t L1Tech_FSC_St3Sect45_uppLeft_v0;
Int_t L1Tech_FSC_St3Sect45_uppLeft_v0_Prescl;
Int_t L1Tech_FSC_St3Sect45_uppRight_v0;
Int_t L1Tech_FSC_St3Sect45_uppRight_v0_Prescl;
Int_t L1Tech_FSC_St3Sect56_downLeft_v0;
Int_t L1Tech_FSC_St3Sect56_downLeft_v0_Prescl;
Int_t L1Tech_FSC_St3Sect56_downRight_v0;
Int_t L1Tech_FSC_St3Sect56_downRight_v0_Prescl;
Int_t L1Tech_FSC_St3Sect56_uppLeft_v0;
Int_t L1Tech_FSC_St3Sect56_uppLeft_v0_Prescl;
Int_t L1Tech_FSC_St3Sect56_uppRight_v0;
Int_t L1Tech_FSC_St3Sect56_uppRight_v0_Prescl;
Int_t L1Tech_HCAL_HBHE_totalOR_v0;
Int_t L1Tech_HCAL_HBHE_totalOR_v0_Prescl;
Int_t L1Tech_HCAL_HF_MMP_or_MPP_v1;
Int_t L1Tech_HCAL_HF_MMP_or_MPP_v1_Prescl;
Int_t L1Tech_HCAL_HF_coincidence_PM_v2;
Int_t L1Tech_HCAL_HF_coincidence_PM_v2_Prescl;
Int_t L1Tech_HCAL_HF_single_channel_v0;
Int_t L1Tech_HCAL_HF_single_channel_v0_Prescl;
Int_t L1Tech_HCAL_HO_totalOR_v0;
Int_t L1Tech_HCAL_HO_totalOR_v0_Prescl;
Int_t L1Tech_RPC_TTU_RB0_Cosmics_v0;
Int_t L1Tech_RPC_TTU_RB0_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_RBminus1_Cosmics_v0;
Int_t L1Tech_RPC_TTU_RBminus1_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_RBminus2_Cosmics_v0;
Int_t L1Tech_RPC_TTU_RBminus2_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_RBplus1_Cosmics_v0;
Int_t L1Tech_RPC_TTU_RBplus1_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_RBplus2_Cosmics_v0;
Int_t L1Tech_RPC_TTU_RBplus2_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_RBst1_collisions_v0;
Int_t L1Tech_RPC_TTU_RBst1_collisions_v0_Prescl;
Int_t L1Tech_RPC_TTU_barrel_Cosmics_v0;
Int_t L1Tech_RPC_TTU_barrel_Cosmics_v0_Prescl;
Int_t L1Tech_RPC_TTU_pointing_Cosmics_v0;
Int_t L1Tech_RPC_TTU_pointing_Cosmics_v0_Prescl;
Int_t L1Tech_TOTEM_Diffractive_v0;
Int_t L1Tech_TOTEM_Diffractive_v0_Prescl;
Int_t L1Tech_TOTEM_LowMultiplicity_v0;
Int_t L1Tech_TOTEM_LowMultiplicity_v0_Prescl;
Int_t L1Tech_TOTEM_MinBias_v0;
Int_t L1Tech_TOTEM_MinBias_v0_Prescl;
Int_t L1Tech_TOTEM_ZeroBias_v0;
Int_t L1Tech_TOTEM_ZeroBias_v0_Prescl;
Int_t L1Tech_ZDC_Scint_loose_vertex_v0;
Int_t L1Tech_ZDC_Scint_loose_vertex_v0_Prescl;
Int_t L1Tech_ZDC_Scint_minus_v0;
Int_t L1Tech_ZDC_Scint_minus_v0_Prescl;
Int_t L1Tech_ZDC_Scint_plus_v0;
Int_t L1Tech_ZDC_Scint_plus_v0_Prescl;
Int_t L1Tech_ZDC_Scint_tight_vertex_v0;
Int_t L1Tech_ZDC_Scint_tight_vertex_v0_Prescl;
// List of branches
TBranch *b_NL1IsolEm; //!
TBranch *b_L1IsolEmEt; //!
TBranch *b_L1IsolEmE; //!
TBranch *b_L1IsolEmEta; //!
TBranch *b_L1IsolEmPhi; //!
TBranch *b_NL1NIsolEm; //!
TBranch *b_L1NIsolEmEt; //!
TBranch *b_L1NIsolEmE; //!
TBranch *b_L1NIsolEmEta; //!
TBranch *b_L1NIsolEmPhi; //!
TBranch *b_NL1Mu; //!
TBranch *b_L1MuPt; //!
TBranch *b_L1MuE; //!
TBranch *b_L1MuEta; //!
TBranch *b_L1MuPhi; //!
TBranch *b_L1MuIsol; //!
TBranch *b_L1MuMip; //!
TBranch *b_L1MuFor; //!
TBranch *b_L1MuRPC; //!
TBranch *b_L1MuQal; //!
TBranch *b_L1MuChg; //!
TBranch *b_NL1CenJet; //!
TBranch *b_L1CenJetEt; //!
TBranch *b_L1CenJetE; //!
TBranch *b_L1CenJetEta; //!
TBranch *b_L1CenJetPhi; //!
TBranch *b_NL1ForJet; //!
TBranch *b_L1ForJetEt; //!
TBranch *b_L1ForJetE; //!
TBranch *b_L1ForJetEta; //!
TBranch *b_L1ForJetPhi; //!
TBranch *b_NL1Tau; //!
TBranch *b_L1TauEt; //!
TBranch *b_L1TauE; //!
TBranch *b_L1TauEta; //!
TBranch *b_L1TauPhi; //!
TBranch *b_L1Met; //!
TBranch *b_L1MetPhi; //!
TBranch *b_L1EtTot; //!
TBranch *b_L1Mht; //!
TBranch *b_L1MhtPhi; //!
TBranch *b_L1EtHad; //!
TBranch *b_L1HfRing1EtSumPositiveEta; //!
TBranch *b_L1HfRing2EtSumPositiveEta; //!
TBranch *b_L1HfRing1EtSumNegativeEta; //!
TBranch *b_L1HfRing2EtSumNegativeEta; //!
TBranch *b_L1HfTowerCountPositiveEtaRing1; //!
TBranch *b_L1HfTowerCountNegativeEtaRing1; //!
TBranch *b_L1HfTowerCountPositiveEtaRing2; //!
TBranch *b_L1HfTowerCountNegativeEtaRing2; //!
TBranch *b_Run; //!
TBranch *b_Event; //!
TBranch *b_LumiBlock; //!
TBranch *b_Bx; //!
TBranch *b_Orbit; //!
TBranch *b_AvgInstDelLumi; //!
TBranch *b_HLTriggerFirstPath; //!
TBranch *b_HLTriggerFirstPath_Prescl; //!
TBranch *b_HLT_Activity_Ecal_SC7_v13; //!
TBranch *b_HLT_Activity_Ecal_SC7_v13_Prescl; //!
TBranch *b_HLT_BeamGas_HF_Beam1_v5; //!
TBranch *b_HLT_BeamGas_HF_Beam1_v5_Prescl; //!
TBranch *b_HLT_BeamGas_HF_Beam2_v5; //!
TBranch *b_HLT_BeamGas_HF_Beam2_v5_Prescl; //!
TBranch *b_HLT_BeamHalo_v13; //!
TBranch *b_HLT_BeamHalo_v13_Prescl; //!
TBranch *b_HLT_PAHcalUTCA_v1; //!
TBranch *b_HLT_PAHcalUTCA_v1_Prescl; //!
TBranch *b_HLT_PAHcalPhiSym_v1; //!
TBranch *b_HLT_PAHcalPhiSym_v1_Prescl; //!
TBranch *b_HLT_PAHcalNZS_v1; //!
TBranch *b_HLT_PAHcalNZS_v1_Prescl; //!
TBranch *b_HLT_GlobalRunHPDNoise_v8; //!
TBranch *b_HLT_GlobalRunHPDNoise_v8_Prescl; //!
TBranch *b_HLT_Physics_v5; //!
TBranch *b_HLT_Physics_v5_Prescl; //!
TBranch *b_DST_Physics_v5; //!
TBranch *b_DST_Physics_v5_Prescl; //!
TBranch *b_HLT_DTCalibration_v2; //!
TBranch *b_HLT_DTCalibration_v2_Prescl; //!
TBranch *b_HLT_EcalCalibration_v3; //!
TBranch *b_HLT_EcalCalibration_v3_Prescl; //!
TBranch *b_HLT_HcalCalibration_v3; //!
TBranch *b_HLT_HcalCalibration_v3_Prescl; //!
TBranch *b_HLT_TrackerCalibration_v3; //!
TBranch *b_HLT_TrackerCalibration_v3_Prescl; //!
TBranch *b_HLT_L1SingleMuOpen_AntiBPTX_v7; //!
TBranch *b_HLT_L1SingleMuOpen_AntiBPTX_v7_Prescl; //!
TBranch *b_HLT_L1TrackerCosmics_v7; //!
TBranch *b_HLT_L1TrackerCosmics_v7_Prescl; //!
TBranch *b_AlCa_PAEcalPi0EBonly_v1; //!
TBranch *b_AlCa_PAEcalPi0EBonly_v1_Prescl; //!
TBranch *b_AlCa_PAEcalPi0EEonly_v1; //!
TBranch *b_AlCa_PAEcalPi0EEonly_v1_Prescl; //!
TBranch *b_AlCa_PAEcalEtaEBonly_v1; //!
TBranch *b_AlCa_PAEcalEtaEBonly_v1_Prescl; //!
TBranch *b_AlCa_PAEcalEtaEEonly_v1; //!
TBranch *b_AlCa_PAEcalEtaEEonly_v1_Prescl; //!
TBranch *b_AlCa_EcalPhiSym_v13; //!
TBranch *b_AlCa_EcalPhiSym_v13_Prescl; //!
TBranch *b_AlCa_RPCMuonNoTriggers_v9; //!
TBranch *b_AlCa_RPCMuonNoTriggers_v9_Prescl; //!
TBranch *b_AlCa_RPCMuonNoHits_v9; //!
TBranch *b_AlCa_RPCMuonNoHits_v9_Prescl; //!
TBranch *b_AlCa_RPCMuonNormalisation_v9; //!
TBranch *b_AlCa_RPCMuonNormalisation_v9_Prescl; //!
TBranch *b_AlCa_LumiPixels_v8; //!
TBranch *b_AlCa_LumiPixels_v8_Prescl; //!
TBranch *b_AlCa_LumiPixels_ZeroBias_v4; //!
TBranch *b_AlCa_LumiPixels_ZeroBias_v4_Prescl; //!
TBranch *b_AlCa_LumiPixels_Random_v1; //!
TBranch *b_AlCa_LumiPixels_Random_v1_Prescl; //!
TBranch *b_HLT_PAL1SingleJet16_v1; //!
TBranch *b_HLT_PAL1SingleJet16_v1_Prescl; //!
TBranch *b_HLT_PAL1SingleJet36_v1; //!
TBranch *b_HLT_PAL1SingleJet36_v1_Prescl; //!
TBranch *b_HLT_PASingleForJet15_v1; //!
TBranch *b_HLT_PASingleForJet15_v1_Prescl; //!
TBranch *b_HLT_PASingleForJet25_v1; //!
TBranch *b_HLT_PASingleForJet25_v1_Prescl; //!
TBranch *b_HLT_PAJet20_NoJetID_v1; //!
TBranch *b_HLT_PAJet20_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAJet40_NoJetID_v1; //!
TBranch *b_HLT_PAJet40_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAJet60_NoJetID_v1; //!
TBranch *b_HLT_PAJet60_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAJet80_NoJetID_v1; //!
TBranch *b_HLT_PAJet80_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAJet100_NoJetID_v1; //!
TBranch *b_HLT_PAJet100_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAJet120_NoJetID_v1; //!
TBranch *b_HLT_PAJet120_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PAForJet20Eta2_v1; //!
TBranch *b_HLT_PAForJet20Eta2_v1_Prescl; //!
TBranch *b_HLT_PAForJet40Eta2_v1; //!
TBranch *b_HLT_PAForJet40Eta2_v1_Prescl; //!
TBranch *b_HLT_PAForJet60Eta2_v1; //!
TBranch *b_HLT_PAForJet60Eta2_v1_Prescl; //!
TBranch *b_HLT_PAForJet80Eta2_v1; //!
TBranch *b_HLT_PAForJet80Eta2_v1_Prescl; //!
TBranch *b_HLT_PAForJet100Eta2_v1; //!
TBranch *b_HLT_PAForJet100Eta2_v1_Prescl; //!
TBranch *b_HLT_PAForJet20Eta3_v1; //!
TBranch *b_HLT_PAForJet20Eta3_v1_Prescl; //!
TBranch *b_HLT_PAForJet40Eta3_v1; //!
TBranch *b_HLT_PAForJet40Eta3_v1_Prescl; //!
TBranch *b_HLT_PAForJet60Eta3_v1; //!
TBranch *b_HLT_PAForJet60Eta3_v1_Prescl; //!
TBranch *b_HLT_PAForJet80Eta3_v1; //!
TBranch *b_HLT_PAForJet80Eta3_v1_Prescl; //!
TBranch *b_HLT_PAForJet100Eta3_v1; //!
TBranch *b_HLT_PAForJet100Eta3_v1_Prescl; //!
TBranch *b_HLT_PATripleJet20_20_20_v1; //!
TBranch *b_HLT_PATripleJet20_20_20_v1_Prescl; //!
TBranch *b_HLT_PATripleJet40_20_20_v1; //!
TBranch *b_HLT_PATripleJet40_20_20_v1_Prescl; //!
TBranch *b_HLT_PATripleJet60_20_20_v1; //!
TBranch *b_HLT_PATripleJet60_20_20_v1_Prescl; //!
TBranch *b_HLT_PATripleJet80_20_20_v1; //!
TBranch *b_HLT_PATripleJet80_20_20_v1_Prescl; //!
TBranch *b_HLT_PATripleJet100_20_20_v1; //!
TBranch *b_HLT_PATripleJet100_20_20_v1_Prescl; //!
TBranch *b_HLT_PAJet40ETM30_v1; //!
TBranch *b_HLT_PAJet40ETM30_v1_Prescl; //!
TBranch *b_HLT_PAJet60ETM30_v1; //!
TBranch *b_HLT_PAJet60ETM30_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleMu0_v1; //!
TBranch *b_HLT_PAL1DoubleMu0_v1_Prescl; //!
TBranch *b_HLT_PADimuon0_NoVertexing_v1; //!
TBranch *b_HLT_PADimuon0_NoVertexing_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleMu0_HighQ_v1; //!
TBranch *b_HLT_PAL1DoubleMu0_HighQ_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleMuOpen_v1; //!
TBranch *b_HLT_PAL1DoubleMuOpen_v1_Prescl; //!
TBranch *b_HLT_PAL2DoubleMu3_v1; //!
TBranch *b_HLT_PAL2DoubleMu3_v1_Prescl; //!
TBranch *b_HLT_PAMu3_v1; //!
TBranch *b_HLT_PAMu3_v1_Prescl; //!
TBranch *b_HLT_PAMu7_v1; //!
TBranch *b_HLT_PAMu7_v1_Prescl; //!
TBranch *b_HLT_PAMu12_v1; //!
TBranch *b_HLT_PAMu12_v1_Prescl; //!
TBranch *b_HLT_PABTagMu_Jet20_Mu4_v1; //!
TBranch *b_HLT_PABTagMu_Jet20_Mu4_v1_Prescl; //!
TBranch *b_HLT_PAMu3PFJet20_v1; //!
TBranch *b_HLT_PAMu3PFJet20_v1_Prescl; //!
TBranch *b_HLT_PAMu3PFJet40_v1; //!
TBranch *b_HLT_PAMu3PFJet40_v1_Prescl; //!
TBranch *b_HLT_PAMu7PFJet20_v1; //!
TBranch *b_HLT_PAMu7PFJet20_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton10_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton15_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton15_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton20_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton30_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton30_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton40_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton40_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton60_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton60_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton10_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton15_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton15_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton20_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton30_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton30_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton40_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton40_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_TightCaloIdVL_Iso50_v1; //!
TBranch *b_HLT_PAPhoton10_TightCaloIdVL_Iso50_v1_Prescl; //!
TBranch *b_HLT_PAPhoton15_TightCaloIdVL_Iso50_v1; //!
TBranch *b_HLT_PAPhoton15_TightCaloIdVL_Iso50_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_TightCaloIdVL_Iso50_v1; //!
TBranch *b_HLT_PAPhoton20_TightCaloIdVL_Iso50_v1_Prescl; //!
TBranch *b_HLT_PAPhoton30_TightCaloIdVL_Iso50_v1; //!
TBranch *b_HLT_PAPhoton30_TightCaloIdVL_Iso50_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_Photon10_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton10_Photon10_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton15_Photon10_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton15_Photon10_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_Photon15_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton20_Photon15_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_Photon20_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton20_Photon20_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton30_Photon30_NoCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton30_Photon30_NoCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_Photon10_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton10_Photon10_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1; //!
TBranch *b_HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1_Prescl; //!
TBranch *b_HLT_PAPhoton15_Photon10_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton15_Photon10_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPhoton20_Photon15_TightCaloIdVL_v1; //!
TBranch *b_HLT_PAPhoton20_Photon15_TightCaloIdVL_v1_Prescl; //!
TBranch *b_HLT_PASingleEle6_CaloIdT_TrkIdVL_v1; //!
TBranch *b_HLT_PASingleEle6_CaloIdT_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1; //!
TBranch *b_HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1; //!
TBranch *b_HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1; //!
TBranch *b_HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1; //!
TBranch *b_HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1; //!
TBranch *b_HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1_Prescl; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity100_v1; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity100_v1_Prescl; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity130_v1; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity130_v1_Prescl; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity160_v1; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity160_v1_Prescl; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity190_v1; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity190_v1_Prescl; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity220_v1; //!
TBranch *b_HLT_PAPixelTracks_Multiplicity220_v1_Prescl; //!
TBranch *b_HLT_PAPixelTrackMultiplicity100_FullTrack12_v1; //!
TBranch *b_HLT_PAPixelTrackMultiplicity100_FullTrack12_v1_Prescl; //!
TBranch *b_HLT_PAPixelTrackMultiplicity130_FullTrack12_v1; //!
TBranch *b_HLT_PAPixelTrackMultiplicity130_FullTrack12_v1_Prescl; //!
TBranch *b_HLT_PAPixelTrackMultiplicity160_FullTrack12_v1; //!
TBranch *b_HLT_PAPixelTrackMultiplicity160_FullTrack12_v1_Prescl; //!
TBranch *b_HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1; //!
TBranch *b_HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1_Prescl; //!
TBranch *b_HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1; //!
TBranch *b_HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1_Prescl; //!
TBranch *b_HLT_PATech35_v1; //!
TBranch *b_HLT_PATech35_v1_Prescl; //!
TBranch *b_HLT_PATech35_HFSumET100_v1; //!
TBranch *b_HLT_PATech35_HFSumET100_v1_Prescl; //!
TBranch *b_HLT_PAFullTrack12_v1; //!
TBranch *b_HLT_PAFullTrack12_v1_Prescl; //!
TBranch *b_HLT_PAFullTrack20_v1; //!
TBranch *b_HLT_PAFullTrack20_v1_Prescl; //!
TBranch *b_HLT_PAFullTrack30_v1; //!
TBranch *b_HLT_PAFullTrack30_v1_Prescl; //!
TBranch *b_HLT_PAFullTrack50_v1; //!
TBranch *b_HLT_PAFullTrack50_v1_Prescl; //!
TBranch *b_HLT_PAHFSumET100_v1; //!
TBranch *b_HLT_PAHFSumET100_v1_Prescl; //!
TBranch *b_HLT_PAHFSumET140_v1; //!
TBranch *b_HLT_PAHFSumET140_v1_Prescl; //!
TBranch *b_HLT_PAHFSumET170_v1; //!
TBranch *b_HLT_PAHFSumET170_v1_Prescl; //!
TBranch *b_HLT_PAHFSumET210_v1; //!
TBranch *b_HLT_PAHFSumET210_v1_Prescl; //!
TBranch *b_HLT_PARomanPots_Tech52_v1; //!
TBranch *b_HLT_PARomanPots_Tech52_v1_Prescl; //!
TBranch *b_HLT_PAL1Tech53_MB_v1; //!
TBranch *b_HLT_PAL1Tech53_MB_v1_Prescl; //!
TBranch *b_HLT_PAL1Tech53_MB_SingleTrack_v1; //!
TBranch *b_HLT_PAL1Tech53_MB_SingleTrack_v1_Prescl; //!
TBranch *b_HLT_PAL1Tech54_ZeroBias_v1; //!
TBranch *b_HLT_PAL1Tech54_ZeroBias_v1_Prescl; //!
TBranch *b_HLT_PAT1minbias_Tech55_v1; //!
TBranch *b_HLT_PAT1minbias_Tech55_v1_Prescl; //!
TBranch *b_HLT_PAL1Tech_HBHEHO_totalOR_v1; //!
TBranch *b_HLT_PAL1Tech_HBHEHO_totalOR_v1_Prescl; //!
TBranch *b_HLT_PAL1Tech63_CASTORHaloMuon_v1; //!
TBranch *b_HLT_PAL1Tech63_CASTORHaloMuon_v1_Prescl; //!
TBranch *b_HLT_PACastorEmTotemLowMultiplicity_v1; //!
TBranch *b_HLT_PACastorEmTotemLowMultiplicity_v1_Prescl; //!
TBranch *b_HLT_PACastorEmNotHfCoincidencePm_v1; //!
TBranch *b_HLT_PACastorEmNotHfCoincidencePm_v1_Prescl; //!
TBranch *b_HLT_PACastorEmNotHfSingleChannel_v1; //!
TBranch *b_HLT_PACastorEmNotHfSingleChannel_v1_Prescl; //!
TBranch *b_HLT_PAL1CastorTotalTotemLowMultiplicity_v1; //!
TBranch *b_HLT_PAL1CastorTotalTotemLowMultiplicity_v1_Prescl; //!
TBranch *b_HLT_PAMinBiasHF_v1; //!
TBranch *b_HLT_PAMinBiasHF_v1_Prescl; //!
TBranch *b_HLT_PAMinBiasHF_OR_v1; //!
TBranch *b_HLT_PAMinBiasHF_OR_v1_Prescl; //!
TBranch *b_HLT_PAMinBiasBHC_v1; //!
TBranch *b_HLT_PAMinBiasBHC_v1_Prescl; //!
TBranch *b_HLT_PAMinBiasBHC_OR_v1; //!
TBranch *b_HLT_PAMinBiasBHC_OR_v1_Prescl; //!
TBranch *b_HLT_PAMinBiasHfOrBHC_v1; //!
TBranch *b_HLT_PAMinBiasHfOrBHC_v1_Prescl; //!
TBranch *b_HLT_PABptxPlusNotBptxMinus_v1; //!
TBranch *b_HLT_PABptxPlusNotBptxMinus_v1_Prescl; //!
TBranch *b_HLT_PABptxMinusNotBptxPlus_v1; //!
TBranch *b_HLT_PABptxMinusNotBptxPlus_v1_Prescl; //!
TBranch *b_HLT_PAZeroBias_v1; //!
TBranch *b_HLT_PAZeroBias_v1_Prescl; //!
TBranch *b_HLT_PAZeroBiasPixel_SingleTrack_v1; //!
TBranch *b_HLT_PAZeroBiasPixel_SingleTrack_v1_Prescl; //!
TBranch *b_HLT_PAHFOR_SingleTrack_v1; //!
TBranch *b_HLT_PAHFOR_SingleTrack_v1_Prescl; //!
TBranch *b_HLT_PAZeroBiasPixel_DoubleTrack_v1; //!
TBranch *b_HLT_PAZeroBiasPixel_DoubleTrack_v1_Prescl; //!
TBranch *b_HLT_PADoubleMu4_Acoplanarity03_v1; //!
TBranch *b_HLT_PADoubleMu4_Acoplanarity03_v1_Prescl; //!
TBranch *b_HLT_PAExclDijet35_HFAND_v1; //!
TBranch *b_HLT_PAExclDijet35_HFAND_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleEG3_FwdVeto_v1; //!
TBranch *b_HLT_PAL1DoubleEG3_FwdVeto_v1_Prescl; //!
TBranch *b_HLT_PAL1DoubleJet20_TotemDiffractive_v1; //!
TBranch *b_HLT_PAL1DoubleJet20_TotemDiffractive_v1_Prescl; //!
TBranch *b_HLT_PADoubleJet20_ForwardBackward_v1; //!
TBranch *b_HLT_PADoubleJet20_ForwardBackward_v1_Prescl; //!
TBranch *b_HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1; //!
TBranch *b_HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1_Prescl; //!
TBranch *b_HLT_PAUpcSingleEG5Pixel_TrackVeto_v1; //!
TBranch *b_HLT_PAUpcSingleEG5Pixel_TrackVeto_v1_Prescl; //!
TBranch *b_HLT_PAUpcSingleEG5Full_TrackVeto7_v1; //!
TBranch *b_HLT_PAUpcSingleEG5Full_TrackVeto7_v1_Prescl; //!
TBranch *b_HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1; //!
TBranch *b_HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1_Prescl; //!
TBranch *b_HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1; //!
TBranch *b_HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1_Prescl; //!
TBranch *b_HLT_PAUpcSingleMuOpenTkMu_Onia_v1; //!
TBranch *b_HLT_PAUpcSingleMuOpenTkMu_Onia_v1_Prescl; //!
TBranch *b_HLT_PARandom_v1; //!
TBranch *b_HLT_PARandom_v1_Prescl; //!
TBranch *b_DQM_FEDIntegrity_v11; //!
TBranch *b_DQM_FEDIntegrity_v11_Prescl; //!
TBranch *b_HLT_LogMonitor_v4; //!
TBranch *b_HLT_LogMonitor_v4_Prescl; //!
TBranch *b_HLTriggerFinalPath; //!
TBranch *b_HLTriggerFinalPath_Prescl; //!
TBranch *b_L1_AlwaysTrue; //!
TBranch *b_L1_AlwaysTrue_Prescl; //!
TBranch *b_L1_BeamGas_Hf_BptxMinusPostQuiet; //!
TBranch *b_L1_BeamGas_Hf_BptxMinusPostQuiet_Prescl; //!
TBranch *b_L1_BeamGas_Hf_BptxPlusPostQuiet; //!
TBranch *b_L1_BeamGas_Hf_BptxPlusPostQuiet_Prescl; //!
TBranch *b_L1_BeamHalo; //!
TBranch *b_L1_BeamHalo_Prescl; //!
TBranch *b_L1_BptxMinus_NotBptxPlus; //!
TBranch *b_L1_BptxMinus_NotBptxPlus_Prescl; //!
TBranch *b_L1_BptxPlus_NotBptxMinus; //!
TBranch *b_L1_BptxPlus_NotBptxMinus_Prescl; //!
TBranch *b_L1_BscHighMultiplicity_BptxAND; //!
TBranch *b_L1_BscHighMultiplicity_BptxAND_Prescl; //!
TBranch *b_L1_BscMinBiasOR_BptxAND; //!
TBranch *b_L1_BscMinBiasOR_BptxAND_Prescl; //!
TBranch *b_L1_BscMinBiasThreshold1_BptxAND; //!
TBranch *b_L1_BscMinBiasThreshold1_BptxAND_Prescl; //!
TBranch *b_L1_BscMinBiasThreshold2_BptxAND; //!
TBranch *b_L1_BscMinBiasThreshold2_BptxAND_Prescl; //!
TBranch *b_L1_CastorEm_NotHcalHfCoincidencePm; //!
TBranch *b_L1_CastorEm_NotHcalHfCoincidencePm_Prescl; //!
TBranch *b_L1_CastorEm_NotHcalHfSingleChannel; //!
TBranch *b_L1_CastorEm_NotHcalHfSingleChannel_Prescl; //!
TBranch *b_L1_CastorEm_TotemLowMultiplicity; //!
TBranch *b_L1_CastorEm_TotemLowMultiplicity_Prescl; //!
TBranch *b_L1_CastorTotalEnergy_TotemLowMultiplicity; //!
TBranch *b_L1_CastorTotalEnergy_TotemLowMultiplicity_Prescl; //!
TBranch *b_L1_DoubleEG3_FwdVeto; //!
TBranch *b_L1_DoubleEG3_FwdVeto_Prescl; //!
TBranch *b_L1_DoubleEG5; //!
TBranch *b_L1_DoubleEG5_Prescl; //!
TBranch *b_L1_DoubleEG5_TotemDiffractive; //!
TBranch *b_L1_DoubleEG5_TotemDiffractive_Prescl; //!
TBranch *b_L1_DoubleEG6_HTT100; //!
TBranch *b_L1_DoubleEG6_HTT100_Prescl; //!
TBranch *b_L1_DoubleEG6_HTT125; //!
TBranch *b_L1_DoubleEG6_HTT125_Prescl; //!
TBranch *b_L1_DoubleEG_13_7; //!
TBranch *b_L1_DoubleEG_13_7_Prescl; //!
TBranch *b_L1_DoubleForJet16_EtaOpp; //!
TBranch *b_L1_DoubleForJet16_EtaOpp_Prescl; //!
TBranch *b_L1_DoubleJet20; //!
TBranch *b_L1_DoubleJet20_Prescl; //!
TBranch *b_L1_DoubleJet20_TotemDiffractive; //!
TBranch *b_L1_DoubleJet20_TotemDiffractive_Prescl; //!
TBranch *b_L1_DoubleJet24_v1; //!
TBranch *b_L1_DoubleJet24_v1_Prescl; //!
TBranch *b_L1_DoubleJet36_Central; //!
TBranch *b_L1_DoubleJet36_Central_Prescl; //!
TBranch *b_L1_DoubleJet52_Central; //!
TBranch *b_L1_DoubleJet52_Central_Prescl; //!
TBranch *b_L1_DoubleJetC36_TotemDiffractive; //!
TBranch *b_L1_DoubleJetC36_TotemDiffractive_Prescl; //!
TBranch *b_L1_DoubleJetC44_ETM30; //!
TBranch *b_L1_DoubleJetC44_ETM30_Prescl; //!
TBranch *b_L1_DoubleJetC56; //!
TBranch *b_L1_DoubleJetC56_Prescl; //!
TBranch *b_L1_DoubleJetC56_Eta1p74_WdEta4; //!
TBranch *b_L1_DoubleJetC56_Eta1p74_WdEta4_Prescl; //!
TBranch *b_L1_DoubleMu0; //!
TBranch *b_L1_DoubleMu0_Prescl; //!
TBranch *b_L1_DoubleMu0_HighQ_EtaCuts; //!
TBranch *b_L1_DoubleMu0_HighQ_EtaCuts_Prescl; //!
TBranch *b_L1_DoubleMu3p5_EG5; //!
TBranch *b_L1_DoubleMu3p5_EG5_Prescl; //!
TBranch *b_L1_DoubleMu5_EG5; //!
TBranch *b_L1_DoubleMu5_EG5_Prescl; //!
TBranch *b_L1_DoubleMu5_TotemDiffractive; //!
TBranch *b_L1_DoubleMu5_TotemDiffractive_Prescl; //!
TBranch *b_L1_DoubleMu5_v1; //!
TBranch *b_L1_DoubleMu5_v1_Prescl; //!
TBranch *b_L1_DoubleMuOpen_BptxAND; //!
TBranch *b_L1_DoubleMuOpen_BptxAND_Prescl; //!
TBranch *b_L1_DoubleMu_10_3p5; //!
TBranch *b_L1_DoubleMu_10_3p5_Prescl; //!
TBranch *b_L1_DoubleMu_10_Open; //!
TBranch *b_L1_DoubleMu_10_Open_Prescl; //!
TBranch *b_L1_DoubleMu_12_5; //!
TBranch *b_L1_DoubleMu_12_5_Prescl; //!
TBranch *b_L1_DoubleMu_3er_0er_HighQ_WdEta22; //!
TBranch *b_L1_DoubleMu_3er_0er_HighQ_WdEta22_Prescl; //!
TBranch *b_L1_DoubleMu_5er_0er_HighQ_WdEta22; //!
TBranch *b_L1_DoubleMu_5er_0er_HighQ_WdEta22_Prescl; //!
TBranch *b_L1_EG8_DoubleJetC20; //!
TBranch *b_L1_EG8_DoubleJetC20_Prescl; //!
TBranch *b_L1_ETM100; //!
TBranch *b_L1_ETM100_Prescl; //!
TBranch *b_L1_ETM30; //!
TBranch *b_L1_ETM30_Prescl; //!
TBranch *b_L1_ETM36; //!
TBranch *b_L1_ETM36_Prescl; //!
TBranch *b_L1_ETM40; //!
TBranch *b_L1_ETM40_Prescl; //!
TBranch *b_L1_ETM50; //!
TBranch *b_L1_ETM50_Prescl; //!
TBranch *b_L1_ETM70; //!
TBranch *b_L1_ETM70_Prescl; //!
TBranch *b_L1_ETT140; //!
TBranch *b_L1_ETT140_Prescl; //!
TBranch *b_L1_ETT20_BptxAND; //!
TBranch *b_L1_ETT20_BptxAND_Prescl; //!
TBranch *b_L1_ETT300; //!
TBranch *b_L1_ETT300_Prescl; //!
TBranch *b_L1_ETT40; //!
TBranch *b_L1_ETT40_Prescl; //!
TBranch *b_L1_ETT60; //!
TBranch *b_L1_ETT60_Prescl; //!
TBranch *b_L1_ETT80; //!
TBranch *b_L1_ETT80_Prescl; //!
TBranch *b_L1_HTT100; //!
TBranch *b_L1_HTT100_Prescl; //!
TBranch *b_L1_HTT125; //!
TBranch *b_L1_HTT125_Prescl; //!
TBranch *b_L1_HTT150; //!
TBranch *b_L1_HTT150_Prescl; //!
TBranch *b_L1_HTT175; //!
TBranch *b_L1_HTT175_Prescl; //!
TBranch *b_L1_HTT200; //!
TBranch *b_L1_HTT200_Prescl; //!
TBranch *b_L1_HTT50; //!
TBranch *b_L1_HTT50_Prescl; //!
TBranch *b_L1_HTT75; //!
TBranch *b_L1_HTT75_Prescl; //!
TBranch *b_L1_HcalHfCoincidencePm_BptxAND_v1; //!
TBranch *b_L1_HcalHfCoincidencePm_BptxAND_v1_Prescl; //!
TBranch *b_L1_HcalHfSingleChannel_BptxAND; //!
TBranch *b_L1_HcalHfSingleChannel_BptxAND_Prescl; //!
TBranch *b_L1_Mu10er_JetC32; //!
TBranch *b_L1_Mu10er_JetC32_Prescl; //!
TBranch *b_L1_Mu12_EG7; //!
TBranch *b_L1_Mu12_EG7_Prescl; //!
TBranch *b_L1_Mu3_Jet16; //!
TBranch *b_L1_Mu3_Jet16_Prescl; //!
TBranch *b_L1_Mu3_Jet36; //!
TBranch *b_L1_Mu3_Jet36_Prescl; //!
TBranch *b_L1_Mu3_JetC16_WdEtaPhi2; //!
TBranch *b_L1_Mu3_JetC16_WdEtaPhi2_Prescl; //!
TBranch *b_L1_Mu3_JetC52_WdEtaPhi2; //!
TBranch *b_L1_Mu3_JetC52_WdEtaPhi2_Prescl; //!
TBranch *b_L1_Mu5_DoubleEG5; //!
TBranch *b_L1_Mu5_DoubleEG5_Prescl; //!
TBranch *b_L1_Mu5_DoubleEG6; //!
TBranch *b_L1_Mu5_DoubleEG6_Prescl; //!
TBranch *b_L1_Mu7_Jet16; //!
TBranch *b_L1_Mu7_Jet16_Prescl; //!
TBranch *b_L1_Mu8_DoubleJetC20; //!
TBranch *b_L1_Mu8_DoubleJetC20_Prescl; //!
TBranch *b_L1_MuOpen_EG12; //!
TBranch *b_L1_MuOpen_EG12_Prescl; //!
TBranch *b_L1_MuOpen_EG5; //!
TBranch *b_L1_MuOpen_EG5_Prescl; //!
TBranch *b_L1_QuadJetC32; //!
TBranch *b_L1_QuadJetC32_Prescl; //!
TBranch *b_L1_QuadJetC36; //!
TBranch *b_L1_QuadJetC36_Prescl; //!
TBranch *b_L1_QuadJetC40; //!
TBranch *b_L1_QuadJetC40_Prescl; //!
TBranch *b_L1_SingleEG12; //!
TBranch *b_L1_SingleEG12_Prescl; //!
TBranch *b_L1_SingleEG18er; //!
TBranch *b_L1_SingleEG18er_Prescl; //!
TBranch *b_L1_SingleEG20; //!
TBranch *b_L1_SingleEG20_Prescl; //!
TBranch *b_L1_SingleEG20_TotemDiffractive; //!
TBranch *b_L1_SingleEG20_TotemDiffractive_Prescl; //!
TBranch *b_L1_SingleEG22; //!
TBranch *b_L1_SingleEG22_Prescl; //!
TBranch *b_L1_SingleEG24; //!
TBranch *b_L1_SingleEG24_Prescl; //!
TBranch *b_L1_SingleEG30; //!
TBranch *b_L1_SingleEG30_Prescl; //!
TBranch *b_L1_SingleEG5_BptxAND; //!
TBranch *b_L1_SingleEG5_BptxAND_Prescl; //!
TBranch *b_L1_SingleEG7; //!
TBranch *b_L1_SingleEG7_Prescl; //!
TBranch *b_L1_SingleForJet16; //!
TBranch *b_L1_SingleForJet16_Prescl; //!
TBranch *b_L1_SingleIsoEG18er; //!
TBranch *b_L1_SingleIsoEG18er_Prescl; //!
TBranch *b_L1_SingleIsoEG20er; //!
TBranch *b_L1_SingleIsoEG20er_Prescl; //!
TBranch *b_L1_SingleJet128; //!
TBranch *b_L1_SingleJet128_Prescl; //!
TBranch *b_L1_SingleJet12_BptxAND; //!
TBranch *b_L1_SingleJet12_BptxAND_Prescl; //!
TBranch *b_L1_SingleJet16_BptxAND; //!
TBranch *b_L1_SingleJet16_BptxAND_Prescl; //!
TBranch *b_L1_SingleJet16_FwdVeto5; //!
TBranch *b_L1_SingleJet16_FwdVeto5_Prescl; //!
TBranch *b_L1_SingleJet20_Central_NotBptxOR; //!
TBranch *b_L1_SingleJet20_Central_NotBptxOR_Prescl; //!
TBranch *b_L1_SingleJet36; //!
TBranch *b_L1_SingleJet36_Prescl; //!
TBranch *b_L1_SingleJet36_FwdVeto5; //!
TBranch *b_L1_SingleJet36_FwdVeto5_Prescl; //!
TBranch *b_L1_SingleJet52; //!
TBranch *b_L1_SingleJet52_Prescl; //!
TBranch *b_L1_SingleJet52_TotemDiffractive; //!
TBranch *b_L1_SingleJet52_TotemDiffractive_Prescl; //!
TBranch *b_L1_SingleJet68; //!
TBranch *b_L1_SingleJet68_Prescl; //!
TBranch *b_L1_SingleJet92; //!
TBranch *b_L1_SingleJet92_Prescl; //!
TBranch *b_L1_SingleJetC32_NotBptxOR; //!
TBranch *b_L1_SingleJetC32_NotBptxOR_Prescl; //!
TBranch *b_L1_SingleMu12; //!
TBranch *b_L1_SingleMu12_Prescl; //!
TBranch *b_L1_SingleMu12er; //!
TBranch *b_L1_SingleMu12er_Prescl; //!
TBranch *b_L1_SingleMu14_Eta2p1; //!
TBranch *b_L1_SingleMu14_Eta2p1_Prescl; //!
TBranch *b_L1_SingleMu16; //!
TBranch *b_L1_SingleMu16_Prescl; //!
TBranch *b_L1_SingleMu16_Eta2p1; //!
TBranch *b_L1_SingleMu16_Eta2p1_Prescl; //!
TBranch *b_L1_SingleMu18er; //!
TBranch *b_L1_SingleMu18er_Prescl; //!
TBranch *b_L1_SingleMu20; //!
TBranch *b_L1_SingleMu20_Prescl; //!
TBranch *b_L1_SingleMu20_TotemDiffractive; //!
TBranch *b_L1_SingleMu20_TotemDiffractive_Prescl; //!
TBranch *b_L1_SingleMu20er; //!
TBranch *b_L1_SingleMu20er_Prescl; //!
TBranch *b_L1_SingleMu25er; //!
TBranch *b_L1_SingleMu25er_Prescl; //!
TBranch *b_L1_SingleMu3; //!
TBranch *b_L1_SingleMu3_Prescl; //!
TBranch *b_L1_SingleMu6_NotBptxOR; //!
TBranch *b_L1_SingleMu6_NotBptxOR_Prescl; //!
TBranch *b_L1_SingleMu7; //!
TBranch *b_L1_SingleMu7_Prescl; //!
TBranch *b_L1_SingleMuBeamHalo; //!
TBranch *b_L1_SingleMuBeamHalo_Prescl; //!
TBranch *b_L1_SingleMuOpen; //!
TBranch *b_L1_SingleMuOpen_Prescl; //!
TBranch *b_L1_TripleEG7; //!
TBranch *b_L1_TripleEG7_Prescl; //!
TBranch *b_L1_TripleEG_12_7_5; //!
TBranch *b_L1_TripleEG_12_7_5_Prescl; //!
TBranch *b_L1_TripleJetC_52_28_28; //!
TBranch *b_L1_TripleJetC_52_28_28_Prescl; //!
TBranch *b_L1_TripleJet_64_44_24_VBF; //!
TBranch *b_L1_TripleJet_64_44_24_VBF_Prescl; //!
TBranch *b_L1_TripleJet_64_48_28_VBF; //!
TBranch *b_L1_TripleJet_64_48_28_VBF_Prescl; //!
TBranch *b_L1_ZdcCaloPlus_TotemDiffractive_QElastic; //!
TBranch *b_L1_ZdcCaloPlus_TotemDiffractive_QElastic_Prescl; //!
TBranch *b_L1_ZeroBias; //!
TBranch *b_L1_ZeroBias_Prescl; //!
TBranch *b_L1Tech_BPTX_PreBPTX_v0; //!
TBranch *b_L1Tech_BPTX_PreBPTX_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_minus_v0; //!
TBranch *b_L1Tech_BPTX_minus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_minus_AND_not_plus_v0; //!
TBranch *b_L1Tech_BPTX_minus_AND_not_plus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_plus_v0; //!
TBranch *b_L1Tech_BPTX_plus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_plus_AND_NOT_minus_v0; //!
TBranch *b_L1Tech_BPTX_plus_AND_NOT_minus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_plus_AND_minus_v0; //!
TBranch *b_L1Tech_BPTX_plus_AND_minus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_plus_AND_minus_instance1_v0; //!
TBranch *b_L1Tech_BPTX_plus_AND_minus_instance1_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_plus_OR_minus_v0; //!
TBranch *b_L1Tech_BPTX_plus_OR_minus_v0_Prescl; //!
TBranch *b_L1Tech_BPTX_quiet_v0; //!
TBranch *b_L1Tech_BPTX_quiet_v0_Prescl; //!
TBranch *b_L1Tech_BSC_HighMultiplicity_v0; //!
TBranch *b_L1Tech_BSC_HighMultiplicity_v0_Prescl; //!
TBranch *b_L1Tech_BSC_halo_beam1_inner_v0; //!
TBranch *b_L1Tech_BSC_halo_beam1_inner_v0_Prescl; //!
TBranch *b_L1Tech_BSC_halo_beam1_outer_v0; //!
TBranch *b_L1Tech_BSC_halo_beam1_outer_v0_Prescl; //!
TBranch *b_L1Tech_BSC_halo_beam2_inner_v0; //!
TBranch *b_L1Tech_BSC_halo_beam2_inner_v0_Prescl; //!
TBranch *b_L1Tech_BSC_halo_beam2_outer_v0; //!
TBranch *b_L1Tech_BSC_halo_beam2_outer_v0_Prescl; //!
TBranch *b_L1Tech_BSC_minBias_OR_v0; //!
TBranch *b_L1Tech_BSC_minBias_OR_v0_Prescl; //!
TBranch *b_L1Tech_BSC_minBias_inner_threshold1_v0; //!
TBranch *b_L1Tech_BSC_minBias_inner_threshold1_v0_Prescl; //!
TBranch *b_L1Tech_BSC_minBias_inner_threshold2_v0; //!
TBranch *b_L1Tech_BSC_minBias_inner_threshold2_v0_Prescl; //!
TBranch *b_L1Tech_BSC_minBias_threshold1_v0; //!
TBranch *b_L1Tech_BSC_minBias_threshold1_v0_Prescl; //!
TBranch *b_L1Tech_BSC_minBias_threshold2_v0; //!
TBranch *b_L1Tech_BSC_minBias_threshold2_v0_Prescl; //!
TBranch *b_L1Tech_BSC_splash_beam1_v0; //!
TBranch *b_L1Tech_BSC_splash_beam1_v0_Prescl; //!
TBranch *b_L1Tech_BSC_splash_beam2_v0; //!
TBranch *b_L1Tech_BSC_splash_beam2_v0_Prescl; //!
TBranch *b_L1Tech_CASTOR_0_v0; //!
TBranch *b_L1Tech_CASTOR_0_v0_Prescl; //!
TBranch *b_L1Tech_CASTOR_EM_v0; //!
TBranch *b_L1Tech_CASTOR_EM_v0_Prescl; //!
TBranch *b_L1Tech_CASTOR_HaloMuon_v0; //!
TBranch *b_L1Tech_CASTOR_HaloMuon_v0_Prescl; //!
TBranch *b_L1Tech_CASTOR_TotalEnergy_v0; //!
TBranch *b_L1Tech_CASTOR_TotalEnergy_v0_Prescl; //!
TBranch *b_L1Tech_DT_GlobalOR_v0; //!
TBranch *b_L1Tech_DT_GlobalOR_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect45_downLeft_v0; //!
TBranch *b_L1Tech_FSC_St3Sect45_downLeft_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect45_downRight_v0; //!
TBranch *b_L1Tech_FSC_St3Sect45_downRight_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect45_uppLeft_v0; //!
TBranch *b_L1Tech_FSC_St3Sect45_uppLeft_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect45_uppRight_v0; //!
TBranch *b_L1Tech_FSC_St3Sect45_uppRight_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect56_downLeft_v0; //!
TBranch *b_L1Tech_FSC_St3Sect56_downLeft_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect56_downRight_v0; //!
TBranch *b_L1Tech_FSC_St3Sect56_downRight_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect56_uppLeft_v0; //!
TBranch *b_L1Tech_FSC_St3Sect56_uppLeft_v0_Prescl; //!
TBranch *b_L1Tech_FSC_St3Sect56_uppRight_v0; //!
TBranch *b_L1Tech_FSC_St3Sect56_uppRight_v0_Prescl; //!
TBranch *b_L1Tech_HCAL_HBHE_totalOR_v0; //!
TBranch *b_L1Tech_HCAL_HBHE_totalOR_v0_Prescl; //!
TBranch *b_L1Tech_HCAL_HF_MMP_or_MPP_v1; //!
TBranch *b_L1Tech_HCAL_HF_MMP_or_MPP_v1_Prescl; //!
TBranch *b_L1Tech_HCAL_HF_coincidence_PM_v2; //!
TBranch *b_L1Tech_HCAL_HF_coincidence_PM_v2_Prescl; //!
TBranch *b_L1Tech_HCAL_HF_single_channel_v0; //!
TBranch *b_L1Tech_HCAL_HF_single_channel_v0_Prescl; //!
TBranch *b_L1Tech_HCAL_HO_totalOR_v0; //!
TBranch *b_L1Tech_HCAL_HO_totalOR_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RB0_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_RB0_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RBminus1_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_RBminus1_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RBminus2_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_RBminus2_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RBplus1_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_RBplus1_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RBplus2_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_RBplus2_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_RBst1_collisions_v0; //!
TBranch *b_L1Tech_RPC_TTU_RBst1_collisions_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_barrel_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_barrel_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_RPC_TTU_pointing_Cosmics_v0; //!
TBranch *b_L1Tech_RPC_TTU_pointing_Cosmics_v0_Prescl; //!
TBranch *b_L1Tech_TOTEM_Diffractive_v0; //!
TBranch *b_L1Tech_TOTEM_Diffractive_v0_Prescl; //!
TBranch *b_L1Tech_TOTEM_LowMultiplicity_v0; //!
TBranch *b_L1Tech_TOTEM_LowMultiplicity_v0_Prescl; //!
TBranch *b_L1Tech_TOTEM_MinBias_v0; //!
TBranch *b_L1Tech_TOTEM_MinBias_v0_Prescl; //!
TBranch *b_L1Tech_TOTEM_ZeroBias_v0; //!
TBranch *b_L1Tech_TOTEM_ZeroBias_v0_Prescl; //!
TBranch *b_L1Tech_ZDC_Scint_loose_vertex_v0; //!
TBranch *b_L1Tech_ZDC_Scint_loose_vertex_v0_Prescl; //!
TBranch *b_L1Tech_ZDC_Scint_minus_v0; //!
TBranch *b_L1Tech_ZDC_Scint_minus_v0_Prescl; //!
TBranch *b_L1Tech_ZDC_Scint_plus_v0; //!
TBranch *b_L1Tech_ZDC_Scint_plus_v0_Prescl; //!
TBranch *b_L1Tech_ZDC_Scint_tight_vertex_v0; //!
TBranch *b_L1Tech_ZDC_Scint_tight_vertex_v0_Prescl; //!
};
void setupHltTree(TTree *t,Hlts &tHlts,bool doCheck = 0)
{
// Set branch addresses and branch pointers
t->SetBranchAddress("NL1IsolEm", &tHlts.NL1IsolEm, &tHlts.b_NL1IsolEm);
t->SetBranchAddress("L1IsolEmEt", tHlts.L1IsolEmEt, &tHlts.b_L1IsolEmEt);
t->SetBranchAddress("L1IsolEmE", tHlts.L1IsolEmE, &tHlts.b_L1IsolEmE);
t->SetBranchAddress("L1IsolEmEta", tHlts.L1IsolEmEta, &tHlts.b_L1IsolEmEta);
t->SetBranchAddress("L1IsolEmPhi", tHlts.L1IsolEmPhi, &tHlts.b_L1IsolEmPhi);
t->SetBranchAddress("NL1NIsolEm", &tHlts.NL1NIsolEm, &tHlts.b_NL1NIsolEm);
t->SetBranchAddress("L1NIsolEmEt", tHlts.L1NIsolEmEt, &tHlts.b_L1NIsolEmEt);
t->SetBranchAddress("L1NIsolEmE", tHlts.L1NIsolEmE, &tHlts.b_L1NIsolEmE);
t->SetBranchAddress("L1NIsolEmEta", tHlts.L1NIsolEmEta, &tHlts.b_L1NIsolEmEta);
t->SetBranchAddress("L1NIsolEmPhi", tHlts.L1NIsolEmPhi, &tHlts.b_L1NIsolEmPhi);
t->SetBranchAddress("NL1Mu", &tHlts.NL1Mu, &tHlts.b_NL1Mu);
t->SetBranchAddress("L1MuPt", tHlts.L1MuPt, &tHlts.b_L1MuPt);
t->SetBranchAddress("L1MuE", tHlts.L1MuE, &tHlts.b_L1MuE);
t->SetBranchAddress("L1MuEta", tHlts.L1MuEta, &tHlts.b_L1MuEta);
t->SetBranchAddress("L1MuPhi", tHlts.L1MuPhi, &tHlts.b_L1MuPhi);
t->SetBranchAddress("L1MuIsol", tHlts.L1MuIsol, &tHlts.b_L1MuIsol);
t->SetBranchAddress("L1MuMip", tHlts.L1MuMip, &tHlts.b_L1MuMip);
t->SetBranchAddress("L1MuFor", tHlts.L1MuFor, &tHlts.b_L1MuFor);
t->SetBranchAddress("L1MuRPC", tHlts.L1MuRPC, &tHlts.b_L1MuRPC);
t->SetBranchAddress("L1MuQal", tHlts.L1MuQal, &tHlts.b_L1MuQal);
t->SetBranchAddress("L1MuChg", tHlts.L1MuChg, &tHlts.b_L1MuChg);
t->SetBranchAddress("NL1CenJet", &tHlts.NL1CenJet, &tHlts.b_NL1CenJet);
t->SetBranchAddress("L1CenJetEt", tHlts.L1CenJetEt, &tHlts.b_L1CenJetEt);
t->SetBranchAddress("L1CenJetE", tHlts.L1CenJetE, &tHlts.b_L1CenJetE);
t->SetBranchAddress("L1CenJetEta", tHlts.L1CenJetEta, &tHlts.b_L1CenJetEta);
t->SetBranchAddress("L1CenJetPhi", tHlts.L1CenJetPhi, &tHlts.b_L1CenJetPhi);
t->SetBranchAddress("NL1ForJet", &tHlts.NL1ForJet, &tHlts.b_NL1ForJet);
t->SetBranchAddress("L1ForJetEt", tHlts.L1ForJetEt, &tHlts.b_L1ForJetEt);
t->SetBranchAddress("L1ForJetE", tHlts.L1ForJetE, &tHlts.b_L1ForJetE);
t->SetBranchAddress("L1ForJetEta", tHlts.L1ForJetEta, &tHlts.b_L1ForJetEta);
t->SetBranchAddress("L1ForJetPhi", tHlts.L1ForJetPhi, &tHlts.b_L1ForJetPhi);
t->SetBranchAddress("NL1Tau", &tHlts.NL1Tau, &tHlts.b_NL1Tau);
t->SetBranchAddress("L1TauEt", tHlts.L1TauEt, &tHlts.b_L1TauEt);
t->SetBranchAddress("L1TauE", tHlts.L1TauE, &tHlts.b_L1TauE);
t->SetBranchAddress("L1TauEta", tHlts.L1TauEta, &tHlts.b_L1TauEta);
t->SetBranchAddress("L1TauPhi", tHlts.L1TauPhi, &tHlts.b_L1TauPhi);
t->SetBranchAddress("L1Met", &tHlts.L1Met, &tHlts.b_L1Met);
t->SetBranchAddress("L1MetPhi", &tHlts.L1MetPhi, &tHlts.b_L1MetPhi);
t->SetBranchAddress("L1EtTot", &tHlts.L1EtTot, &tHlts.b_L1EtTot);
t->SetBranchAddress("L1Mht", &tHlts.L1Mht, &tHlts.b_L1Mht);
t->SetBranchAddress("L1MhtPhi", &tHlts.L1MhtPhi, &tHlts.b_L1MhtPhi);
t->SetBranchAddress("L1EtHad", &tHlts.L1EtHad, &tHlts.b_L1EtHad);
t->SetBranchAddress("L1HfRing1EtSumPositiveEta", &tHlts.L1HfRing1EtSumPositiveEta, &tHlts.b_L1HfRing1EtSumPositiveEta);
t->SetBranchAddress("L1HfRing2EtSumPositiveEta", &tHlts.L1HfRing2EtSumPositiveEta, &tHlts.b_L1HfRing2EtSumPositiveEta);
t->SetBranchAddress("L1HfRing1EtSumNegativeEta", &tHlts.L1HfRing1EtSumNegativeEta, &tHlts.b_L1HfRing1EtSumNegativeEta);
t->SetBranchAddress("L1HfRing2EtSumNegativeEta", &tHlts.L1HfRing2EtSumNegativeEta, &tHlts.b_L1HfRing2EtSumNegativeEta);
t->SetBranchAddress("L1HfTowerCountPositiveEtaRing1", &tHlts.L1HfTowerCountPositiveEtaRing1, &tHlts.b_L1HfTowerCountPositiveEtaRing1);
t->SetBranchAddress("L1HfTowerCountNegativeEtaRing1", &tHlts.L1HfTowerCountNegativeEtaRing1, &tHlts.b_L1HfTowerCountNegativeEtaRing1);
t->SetBranchAddress("L1HfTowerCountPositiveEtaRing2", &tHlts.L1HfTowerCountPositiveEtaRing2, &tHlts.b_L1HfTowerCountPositiveEtaRing2);
t->SetBranchAddress("L1HfTowerCountNegativeEtaRing2", &tHlts.L1HfTowerCountNegativeEtaRing2, &tHlts.b_L1HfTowerCountNegativeEtaRing2);
t->SetBranchAddress("Run", &tHlts.Run, &tHlts.b_Run);
t->SetBranchAddress("Event", &tHlts.Event, &tHlts.b_Event);
t->SetBranchAddress("LumiBlock", &tHlts.LumiBlock, &tHlts.b_LumiBlock);
t->SetBranchAddress("Bx", &tHlts.Bx, &tHlts.b_Bx);
t->SetBranchAddress("Orbit", &tHlts.Orbit, &tHlts.b_Orbit);
t->SetBranchAddress("AvgInstDelLumi", &tHlts.AvgInstDelLumi, &tHlts.b_AvgInstDelLumi);
t->SetBranchAddress("HLTriggerFirstPath", &tHlts.HLTriggerFirstPath, &tHlts.b_HLTriggerFirstPath);
t->SetBranchAddress("HLTriggerFirstPath_Prescl", &tHlts.HLTriggerFirstPath_Prescl, &tHlts.b_HLTriggerFirstPath_Prescl);
t->SetBranchAddress("HLT_Activity_Ecal_SC7_v13", &tHlts.HLT_Activity_Ecal_SC7_v13, &tHlts.b_HLT_Activity_Ecal_SC7_v13);
t->SetBranchAddress("HLT_Activity_Ecal_SC7_v13_Prescl", &tHlts.HLT_Activity_Ecal_SC7_v13_Prescl, &tHlts.b_HLT_Activity_Ecal_SC7_v13_Prescl);
t->SetBranchAddress("HLT_BeamGas_HF_Beam1_v5", &tHlts.HLT_BeamGas_HF_Beam1_v5, &tHlts.b_HLT_BeamGas_HF_Beam1_v5);
t->SetBranchAddress("HLT_BeamGas_HF_Beam1_v5_Prescl", &tHlts.HLT_BeamGas_HF_Beam1_v5_Prescl, &tHlts.b_HLT_BeamGas_HF_Beam1_v5_Prescl);
t->SetBranchAddress("HLT_BeamGas_HF_Beam2_v5", &tHlts.HLT_BeamGas_HF_Beam2_v5, &tHlts.b_HLT_BeamGas_HF_Beam2_v5);
t->SetBranchAddress("HLT_BeamGas_HF_Beam2_v5_Prescl", &tHlts.HLT_BeamGas_HF_Beam2_v5_Prescl, &tHlts.b_HLT_BeamGas_HF_Beam2_v5_Prescl);
t->SetBranchAddress("HLT_BeamHalo_v13", &tHlts.HLT_BeamHalo_v13, &tHlts.b_HLT_BeamHalo_v13);
t->SetBranchAddress("HLT_BeamHalo_v13_Prescl", &tHlts.HLT_BeamHalo_v13_Prescl, &tHlts.b_HLT_BeamHalo_v13_Prescl);
t->SetBranchAddress("HLT_PAHcalUTCA_v1", &tHlts.HLT_PAHcalUTCA_v1, &tHlts.b_HLT_PAHcalUTCA_v1);
t->SetBranchAddress("HLT_PAHcalUTCA_v1_Prescl", &tHlts.HLT_PAHcalUTCA_v1_Prescl, &tHlts.b_HLT_PAHcalUTCA_v1_Prescl);
t->SetBranchAddress("HLT_PAHcalPhiSym_v1", &tHlts.HLT_PAHcalPhiSym_v1, &tHlts.b_HLT_PAHcalPhiSym_v1);
t->SetBranchAddress("HLT_PAHcalPhiSym_v1_Prescl", &tHlts.HLT_PAHcalPhiSym_v1_Prescl, &tHlts.b_HLT_PAHcalPhiSym_v1_Prescl);
t->SetBranchAddress("HLT_PAHcalNZS_v1", &tHlts.HLT_PAHcalNZS_v1, &tHlts.b_HLT_PAHcalNZS_v1);
t->SetBranchAddress("HLT_PAHcalNZS_v1_Prescl", &tHlts.HLT_PAHcalNZS_v1_Prescl, &tHlts.b_HLT_PAHcalNZS_v1_Prescl);
t->SetBranchAddress("HLT_GlobalRunHPDNoise_v8", &tHlts.HLT_GlobalRunHPDNoise_v8, &tHlts.b_HLT_GlobalRunHPDNoise_v8);
t->SetBranchAddress("HLT_GlobalRunHPDNoise_v8_Prescl", &tHlts.HLT_GlobalRunHPDNoise_v8_Prescl, &tHlts.b_HLT_GlobalRunHPDNoise_v8_Prescl);
t->SetBranchAddress("HLT_Physics_v5", &tHlts.HLT_Physics_v5, &tHlts.b_HLT_Physics_v5);
t->SetBranchAddress("HLT_Physics_v5_Prescl", &tHlts.HLT_Physics_v5_Prescl, &tHlts.b_HLT_Physics_v5_Prescl);
t->SetBranchAddress("DST_Physics_v5", &tHlts.DST_Physics_v5, &tHlts.b_DST_Physics_v5);
t->SetBranchAddress("DST_Physics_v5_Prescl", &tHlts.DST_Physics_v5_Prescl, &tHlts.b_DST_Physics_v5_Prescl);
t->SetBranchAddress("HLT_DTCalibration_v2", &tHlts.HLT_DTCalibration_v2, &tHlts.b_HLT_DTCalibration_v2);
t->SetBranchAddress("HLT_DTCalibration_v2_Prescl", &tHlts.HLT_DTCalibration_v2_Prescl, &tHlts.b_HLT_DTCalibration_v2_Prescl);
t->SetBranchAddress("HLT_EcalCalibration_v3", &tHlts.HLT_EcalCalibration_v3, &tHlts.b_HLT_EcalCalibration_v3);
t->SetBranchAddress("HLT_EcalCalibration_v3_Prescl", &tHlts.HLT_EcalCalibration_v3_Prescl, &tHlts.b_HLT_EcalCalibration_v3_Prescl);
t->SetBranchAddress("HLT_HcalCalibration_v3", &tHlts.HLT_HcalCalibration_v3, &tHlts.b_HLT_HcalCalibration_v3);
t->SetBranchAddress("HLT_HcalCalibration_v3_Prescl", &tHlts.HLT_HcalCalibration_v3_Prescl, &tHlts.b_HLT_HcalCalibration_v3_Prescl);
t->SetBranchAddress("HLT_TrackerCalibration_v3", &tHlts.HLT_TrackerCalibration_v3, &tHlts.b_HLT_TrackerCalibration_v3);
t->SetBranchAddress("HLT_TrackerCalibration_v3_Prescl", &tHlts.HLT_TrackerCalibration_v3_Prescl, &tHlts.b_HLT_TrackerCalibration_v3_Prescl);
t->SetBranchAddress("HLT_L1SingleMuOpen_AntiBPTX_v7", &tHlts.HLT_L1SingleMuOpen_AntiBPTX_v7, &tHlts.b_HLT_L1SingleMuOpen_AntiBPTX_v7);
t->SetBranchAddress("HLT_L1SingleMuOpen_AntiBPTX_v7_Prescl", &tHlts.HLT_L1SingleMuOpen_AntiBPTX_v7_Prescl, &tHlts.b_HLT_L1SingleMuOpen_AntiBPTX_v7_Prescl);
t->SetBranchAddress("HLT_L1TrackerCosmics_v7", &tHlts.HLT_L1TrackerCosmics_v7, &tHlts.b_HLT_L1TrackerCosmics_v7);
t->SetBranchAddress("HLT_L1TrackerCosmics_v7_Prescl", &tHlts.HLT_L1TrackerCosmics_v7_Prescl, &tHlts.b_HLT_L1TrackerCosmics_v7_Prescl);
t->SetBranchAddress("AlCa_PAEcalPi0EBonly_v1", &tHlts.AlCa_PAEcalPi0EBonly_v1, &tHlts.b_AlCa_PAEcalPi0EBonly_v1);
t->SetBranchAddress("AlCa_PAEcalPi0EBonly_v1_Prescl", &tHlts.AlCa_PAEcalPi0EBonly_v1_Prescl, &tHlts.b_AlCa_PAEcalPi0EBonly_v1_Prescl);
t->SetBranchAddress("AlCa_PAEcalPi0EEonly_v1", &tHlts.AlCa_PAEcalPi0EEonly_v1, &tHlts.b_AlCa_PAEcalPi0EEonly_v1);
t->SetBranchAddress("AlCa_PAEcalPi0EEonly_v1_Prescl", &tHlts.AlCa_PAEcalPi0EEonly_v1_Prescl, &tHlts.b_AlCa_PAEcalPi0EEonly_v1_Prescl);
t->SetBranchAddress("AlCa_PAEcalEtaEBonly_v1", &tHlts.AlCa_PAEcalEtaEBonly_v1, &tHlts.b_AlCa_PAEcalEtaEBonly_v1);
t->SetBranchAddress("AlCa_PAEcalEtaEBonly_v1_Prescl", &tHlts.AlCa_PAEcalEtaEBonly_v1_Prescl, &tHlts.b_AlCa_PAEcalEtaEBonly_v1_Prescl);
t->SetBranchAddress("AlCa_PAEcalEtaEEonly_v1", &tHlts.AlCa_PAEcalEtaEEonly_v1, &tHlts.b_AlCa_PAEcalEtaEEonly_v1);
t->SetBranchAddress("AlCa_PAEcalEtaEEonly_v1_Prescl", &tHlts.AlCa_PAEcalEtaEEonly_v1_Prescl, &tHlts.b_AlCa_PAEcalEtaEEonly_v1_Prescl);
t->SetBranchAddress("AlCa_EcalPhiSym_v13", &tHlts.AlCa_EcalPhiSym_v13, &tHlts.b_AlCa_EcalPhiSym_v13);
t->SetBranchAddress("AlCa_EcalPhiSym_v13_Prescl", &tHlts.AlCa_EcalPhiSym_v13_Prescl, &tHlts.b_AlCa_EcalPhiSym_v13_Prescl);
t->SetBranchAddress("AlCa_RPCMuonNoTriggers_v9", &tHlts.AlCa_RPCMuonNoTriggers_v9, &tHlts.b_AlCa_RPCMuonNoTriggers_v9);
t->SetBranchAddress("AlCa_RPCMuonNoTriggers_v9_Prescl", &tHlts.AlCa_RPCMuonNoTriggers_v9_Prescl, &tHlts.b_AlCa_RPCMuonNoTriggers_v9_Prescl);
t->SetBranchAddress("AlCa_RPCMuonNoHits_v9", &tHlts.AlCa_RPCMuonNoHits_v9, &tHlts.b_AlCa_RPCMuonNoHits_v9);
t->SetBranchAddress("AlCa_RPCMuonNoHits_v9_Prescl", &tHlts.AlCa_RPCMuonNoHits_v9_Prescl, &tHlts.b_AlCa_RPCMuonNoHits_v9_Prescl);
t->SetBranchAddress("AlCa_RPCMuonNormalisation_v9", &tHlts.AlCa_RPCMuonNormalisation_v9, &tHlts.b_AlCa_RPCMuonNormalisation_v9);
t->SetBranchAddress("AlCa_RPCMuonNormalisation_v9_Prescl", &tHlts.AlCa_RPCMuonNormalisation_v9_Prescl, &tHlts.b_AlCa_RPCMuonNormalisation_v9_Prescl);
t->SetBranchAddress("AlCa_LumiPixels_v8", &tHlts.AlCa_LumiPixels_v8, &tHlts.b_AlCa_LumiPixels_v8);
t->SetBranchAddress("AlCa_LumiPixels_v8_Prescl", &tHlts.AlCa_LumiPixels_v8_Prescl, &tHlts.b_AlCa_LumiPixels_v8_Prescl);
t->SetBranchAddress("AlCa_LumiPixels_ZeroBias_v4", &tHlts.AlCa_LumiPixels_ZeroBias_v4, &tHlts.b_AlCa_LumiPixels_ZeroBias_v4);
t->SetBranchAddress("AlCa_LumiPixels_ZeroBias_v4_Prescl", &tHlts.AlCa_LumiPixels_ZeroBias_v4_Prescl, &tHlts.b_AlCa_LumiPixels_ZeroBias_v4_Prescl);
t->SetBranchAddress("AlCa_LumiPixels_Random_v1", &tHlts.AlCa_LumiPixels_Random_v1, &tHlts.b_AlCa_LumiPixels_Random_v1);
t->SetBranchAddress("AlCa_LumiPixels_Random_v1_Prescl", &tHlts.AlCa_LumiPixels_Random_v1_Prescl, &tHlts.b_AlCa_LumiPixels_Random_v1_Prescl);
t->SetBranchAddress("HLT_PAL1SingleJet16_v1", &tHlts.HLT_PAL1SingleJet16_v1, &tHlts.b_HLT_PAL1SingleJet16_v1);
t->SetBranchAddress("HLT_PAL1SingleJet16_v1_Prescl", &tHlts.HLT_PAL1SingleJet16_v1_Prescl, &tHlts.b_HLT_PAL1SingleJet16_v1_Prescl);
t->SetBranchAddress("HLT_PAL1SingleJet36_v1", &tHlts.HLT_PAL1SingleJet36_v1, &tHlts.b_HLT_PAL1SingleJet36_v1);
t->SetBranchAddress("HLT_PAL1SingleJet36_v1_Prescl", &tHlts.HLT_PAL1SingleJet36_v1_Prescl, &tHlts.b_HLT_PAL1SingleJet36_v1_Prescl);
t->SetBranchAddress("HLT_PASingleForJet15_v1", &tHlts.HLT_PASingleForJet15_v1, &tHlts.b_HLT_PASingleForJet15_v1);
t->SetBranchAddress("HLT_PASingleForJet15_v1_Prescl", &tHlts.HLT_PASingleForJet15_v1_Prescl, &tHlts.b_HLT_PASingleForJet15_v1_Prescl);
t->SetBranchAddress("HLT_PASingleForJet25_v1", &tHlts.HLT_PASingleForJet25_v1, &tHlts.b_HLT_PASingleForJet25_v1);
t->SetBranchAddress("HLT_PASingleForJet25_v1_Prescl", &tHlts.HLT_PASingleForJet25_v1_Prescl, &tHlts.b_HLT_PASingleForJet25_v1_Prescl);
t->SetBranchAddress("HLT_PAJet20_NoJetID_v1", &tHlts.HLT_PAJet20_NoJetID_v1, &tHlts.b_HLT_PAJet20_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet20_NoJetID_v1_Prescl", &tHlts.HLT_PAJet20_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet20_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAJet40_NoJetID_v1", &tHlts.HLT_PAJet40_NoJetID_v1, &tHlts.b_HLT_PAJet40_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet40_NoJetID_v1_Prescl", &tHlts.HLT_PAJet40_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet40_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAJet60_NoJetID_v1", &tHlts.HLT_PAJet60_NoJetID_v1, &tHlts.b_HLT_PAJet60_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet60_NoJetID_v1_Prescl", &tHlts.HLT_PAJet60_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet60_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAJet80_NoJetID_v1", &tHlts.HLT_PAJet80_NoJetID_v1, &tHlts.b_HLT_PAJet80_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet80_NoJetID_v1_Prescl", &tHlts.HLT_PAJet80_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet80_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAJet100_NoJetID_v1", &tHlts.HLT_PAJet100_NoJetID_v1, &tHlts.b_HLT_PAJet100_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet100_NoJetID_v1_Prescl", &tHlts.HLT_PAJet100_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet100_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAJet120_NoJetID_v1", &tHlts.HLT_PAJet120_NoJetID_v1, &tHlts.b_HLT_PAJet120_NoJetID_v1);
t->SetBranchAddress("HLT_PAJet120_NoJetID_v1_Prescl", &tHlts.HLT_PAJet120_NoJetID_v1_Prescl, &tHlts.b_HLT_PAJet120_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet20Eta2_v1", &tHlts.HLT_PAForJet20Eta2_v1, &tHlts.b_HLT_PAForJet20Eta2_v1);
t->SetBranchAddress("HLT_PAForJet20Eta2_v1_Prescl", &tHlts.HLT_PAForJet20Eta2_v1_Prescl, &tHlts.b_HLT_PAForJet20Eta2_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet40Eta2_v1", &tHlts.HLT_PAForJet40Eta2_v1, &tHlts.b_HLT_PAForJet40Eta2_v1);
t->SetBranchAddress("HLT_PAForJet40Eta2_v1_Prescl", &tHlts.HLT_PAForJet40Eta2_v1_Prescl, &tHlts.b_HLT_PAForJet40Eta2_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet60Eta2_v1", &tHlts.HLT_PAForJet60Eta2_v1, &tHlts.b_HLT_PAForJet60Eta2_v1);
t->SetBranchAddress("HLT_PAForJet60Eta2_v1_Prescl", &tHlts.HLT_PAForJet60Eta2_v1_Prescl, &tHlts.b_HLT_PAForJet60Eta2_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet80Eta2_v1", &tHlts.HLT_PAForJet80Eta2_v1, &tHlts.b_HLT_PAForJet80Eta2_v1);
t->SetBranchAddress("HLT_PAForJet80Eta2_v1_Prescl", &tHlts.HLT_PAForJet80Eta2_v1_Prescl, &tHlts.b_HLT_PAForJet80Eta2_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet100Eta2_v1", &tHlts.HLT_PAForJet100Eta2_v1, &tHlts.b_HLT_PAForJet100Eta2_v1);
t->SetBranchAddress("HLT_PAForJet100Eta2_v1_Prescl", &tHlts.HLT_PAForJet100Eta2_v1_Prescl, &tHlts.b_HLT_PAForJet100Eta2_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet20Eta3_v1", &tHlts.HLT_PAForJet20Eta3_v1, &tHlts.b_HLT_PAForJet20Eta3_v1);
t->SetBranchAddress("HLT_PAForJet20Eta3_v1_Prescl", &tHlts.HLT_PAForJet20Eta3_v1_Prescl, &tHlts.b_HLT_PAForJet20Eta3_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet40Eta3_v1", &tHlts.HLT_PAForJet40Eta3_v1, &tHlts.b_HLT_PAForJet40Eta3_v1);
t->SetBranchAddress("HLT_PAForJet40Eta3_v1_Prescl", &tHlts.HLT_PAForJet40Eta3_v1_Prescl, &tHlts.b_HLT_PAForJet40Eta3_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet60Eta3_v1", &tHlts.HLT_PAForJet60Eta3_v1, &tHlts.b_HLT_PAForJet60Eta3_v1);
t->SetBranchAddress("HLT_PAForJet60Eta3_v1_Prescl", &tHlts.HLT_PAForJet60Eta3_v1_Prescl, &tHlts.b_HLT_PAForJet60Eta3_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet80Eta3_v1", &tHlts.HLT_PAForJet80Eta3_v1, &tHlts.b_HLT_PAForJet80Eta3_v1);
t->SetBranchAddress("HLT_PAForJet80Eta3_v1_Prescl", &tHlts.HLT_PAForJet80Eta3_v1_Prescl, &tHlts.b_HLT_PAForJet80Eta3_v1_Prescl);
t->SetBranchAddress("HLT_PAForJet100Eta3_v1", &tHlts.HLT_PAForJet100Eta3_v1, &tHlts.b_HLT_PAForJet100Eta3_v1);
t->SetBranchAddress("HLT_PAForJet100Eta3_v1_Prescl", &tHlts.HLT_PAForJet100Eta3_v1_Prescl, &tHlts.b_HLT_PAForJet100Eta3_v1_Prescl);
t->SetBranchAddress("HLT_PATripleJet20_20_20_v1", &tHlts.HLT_PATripleJet20_20_20_v1, &tHlts.b_HLT_PATripleJet20_20_20_v1);
t->SetBranchAddress("HLT_PATripleJet20_20_20_v1_Prescl", &tHlts.HLT_PATripleJet20_20_20_v1_Prescl, &tHlts.b_HLT_PATripleJet20_20_20_v1_Prescl);
t->SetBranchAddress("HLT_PATripleJet40_20_20_v1", &tHlts.HLT_PATripleJet40_20_20_v1, &tHlts.b_HLT_PATripleJet40_20_20_v1);
t->SetBranchAddress("HLT_PATripleJet40_20_20_v1_Prescl", &tHlts.HLT_PATripleJet40_20_20_v1_Prescl, &tHlts.b_HLT_PATripleJet40_20_20_v1_Prescl);
t->SetBranchAddress("HLT_PATripleJet60_20_20_v1", &tHlts.HLT_PATripleJet60_20_20_v1, &tHlts.b_HLT_PATripleJet60_20_20_v1);
t->SetBranchAddress("HLT_PATripleJet60_20_20_v1_Prescl", &tHlts.HLT_PATripleJet60_20_20_v1_Prescl, &tHlts.b_HLT_PATripleJet60_20_20_v1_Prescl);
t->SetBranchAddress("HLT_PATripleJet80_20_20_v1", &tHlts.HLT_PATripleJet80_20_20_v1, &tHlts.b_HLT_PATripleJet80_20_20_v1);
t->SetBranchAddress("HLT_PATripleJet80_20_20_v1_Prescl", &tHlts.HLT_PATripleJet80_20_20_v1_Prescl, &tHlts.b_HLT_PATripleJet80_20_20_v1_Prescl);
t->SetBranchAddress("HLT_PATripleJet100_20_20_v1", &tHlts.HLT_PATripleJet100_20_20_v1, &tHlts.b_HLT_PATripleJet100_20_20_v1);
t->SetBranchAddress("HLT_PATripleJet100_20_20_v1_Prescl", &tHlts.HLT_PATripleJet100_20_20_v1_Prescl, &tHlts.b_HLT_PATripleJet100_20_20_v1_Prescl);
t->SetBranchAddress("HLT_PAJet40ETM30_v1", &tHlts.HLT_PAJet40ETM30_v1, &tHlts.b_HLT_PAJet40ETM30_v1);
t->SetBranchAddress("HLT_PAJet40ETM30_v1_Prescl", &tHlts.HLT_PAJet40ETM30_v1_Prescl, &tHlts.b_HLT_PAJet40ETM30_v1_Prescl);
t->SetBranchAddress("HLT_PAJet60ETM30_v1", &tHlts.HLT_PAJet60ETM30_v1, &tHlts.b_HLT_PAJet60ETM30_v1);
t->SetBranchAddress("HLT_PAJet60ETM30_v1_Prescl", &tHlts.HLT_PAJet60ETM30_v1_Prescl, &tHlts.b_HLT_PAJet60ETM30_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleMu0_v1", &tHlts.HLT_PAL1DoubleMu0_v1, &tHlts.b_HLT_PAL1DoubleMu0_v1);
t->SetBranchAddress("HLT_PAL1DoubleMu0_v1_Prescl", &tHlts.HLT_PAL1DoubleMu0_v1_Prescl, &tHlts.b_HLT_PAL1DoubleMu0_v1_Prescl);
t->SetBranchAddress("HLT_PADimuon0_NoVertexing_v1", &tHlts.HLT_PADimuon0_NoVertexing_v1, &tHlts.b_HLT_PADimuon0_NoVertexing_v1);
t->SetBranchAddress("HLT_PADimuon0_NoVertexing_v1_Prescl", &tHlts.HLT_PADimuon0_NoVertexing_v1_Prescl, &tHlts.b_HLT_PADimuon0_NoVertexing_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleMu0_HighQ_v1", &tHlts.HLT_PAL1DoubleMu0_HighQ_v1, &tHlts.b_HLT_PAL1DoubleMu0_HighQ_v1);
t->SetBranchAddress("HLT_PAL1DoubleMu0_HighQ_v1_Prescl", &tHlts.HLT_PAL1DoubleMu0_HighQ_v1_Prescl, &tHlts.b_HLT_PAL1DoubleMu0_HighQ_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleMuOpen_v1", &tHlts.HLT_PAL1DoubleMuOpen_v1, &tHlts.b_HLT_PAL1DoubleMuOpen_v1);
t->SetBranchAddress("HLT_PAL1DoubleMuOpen_v1_Prescl", &tHlts.HLT_PAL1DoubleMuOpen_v1_Prescl, &tHlts.b_HLT_PAL1DoubleMuOpen_v1_Prescl);
t->SetBranchAddress("HLT_PAL2DoubleMu3_v1", &tHlts.HLT_PAL2DoubleMu3_v1, &tHlts.b_HLT_PAL2DoubleMu3_v1);
t->SetBranchAddress("HLT_PAL2DoubleMu3_v1_Prescl", &tHlts.HLT_PAL2DoubleMu3_v1_Prescl, &tHlts.b_HLT_PAL2DoubleMu3_v1_Prescl);
t->SetBranchAddress("HLT_PAMu3_v1", &tHlts.HLT_PAMu3_v1, &tHlts.b_HLT_PAMu3_v1);
t->SetBranchAddress("HLT_PAMu3_v1_Prescl", &tHlts.HLT_PAMu3_v1_Prescl, &tHlts.b_HLT_PAMu3_v1_Prescl);
t->SetBranchAddress("HLT_PAMu7_v1", &tHlts.HLT_PAMu7_v1, &tHlts.b_HLT_PAMu7_v1);
t->SetBranchAddress("HLT_PAMu7_v1_Prescl", &tHlts.HLT_PAMu7_v1_Prescl, &tHlts.b_HLT_PAMu7_v1_Prescl);
t->SetBranchAddress("HLT_PAMu12_v1", &tHlts.HLT_PAMu12_v1, &tHlts.b_HLT_PAMu12_v1);
t->SetBranchAddress("HLT_PAMu12_v1_Prescl", &tHlts.HLT_PAMu12_v1_Prescl, &tHlts.b_HLT_PAMu12_v1_Prescl);
t->SetBranchAddress("HLT_PABTagMu_Jet20_Mu4_v1", &tHlts.HLT_PABTagMu_Jet20_Mu4_v1, &tHlts.b_HLT_PABTagMu_Jet20_Mu4_v1);
t->SetBranchAddress("HLT_PABTagMu_Jet20_Mu4_v1_Prescl", &tHlts.HLT_PABTagMu_Jet20_Mu4_v1_Prescl, &tHlts.b_HLT_PABTagMu_Jet20_Mu4_v1_Prescl);
t->SetBranchAddress("HLT_PAMu3PFJet20_v1", &tHlts.HLT_PAMu3PFJet20_v1, &tHlts.b_HLT_PAMu3PFJet20_v1);
t->SetBranchAddress("HLT_PAMu3PFJet20_v1_Prescl", &tHlts.HLT_PAMu3PFJet20_v1_Prescl, &tHlts.b_HLT_PAMu3PFJet20_v1_Prescl);
t->SetBranchAddress("HLT_PAMu3PFJet40_v1", &tHlts.HLT_PAMu3PFJet40_v1, &tHlts.b_HLT_PAMu3PFJet40_v1);
t->SetBranchAddress("HLT_PAMu3PFJet40_v1_Prescl", &tHlts.HLT_PAMu3PFJet40_v1_Prescl, &tHlts.b_HLT_PAMu3PFJet40_v1_Prescl);
t->SetBranchAddress("HLT_PAMu7PFJet20_v1", &tHlts.HLT_PAMu7PFJet20_v1, &tHlts.b_HLT_PAMu7PFJet20_v1);
t->SetBranchAddress("HLT_PAMu7PFJet20_v1_Prescl", &tHlts.HLT_PAMu7PFJet20_v1_Prescl, &tHlts.b_HLT_PAMu7PFJet20_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton10_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton10_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton10_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton10_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton10_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton15_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton15_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton15_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton15_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton15_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton15_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton20_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton20_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton20_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton20_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton20_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton30_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton30_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton30_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton30_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton30_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton30_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton40_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton40_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton40_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton40_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton40_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton40_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton60_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton60_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton60_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton60_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton60_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton60_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton10_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton10_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton10_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton10_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton10_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton15_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton15_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton15_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton15_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton15_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton15_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton20_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton20_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton20_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton20_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton20_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton30_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton30_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton30_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton30_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton30_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton30_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton40_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton40_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton40_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton40_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton40_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton40_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_TightCaloIdVL_Iso50_v1", &tHlts.HLT_PAPhoton10_TightCaloIdVL_Iso50_v1, &tHlts.b_HLT_PAPhoton10_TightCaloIdVL_Iso50_v1);
t->SetBranchAddress("HLT_PAPhoton10_TightCaloIdVL_Iso50_v1_Prescl", &tHlts.HLT_PAPhoton10_TightCaloIdVL_Iso50_v1_Prescl, &tHlts.b_HLT_PAPhoton10_TightCaloIdVL_Iso50_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton15_TightCaloIdVL_Iso50_v1", &tHlts.HLT_PAPhoton15_TightCaloIdVL_Iso50_v1, &tHlts.b_HLT_PAPhoton15_TightCaloIdVL_Iso50_v1);
t->SetBranchAddress("HLT_PAPhoton15_TightCaloIdVL_Iso50_v1_Prescl", &tHlts.HLT_PAPhoton15_TightCaloIdVL_Iso50_v1_Prescl, &tHlts.b_HLT_PAPhoton15_TightCaloIdVL_Iso50_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_TightCaloIdVL_Iso50_v1", &tHlts.HLT_PAPhoton20_TightCaloIdVL_Iso50_v1, &tHlts.b_HLT_PAPhoton20_TightCaloIdVL_Iso50_v1);
t->SetBranchAddress("HLT_PAPhoton20_TightCaloIdVL_Iso50_v1_Prescl", &tHlts.HLT_PAPhoton20_TightCaloIdVL_Iso50_v1_Prescl, &tHlts.b_HLT_PAPhoton20_TightCaloIdVL_Iso50_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton30_TightCaloIdVL_Iso50_v1", &tHlts.HLT_PAPhoton30_TightCaloIdVL_Iso50_v1, &tHlts.b_HLT_PAPhoton30_TightCaloIdVL_Iso50_v1);
t->SetBranchAddress("HLT_PAPhoton30_TightCaloIdVL_Iso50_v1_Prescl", &tHlts.HLT_PAPhoton30_TightCaloIdVL_Iso50_v1_Prescl, &tHlts.b_HLT_PAPhoton30_TightCaloIdVL_Iso50_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton10_Photon10_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton10_Photon10_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton10_Photon10_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton10_Photon10_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton15_Photon10_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton15_Photon10_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton15_Photon10_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton15_Photon10_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton15_Photon10_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton15_Photon10_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_Photon15_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton20_Photon15_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton20_Photon15_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton20_Photon15_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton20_Photon15_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton20_Photon15_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_Photon20_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton20_Photon20_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton20_Photon20_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton20_Photon20_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton20_Photon20_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton20_Photon20_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton30_Photon30_NoCaloIdVL_v1", &tHlts.HLT_PAPhoton30_Photon30_NoCaloIdVL_v1, &tHlts.b_HLT_PAPhoton30_Photon30_NoCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton30_Photon30_NoCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton30_Photon30_NoCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton30_Photon30_NoCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton10_Photon10_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton10_Photon10_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton10_Photon10_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton10_Photon10_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1", &tHlts.HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1, &tHlts.b_HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1);
t->SetBranchAddress("HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1_Prescl", &tHlts.HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1_Prescl, &tHlts.b_HLT_PAPhoton10_Photon10_TightCaloIdVL_Iso50_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton15_Photon10_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton15_Photon10_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton15_Photon10_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton15_Photon10_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton15_Photon10_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton15_Photon10_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPhoton20_Photon15_TightCaloIdVL_v1", &tHlts.HLT_PAPhoton20_Photon15_TightCaloIdVL_v1, &tHlts.b_HLT_PAPhoton20_Photon15_TightCaloIdVL_v1);
t->SetBranchAddress("HLT_PAPhoton20_Photon15_TightCaloIdVL_v1_Prescl", &tHlts.HLT_PAPhoton20_Photon15_TightCaloIdVL_v1_Prescl, &tHlts.b_HLT_PAPhoton20_Photon15_TightCaloIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PASingleEle6_CaloIdT_TrkIdVL_v1", &tHlts.HLT_PASingleEle6_CaloIdT_TrkIdVL_v1, &tHlts.b_HLT_PASingleEle6_CaloIdT_TrkIdVL_v1);
t->SetBranchAddress("HLT_PASingleEle6_CaloIdT_TrkIdVL_v1_Prescl", &tHlts.HLT_PASingleEle6_CaloIdT_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PASingleEle6_CaloIdT_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1", &tHlts.HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1, &tHlts.b_HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1);
t->SetBranchAddress("HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1_Prescl", &tHlts.HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PASingleEle6_CaloIdNone_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1", &tHlts.HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1, &tHlts.b_HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1);
t->SetBranchAddress("HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1_Prescl", &tHlts.HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PASingleEle8_CaloIdNone_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1", &tHlts.HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1, &tHlts.b_HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1);
t->SetBranchAddress("HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1_Prescl", &tHlts.HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PAL1DoubleEG5DoubleEle6_CaloIdT_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1", &tHlts.HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1, &tHlts.b_HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1);
t->SetBranchAddress("HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1_Prescl", &tHlts.HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PADoubleEle6_CaloIdT_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1", &tHlts.HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1, &tHlts.b_HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1);
t->SetBranchAddress("HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1_Prescl", &tHlts.HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1_Prescl, &tHlts.b_HLT_PADoubleEle8_CaloIdT_TrkIdVL_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity100_v1", &tHlts.HLT_PAPixelTracks_Multiplicity100_v1, &tHlts.b_HLT_PAPixelTracks_Multiplicity100_v1);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity100_v1_Prescl", &tHlts.HLT_PAPixelTracks_Multiplicity100_v1_Prescl, &tHlts.b_HLT_PAPixelTracks_Multiplicity100_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity130_v1", &tHlts.HLT_PAPixelTracks_Multiplicity130_v1, &tHlts.b_HLT_PAPixelTracks_Multiplicity130_v1);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity130_v1_Prescl", &tHlts.HLT_PAPixelTracks_Multiplicity130_v1_Prescl, &tHlts.b_HLT_PAPixelTracks_Multiplicity130_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity160_v1", &tHlts.HLT_PAPixelTracks_Multiplicity160_v1, &tHlts.b_HLT_PAPixelTracks_Multiplicity160_v1);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity160_v1_Prescl", &tHlts.HLT_PAPixelTracks_Multiplicity160_v1_Prescl, &tHlts.b_HLT_PAPixelTracks_Multiplicity160_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity190_v1", &tHlts.HLT_PAPixelTracks_Multiplicity190_v1, &tHlts.b_HLT_PAPixelTracks_Multiplicity190_v1);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity190_v1_Prescl", &tHlts.HLT_PAPixelTracks_Multiplicity190_v1_Prescl, &tHlts.b_HLT_PAPixelTracks_Multiplicity190_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity220_v1", &tHlts.HLT_PAPixelTracks_Multiplicity220_v1, &tHlts.b_HLT_PAPixelTracks_Multiplicity220_v1);
t->SetBranchAddress("HLT_PAPixelTracks_Multiplicity220_v1_Prescl", &tHlts.HLT_PAPixelTracks_Multiplicity220_v1_Prescl, &tHlts.b_HLT_PAPixelTracks_Multiplicity220_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity100_FullTrack12_v1", &tHlts.HLT_PAPixelTrackMultiplicity100_FullTrack12_v1, &tHlts.b_HLT_PAPixelTrackMultiplicity100_FullTrack12_v1);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity100_FullTrack12_v1_Prescl", &tHlts.HLT_PAPixelTrackMultiplicity100_FullTrack12_v1_Prescl, &tHlts.b_HLT_PAPixelTrackMultiplicity100_FullTrack12_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity130_FullTrack12_v1", &tHlts.HLT_PAPixelTrackMultiplicity130_FullTrack12_v1, &tHlts.b_HLT_PAPixelTrackMultiplicity130_FullTrack12_v1);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity130_FullTrack12_v1_Prescl", &tHlts.HLT_PAPixelTrackMultiplicity130_FullTrack12_v1_Prescl, &tHlts.b_HLT_PAPixelTrackMultiplicity130_FullTrack12_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity160_FullTrack12_v1", &tHlts.HLT_PAPixelTrackMultiplicity160_FullTrack12_v1, &tHlts.b_HLT_PAPixelTrackMultiplicity160_FullTrack12_v1);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity160_FullTrack12_v1_Prescl", &tHlts.HLT_PAPixelTrackMultiplicity160_FullTrack12_v1_Prescl, &tHlts.b_HLT_PAPixelTrackMultiplicity160_FullTrack12_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1", &tHlts.HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1, &tHlts.b_HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1_Prescl", &tHlts.HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1_Prescl, &tHlts.b_HLT_PAPixelTrackMultiplicity100_L2DoubleMu3_v1_Prescl);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1", &tHlts.HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1, &tHlts.b_HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1);
t->SetBranchAddress("HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1_Prescl", &tHlts.HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1_Prescl, &tHlts.b_HLT_PAPixelTrackMultiplicity140_Jet80_NoJetID_v1_Prescl);
t->SetBranchAddress("HLT_PATech35_v1", &tHlts.HLT_PATech35_v1, &tHlts.b_HLT_PATech35_v1);
t->SetBranchAddress("HLT_PATech35_v1_Prescl", &tHlts.HLT_PATech35_v1_Prescl, &tHlts.b_HLT_PATech35_v1_Prescl);
t->SetBranchAddress("HLT_PATech35_HFSumET100_v1", &tHlts.HLT_PATech35_HFSumET100_v1, &tHlts.b_HLT_PATech35_HFSumET100_v1);
t->SetBranchAddress("HLT_PATech35_HFSumET100_v1_Prescl", &tHlts.HLT_PATech35_HFSumET100_v1_Prescl, &tHlts.b_HLT_PATech35_HFSumET100_v1_Prescl);
t->SetBranchAddress("HLT_PAFullTrack12_v1", &tHlts.HLT_PAFullTrack12_v1, &tHlts.b_HLT_PAFullTrack12_v1);
t->SetBranchAddress("HLT_PAFullTrack12_v1_Prescl", &tHlts.HLT_PAFullTrack12_v1_Prescl, &tHlts.b_HLT_PAFullTrack12_v1_Prescl);
t->SetBranchAddress("HLT_PAFullTrack20_v1", &tHlts.HLT_PAFullTrack20_v1, &tHlts.b_HLT_PAFullTrack20_v1);
t->SetBranchAddress("HLT_PAFullTrack20_v1_Prescl", &tHlts.HLT_PAFullTrack20_v1_Prescl, &tHlts.b_HLT_PAFullTrack20_v1_Prescl);
t->SetBranchAddress("HLT_PAFullTrack30_v1", &tHlts.HLT_PAFullTrack30_v1, &tHlts.b_HLT_PAFullTrack30_v1);
t->SetBranchAddress("HLT_PAFullTrack30_v1_Prescl", &tHlts.HLT_PAFullTrack30_v1_Prescl, &tHlts.b_HLT_PAFullTrack30_v1_Prescl);
t->SetBranchAddress("HLT_PAFullTrack50_v1", &tHlts.HLT_PAFullTrack50_v1, &tHlts.b_HLT_PAFullTrack50_v1);
t->SetBranchAddress("HLT_PAFullTrack50_v1_Prescl", &tHlts.HLT_PAFullTrack50_v1_Prescl, &tHlts.b_HLT_PAFullTrack50_v1_Prescl);
t->SetBranchAddress("HLT_PAHFSumET100_v1", &tHlts.HLT_PAHFSumET100_v1, &tHlts.b_HLT_PAHFSumET100_v1);
t->SetBranchAddress("HLT_PAHFSumET100_v1_Prescl", &tHlts.HLT_PAHFSumET100_v1_Prescl, &tHlts.b_HLT_PAHFSumET100_v1_Prescl);
t->SetBranchAddress("HLT_PAHFSumET140_v1", &tHlts.HLT_PAHFSumET140_v1, &tHlts.b_HLT_PAHFSumET140_v1);
t->SetBranchAddress("HLT_PAHFSumET140_v1_Prescl", &tHlts.HLT_PAHFSumET140_v1_Prescl, &tHlts.b_HLT_PAHFSumET140_v1_Prescl);
t->SetBranchAddress("HLT_PAHFSumET170_v1", &tHlts.HLT_PAHFSumET170_v1, &tHlts.b_HLT_PAHFSumET170_v1);
t->SetBranchAddress("HLT_PAHFSumET170_v1_Prescl", &tHlts.HLT_PAHFSumET170_v1_Prescl, &tHlts.b_HLT_PAHFSumET170_v1_Prescl);
t->SetBranchAddress("HLT_PAHFSumET210_v1", &tHlts.HLT_PAHFSumET210_v1, &tHlts.b_HLT_PAHFSumET210_v1);
t->SetBranchAddress("HLT_PAHFSumET210_v1_Prescl", &tHlts.HLT_PAHFSumET210_v1_Prescl, &tHlts.b_HLT_PAHFSumET210_v1_Prescl);
t->SetBranchAddress("HLT_PARomanPots_Tech52_v1", &tHlts.HLT_PARomanPots_Tech52_v1, &tHlts.b_HLT_PARomanPots_Tech52_v1);
t->SetBranchAddress("HLT_PARomanPots_Tech52_v1_Prescl", &tHlts.HLT_PARomanPots_Tech52_v1_Prescl, &tHlts.b_HLT_PARomanPots_Tech52_v1_Prescl);
t->SetBranchAddress("HLT_PAL1Tech53_MB_v1", &tHlts.HLT_PAL1Tech53_MB_v1, &tHlts.b_HLT_PAL1Tech53_MB_v1);
t->SetBranchAddress("HLT_PAL1Tech53_MB_v1_Prescl", &tHlts.HLT_PAL1Tech53_MB_v1_Prescl, &tHlts.b_HLT_PAL1Tech53_MB_v1_Prescl);
t->SetBranchAddress("HLT_PAL1Tech53_MB_SingleTrack_v1", &tHlts.HLT_PAL1Tech53_MB_SingleTrack_v1, &tHlts.b_HLT_PAL1Tech53_MB_SingleTrack_v1);
t->SetBranchAddress("HLT_PAL1Tech53_MB_SingleTrack_v1_Prescl", &tHlts.HLT_PAL1Tech53_MB_SingleTrack_v1_Prescl, &tHlts.b_HLT_PAL1Tech53_MB_SingleTrack_v1_Prescl);
t->SetBranchAddress("HLT_PAL1Tech54_ZeroBias_v1", &tHlts.HLT_PAL1Tech54_ZeroBias_v1, &tHlts.b_HLT_PAL1Tech54_ZeroBias_v1);
t->SetBranchAddress("HLT_PAL1Tech54_ZeroBias_v1_Prescl", &tHlts.HLT_PAL1Tech54_ZeroBias_v1_Prescl, &tHlts.b_HLT_PAL1Tech54_ZeroBias_v1_Prescl);
t->SetBranchAddress("HLT_PAT1minbias_Tech55_v1", &tHlts.HLT_PAT1minbias_Tech55_v1, &tHlts.b_HLT_PAT1minbias_Tech55_v1);
t->SetBranchAddress("HLT_PAT1minbias_Tech55_v1_Prescl", &tHlts.HLT_PAT1minbias_Tech55_v1_Prescl, &tHlts.b_HLT_PAT1minbias_Tech55_v1_Prescl);
t->SetBranchAddress("HLT_PAL1Tech_HBHEHO_totalOR_v1", &tHlts.HLT_PAL1Tech_HBHEHO_totalOR_v1, &tHlts.b_HLT_PAL1Tech_HBHEHO_totalOR_v1);
t->SetBranchAddress("HLT_PAL1Tech_HBHEHO_totalOR_v1_Prescl", &tHlts.HLT_PAL1Tech_HBHEHO_totalOR_v1_Prescl, &tHlts.b_HLT_PAL1Tech_HBHEHO_totalOR_v1_Prescl);
t->SetBranchAddress("HLT_PAL1Tech63_CASTORHaloMuon_v1", &tHlts.HLT_PAL1Tech63_CASTORHaloMuon_v1, &tHlts.b_HLT_PAL1Tech63_CASTORHaloMuon_v1);
t->SetBranchAddress("HLT_PAL1Tech63_CASTORHaloMuon_v1_Prescl", &tHlts.HLT_PAL1Tech63_CASTORHaloMuon_v1_Prescl, &tHlts.b_HLT_PAL1Tech63_CASTORHaloMuon_v1_Prescl);
t->SetBranchAddress("HLT_PACastorEmTotemLowMultiplicity_v1", &tHlts.HLT_PACastorEmTotemLowMultiplicity_v1, &tHlts.b_HLT_PACastorEmTotemLowMultiplicity_v1);
t->SetBranchAddress("HLT_PACastorEmTotemLowMultiplicity_v1_Prescl", &tHlts.HLT_PACastorEmTotemLowMultiplicity_v1_Prescl, &tHlts.b_HLT_PACastorEmTotemLowMultiplicity_v1_Prescl);
t->SetBranchAddress("HLT_PACastorEmNotHfCoincidencePm_v1", &tHlts.HLT_PACastorEmNotHfCoincidencePm_v1, &tHlts.b_HLT_PACastorEmNotHfCoincidencePm_v1);
t->SetBranchAddress("HLT_PACastorEmNotHfCoincidencePm_v1_Prescl", &tHlts.HLT_PACastorEmNotHfCoincidencePm_v1_Prescl, &tHlts.b_HLT_PACastorEmNotHfCoincidencePm_v1_Prescl);
t->SetBranchAddress("HLT_PACastorEmNotHfSingleChannel_v1", &tHlts.HLT_PACastorEmNotHfSingleChannel_v1, &tHlts.b_HLT_PACastorEmNotHfSingleChannel_v1);
t->SetBranchAddress("HLT_PACastorEmNotHfSingleChannel_v1_Prescl", &tHlts.HLT_PACastorEmNotHfSingleChannel_v1_Prescl, &tHlts.b_HLT_PACastorEmNotHfSingleChannel_v1_Prescl);
t->SetBranchAddress("HLT_PAL1CastorTotalTotemLowMultiplicity_v1", &tHlts.HLT_PAL1CastorTotalTotemLowMultiplicity_v1, &tHlts.b_HLT_PAL1CastorTotalTotemLowMultiplicity_v1);
t->SetBranchAddress("HLT_PAL1CastorTotalTotemLowMultiplicity_v1_Prescl", &tHlts.HLT_PAL1CastorTotalTotemLowMultiplicity_v1_Prescl, &tHlts.b_HLT_PAL1CastorTotalTotemLowMultiplicity_v1_Prescl);
t->SetBranchAddress("HLT_PAMinBiasHF_v1", &tHlts.HLT_PAMinBiasHF_v1, &tHlts.b_HLT_PAMinBiasHF_v1);
t->SetBranchAddress("HLT_PAMinBiasHF_v1_Prescl", &tHlts.HLT_PAMinBiasHF_v1_Prescl, &tHlts.b_HLT_PAMinBiasHF_v1_Prescl);
t->SetBranchAddress("HLT_PAMinBiasHF_OR_v1", &tHlts.HLT_PAMinBiasHF_OR_v1, &tHlts.b_HLT_PAMinBiasHF_OR_v1);
t->SetBranchAddress("HLT_PAMinBiasHF_OR_v1_Prescl", &tHlts.HLT_PAMinBiasHF_OR_v1_Prescl, &tHlts.b_HLT_PAMinBiasHF_OR_v1_Prescl);
t->SetBranchAddress("HLT_PAMinBiasBHC_v1", &tHlts.HLT_PAMinBiasBHC_v1, &tHlts.b_HLT_PAMinBiasBHC_v1);
t->SetBranchAddress("HLT_PAMinBiasBHC_v1_Prescl", &tHlts.HLT_PAMinBiasBHC_v1_Prescl, &tHlts.b_HLT_PAMinBiasBHC_v1_Prescl);
t->SetBranchAddress("HLT_PAMinBiasBHC_OR_v1", &tHlts.HLT_PAMinBiasBHC_OR_v1, &tHlts.b_HLT_PAMinBiasBHC_OR_v1);
t->SetBranchAddress("HLT_PAMinBiasBHC_OR_v1_Prescl", &tHlts.HLT_PAMinBiasBHC_OR_v1_Prescl, &tHlts.b_HLT_PAMinBiasBHC_OR_v1_Prescl);
t->SetBranchAddress("HLT_PAMinBiasHfOrBHC_v1", &tHlts.HLT_PAMinBiasHfOrBHC_v1, &tHlts.b_HLT_PAMinBiasHfOrBHC_v1);
t->SetBranchAddress("HLT_PAMinBiasHfOrBHC_v1_Prescl", &tHlts.HLT_PAMinBiasHfOrBHC_v1_Prescl, &tHlts.b_HLT_PAMinBiasHfOrBHC_v1_Prescl);
t->SetBranchAddress("HLT_PABptxPlusNotBptxMinus_v1", &tHlts.HLT_PABptxPlusNotBptxMinus_v1, &tHlts.b_HLT_PABptxPlusNotBptxMinus_v1);
t->SetBranchAddress("HLT_PABptxPlusNotBptxMinus_v1_Prescl", &tHlts.HLT_PABptxPlusNotBptxMinus_v1_Prescl, &tHlts.b_HLT_PABptxPlusNotBptxMinus_v1_Prescl);
t->SetBranchAddress("HLT_PABptxMinusNotBptxPlus_v1", &tHlts.HLT_PABptxMinusNotBptxPlus_v1, &tHlts.b_HLT_PABptxMinusNotBptxPlus_v1);
t->SetBranchAddress("HLT_PABptxMinusNotBptxPlus_v1_Prescl", &tHlts.HLT_PABptxMinusNotBptxPlus_v1_Prescl, &tHlts.b_HLT_PABptxMinusNotBptxPlus_v1_Prescl);
t->SetBranchAddress("HLT_PAZeroBias_v1", &tHlts.HLT_PAZeroBias_v1, &tHlts.b_HLT_PAZeroBias_v1);
t->SetBranchAddress("HLT_PAZeroBias_v1_Prescl", &tHlts.HLT_PAZeroBias_v1_Prescl, &tHlts.b_HLT_PAZeroBias_v1_Prescl);
t->SetBranchAddress("HLT_PAZeroBiasPixel_SingleTrack_v1", &tHlts.HLT_PAZeroBiasPixel_SingleTrack_v1, &tHlts.b_HLT_PAZeroBiasPixel_SingleTrack_v1);
t->SetBranchAddress("HLT_PAZeroBiasPixel_SingleTrack_v1_Prescl", &tHlts.HLT_PAZeroBiasPixel_SingleTrack_v1_Prescl, &tHlts.b_HLT_PAZeroBiasPixel_SingleTrack_v1_Prescl);
t->SetBranchAddress("HLT_PAHFOR_SingleTrack_v1", &tHlts.HLT_PAHFOR_SingleTrack_v1, &tHlts.b_HLT_PAHFOR_SingleTrack_v1);
t->SetBranchAddress("HLT_PAHFOR_SingleTrack_v1_Prescl", &tHlts.HLT_PAHFOR_SingleTrack_v1_Prescl, &tHlts.b_HLT_PAHFOR_SingleTrack_v1_Prescl);
t->SetBranchAddress("HLT_PAZeroBiasPixel_DoubleTrack_v1", &tHlts.HLT_PAZeroBiasPixel_DoubleTrack_v1, &tHlts.b_HLT_PAZeroBiasPixel_DoubleTrack_v1);
t->SetBranchAddress("HLT_PAZeroBiasPixel_DoubleTrack_v1_Prescl", &tHlts.HLT_PAZeroBiasPixel_DoubleTrack_v1_Prescl, &tHlts.b_HLT_PAZeroBiasPixel_DoubleTrack_v1_Prescl);
t->SetBranchAddress("HLT_PADoubleMu4_Acoplanarity03_v1", &tHlts.HLT_PADoubleMu4_Acoplanarity03_v1, &tHlts.b_HLT_PADoubleMu4_Acoplanarity03_v1);
t->SetBranchAddress("HLT_PADoubleMu4_Acoplanarity03_v1_Prescl", &tHlts.HLT_PADoubleMu4_Acoplanarity03_v1_Prescl, &tHlts.b_HLT_PADoubleMu4_Acoplanarity03_v1_Prescl);
t->SetBranchAddress("HLT_PAExclDijet35_HFAND_v1", &tHlts.HLT_PAExclDijet35_HFAND_v1, &tHlts.b_HLT_PAExclDijet35_HFAND_v1);
t->SetBranchAddress("HLT_PAExclDijet35_HFAND_v1_Prescl", &tHlts.HLT_PAExclDijet35_HFAND_v1_Prescl, &tHlts.b_HLT_PAExclDijet35_HFAND_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleEG3_FwdVeto_v1", &tHlts.HLT_PAL1DoubleEG3_FwdVeto_v1, &tHlts.b_HLT_PAL1DoubleEG3_FwdVeto_v1);
t->SetBranchAddress("HLT_PAL1DoubleEG3_FwdVeto_v1_Prescl", &tHlts.HLT_PAL1DoubleEG3_FwdVeto_v1_Prescl, &tHlts.b_HLT_PAL1DoubleEG3_FwdVeto_v1_Prescl);
t->SetBranchAddress("HLT_PAL1DoubleJet20_TotemDiffractive_v1", &tHlts.HLT_PAL1DoubleJet20_TotemDiffractive_v1, &tHlts.b_HLT_PAL1DoubleJet20_TotemDiffractive_v1);
t->SetBranchAddress("HLT_PAL1DoubleJet20_TotemDiffractive_v1_Prescl", &tHlts.HLT_PAL1DoubleJet20_TotemDiffractive_v1_Prescl, &tHlts.b_HLT_PAL1DoubleJet20_TotemDiffractive_v1_Prescl);
t->SetBranchAddress("HLT_PADoubleJet20_ForwardBackward_v1", &tHlts.HLT_PADoubleJet20_ForwardBackward_v1, &tHlts.b_HLT_PADoubleJet20_ForwardBackward_v1);
t->SetBranchAddress("HLT_PADoubleJet20_ForwardBackward_v1_Prescl", &tHlts.HLT_PADoubleJet20_ForwardBackward_v1_Prescl, &tHlts.b_HLT_PADoubleJet20_ForwardBackward_v1_Prescl);
t->SetBranchAddress("HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1", &tHlts.HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1, &tHlts.b_HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1);
t->SetBranchAddress("HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1_Prescl", &tHlts.HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1_Prescl, &tHlts.b_HLT_PAMu7_Ele7_CaloIdT_CaloIsoVL_v1_Prescl);
t->SetBranchAddress("HLT_PAUpcSingleEG5Pixel_TrackVeto_v1", &tHlts.HLT_PAUpcSingleEG5Pixel_TrackVeto_v1, &tHlts.b_HLT_PAUpcSingleEG5Pixel_TrackVeto_v1);
t->SetBranchAddress("HLT_PAUpcSingleEG5Pixel_TrackVeto_v1_Prescl", &tHlts.HLT_PAUpcSingleEG5Pixel_TrackVeto_v1_Prescl, &tHlts.b_HLT_PAUpcSingleEG5Pixel_TrackVeto_v1_Prescl);
t->SetBranchAddress("HLT_PAUpcSingleEG5Full_TrackVeto7_v1", &tHlts.HLT_PAUpcSingleEG5Full_TrackVeto7_v1, &tHlts.b_HLT_PAUpcSingleEG5Full_TrackVeto7_v1);
t->SetBranchAddress("HLT_PAUpcSingleEG5Full_TrackVeto7_v1_Prescl", &tHlts.HLT_PAUpcSingleEG5Full_TrackVeto7_v1_Prescl, &tHlts.b_HLT_PAUpcSingleEG5Full_TrackVeto7_v1_Prescl);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1", &tHlts.HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1, &tHlts.b_HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1_Prescl", &tHlts.HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1_Prescl, &tHlts.b_HLT_PAUpcSingleMuOpenPixel_TrackVeto_v1_Prescl);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1", &tHlts.HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1, &tHlts.b_HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1_Prescl", &tHlts.HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1_Prescl, &tHlts.b_HLT_PAUpcSingleMuOpenFull_TrackVeto7_v1_Prescl);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenTkMu_Onia_v1", &tHlts.HLT_PAUpcSingleMuOpenTkMu_Onia_v1, &tHlts.b_HLT_PAUpcSingleMuOpenTkMu_Onia_v1);
t->SetBranchAddress("HLT_PAUpcSingleMuOpenTkMu_Onia_v1_Prescl", &tHlts.HLT_PAUpcSingleMuOpenTkMu_Onia_v1_Prescl, &tHlts.b_HLT_PAUpcSingleMuOpenTkMu_Onia_v1_Prescl);
t->SetBranchAddress("HLT_PARandom_v1", &tHlts.HLT_PARandom_v1, &tHlts.b_HLT_PARandom_v1);
t->SetBranchAddress("HLT_PARandom_v1_Prescl", &tHlts.HLT_PARandom_v1_Prescl, &tHlts.b_HLT_PARandom_v1_Prescl);
t->SetBranchAddress("DQM_FEDIntegrity_v11", &tHlts.DQM_FEDIntegrity_v11, &tHlts.b_DQM_FEDIntegrity_v11);
t->SetBranchAddress("DQM_FEDIntegrity_v11_Prescl", &tHlts.DQM_FEDIntegrity_v11_Prescl, &tHlts.b_DQM_FEDIntegrity_v11_Prescl);
t->SetBranchAddress("HLT_LogMonitor_v4", &tHlts.HLT_LogMonitor_v4, &tHlts.b_HLT_LogMonitor_v4);
t->SetBranchAddress("HLT_LogMonitor_v4_Prescl", &tHlts.HLT_LogMonitor_v4_Prescl, &tHlts.b_HLT_LogMonitor_v4_Prescl);
t->SetBranchAddress("HLTriggerFinalPath", &tHlts.HLTriggerFinalPath, &tHlts.b_HLTriggerFinalPath);
t->SetBranchAddress("HLTriggerFinalPath_Prescl", &tHlts.HLTriggerFinalPath_Prescl, &tHlts.b_HLTriggerFinalPath_Prescl);
t->SetBranchAddress("L1_AlwaysTrue", &tHlts.L1_AlwaysTrue, &tHlts.b_L1_AlwaysTrue);
t->SetBranchAddress("L1_AlwaysTrue_Prescl", &tHlts.L1_AlwaysTrue_Prescl, &tHlts.b_L1_AlwaysTrue_Prescl);
t->SetBranchAddress("L1_BeamGas_Hf_BptxMinusPostQuiet", &tHlts.L1_BeamGas_Hf_BptxMinusPostQuiet, &tHlts.b_L1_BeamGas_Hf_BptxMinusPostQuiet);
t->SetBranchAddress("L1_BeamGas_Hf_BptxMinusPostQuiet_Prescl", &tHlts.L1_BeamGas_Hf_BptxMinusPostQuiet_Prescl, &tHlts.b_L1_BeamGas_Hf_BptxMinusPostQuiet_Prescl);
t->SetBranchAddress("L1_BeamGas_Hf_BptxPlusPostQuiet", &tHlts.L1_BeamGas_Hf_BptxPlusPostQuiet, &tHlts.b_L1_BeamGas_Hf_BptxPlusPostQuiet);
t->SetBranchAddress("L1_BeamGas_Hf_BptxPlusPostQuiet_Prescl", &tHlts.L1_BeamGas_Hf_BptxPlusPostQuiet_Prescl, &tHlts.b_L1_BeamGas_Hf_BptxPlusPostQuiet_Prescl);
t->SetBranchAddress("L1_BeamHalo", &tHlts.L1_BeamHalo, &tHlts.b_L1_BeamHalo);
t->SetBranchAddress("L1_BeamHalo_Prescl", &tHlts.L1_BeamHalo_Prescl, &tHlts.b_L1_BeamHalo_Prescl);
t->SetBranchAddress("L1_BptxMinus_NotBptxPlus", &tHlts.L1_BptxMinus_NotBptxPlus, &tHlts.b_L1_BptxMinus_NotBptxPlus);
t->SetBranchAddress("L1_BptxMinus_NotBptxPlus_Prescl", &tHlts.L1_BptxMinus_NotBptxPlus_Prescl, &tHlts.b_L1_BptxMinus_NotBptxPlus_Prescl);
t->SetBranchAddress("L1_BptxPlus_NotBptxMinus", &tHlts.L1_BptxPlus_NotBptxMinus, &tHlts.b_L1_BptxPlus_NotBptxMinus);
t->SetBranchAddress("L1_BptxPlus_NotBptxMinus_Prescl", &tHlts.L1_BptxPlus_NotBptxMinus_Prescl, &tHlts.b_L1_BptxPlus_NotBptxMinus_Prescl);
t->SetBranchAddress("L1_BscHighMultiplicity_BptxAND", &tHlts.L1_BscHighMultiplicity_BptxAND, &tHlts.b_L1_BscHighMultiplicity_BptxAND);
t->SetBranchAddress("L1_BscHighMultiplicity_BptxAND_Prescl", &tHlts.L1_BscHighMultiplicity_BptxAND_Prescl, &tHlts.b_L1_BscHighMultiplicity_BptxAND_Prescl);
t->SetBranchAddress("L1_BscMinBiasOR_BptxAND", &tHlts.L1_BscMinBiasOR_BptxAND, &tHlts.b_L1_BscMinBiasOR_BptxAND);
t->SetBranchAddress("L1_BscMinBiasOR_BptxAND_Prescl", &tHlts.L1_BscMinBiasOR_BptxAND_Prescl, &tHlts.b_L1_BscMinBiasOR_BptxAND_Prescl);
t->SetBranchAddress("L1_BscMinBiasThreshold1_BptxAND", &tHlts.L1_BscMinBiasThreshold1_BptxAND, &tHlts.b_L1_BscMinBiasThreshold1_BptxAND);
t->SetBranchAddress("L1_BscMinBiasThreshold1_BptxAND_Prescl", &tHlts.L1_BscMinBiasThreshold1_BptxAND_Prescl, &tHlts.b_L1_BscMinBiasThreshold1_BptxAND_Prescl);
t->SetBranchAddress("L1_BscMinBiasThreshold2_BptxAND", &tHlts.L1_BscMinBiasThreshold2_BptxAND, &tHlts.b_L1_BscMinBiasThreshold2_BptxAND);
t->SetBranchAddress("L1_BscMinBiasThreshold2_BptxAND_Prescl", &tHlts.L1_BscMinBiasThreshold2_BptxAND_Prescl, &tHlts.b_L1_BscMinBiasThreshold2_BptxAND_Prescl);
t->SetBranchAddress("L1_CastorEm_NotHcalHfCoincidencePm", &tHlts.L1_CastorEm_NotHcalHfCoincidencePm, &tHlts.b_L1_CastorEm_NotHcalHfCoincidencePm);
t->SetBranchAddress("L1_CastorEm_NotHcalHfCoincidencePm_Prescl", &tHlts.L1_CastorEm_NotHcalHfCoincidencePm_Prescl, &tHlts.b_L1_CastorEm_NotHcalHfCoincidencePm_Prescl);
t->SetBranchAddress("L1_CastorEm_NotHcalHfSingleChannel", &tHlts.L1_CastorEm_NotHcalHfSingleChannel, &tHlts.b_L1_CastorEm_NotHcalHfSingleChannel);
t->SetBranchAddress("L1_CastorEm_NotHcalHfSingleChannel_Prescl", &tHlts.L1_CastorEm_NotHcalHfSingleChannel_Prescl, &tHlts.b_L1_CastorEm_NotHcalHfSingleChannel_Prescl);
t->SetBranchAddress("L1_CastorEm_TotemLowMultiplicity", &tHlts.L1_CastorEm_TotemLowMultiplicity, &tHlts.b_L1_CastorEm_TotemLowMultiplicity);
t->SetBranchAddress("L1_CastorEm_TotemLowMultiplicity_Prescl", &tHlts.L1_CastorEm_TotemLowMultiplicity_Prescl, &tHlts.b_L1_CastorEm_TotemLowMultiplicity_Prescl);
t->SetBranchAddress("L1_CastorTotalEnergy_TotemLowMultiplicity", &tHlts.L1_CastorTotalEnergy_TotemLowMultiplicity, &tHlts.b_L1_CastorTotalEnergy_TotemLowMultiplicity);
t->SetBranchAddress("L1_CastorTotalEnergy_TotemLowMultiplicity_Prescl", &tHlts.L1_CastorTotalEnergy_TotemLowMultiplicity_Prescl, &tHlts.b_L1_CastorTotalEnergy_TotemLowMultiplicity_Prescl);
t->SetBranchAddress("L1_DoubleEG3_FwdVeto", &tHlts.L1_DoubleEG3_FwdVeto, &tHlts.b_L1_DoubleEG3_FwdVeto);
t->SetBranchAddress("L1_DoubleEG3_FwdVeto_Prescl", &tHlts.L1_DoubleEG3_FwdVeto_Prescl, &tHlts.b_L1_DoubleEG3_FwdVeto_Prescl);
t->SetBranchAddress("L1_DoubleEG5", &tHlts.L1_DoubleEG5, &tHlts.b_L1_DoubleEG5);
t->SetBranchAddress("L1_DoubleEG5_Prescl", &tHlts.L1_DoubleEG5_Prescl, &tHlts.b_L1_DoubleEG5_Prescl);
t->SetBranchAddress("L1_DoubleEG5_TotemDiffractive", &tHlts.L1_DoubleEG5_TotemDiffractive, &tHlts.b_L1_DoubleEG5_TotemDiffractive);
t->SetBranchAddress("L1_DoubleEG5_TotemDiffractive_Prescl", &tHlts.L1_DoubleEG5_TotemDiffractive_Prescl, &tHlts.b_L1_DoubleEG5_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_DoubleEG6_HTT100", &tHlts.L1_DoubleEG6_HTT100, &tHlts.b_L1_DoubleEG6_HTT100);
t->SetBranchAddress("L1_DoubleEG6_HTT100_Prescl", &tHlts.L1_DoubleEG6_HTT100_Prescl, &tHlts.b_L1_DoubleEG6_HTT100_Prescl);
t->SetBranchAddress("L1_DoubleEG6_HTT125", &tHlts.L1_DoubleEG6_HTT125, &tHlts.b_L1_DoubleEG6_HTT125);
t->SetBranchAddress("L1_DoubleEG6_HTT125_Prescl", &tHlts.L1_DoubleEG6_HTT125_Prescl, &tHlts.b_L1_DoubleEG6_HTT125_Prescl);
t->SetBranchAddress("L1_DoubleEG_13_7", &tHlts.L1_DoubleEG_13_7, &tHlts.b_L1_DoubleEG_13_7);
t->SetBranchAddress("L1_DoubleEG_13_7_Prescl", &tHlts.L1_DoubleEG_13_7_Prescl, &tHlts.b_L1_DoubleEG_13_7_Prescl);
t->SetBranchAddress("L1_DoubleForJet16_EtaOpp", &tHlts.L1_DoubleForJet16_EtaOpp, &tHlts.b_L1_DoubleForJet16_EtaOpp);
t->SetBranchAddress("L1_DoubleForJet16_EtaOpp_Prescl", &tHlts.L1_DoubleForJet16_EtaOpp_Prescl, &tHlts.b_L1_DoubleForJet16_EtaOpp_Prescl);
t->SetBranchAddress("L1_DoubleJet20", &tHlts.L1_DoubleJet20, &tHlts.b_L1_DoubleJet20);
t->SetBranchAddress("L1_DoubleJet20_Prescl", &tHlts.L1_DoubleJet20_Prescl, &tHlts.b_L1_DoubleJet20_Prescl);
t->SetBranchAddress("L1_DoubleJet20_TotemDiffractive", &tHlts.L1_DoubleJet20_TotemDiffractive, &tHlts.b_L1_DoubleJet20_TotemDiffractive);
t->SetBranchAddress("L1_DoubleJet20_TotemDiffractive_Prescl", &tHlts.L1_DoubleJet20_TotemDiffractive_Prescl, &tHlts.b_L1_DoubleJet20_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_DoubleJet24_v1", &tHlts.L1_DoubleJet24_v1, &tHlts.b_L1_DoubleJet24_v1);
t->SetBranchAddress("L1_DoubleJet24_v1_Prescl", &tHlts.L1_DoubleJet24_v1_Prescl, &tHlts.b_L1_DoubleJet24_v1_Prescl);
t->SetBranchAddress("L1_DoubleJet36_Central", &tHlts.L1_DoubleJet36_Central, &tHlts.b_L1_DoubleJet36_Central);
t->SetBranchAddress("L1_DoubleJet36_Central_Prescl", &tHlts.L1_DoubleJet36_Central_Prescl, &tHlts.b_L1_DoubleJet36_Central_Prescl);
t->SetBranchAddress("L1_DoubleJet52_Central", &tHlts.L1_DoubleJet52_Central, &tHlts.b_L1_DoubleJet52_Central);
t->SetBranchAddress("L1_DoubleJet52_Central_Prescl", &tHlts.L1_DoubleJet52_Central_Prescl, &tHlts.b_L1_DoubleJet52_Central_Prescl);
t->SetBranchAddress("L1_DoubleJetC36_TotemDiffractive", &tHlts.L1_DoubleJetC36_TotemDiffractive, &tHlts.b_L1_DoubleJetC36_TotemDiffractive);
t->SetBranchAddress("L1_DoubleJetC36_TotemDiffractive_Prescl", &tHlts.L1_DoubleJetC36_TotemDiffractive_Prescl, &tHlts.b_L1_DoubleJetC36_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_DoubleJetC44_ETM30", &tHlts.L1_DoubleJetC44_ETM30, &tHlts.b_L1_DoubleJetC44_ETM30);
t->SetBranchAddress("L1_DoubleJetC44_ETM30_Prescl", &tHlts.L1_DoubleJetC44_ETM30_Prescl, &tHlts.b_L1_DoubleJetC44_ETM30_Prescl);
t->SetBranchAddress("L1_DoubleJetC56", &tHlts.L1_DoubleJetC56, &tHlts.b_L1_DoubleJetC56);
t->SetBranchAddress("L1_DoubleJetC56_Prescl", &tHlts.L1_DoubleJetC56_Prescl, &tHlts.b_L1_DoubleJetC56_Prescl);
t->SetBranchAddress("L1_DoubleJetC56_Eta1p74_WdEta4", &tHlts.L1_DoubleJetC56_Eta1p74_WdEta4, &tHlts.b_L1_DoubleJetC56_Eta1p74_WdEta4);
t->SetBranchAddress("L1_DoubleJetC56_Eta1p74_WdEta4_Prescl", &tHlts.L1_DoubleJetC56_Eta1p74_WdEta4_Prescl, &tHlts.b_L1_DoubleJetC56_Eta1p74_WdEta4_Prescl);
t->SetBranchAddress("L1_DoubleMu0", &tHlts.L1_DoubleMu0, &tHlts.b_L1_DoubleMu0);
t->SetBranchAddress("L1_DoubleMu0_Prescl", &tHlts.L1_DoubleMu0_Prescl, &tHlts.b_L1_DoubleMu0_Prescl);
t->SetBranchAddress("L1_DoubleMu0_HighQ_EtaCuts", &tHlts.L1_DoubleMu0_HighQ_EtaCuts, &tHlts.b_L1_DoubleMu0_HighQ_EtaCuts);
t->SetBranchAddress("L1_DoubleMu0_HighQ_EtaCuts_Prescl", &tHlts.L1_DoubleMu0_HighQ_EtaCuts_Prescl, &tHlts.b_L1_DoubleMu0_HighQ_EtaCuts_Prescl);
t->SetBranchAddress("L1_DoubleMu3p5_EG5", &tHlts.L1_DoubleMu3p5_EG5, &tHlts.b_L1_DoubleMu3p5_EG5);
t->SetBranchAddress("L1_DoubleMu3p5_EG5_Prescl", &tHlts.L1_DoubleMu3p5_EG5_Prescl, &tHlts.b_L1_DoubleMu3p5_EG5_Prescl);
t->SetBranchAddress("L1_DoubleMu5_EG5", &tHlts.L1_DoubleMu5_EG5, &tHlts.b_L1_DoubleMu5_EG5);
t->SetBranchAddress("L1_DoubleMu5_EG5_Prescl", &tHlts.L1_DoubleMu5_EG5_Prescl, &tHlts.b_L1_DoubleMu5_EG5_Prescl);
t->SetBranchAddress("L1_DoubleMu5_TotemDiffractive", &tHlts.L1_DoubleMu5_TotemDiffractive, &tHlts.b_L1_DoubleMu5_TotemDiffractive);
t->SetBranchAddress("L1_DoubleMu5_TotemDiffractive_Prescl", &tHlts.L1_DoubleMu5_TotemDiffractive_Prescl, &tHlts.b_L1_DoubleMu5_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_DoubleMu5_v1", &tHlts.L1_DoubleMu5_v1, &tHlts.b_L1_DoubleMu5_v1);
t->SetBranchAddress("L1_DoubleMu5_v1_Prescl", &tHlts.L1_DoubleMu5_v1_Prescl, &tHlts.b_L1_DoubleMu5_v1_Prescl);
t->SetBranchAddress("L1_DoubleMuOpen_BptxAND", &tHlts.L1_DoubleMuOpen_BptxAND, &tHlts.b_L1_DoubleMuOpen_BptxAND);
t->SetBranchAddress("L1_DoubleMuOpen_BptxAND_Prescl", &tHlts.L1_DoubleMuOpen_BptxAND_Prescl, &tHlts.b_L1_DoubleMuOpen_BptxAND_Prescl);
t->SetBranchAddress("L1_DoubleMu_10_3p5", &tHlts.L1_DoubleMu_10_3p5, &tHlts.b_L1_DoubleMu_10_3p5);
t->SetBranchAddress("L1_DoubleMu_10_3p5_Prescl", &tHlts.L1_DoubleMu_10_3p5_Prescl, &tHlts.b_L1_DoubleMu_10_3p5_Prescl);
t->SetBranchAddress("L1_DoubleMu_10_Open", &tHlts.L1_DoubleMu_10_Open, &tHlts.b_L1_DoubleMu_10_Open);
t->SetBranchAddress("L1_DoubleMu_10_Open_Prescl", &tHlts.L1_DoubleMu_10_Open_Prescl, &tHlts.b_L1_DoubleMu_10_Open_Prescl);
t->SetBranchAddress("L1_DoubleMu_12_5", &tHlts.L1_DoubleMu_12_5, &tHlts.b_L1_DoubleMu_12_5);
t->SetBranchAddress("L1_DoubleMu_12_5_Prescl", &tHlts.L1_DoubleMu_12_5_Prescl, &tHlts.b_L1_DoubleMu_12_5_Prescl);
t->SetBranchAddress("L1_DoubleMu_3er_0er_HighQ_WdEta22", &tHlts.L1_DoubleMu_3er_0er_HighQ_WdEta22, &tHlts.b_L1_DoubleMu_3er_0er_HighQ_WdEta22);
t->SetBranchAddress("L1_DoubleMu_3er_0er_HighQ_WdEta22_Prescl", &tHlts.L1_DoubleMu_3er_0er_HighQ_WdEta22_Prescl, &tHlts.b_L1_DoubleMu_3er_0er_HighQ_WdEta22_Prescl);
t->SetBranchAddress("L1_DoubleMu_5er_0er_HighQ_WdEta22", &tHlts.L1_DoubleMu_5er_0er_HighQ_WdEta22, &tHlts.b_L1_DoubleMu_5er_0er_HighQ_WdEta22);
t->SetBranchAddress("L1_DoubleMu_5er_0er_HighQ_WdEta22_Prescl", &tHlts.L1_DoubleMu_5er_0er_HighQ_WdEta22_Prescl, &tHlts.b_L1_DoubleMu_5er_0er_HighQ_WdEta22_Prescl);
t->SetBranchAddress("L1_EG8_DoubleJetC20", &tHlts.L1_EG8_DoubleJetC20, &tHlts.b_L1_EG8_DoubleJetC20);
t->SetBranchAddress("L1_EG8_DoubleJetC20_Prescl", &tHlts.L1_EG8_DoubleJetC20_Prescl, &tHlts.b_L1_EG8_DoubleJetC20_Prescl);
t->SetBranchAddress("L1_ETM100", &tHlts.L1_ETM100, &tHlts.b_L1_ETM100);
t->SetBranchAddress("L1_ETM100_Prescl", &tHlts.L1_ETM100_Prescl, &tHlts.b_L1_ETM100_Prescl);
t->SetBranchAddress("L1_ETM30", &tHlts.L1_ETM30, &tHlts.b_L1_ETM30);
t->SetBranchAddress("L1_ETM30_Prescl", &tHlts.L1_ETM30_Prescl, &tHlts.b_L1_ETM30_Prescl);
t->SetBranchAddress("L1_ETM36", &tHlts.L1_ETM36, &tHlts.b_L1_ETM36);
t->SetBranchAddress("L1_ETM36_Prescl", &tHlts.L1_ETM36_Prescl, &tHlts.b_L1_ETM36_Prescl);
t->SetBranchAddress("L1_ETM40", &tHlts.L1_ETM40, &tHlts.b_L1_ETM40);
t->SetBranchAddress("L1_ETM40_Prescl", &tHlts.L1_ETM40_Prescl, &tHlts.b_L1_ETM40_Prescl);
t->SetBranchAddress("L1_ETM50", &tHlts.L1_ETM50, &tHlts.b_L1_ETM50);
t->SetBranchAddress("L1_ETM50_Prescl", &tHlts.L1_ETM50_Prescl, &tHlts.b_L1_ETM50_Prescl);
t->SetBranchAddress("L1_ETM70", &tHlts.L1_ETM70, &tHlts.b_L1_ETM70);
t->SetBranchAddress("L1_ETM70_Prescl", &tHlts.L1_ETM70_Prescl, &tHlts.b_L1_ETM70_Prescl);
t->SetBranchAddress("L1_ETT140", &tHlts.L1_ETT140, &tHlts.b_L1_ETT140);
t->SetBranchAddress("L1_ETT140_Prescl", &tHlts.L1_ETT140_Prescl, &tHlts.b_L1_ETT140_Prescl);
t->SetBranchAddress("L1_ETT20_BptxAND", &tHlts.L1_ETT20_BptxAND, &tHlts.b_L1_ETT20_BptxAND);
t->SetBranchAddress("L1_ETT20_BptxAND_Prescl", &tHlts.L1_ETT20_BptxAND_Prescl, &tHlts.b_L1_ETT20_BptxAND_Prescl);
t->SetBranchAddress("L1_ETT300", &tHlts.L1_ETT300, &tHlts.b_L1_ETT300);
t->SetBranchAddress("L1_ETT300_Prescl", &tHlts.L1_ETT300_Prescl, &tHlts.b_L1_ETT300_Prescl);
t->SetBranchAddress("L1_ETT40", &tHlts.L1_ETT40, &tHlts.b_L1_ETT40);
t->SetBranchAddress("L1_ETT40_Prescl", &tHlts.L1_ETT40_Prescl, &tHlts.b_L1_ETT40_Prescl);
t->SetBranchAddress("L1_ETT60", &tHlts.L1_ETT60, &tHlts.b_L1_ETT60);
t->SetBranchAddress("L1_ETT60_Prescl", &tHlts.L1_ETT60_Prescl, &tHlts.b_L1_ETT60_Prescl);
t->SetBranchAddress("L1_ETT80", &tHlts.L1_ETT80, &tHlts.b_L1_ETT80);
t->SetBranchAddress("L1_ETT80_Prescl", &tHlts.L1_ETT80_Prescl, &tHlts.b_L1_ETT80_Prescl);
t->SetBranchAddress("L1_HTT100", &tHlts.L1_HTT100, &tHlts.b_L1_HTT100);
t->SetBranchAddress("L1_HTT100_Prescl", &tHlts.L1_HTT100_Prescl, &tHlts.b_L1_HTT100_Prescl);
t->SetBranchAddress("L1_HTT125", &tHlts.L1_HTT125, &tHlts.b_L1_HTT125);
t->SetBranchAddress("L1_HTT125_Prescl", &tHlts.L1_HTT125_Prescl, &tHlts.b_L1_HTT125_Prescl);
t->SetBranchAddress("L1_HTT150", &tHlts.L1_HTT150, &tHlts.b_L1_HTT150);
t->SetBranchAddress("L1_HTT150_Prescl", &tHlts.L1_HTT150_Prescl, &tHlts.b_L1_HTT150_Prescl);
t->SetBranchAddress("L1_HTT175", &tHlts.L1_HTT175, &tHlts.b_L1_HTT175);
t->SetBranchAddress("L1_HTT175_Prescl", &tHlts.L1_HTT175_Prescl, &tHlts.b_L1_HTT175_Prescl);
t->SetBranchAddress("L1_HTT200", &tHlts.L1_HTT200, &tHlts.b_L1_HTT200);
t->SetBranchAddress("L1_HTT200_Prescl", &tHlts.L1_HTT200_Prescl, &tHlts.b_L1_HTT200_Prescl);
t->SetBranchAddress("L1_HTT50", &tHlts.L1_HTT50, &tHlts.b_L1_HTT50);
t->SetBranchAddress("L1_HTT50_Prescl", &tHlts.L1_HTT50_Prescl, &tHlts.b_L1_HTT50_Prescl);
t->SetBranchAddress("L1_HTT75", &tHlts.L1_HTT75, &tHlts.b_L1_HTT75);
t->SetBranchAddress("L1_HTT75_Prescl", &tHlts.L1_HTT75_Prescl, &tHlts.b_L1_HTT75_Prescl);
t->SetBranchAddress("L1_HcalHfCoincidencePm_BptxAND_v1", &tHlts.L1_HcalHfCoincidencePm_BptxAND_v1, &tHlts.b_L1_HcalHfCoincidencePm_BptxAND_v1);
t->SetBranchAddress("L1_HcalHfCoincidencePm_BptxAND_v1_Prescl", &tHlts.L1_HcalHfCoincidencePm_BptxAND_v1_Prescl, &tHlts.b_L1_HcalHfCoincidencePm_BptxAND_v1_Prescl);
t->SetBranchAddress("L1_HcalHfSingleChannel_BptxAND", &tHlts.L1_HcalHfSingleChannel_BptxAND, &tHlts.b_L1_HcalHfSingleChannel_BptxAND);
t->SetBranchAddress("L1_HcalHfSingleChannel_BptxAND_Prescl", &tHlts.L1_HcalHfSingleChannel_BptxAND_Prescl, &tHlts.b_L1_HcalHfSingleChannel_BptxAND_Prescl);
t->SetBranchAddress("L1_Mu10er_JetC32", &tHlts.L1_Mu10er_JetC32, &tHlts.b_L1_Mu10er_JetC32);
t->SetBranchAddress("L1_Mu10er_JetC32_Prescl", &tHlts.L1_Mu10er_JetC32_Prescl, &tHlts.b_L1_Mu10er_JetC32_Prescl);
t->SetBranchAddress("L1_Mu12_EG7", &tHlts.L1_Mu12_EG7, &tHlts.b_L1_Mu12_EG7);
t->SetBranchAddress("L1_Mu12_EG7_Prescl", &tHlts.L1_Mu12_EG7_Prescl, &tHlts.b_L1_Mu12_EG7_Prescl);
t->SetBranchAddress("L1_Mu3_Jet16", &tHlts.L1_Mu3_Jet16, &tHlts.b_L1_Mu3_Jet16);
t->SetBranchAddress("L1_Mu3_Jet16_Prescl", &tHlts.L1_Mu3_Jet16_Prescl, &tHlts.b_L1_Mu3_Jet16_Prescl);
t->SetBranchAddress("L1_Mu3_Jet36", &tHlts.L1_Mu3_Jet36, &tHlts.b_L1_Mu3_Jet36);
t->SetBranchAddress("L1_Mu3_Jet36_Prescl", &tHlts.L1_Mu3_Jet36_Prescl, &tHlts.b_L1_Mu3_Jet36_Prescl);
t->SetBranchAddress("L1_Mu3_JetC16_WdEtaPhi2", &tHlts.L1_Mu3_JetC16_WdEtaPhi2, &tHlts.b_L1_Mu3_JetC16_WdEtaPhi2);
t->SetBranchAddress("L1_Mu3_JetC16_WdEtaPhi2_Prescl", &tHlts.L1_Mu3_JetC16_WdEtaPhi2_Prescl, &tHlts.b_L1_Mu3_JetC16_WdEtaPhi2_Prescl);
t->SetBranchAddress("L1_Mu3_JetC52_WdEtaPhi2", &tHlts.L1_Mu3_JetC52_WdEtaPhi2, &tHlts.b_L1_Mu3_JetC52_WdEtaPhi2);
t->SetBranchAddress("L1_Mu3_JetC52_WdEtaPhi2_Prescl", &tHlts.L1_Mu3_JetC52_WdEtaPhi2_Prescl, &tHlts.b_L1_Mu3_JetC52_WdEtaPhi2_Prescl);
t->SetBranchAddress("L1_Mu5_DoubleEG5", &tHlts.L1_Mu5_DoubleEG5, &tHlts.b_L1_Mu5_DoubleEG5);
t->SetBranchAddress("L1_Mu5_DoubleEG5_Prescl", &tHlts.L1_Mu5_DoubleEG5_Prescl, &tHlts.b_L1_Mu5_DoubleEG5_Prescl);
t->SetBranchAddress("L1_Mu5_DoubleEG6", &tHlts.L1_Mu5_DoubleEG6, &tHlts.b_L1_Mu5_DoubleEG6);
t->SetBranchAddress("L1_Mu5_DoubleEG6_Prescl", &tHlts.L1_Mu5_DoubleEG6_Prescl, &tHlts.b_L1_Mu5_DoubleEG6_Prescl);
t->SetBranchAddress("L1_Mu7_Jet16", &tHlts.L1_Mu7_Jet16, &tHlts.b_L1_Mu7_Jet16);
t->SetBranchAddress("L1_Mu7_Jet16_Prescl", &tHlts.L1_Mu7_Jet16_Prescl, &tHlts.b_L1_Mu7_Jet16_Prescl);
t->SetBranchAddress("L1_Mu8_DoubleJetC20", &tHlts.L1_Mu8_DoubleJetC20, &tHlts.b_L1_Mu8_DoubleJetC20);
t->SetBranchAddress("L1_Mu8_DoubleJetC20_Prescl", &tHlts.L1_Mu8_DoubleJetC20_Prescl, &tHlts.b_L1_Mu8_DoubleJetC20_Prescl);
t->SetBranchAddress("L1_MuOpen_EG12", &tHlts.L1_MuOpen_EG12, &tHlts.b_L1_MuOpen_EG12);
t->SetBranchAddress("L1_MuOpen_EG12_Prescl", &tHlts.L1_MuOpen_EG12_Prescl, &tHlts.b_L1_MuOpen_EG12_Prescl);
t->SetBranchAddress("L1_MuOpen_EG5", &tHlts.L1_MuOpen_EG5, &tHlts.b_L1_MuOpen_EG5);
t->SetBranchAddress("L1_MuOpen_EG5_Prescl", &tHlts.L1_MuOpen_EG5_Prescl, &tHlts.b_L1_MuOpen_EG5_Prescl);
t->SetBranchAddress("L1_QuadJetC32", &tHlts.L1_QuadJetC32, &tHlts.b_L1_QuadJetC32);
t->SetBranchAddress("L1_QuadJetC32_Prescl", &tHlts.L1_QuadJetC32_Prescl, &tHlts.b_L1_QuadJetC32_Prescl);
t->SetBranchAddress("L1_QuadJetC36", &tHlts.L1_QuadJetC36, &tHlts.b_L1_QuadJetC36);
t->SetBranchAddress("L1_QuadJetC36_Prescl", &tHlts.L1_QuadJetC36_Prescl, &tHlts.b_L1_QuadJetC36_Prescl);
t->SetBranchAddress("L1_QuadJetC40", &tHlts.L1_QuadJetC40, &tHlts.b_L1_QuadJetC40);
t->SetBranchAddress("L1_QuadJetC40_Prescl", &tHlts.L1_QuadJetC40_Prescl, &tHlts.b_L1_QuadJetC40_Prescl);
t->SetBranchAddress("L1_SingleEG12", &tHlts.L1_SingleEG12, &tHlts.b_L1_SingleEG12);
t->SetBranchAddress("L1_SingleEG12_Prescl", &tHlts.L1_SingleEG12_Prescl, &tHlts.b_L1_SingleEG12_Prescl);
t->SetBranchAddress("L1_SingleEG18er", &tHlts.L1_SingleEG18er, &tHlts.b_L1_SingleEG18er);
t->SetBranchAddress("L1_SingleEG18er_Prescl", &tHlts.L1_SingleEG18er_Prescl, &tHlts.b_L1_SingleEG18er_Prescl);
t->SetBranchAddress("L1_SingleEG20", &tHlts.L1_SingleEG20, &tHlts.b_L1_SingleEG20);
t->SetBranchAddress("L1_SingleEG20_Prescl", &tHlts.L1_SingleEG20_Prescl, &tHlts.b_L1_SingleEG20_Prescl);
t->SetBranchAddress("L1_SingleEG20_TotemDiffractive", &tHlts.L1_SingleEG20_TotemDiffractive, &tHlts.b_L1_SingleEG20_TotemDiffractive);
t->SetBranchAddress("L1_SingleEG20_TotemDiffractive_Prescl", &tHlts.L1_SingleEG20_TotemDiffractive_Prescl, &tHlts.b_L1_SingleEG20_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_SingleEG22", &tHlts.L1_SingleEG22, &tHlts.b_L1_SingleEG22);
t->SetBranchAddress("L1_SingleEG22_Prescl", &tHlts.L1_SingleEG22_Prescl, &tHlts.b_L1_SingleEG22_Prescl);
t->SetBranchAddress("L1_SingleEG24", &tHlts.L1_SingleEG24, &tHlts.b_L1_SingleEG24);
t->SetBranchAddress("L1_SingleEG24_Prescl", &tHlts.L1_SingleEG24_Prescl, &tHlts.b_L1_SingleEG24_Prescl);
t->SetBranchAddress("L1_SingleEG30", &tHlts.L1_SingleEG30, &tHlts.b_L1_SingleEG30);
t->SetBranchAddress("L1_SingleEG30_Prescl", &tHlts.L1_SingleEG30_Prescl, &tHlts.b_L1_SingleEG30_Prescl);
t->SetBranchAddress("L1_SingleEG5_BptxAND", &tHlts.L1_SingleEG5_BptxAND, &tHlts.b_L1_SingleEG5_BptxAND);
t->SetBranchAddress("L1_SingleEG5_BptxAND_Prescl", &tHlts.L1_SingleEG5_BptxAND_Prescl, &tHlts.b_L1_SingleEG5_BptxAND_Prescl);
t->SetBranchAddress("L1_SingleEG7", &tHlts.L1_SingleEG7, &tHlts.b_L1_SingleEG7);
t->SetBranchAddress("L1_SingleEG7_Prescl", &tHlts.L1_SingleEG7_Prescl, &tHlts.b_L1_SingleEG7_Prescl);
t->SetBranchAddress("L1_SingleForJet16", &tHlts.L1_SingleForJet16, &tHlts.b_L1_SingleForJet16);
t->SetBranchAddress("L1_SingleForJet16_Prescl", &tHlts.L1_SingleForJet16_Prescl, &tHlts.b_L1_SingleForJet16_Prescl);
t->SetBranchAddress("L1_SingleIsoEG18er", &tHlts.L1_SingleIsoEG18er, &tHlts.b_L1_SingleIsoEG18er);
t->SetBranchAddress("L1_SingleIsoEG18er_Prescl", &tHlts.L1_SingleIsoEG18er_Prescl, &tHlts.b_L1_SingleIsoEG18er_Prescl);
t->SetBranchAddress("L1_SingleIsoEG20er", &tHlts.L1_SingleIsoEG20er, &tHlts.b_L1_SingleIsoEG20er);
t->SetBranchAddress("L1_SingleIsoEG20er_Prescl", &tHlts.L1_SingleIsoEG20er_Prescl, &tHlts.b_L1_SingleIsoEG20er_Prescl);
t->SetBranchAddress("L1_SingleJet128", &tHlts.L1_SingleJet128, &tHlts.b_L1_SingleJet128);
t->SetBranchAddress("L1_SingleJet128_Prescl", &tHlts.L1_SingleJet128_Prescl, &tHlts.b_L1_SingleJet128_Prescl);
t->SetBranchAddress("L1_SingleJet12_BptxAND", &tHlts.L1_SingleJet12_BptxAND, &tHlts.b_L1_SingleJet12_BptxAND);
t->SetBranchAddress("L1_SingleJet12_BptxAND_Prescl", &tHlts.L1_SingleJet12_BptxAND_Prescl, &tHlts.b_L1_SingleJet12_BptxAND_Prescl);
t->SetBranchAddress("L1_SingleJet16_BptxAND", &tHlts.L1_SingleJet16_BptxAND, &tHlts.b_L1_SingleJet16_BptxAND);
t->SetBranchAddress("L1_SingleJet16_BptxAND_Prescl", &tHlts.L1_SingleJet16_BptxAND_Prescl, &tHlts.b_L1_SingleJet16_BptxAND_Prescl);
t->SetBranchAddress("L1_SingleJet16_FwdVeto5", &tHlts.L1_SingleJet16_FwdVeto5, &tHlts.b_L1_SingleJet16_FwdVeto5);
t->SetBranchAddress("L1_SingleJet16_FwdVeto5_Prescl", &tHlts.L1_SingleJet16_FwdVeto5_Prescl, &tHlts.b_L1_SingleJet16_FwdVeto5_Prescl);
t->SetBranchAddress("L1_SingleJet20_Central_NotBptxOR", &tHlts.L1_SingleJet20_Central_NotBptxOR, &tHlts.b_L1_SingleJet20_Central_NotBptxOR);
t->SetBranchAddress("L1_SingleJet20_Central_NotBptxOR_Prescl", &tHlts.L1_SingleJet20_Central_NotBptxOR_Prescl, &tHlts.b_L1_SingleJet20_Central_NotBptxOR_Prescl);
t->SetBranchAddress("L1_SingleJet36", &tHlts.L1_SingleJet36, &tHlts.b_L1_SingleJet36);
t->SetBranchAddress("L1_SingleJet36_Prescl", &tHlts.L1_SingleJet36_Prescl, &tHlts.b_L1_SingleJet36_Prescl);
t->SetBranchAddress("L1_SingleJet36_FwdVeto5", &tHlts.L1_SingleJet36_FwdVeto5, &tHlts.b_L1_SingleJet36_FwdVeto5);
t->SetBranchAddress("L1_SingleJet36_FwdVeto5_Prescl", &tHlts.L1_SingleJet36_FwdVeto5_Prescl, &tHlts.b_L1_SingleJet36_FwdVeto5_Prescl);
t->SetBranchAddress("L1_SingleJet52", &tHlts.L1_SingleJet52, &tHlts.b_L1_SingleJet52);
t->SetBranchAddress("L1_SingleJet52_Prescl", &tHlts.L1_SingleJet52_Prescl, &tHlts.b_L1_SingleJet52_Prescl);
t->SetBranchAddress("L1_SingleJet52_TotemDiffractive", &tHlts.L1_SingleJet52_TotemDiffractive, &tHlts.b_L1_SingleJet52_TotemDiffractive);
t->SetBranchAddress("L1_SingleJet52_TotemDiffractive_Prescl", &tHlts.L1_SingleJet52_TotemDiffractive_Prescl, &tHlts.b_L1_SingleJet52_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_SingleJet68", &tHlts.L1_SingleJet68, &tHlts.b_L1_SingleJet68);
t->SetBranchAddress("L1_SingleJet68_Prescl", &tHlts.L1_SingleJet68_Prescl, &tHlts.b_L1_SingleJet68_Prescl);
t->SetBranchAddress("L1_SingleJet92", &tHlts.L1_SingleJet92, &tHlts.b_L1_SingleJet92);
t->SetBranchAddress("L1_SingleJet92_Prescl", &tHlts.L1_SingleJet92_Prescl, &tHlts.b_L1_SingleJet92_Prescl);
t->SetBranchAddress("L1_SingleJetC32_NotBptxOR", &tHlts.L1_SingleJetC32_NotBptxOR, &tHlts.b_L1_SingleJetC32_NotBptxOR);
t->SetBranchAddress("L1_SingleJetC32_NotBptxOR_Prescl", &tHlts.L1_SingleJetC32_NotBptxOR_Prescl, &tHlts.b_L1_SingleJetC32_NotBptxOR_Prescl);
t->SetBranchAddress("L1_SingleMu12", &tHlts.L1_SingleMu12, &tHlts.b_L1_SingleMu12);
t->SetBranchAddress("L1_SingleMu12_Prescl", &tHlts.L1_SingleMu12_Prescl, &tHlts.b_L1_SingleMu12_Prescl);
t->SetBranchAddress("L1_SingleMu12er", &tHlts.L1_SingleMu12er, &tHlts.b_L1_SingleMu12er);
t->SetBranchAddress("L1_SingleMu12er_Prescl", &tHlts.L1_SingleMu12er_Prescl, &tHlts.b_L1_SingleMu12er_Prescl);
t->SetBranchAddress("L1_SingleMu14_Eta2p1", &tHlts.L1_SingleMu14_Eta2p1, &tHlts.b_L1_SingleMu14_Eta2p1);
t->SetBranchAddress("L1_SingleMu14_Eta2p1_Prescl", &tHlts.L1_SingleMu14_Eta2p1_Prescl, &tHlts.b_L1_SingleMu14_Eta2p1_Prescl);
t->SetBranchAddress("L1_SingleMu16", &tHlts.L1_SingleMu16, &tHlts.b_L1_SingleMu16);
t->SetBranchAddress("L1_SingleMu16_Prescl", &tHlts.L1_SingleMu16_Prescl, &tHlts.b_L1_SingleMu16_Prescl);
t->SetBranchAddress("L1_SingleMu16_Eta2p1", &tHlts.L1_SingleMu16_Eta2p1, &tHlts.b_L1_SingleMu16_Eta2p1);
t->SetBranchAddress("L1_SingleMu16_Eta2p1_Prescl", &tHlts.L1_SingleMu16_Eta2p1_Prescl, &tHlts.b_L1_SingleMu16_Eta2p1_Prescl);
t->SetBranchAddress("L1_SingleMu18er", &tHlts.L1_SingleMu18er, &tHlts.b_L1_SingleMu18er);
t->SetBranchAddress("L1_SingleMu18er_Prescl", &tHlts.L1_SingleMu18er_Prescl, &tHlts.b_L1_SingleMu18er_Prescl);
t->SetBranchAddress("L1_SingleMu20", &tHlts.L1_SingleMu20, &tHlts.b_L1_SingleMu20);
t->SetBranchAddress("L1_SingleMu20_Prescl", &tHlts.L1_SingleMu20_Prescl, &tHlts.b_L1_SingleMu20_Prescl);
t->SetBranchAddress("L1_SingleMu20_TotemDiffractive", &tHlts.L1_SingleMu20_TotemDiffractive, &tHlts.b_L1_SingleMu20_TotemDiffractive);
t->SetBranchAddress("L1_SingleMu20_TotemDiffractive_Prescl", &tHlts.L1_SingleMu20_TotemDiffractive_Prescl, &tHlts.b_L1_SingleMu20_TotemDiffractive_Prescl);
t->SetBranchAddress("L1_SingleMu20er", &tHlts.L1_SingleMu20er, &tHlts.b_L1_SingleMu20er);
t->SetBranchAddress("L1_SingleMu20er_Prescl", &tHlts.L1_SingleMu20er_Prescl, &tHlts.b_L1_SingleMu20er_Prescl);
t->SetBranchAddress("L1_SingleMu25er", &tHlts.L1_SingleMu25er, &tHlts.b_L1_SingleMu25er);
t->SetBranchAddress("L1_SingleMu25er_Prescl", &tHlts.L1_SingleMu25er_Prescl, &tHlts.b_L1_SingleMu25er_Prescl);
t->SetBranchAddress("L1_SingleMu3", &tHlts.L1_SingleMu3, &tHlts.b_L1_SingleMu3);
t->SetBranchAddress("L1_SingleMu3_Prescl", &tHlts.L1_SingleMu3_Prescl, &tHlts.b_L1_SingleMu3_Prescl);
t->SetBranchAddress("L1_SingleMu6_NotBptxOR", &tHlts.L1_SingleMu6_NotBptxOR, &tHlts.b_L1_SingleMu6_NotBptxOR);
t->SetBranchAddress("L1_SingleMu6_NotBptxOR_Prescl", &tHlts.L1_SingleMu6_NotBptxOR_Prescl, &tHlts.b_L1_SingleMu6_NotBptxOR_Prescl);
t->SetBranchAddress("L1_SingleMu7", &tHlts.L1_SingleMu7, &tHlts.b_L1_SingleMu7);
t->SetBranchAddress("L1_SingleMu7_Prescl", &tHlts.L1_SingleMu7_Prescl, &tHlts.b_L1_SingleMu7_Prescl);
t->SetBranchAddress("L1_SingleMuBeamHalo", &tHlts.L1_SingleMuBeamHalo, &tHlts.b_L1_SingleMuBeamHalo);
t->SetBranchAddress("L1_SingleMuBeamHalo_Prescl", &tHlts.L1_SingleMuBeamHalo_Prescl, &tHlts.b_L1_SingleMuBeamHalo_Prescl);
t->SetBranchAddress("L1_SingleMuOpen", &tHlts.L1_SingleMuOpen, &tHlts.b_L1_SingleMuOpen);
t->SetBranchAddress("L1_SingleMuOpen_Prescl", &tHlts.L1_SingleMuOpen_Prescl, &tHlts.b_L1_SingleMuOpen_Prescl);
t->SetBranchAddress("L1_TripleEG7", &tHlts.L1_TripleEG7, &tHlts.b_L1_TripleEG7);
t->SetBranchAddress("L1_TripleEG7_Prescl", &tHlts.L1_TripleEG7_Prescl, &tHlts.b_L1_TripleEG7_Prescl);
t->SetBranchAddress("L1_TripleEG_12_7_5", &tHlts.L1_TripleEG_12_7_5, &tHlts.b_L1_TripleEG_12_7_5);
t->SetBranchAddress("L1_TripleEG_12_7_5_Prescl", &tHlts.L1_TripleEG_12_7_5_Prescl, &tHlts.b_L1_TripleEG_12_7_5_Prescl);
t->SetBranchAddress("L1_TripleJetC_52_28_28", &tHlts.L1_TripleJetC_52_28_28, &tHlts.b_L1_TripleJetC_52_28_28);
t->SetBranchAddress("L1_TripleJetC_52_28_28_Prescl", &tHlts.L1_TripleJetC_52_28_28_Prescl, &tHlts.b_L1_TripleJetC_52_28_28_Prescl);
t->SetBranchAddress("L1_TripleJet_64_44_24_VBF", &tHlts.L1_TripleJet_64_44_24_VBF, &tHlts.b_L1_TripleJet_64_44_24_VBF);
t->SetBranchAddress("L1_TripleJet_64_44_24_VBF_Prescl", &tHlts.L1_TripleJet_64_44_24_VBF_Prescl, &tHlts.b_L1_TripleJet_64_44_24_VBF_Prescl);
t->SetBranchAddress("L1_TripleJet_64_48_28_VBF", &tHlts.L1_TripleJet_64_48_28_VBF, &tHlts.b_L1_TripleJet_64_48_28_VBF);
t->SetBranchAddress("L1_TripleJet_64_48_28_VBF_Prescl", &tHlts.L1_TripleJet_64_48_28_VBF_Prescl, &tHlts.b_L1_TripleJet_64_48_28_VBF_Prescl);
t->SetBranchAddress("L1_ZdcCaloPlus_TotemDiffractive_QElastic", &tHlts.L1_ZdcCaloPlus_TotemDiffractive_QElastic, &tHlts.b_L1_ZdcCaloPlus_TotemDiffractive_QElastic);
t->SetBranchAddress("L1_ZdcCaloPlus_TotemDiffractive_QElastic_Prescl", &tHlts.L1_ZdcCaloPlus_TotemDiffractive_QElastic_Prescl, &tHlts.b_L1_ZdcCaloPlus_TotemDiffractive_QElastic_Prescl);
t->SetBranchAddress("L1_ZeroBias", &tHlts.L1_ZeroBias, &tHlts.b_L1_ZeroBias);
t->SetBranchAddress("L1_ZeroBias_Prescl", &tHlts.L1_ZeroBias_Prescl, &tHlts.b_L1_ZeroBias_Prescl);
t->SetBranchAddress("L1Tech_BPTX_PreBPTX.v0", &tHlts.L1Tech_BPTX_PreBPTX_v0, &tHlts.b_L1Tech_BPTX_PreBPTX_v0);
t->SetBranchAddress("L1Tech_BPTX_PreBPTX.v0_Prescl", &tHlts.L1Tech_BPTX_PreBPTX_v0_Prescl, &tHlts.b_L1Tech_BPTX_PreBPTX_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_minus.v0", &tHlts.L1Tech_BPTX_minus_v0, &tHlts.b_L1Tech_BPTX_minus_v0);
t->SetBranchAddress("L1Tech_BPTX_minus.v0_Prescl", &tHlts.L1Tech_BPTX_minus_v0_Prescl, &tHlts.b_L1Tech_BPTX_minus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_minus_AND_not_plus.v0", &tHlts.L1Tech_BPTX_minus_AND_not_plus_v0, &tHlts.b_L1Tech_BPTX_minus_AND_not_plus_v0);
t->SetBranchAddress("L1Tech_BPTX_minus_AND_not_plus.v0_Prescl", &tHlts.L1Tech_BPTX_minus_AND_not_plus_v0_Prescl, &tHlts.b_L1Tech_BPTX_minus_AND_not_plus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_plus.v0", &tHlts.L1Tech_BPTX_plus_v0, &tHlts.b_L1Tech_BPTX_plus_v0);
t->SetBranchAddress("L1Tech_BPTX_plus.v0_Prescl", &tHlts.L1Tech_BPTX_plus_v0_Prescl, &tHlts.b_L1Tech_BPTX_plus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_NOT_minus.v0", &tHlts.L1Tech_BPTX_plus_AND_NOT_minus_v0, &tHlts.b_L1Tech_BPTX_plus_AND_NOT_minus_v0);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_NOT_minus.v0_Prescl", &tHlts.L1Tech_BPTX_plus_AND_NOT_minus_v0_Prescl, &tHlts.b_L1Tech_BPTX_plus_AND_NOT_minus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_minus.v0", &tHlts.L1Tech_BPTX_plus_AND_minus_v0, &tHlts.b_L1Tech_BPTX_plus_AND_minus_v0);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_minus.v0_Prescl", &tHlts.L1Tech_BPTX_plus_AND_minus_v0_Prescl, &tHlts.b_L1Tech_BPTX_plus_AND_minus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_minus_instance1.v0", &tHlts.L1Tech_BPTX_plus_AND_minus_instance1_v0, &tHlts.b_L1Tech_BPTX_plus_AND_minus_instance1_v0);
t->SetBranchAddress("L1Tech_BPTX_plus_AND_minus_instance1.v0_Prescl", &tHlts.L1Tech_BPTX_plus_AND_minus_instance1_v0_Prescl, &tHlts.b_L1Tech_BPTX_plus_AND_minus_instance1_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_plus_OR_minus.v0", &tHlts.L1Tech_BPTX_plus_OR_minus_v0, &tHlts.b_L1Tech_BPTX_plus_OR_minus_v0);
t->SetBranchAddress("L1Tech_BPTX_plus_OR_minus.v0_Prescl", &tHlts.L1Tech_BPTX_plus_OR_minus_v0_Prescl, &tHlts.b_L1Tech_BPTX_plus_OR_minus_v0_Prescl);
t->SetBranchAddress("L1Tech_BPTX_quiet.v0", &tHlts.L1Tech_BPTX_quiet_v0, &tHlts.b_L1Tech_BPTX_quiet_v0);
t->SetBranchAddress("L1Tech_BPTX_quiet.v0_Prescl", &tHlts.L1Tech_BPTX_quiet_v0_Prescl, &tHlts.b_L1Tech_BPTX_quiet_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_HighMultiplicity.v0", &tHlts.L1Tech_BSC_HighMultiplicity_v0, &tHlts.b_L1Tech_BSC_HighMultiplicity_v0);
t->SetBranchAddress("L1Tech_BSC_HighMultiplicity.v0_Prescl", &tHlts.L1Tech_BSC_HighMultiplicity_v0_Prescl, &tHlts.b_L1Tech_BSC_HighMultiplicity_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_halo_beam1_inner.v0", &tHlts.L1Tech_BSC_halo_beam1_inner_v0, &tHlts.b_L1Tech_BSC_halo_beam1_inner_v0);
t->SetBranchAddress("L1Tech_BSC_halo_beam1_inner.v0_Prescl", &tHlts.L1Tech_BSC_halo_beam1_inner_v0_Prescl, &tHlts.b_L1Tech_BSC_halo_beam1_inner_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_halo_beam1_outer.v0", &tHlts.L1Tech_BSC_halo_beam1_outer_v0, &tHlts.b_L1Tech_BSC_halo_beam1_outer_v0);
t->SetBranchAddress("L1Tech_BSC_halo_beam1_outer.v0_Prescl", &tHlts.L1Tech_BSC_halo_beam1_outer_v0_Prescl, &tHlts.b_L1Tech_BSC_halo_beam1_outer_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_halo_beam2_inner.v0", &tHlts.L1Tech_BSC_halo_beam2_inner_v0, &tHlts.b_L1Tech_BSC_halo_beam2_inner_v0);
t->SetBranchAddress("L1Tech_BSC_halo_beam2_inner.v0_Prescl", &tHlts.L1Tech_BSC_halo_beam2_inner_v0_Prescl, &tHlts.b_L1Tech_BSC_halo_beam2_inner_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_halo_beam2_outer.v0", &tHlts.L1Tech_BSC_halo_beam2_outer_v0, &tHlts.b_L1Tech_BSC_halo_beam2_outer_v0);
t->SetBranchAddress("L1Tech_BSC_halo_beam2_outer.v0_Prescl", &tHlts.L1Tech_BSC_halo_beam2_outer_v0_Prescl, &tHlts.b_L1Tech_BSC_halo_beam2_outer_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_minBias_OR.v0", &tHlts.L1Tech_BSC_minBias_OR_v0, &tHlts.b_L1Tech_BSC_minBias_OR_v0);
t->SetBranchAddress("L1Tech_BSC_minBias_OR.v0_Prescl", &tHlts.L1Tech_BSC_minBias_OR_v0_Prescl, &tHlts.b_L1Tech_BSC_minBias_OR_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_minBias_inner_threshold1.v0", &tHlts.L1Tech_BSC_minBias_inner_threshold1_v0, &tHlts.b_L1Tech_BSC_minBias_inner_threshold1_v0);
t->SetBranchAddress("L1Tech_BSC_minBias_inner_threshold1.v0_Prescl", &tHlts.L1Tech_BSC_minBias_inner_threshold1_v0_Prescl, &tHlts.b_L1Tech_BSC_minBias_inner_threshold1_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_minBias_inner_threshold2.v0", &tHlts.L1Tech_BSC_minBias_inner_threshold2_v0, &tHlts.b_L1Tech_BSC_minBias_inner_threshold2_v0);
t->SetBranchAddress("L1Tech_BSC_minBias_inner_threshold2.v0_Prescl", &tHlts.L1Tech_BSC_minBias_inner_threshold2_v0_Prescl, &tHlts.b_L1Tech_BSC_minBias_inner_threshold2_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_minBias_threshold1.v0", &tHlts.L1Tech_BSC_minBias_threshold1_v0, &tHlts.b_L1Tech_BSC_minBias_threshold1_v0);
t->SetBranchAddress("L1Tech_BSC_minBias_threshold1.v0_Prescl", &tHlts.L1Tech_BSC_minBias_threshold1_v0_Prescl, &tHlts.b_L1Tech_BSC_minBias_threshold1_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_minBias_threshold2.v0", &tHlts.L1Tech_BSC_minBias_threshold2_v0, &tHlts.b_L1Tech_BSC_minBias_threshold2_v0);
t->SetBranchAddress("L1Tech_BSC_minBias_threshold2.v0_Prescl", &tHlts.L1Tech_BSC_minBias_threshold2_v0_Prescl, &tHlts.b_L1Tech_BSC_minBias_threshold2_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_splash_beam1.v0", &tHlts.L1Tech_BSC_splash_beam1_v0, &tHlts.b_L1Tech_BSC_splash_beam1_v0);
t->SetBranchAddress("L1Tech_BSC_splash_beam1.v0_Prescl", &tHlts.L1Tech_BSC_splash_beam1_v0_Prescl, &tHlts.b_L1Tech_BSC_splash_beam1_v0_Prescl);
t->SetBranchAddress("L1Tech_BSC_splash_beam2.v0", &tHlts.L1Tech_BSC_splash_beam2_v0, &tHlts.b_L1Tech_BSC_splash_beam2_v0);
t->SetBranchAddress("L1Tech_BSC_splash_beam2.v0_Prescl", &tHlts.L1Tech_BSC_splash_beam2_v0_Prescl, &tHlts.b_L1Tech_BSC_splash_beam2_v0_Prescl);
t->SetBranchAddress("L1Tech_CASTOR_0.v0", &tHlts.L1Tech_CASTOR_0_v0, &tHlts.b_L1Tech_CASTOR_0_v0);
t->SetBranchAddress("L1Tech_CASTOR_0.v0_Prescl", &tHlts.L1Tech_CASTOR_0_v0_Prescl, &tHlts.b_L1Tech_CASTOR_0_v0_Prescl);
t->SetBranchAddress("L1Tech_CASTOR_EM.v0", &tHlts.L1Tech_CASTOR_EM_v0, &tHlts.b_L1Tech_CASTOR_EM_v0);
t->SetBranchAddress("L1Tech_CASTOR_EM.v0_Prescl", &tHlts.L1Tech_CASTOR_EM_v0_Prescl, &tHlts.b_L1Tech_CASTOR_EM_v0_Prescl);
t->SetBranchAddress("L1Tech_CASTOR_HaloMuon.v0", &tHlts.L1Tech_CASTOR_HaloMuon_v0, &tHlts.b_L1Tech_CASTOR_HaloMuon_v0);
t->SetBranchAddress("L1Tech_CASTOR_HaloMuon.v0_Prescl", &tHlts.L1Tech_CASTOR_HaloMuon_v0_Prescl, &tHlts.b_L1Tech_CASTOR_HaloMuon_v0_Prescl);
t->SetBranchAddress("L1Tech_CASTOR_TotalEnergy.v0", &tHlts.L1Tech_CASTOR_TotalEnergy_v0, &tHlts.b_L1Tech_CASTOR_TotalEnergy_v0);
t->SetBranchAddress("L1Tech_CASTOR_TotalEnergy.v0_Prescl", &tHlts.L1Tech_CASTOR_TotalEnergy_v0_Prescl, &tHlts.b_L1Tech_CASTOR_TotalEnergy_v0_Prescl);
t->SetBranchAddress("L1Tech_DT_GlobalOR.v0", &tHlts.L1Tech_DT_GlobalOR_v0, &tHlts.b_L1Tech_DT_GlobalOR_v0);
t->SetBranchAddress("L1Tech_DT_GlobalOR.v0_Prescl", &tHlts.L1Tech_DT_GlobalOR_v0_Prescl, &tHlts.b_L1Tech_DT_GlobalOR_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_downLeft.v0", &tHlts.L1Tech_FSC_St3Sect45_downLeft_v0, &tHlts.b_L1Tech_FSC_St3Sect45_downLeft_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_downLeft.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect45_downLeft_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect45_downLeft_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_downRight.v0", &tHlts.L1Tech_FSC_St3Sect45_downRight_v0, &tHlts.b_L1Tech_FSC_St3Sect45_downRight_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_downRight.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect45_downRight_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect45_downRight_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_uppLeft.v0", &tHlts.L1Tech_FSC_St3Sect45_uppLeft_v0, &tHlts.b_L1Tech_FSC_St3Sect45_uppLeft_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_uppLeft.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect45_uppLeft_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect45_uppLeft_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_uppRight.v0", &tHlts.L1Tech_FSC_St3Sect45_uppRight_v0, &tHlts.b_L1Tech_FSC_St3Sect45_uppRight_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect45_uppRight.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect45_uppRight_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect45_uppRight_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_downLeft.v0", &tHlts.L1Tech_FSC_St3Sect56_downLeft_v0, &tHlts.b_L1Tech_FSC_St3Sect56_downLeft_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_downLeft.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect56_downLeft_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect56_downLeft_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_downRight.v0", &tHlts.L1Tech_FSC_St3Sect56_downRight_v0, &tHlts.b_L1Tech_FSC_St3Sect56_downRight_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_downRight.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect56_downRight_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect56_downRight_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_uppLeft.v0", &tHlts.L1Tech_FSC_St3Sect56_uppLeft_v0, &tHlts.b_L1Tech_FSC_St3Sect56_uppLeft_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_uppLeft.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect56_uppLeft_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect56_uppLeft_v0_Prescl);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_uppRight.v0", &tHlts.L1Tech_FSC_St3Sect56_uppRight_v0, &tHlts.b_L1Tech_FSC_St3Sect56_uppRight_v0);
t->SetBranchAddress("L1Tech_FSC_St3Sect56_uppRight.v0_Prescl", &tHlts.L1Tech_FSC_St3Sect56_uppRight_v0_Prescl, &tHlts.b_L1Tech_FSC_St3Sect56_uppRight_v0_Prescl);
t->SetBranchAddress("L1Tech_HCAL_HBHE_totalOR.v0", &tHlts.L1Tech_HCAL_HBHE_totalOR_v0, &tHlts.b_L1Tech_HCAL_HBHE_totalOR_v0);
t->SetBranchAddress("L1Tech_HCAL_HBHE_totalOR.v0_Prescl", &tHlts.L1Tech_HCAL_HBHE_totalOR_v0_Prescl, &tHlts.b_L1Tech_HCAL_HBHE_totalOR_v0_Prescl);
t->SetBranchAddress("L1Tech_HCAL_HF_MMP_or_MPP.v1", &tHlts.L1Tech_HCAL_HF_MMP_or_MPP_v1, &tHlts.b_L1Tech_HCAL_HF_MMP_or_MPP_v1);
t->SetBranchAddress("L1Tech_HCAL_HF_MMP_or_MPP.v1_Prescl", &tHlts.L1Tech_HCAL_HF_MMP_or_MPP_v1_Prescl, &tHlts.b_L1Tech_HCAL_HF_MMP_or_MPP_v1_Prescl);
t->SetBranchAddress("L1Tech_HCAL_HF_coincidence_PM.v2", &tHlts.L1Tech_HCAL_HF_coincidence_PM_v2, &tHlts.b_L1Tech_HCAL_HF_coincidence_PM_v2);
t->SetBranchAddress("L1Tech_HCAL_HF_coincidence_PM.v2_Prescl", &tHlts.L1Tech_HCAL_HF_coincidence_PM_v2_Prescl, &tHlts.b_L1Tech_HCAL_HF_coincidence_PM_v2_Prescl);
t->SetBranchAddress("L1Tech_HCAL_HF_single_channel.v0", &tHlts.L1Tech_HCAL_HF_single_channel_v0, &tHlts.b_L1Tech_HCAL_HF_single_channel_v0);
t->SetBranchAddress("L1Tech_HCAL_HF_single_channel.v0_Prescl", &tHlts.L1Tech_HCAL_HF_single_channel_v0_Prescl, &tHlts.b_L1Tech_HCAL_HF_single_channel_v0_Prescl);
t->SetBranchAddress("L1Tech_HCAL_HO_totalOR.v0", &tHlts.L1Tech_HCAL_HO_totalOR_v0, &tHlts.b_L1Tech_HCAL_HO_totalOR_v0);
t->SetBranchAddress("L1Tech_HCAL_HO_totalOR.v0_Prescl", &tHlts.L1Tech_HCAL_HO_totalOR_v0_Prescl, &tHlts.b_L1Tech_HCAL_HO_totalOR_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RB0_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_RB0_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_RB0_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RB0_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RB0_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RB0_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RBminus1_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_RBminus1_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_RBminus1_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RBminus1_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RBminus1_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RBminus1_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RBminus2_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_RBminus2_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_RBminus2_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RBminus2_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RBminus2_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RBminus2_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RBplus1_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_RBplus1_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_RBplus1_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RBplus1_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RBplus1_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RBplus1_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RBplus2_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_RBplus2_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_RBplus2_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RBplus2_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RBplus2_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RBplus2_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_RBst1_collisions.v0", &tHlts.L1Tech_RPC_TTU_RBst1_collisions_v0, &tHlts.b_L1Tech_RPC_TTU_RBst1_collisions_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_RBst1_collisions.v0_Prescl", &tHlts.L1Tech_RPC_TTU_RBst1_collisions_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_RBst1_collisions_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_barrel_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_barrel_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_barrel_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_barrel_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_barrel_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_barrel_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_RPC_TTU_pointing_Cosmics.v0", &tHlts.L1Tech_RPC_TTU_pointing_Cosmics_v0, &tHlts.b_L1Tech_RPC_TTU_pointing_Cosmics_v0);
t->SetBranchAddress("L1Tech_RPC_TTU_pointing_Cosmics.v0_Prescl", &tHlts.L1Tech_RPC_TTU_pointing_Cosmics_v0_Prescl, &tHlts.b_L1Tech_RPC_TTU_pointing_Cosmics_v0_Prescl);
t->SetBranchAddress("L1Tech_TOTEM_Diffractive.v0", &tHlts.L1Tech_TOTEM_Diffractive_v0, &tHlts.b_L1Tech_TOTEM_Diffractive_v0);
t->SetBranchAddress("L1Tech_TOTEM_Diffractive.v0_Prescl", &tHlts.L1Tech_TOTEM_Diffractive_v0_Prescl, &tHlts.b_L1Tech_TOTEM_Diffractive_v0_Prescl);
t->SetBranchAddress("L1Tech_TOTEM_LowMultiplicity.v0", &tHlts.L1Tech_TOTEM_LowMultiplicity_v0, &tHlts.b_L1Tech_TOTEM_LowMultiplicity_v0);
t->SetBranchAddress("L1Tech_TOTEM_LowMultiplicity.v0_Prescl", &tHlts.L1Tech_TOTEM_LowMultiplicity_v0_Prescl, &tHlts.b_L1Tech_TOTEM_LowMultiplicity_v0_Prescl);
t->SetBranchAddress("L1Tech_TOTEM_MinBias.v0", &tHlts.L1Tech_TOTEM_MinBias_v0, &tHlts.b_L1Tech_TOTEM_MinBias_v0);
t->SetBranchAddress("L1Tech_TOTEM_MinBias.v0_Prescl", &tHlts.L1Tech_TOTEM_MinBias_v0_Prescl, &tHlts.b_L1Tech_TOTEM_MinBias_v0_Prescl);
t->SetBranchAddress("L1Tech_TOTEM_ZeroBias.v0", &tHlts.L1Tech_TOTEM_ZeroBias_v0, &tHlts.b_L1Tech_TOTEM_ZeroBias_v0);
t->SetBranchAddress("L1Tech_TOTEM_ZeroBias.v0_Prescl", &tHlts.L1Tech_TOTEM_ZeroBias_v0_Prescl, &tHlts.b_L1Tech_TOTEM_ZeroBias_v0_Prescl);
t->SetBranchAddress("L1Tech_ZDC_Scint_loose_vertex.v0", &tHlts.L1Tech_ZDC_Scint_loose_vertex_v0, &tHlts.b_L1Tech_ZDC_Scint_loose_vertex_v0);
t->SetBranchAddress("L1Tech_ZDC_Scint_loose_vertex.v0_Prescl", &tHlts.L1Tech_ZDC_Scint_loose_vertex_v0_Prescl, &tHlts.b_L1Tech_ZDC_Scint_loose_vertex_v0_Prescl);
t->SetBranchAddress("L1Tech_ZDC_Scint_minus.v0", &tHlts.L1Tech_ZDC_Scint_minus_v0, &tHlts.b_L1Tech_ZDC_Scint_minus_v0);
t->SetBranchAddress("L1Tech_ZDC_Scint_minus.v0_Prescl", &tHlts.L1Tech_ZDC_Scint_minus_v0_Prescl, &tHlts.b_L1Tech_ZDC_Scint_minus_v0_Prescl);
t->SetBranchAddress("L1Tech_ZDC_Scint_plus.v0", &tHlts.L1Tech_ZDC_Scint_plus_v0, &tHlts.b_L1Tech_ZDC_Scint_plus_v0);
t->SetBranchAddress("L1Tech_ZDC_Scint_plus.v0_Prescl", &tHlts.L1Tech_ZDC_Scint_plus_v0_Prescl, &tHlts.b_L1Tech_ZDC_Scint_plus_v0_Prescl);
t->SetBranchAddress("L1Tech_ZDC_Scint_tight_vertex.v0", &tHlts.L1Tech_ZDC_Scint_tight_vertex_v0, &tHlts.b_L1Tech_ZDC_Scint_tight_vertex_v0);
t->SetBranchAddress("L1Tech_ZDC_Scint_tight_vertex.v0_Prescl", &tHlts.L1Tech_ZDC_Scint_tight_vertex_v0_Prescl, &tHlts.b_L1Tech_ZDC_Scint_tight_vertex_v0_Prescl);
if (doCheck) {
if (t->GetMaximum("NL1IsolEm")>8) cout <<"FATAL ERROR: Arrary size of NL1IsolEm too small!!! "<<t->GetMaximum("NL1IsolEm")<<endl;
if (t->GetMaximum("NL1NIsolEm")>8) cout <<"FATAL ERROR: Arrary size of NL1NIsolEm too small!!! "<<t->GetMaximum("NL1NIsolEm")<<endl;
if (t->GetMaximum("NL1Mu")>8) cout <<"FATAL ERROR: Arrary size of NL1Mu too small!!! "<<t->GetMaximum("NL1Mu")<<endl;
if (t->GetMaximum("NL1CenJet")>8) cout <<"FATAL ERROR: Arrary size of NL1CenJet too small!!! "<<t->GetMaximum("NL1CenJet")<<endl;
if (t->GetMaximum("NL1ForJet")>8) cout <<"FATAL ERROR: Arrary size of NL1ForJet too small!!! "<<t->GetMaximum("NL1ForJet")<<endl;
if (t->GetMaximum("NL1Tau")>8) cout <<"FATAL ERROR: Arrary size of NL1Tau too small!!! "<<t->GetMaximum("NL1Tau")<<endl;
}
}
| [
"luck@mit.edu"
] | luck@mit.edu |
b233ed85d6447238489139223dd767179e87322d | cc57145c6aaed587aae05fe5f7e586f1032409ba | /gui/gui/LarvicideForm.h | 3d8d488c3c9eb1096f28fa3c693cbe179b378bc7 | [] | no_license | andygarcia/denmod | f12fb8e0a2691228ce99f0c93c2f3cd318deac86 | 01f85e803ff8f90f121f1070f194d3f297d93842 | refs/heads/master | 2020-04-15T14:39:46.321111 | 2015-06-05T20:29:42 | 2015-06-05T20:29:42 | 9,421,998 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 17,219 | h | #pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace gui {
public ref class LarvicideForm : public System::Windows::Forms::Form
{
public:
LarvicideForm( Larvicide ^ li, BindingSource ^ locationBinding );
~LarvicideForm();
void SetSchedulePanel(void);
private: System::Windows::Forms::GroupBox^ gboxEffects;
private: System::Windows::Forms::Panel^ panel1;
public:
private:
Larvicide ^ Larvicide_;
private:
System::Void OnLoad( System::Object ^ sender, System::EventArgs ^ e );
System::Void OnAddContainer( System::Object ^ sender, System::EventArgs ^ e );
System::Void OnRemoveContainer( System::Object ^ sender, System::EventArgs ^ e );
System::Void OnOk( System::Object ^ sender, System::EventArgs ^ e );
System::Void OnCancel( System::Object ^ sender, System::EventArgs ^ e );
System::Void OnScheduleChange( System::Object ^ sender, System::EventArgs ^ e );
private:
BindingSource ^ LocationBinding;
gui::Location ^ ActiveLocation;
UserControl ^ CurrentSchedulePanel;
private: System::Windows::Forms::Label^ lblName;
private: System::Windows::Forms::TextBox^ tboxName;
private: System::Windows::Forms::Label^ lblTargets;
private: System::Windows::Forms::DataGridView^ dgvTargets;
private: System::Windows::Forms::Button^ btnAddContainer;
private: System::Windows::Forms::Label^ lblSchedule;
private: System::Windows::Forms::Button^ btnOK;
private: System::Windows::Forms::Button^ btnCancel;
private: System::Windows::Forms::Button^ btnRemoveContainer;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dgvcName;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ dgvcRateOfTreatment;
private: System::Windows::Forms::Label^ lblLagPeriod;
private: System::Windows::Forms::NumericUpDown^ numLagPeriod;
private: System::Windows::Forms::Label^ lblMaxEffectPeriod;
private: System::Windows::Forms::NumericUpDown^ numMaxEffectPeriod;
private: System::Windows::Forms::Label^ lblDeclineEffectPeriod;
private: System::Windows::Forms::NumericUpDown^ numDeclineEffectPeriod;
private: System::Windows::Forms::Label^ lblInitMortality;
private: System::Windows::Forms::NumericUpDown^ numInitMortality;
private: System::Windows::Forms::CheckBox^ chkEffectLost;
private: System::Windows::Forms::ComboBox^ cboxSchedule;
private: System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->lblName = (gcnew System::Windows::Forms::Label());
this->tboxName = (gcnew System::Windows::Forms::TextBox());
this->lblTargets = (gcnew System::Windows::Forms::Label());
this->dgvTargets = (gcnew System::Windows::Forms::DataGridView());
this->dgvcName = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->dgvcRateOfTreatment = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
this->btnCancel = (gcnew System::Windows::Forms::Button());
this->btnOK = (gcnew System::Windows::Forms::Button());
this->btnAddContainer = (gcnew System::Windows::Forms::Button());
this->lblSchedule = (gcnew System::Windows::Forms::Label());
this->btnRemoveContainer = (gcnew System::Windows::Forms::Button());
this->lblLagPeriod = (gcnew System::Windows::Forms::Label());
this->numLagPeriod = (gcnew System::Windows::Forms::NumericUpDown());
this->lblMaxEffectPeriod = (gcnew System::Windows::Forms::Label());
this->numMaxEffectPeriod = (gcnew System::Windows::Forms::NumericUpDown());
this->lblDeclineEffectPeriod = (gcnew System::Windows::Forms::Label());
this->numDeclineEffectPeriod = (gcnew System::Windows::Forms::NumericUpDown());
this->lblInitMortality = (gcnew System::Windows::Forms::Label());
this->numInitMortality = (gcnew System::Windows::Forms::NumericUpDown());
this->chkEffectLost = (gcnew System::Windows::Forms::CheckBox());
this->cboxSchedule = (gcnew System::Windows::Forms::ComboBox());
this->gboxEffects = (gcnew System::Windows::Forms::GroupBox());
this->panel1 = (gcnew System::Windows::Forms::Panel());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dgvTargets))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numLagPeriod))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numMaxEffectPeriod))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numDeclineEffectPeriod))->BeginInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numInitMortality))->BeginInit();
this->gboxEffects->SuspendLayout();
this->SuspendLayout();
//
// lblName
//
this->lblName->AutoSize = true;
this->lblName->Location = System::Drawing::Point(29, 15);
this->lblName->Name = L"lblName";
this->lblName->Size = System::Drawing::Size(38, 13);
this->lblName->TabIndex = 0;
this->lblName->Text = L"Name:";
//
// tboxName
//
this->tboxName->Location = System::Drawing::Point(73, 12);
this->tboxName->Name = L"tboxName";
this->tboxName->ReadOnly = true;
this->tboxName->Size = System::Drawing::Size(420, 20);
this->tboxName->TabIndex = 1;
//
// lblTargets
//
this->lblTargets->AutoSize = true;
this->lblTargets->Location = System::Drawing::Point(21, 39);
this->lblTargets->Name = L"lblTargets";
this->lblTargets->Size = System::Drawing::Size(46, 13);
this->lblTargets->TabIndex = 2;
this->lblTargets->Text = L"Targets:";
//
// dgvTargets
//
this->dgvTargets->AllowUserToAddRows = false;
this->dgvTargets->AllowUserToDeleteRows = false;
this->dgvTargets->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->dgvTargets->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(2) {this->dgvcName,
this->dgvcRateOfTreatment});
this->dgvTargets->Location = System::Drawing::Point(73, 39);
this->dgvTargets->Name = L"dgvTargets";
this->dgvTargets->RowHeadersVisible = false;
this->dgvTargets->Size = System::Drawing::Size(420, 194);
this->dgvTargets->TabIndex = 3;
//
// dgvcName
//
this->dgvcName->DataPropertyName = L"Name";
this->dgvcName->HeaderText = L"Name";
this->dgvcName->Name = L"dgvcName";
this->dgvcName->ReadOnly = true;
//
// dgvcRateOfTreatment
//
this->dgvcRateOfTreatment->DataPropertyName = L"RateOfTreatment";
this->dgvcRateOfTreatment->HeaderText = L"Rate of Treatment";
this->dgvcRateOfTreatment->Name = L"dgvcRateOfTreatment";
//
// btnCancel
//
this->btnCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
this->btnCancel->Location = System::Drawing::Point(418, 608);
this->btnCancel->Name = L"btnCancel";
this->btnCancel->Size = System::Drawing::Size(75, 23);
this->btnCancel->TabIndex = 17;
this->btnCancel->Text = L"Cancel";
this->btnCancel->UseVisualStyleBackColor = true;
this->btnCancel->Click += gcnew System::EventHandler(this, &LarvicideForm::OnCancel);
//
// btnOK
//
this->btnOK->DialogResult = System::Windows::Forms::DialogResult::OK;
this->btnOK->Location = System::Drawing::Point(337, 608);
this->btnOK->Name = L"btnOK";
this->btnOK->Size = System::Drawing::Size(75, 23);
this->btnOK->TabIndex = 16;
this->btnOK->Text = L"OK";
this->btnOK->UseVisualStyleBackColor = true;
this->btnOK->Click += gcnew System::EventHandler(this, &LarvicideForm::OnOk);
//
// btnAddContainer
//
this->btnAddContainer->Location = System::Drawing::Point(73, 239);
this->btnAddContainer->Name = L"btnAddContainer";
this->btnAddContainer->Size = System::Drawing::Size(104, 23);
this->btnAddContainer->TabIndex = 4;
this->btnAddContainer->Text = L"Add Container";
this->btnAddContainer->UseVisualStyleBackColor = true;
this->btnAddContainer->Click += gcnew System::EventHandler(this, &LarvicideForm::OnAddContainer);
//
// lblSchedule
//
this->lblSchedule->AutoSize = true;
this->lblSchedule->Location = System::Drawing::Point(12, 378);
this->lblSchedule->Name = L"lblSchedule";
this->lblSchedule->Size = System::Drawing::Size(55, 13);
this->lblSchedule->TabIndex = 15;
this->lblSchedule->Text = L"Schedule:";
//
// btnRemoveContainer
//
this->btnRemoveContainer->Location = System::Drawing::Point(183, 239);
this->btnRemoveContainer->Name = L"btnRemoveContainer";
this->btnRemoveContainer->Size = System::Drawing::Size(104, 23);
this->btnRemoveContainer->TabIndex = 5;
this->btnRemoveContainer->Text = L"Remove Container";
this->btnRemoveContainer->UseVisualStyleBackColor = true;
this->btnRemoveContainer->Click += gcnew System::EventHandler(this, &LarvicideForm::OnRemoveContainer);
//
// lblLagPeriod
//
this->lblLagPeriod->AutoSize = true;
this->lblLagPeriod->Location = System::Drawing::Point(6, 21);
this->lblLagPeriod->Name = L"lblLagPeriod";
this->lblLagPeriod->Size = System::Drawing::Size(92, 13);
this->lblLagPeriod->TabIndex = 6;
this->lblLagPeriod->Text = L"Lag Period (days):";
//
// numLagPeriod
//
this->numLagPeriod->Location = System::Drawing::Point(161, 19);
this->numLagPeriod->Name = L"numLagPeriod";
this->numLagPeriod->Size = System::Drawing::Size(60, 20);
this->numLagPeriod->TabIndex = 7;
//
// lblMaxEffectPeriod
//
this->lblMaxEffectPeriod->AutoSize = true;
this->lblMaxEffectPeriod->Location = System::Drawing::Point(6, 47);
this->lblMaxEffectPeriod->Name = L"lblMaxEffectPeriod";
this->lblMaxEffectPeriod->Size = System::Drawing::Size(149, 13);
this->lblMaxEffectPeriod->TabIndex = 8;
this->lblMaxEffectPeriod->Text = L"Maximum Effect Period (days):";
//
// numMaxEffectPeriod
//
this->numMaxEffectPeriod->Location = System::Drawing::Point(161, 45);
this->numMaxEffectPeriod->Name = L"numMaxEffectPeriod";
this->numMaxEffectPeriod->Size = System::Drawing::Size(60, 20);
this->numMaxEffectPeriod->TabIndex = 9;
//
// lblDeclineEffectPeriod
//
this->lblDeclineEffectPeriod->AutoSize = true;
this->lblDeclineEffectPeriod->Location = System::Drawing::Point(6, 73);
this->lblDeclineEffectPeriod->Name = L"lblDeclineEffectPeriod";
this->lblDeclineEffectPeriod->Size = System::Drawing::Size(149, 13);
this->lblDeclineEffectPeriod->TabIndex = 10;
this->lblDeclineEffectPeriod->Text = L"Declining Effect Period (days):";
//
// numDeclineEffectPeriod
//
this->numDeclineEffectPeriod->Location = System::Drawing::Point(161, 71);
this->numDeclineEffectPeriod->Name = L"numDeclineEffectPeriod";
this->numDeclineEffectPeriod->Size = System::Drawing::Size(60, 20);
this->numDeclineEffectPeriod->TabIndex = 11;
//
// lblInitMortality
//
this->lblInitMortality->AutoSize = true;
this->lblInitMortality->Location = System::Drawing::Point(231, 21);
this->lblInitMortality->Name = L"lblInitMortality";
this->lblInitMortality->Size = System::Drawing::Size(76, 13);
this->lblInitMortality->TabIndex = 12;
this->lblInitMortality->Text = L"Initial Mortality:";
//
// numInitMortality
//
this->numInitMortality->DecimalPlaces = 2;
this->numInitMortality->Increment = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 131072});
this->numInitMortality->Location = System::Drawing::Point(354, 19);
this->numInitMortality->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0});
this->numInitMortality->Name = L"numInitMortality";
this->numInitMortality->Size = System::Drawing::Size(60, 20);
this->numInitMortality->TabIndex = 13;
//
// chkEffectLost
//
this->chkEffectLost->AutoSize = true;
this->chkEffectLost->Location = System::Drawing::Point(234, 46);
this->chkEffectLost->Name = L"chkEffectLost";
this->chkEffectLost->Size = System::Drawing::Size(153, 17);
this->chkEffectLost->TabIndex = 14;
this->chkEffectLost->Text = L"Effect lost if container dries";
this->chkEffectLost->UseVisualStyleBackColor = true;
//
// cboxSchedule
//
this->cboxSchedule->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
this->cboxSchedule->FormattingEnabled = true;
this->cboxSchedule->Location = System::Drawing::Point(73, 375);
this->cboxSchedule->Name = L"cboxSchedule";
this->cboxSchedule->Size = System::Drawing::Size(122, 21);
this->cboxSchedule->TabIndex = 18;
this->cboxSchedule->SelectionChangeCommitted += gcnew System::EventHandler(this, &LarvicideForm::OnScheduleChange);
//
// gboxEffects
//
this->gboxEffects->Controls->Add(this->numLagPeriod);
this->gboxEffects->Controls->Add(this->numInitMortality);
this->gboxEffects->Controls->Add(this->lblLagPeriod);
this->gboxEffects->Controls->Add(this->numDeclineEffectPeriod);
this->gboxEffects->Controls->Add(this->chkEffectLost);
this->gboxEffects->Controls->Add(this->lblDeclineEffectPeriod);
this->gboxEffects->Controls->Add(this->lblMaxEffectPeriod);
this->gboxEffects->Controls->Add(this->lblInitMortality);
this->gboxEffects->Controls->Add(this->numMaxEffectPeriod);
this->gboxEffects->Location = System::Drawing::Point(73, 268);
this->gboxEffects->Name = L"gboxEffects";
this->gboxEffects->Size = System::Drawing::Size(420, 101);
this->gboxEffects->TabIndex = 20;
this->gboxEffects->TabStop = false;
this->gboxEffects->Text = L"Larvicide Effects";
//
// panel1
//
this->panel1->Location = System::Drawing::Point(73, 402);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(420, 200);
this->panel1->TabIndex = 21;
this->panel1->Visible = false;
//
// LarvicideForm
//
this->AcceptButton = this->btnOK;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->CancelButton = this->btnCancel;
this->ClientSize = System::Drawing::Size(505, 643);
this->Controls->Add(this->panel1);
this->Controls->Add(this->gboxEffects);
this->Controls->Add(this->cboxSchedule);
this->Controls->Add(this->lblSchedule);
this->Controls->Add(this->btnRemoveContainer);
this->Controls->Add(this->btnAddContainer);
this->Controls->Add(this->btnOK);
this->Controls->Add(this->btnCancel);
this->Controls->Add(this->dgvTargets);
this->Controls->Add(this->lblTargets);
this->Controls->Add(this->tboxName);
this->Controls->Add(this->lblName);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->Name = L"LarvicideForm";
this->ShowInTaskbar = false;
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"Larvicide";
this->Load += gcnew System::EventHandler(this, &LarvicideForm::OnLoad);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->dgvTargets))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numLagPeriod))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numMaxEffectPeriod))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numDeclineEffectPeriod))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numInitMortality))->EndInit();
this->gboxEffects->ResumeLayout(false);
this->gboxEffects->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}
| [
"andygarcia@gmail.com"
] | andygarcia@gmail.com |
5ea016ea88a9e551f64f03d602b37133dfc75331 | 396711bbe360a254684fb725cfd673b538c1f47d | /src/model/bspfilemodel.h | 5fa092781e32c7a46c5e3b655288f1847ca74e8a | [] | no_license | noodlecollie/bspanalyser | 3589ecd75e72259d182418e2408514b3b48a3811 | 4d1245fb6565369f9bbaae7e6ae07d11049f5576 | refs/heads/master | 2021-10-23T02:02:11.729365 | 2019-03-14T07:16:18 | 2019-03-14T07:16:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 658 | h | #ifndef BSPFILEMODEL_H
#define BSPFILEMODEL_H
#include <QObject>
#include <QString>
#include <QByteArray>
class BSPFileModel : public QObject
{
Q_OBJECT
public:
BSPFileModel(QObject* parent = nullptr);
QString filePath() const;
const QByteArray& contents() const;
bool isValid() const;
bool load(const QString& filePath);
void clear();
quint32 version() const;
quint32 subVersion() const;
quint64 lumpTableOffset() const;
bool hasSubVersion() const;
void setHasSubVersion(bool hasSV);
private:
QString m_strFilePath;
QByteArray m_arrData;
bool m_bHasSubVersion;
};
#endif // BSPFILEMODEL_H
| [
"jonathan.poncelet@talk21.com"
] | jonathan.poncelet@talk21.com |
c38bdf5116ce2a073a30f8d4dbba0d2549aa5da6 | d4818d355abbede867e8b0b3f6418a574c13c5e0 | /src/client/cpp/h2/lane.cpp | 086a73b95682d0a87978be9b8b9792bc4a7fcfab | [] | no_license | Peppar/mist-conn | f6ff5bd4d2cc2fd7f0a8a0e620e00813f9479838 | 5f7301be0458b2348729b3bd425a3fd9392261a0 | refs/heads/master | 2020-05-21T20:41:02.788724 | 2016-10-17T07:14:31 | 2016-10-17T07:14:31 | 62,822,836 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,990 | cpp | #include <cstddef>
#include <string>
#include <vector>
#include <boost/system/error_code.hpp>
#include <nghttp2/nghttp2.h>
#include "h2/lane.hpp"
#include "h2/types.hpp"
#include "h2/util.hpp"
namespace mist
{
namespace h2
{
/*
* Lane
*/
Lane::Lane() {}
void
Lane::setHeaders(header_map headers)
{
_headers = std::move(headers);
for (auto &h : _headers)
parseHeader(h.first, h.second.first);
}
const header_map &
Lane::headers() const
{
return _headers;
}
int
Lane::onHeader(const nghttp2_frame *frame, const std::uint8_t *name,
std::size_t namelen, const std::uint8_t *value,
std::size_t valuelen, std::uint8_t flags)
{
bool noIndex(flags & NGHTTP2_NV_FLAG_NO_INDEX);
std::string nameStr(reinterpret_cast<const char*>(name), namelen);
std::string valueStr(reinterpret_cast<const char*>(value), valuelen);
parseHeader(nameStr, valueStr);
_headers.emplace(std::make_pair(std::move(nameStr),
header_value{std::move(valueStr), noIndex}));
return 0;
}
/*
* RequestLane
*/
RequestLane::RequestLane() {}
void
RequestLane::parseHeader(const std::string &name, const std::string &value)
{
if (name == ":method") {
_method = value;
} else if (name == ":path") {
_path = value;
} else if (name == ":scheme") {
_scheme = value;
} else if (name == ":authority") {
_authority = value;
} else if (name == "content-length") {
_contentLength = parseDecimal<decltype(_contentLength)::value_type>(value);
if (!_contentLength) {
/* TODO: Malformed value; reset stream? */;
}
}
}
const boost::optional<std::string> &
RequestLane::method() const
{
return _method;
}
const boost::optional<std::string> &
RequestLane::path() const
{
return _path;
}
const boost::optional<std::string> &
RequestLane::scheme() const
{
return _scheme;
}
const boost::optional<std::string> &
RequestLane::authority() const
{
return _authority;
}
const boost::optional<std::uint64_t> &
RequestLane::contentLength() const
{
return _contentLength;
}
/*
* ResponseLane
*/
ResponseLane::ResponseLane() {}
void
ResponseLane::parseHeader(const std::string &name, const std::string &value)
{
if (name == ":status") {
_statusCode = parseDecimal<decltype(_statusCode)::value_type>(value);
if (!_statusCode) {
/* TODO: Malformed value; reset stream? */;
}
} else if (name == "content-length") {
_contentLength = parseDecimal<decltype(_contentLength)::value_type>(value);
if (!_contentLength) {
/* TODO: Malformed value; reset stream? */;
}
}
}
const boost::optional<std::uint16_t> &
ResponseLane::statusCode() const
{
return _statusCode;
}
const boost::optional<std::uint64_t> &
ResponseLane::contentLength() const
{
return _contentLength;
}
} // namespace h2
} // namespace mist
| [
"oskar@holstensson.se"
] | oskar@holstensson.se |
846cda7f8312c2b7b7a20521ee6c2d0bb6d48e40 | 218cae4dc9cc965f20439e2505b969fee1334fdf | /src/Job.h | e75f611aabadf0de204d165dc922d635e2b725e1 | [] | no_license | romanov6416/ausrv-2016-task1 | 8f51c51ea388e0bb9326994b990e4f8667c279f3 | e0e5b849abb67b7d96043f7c00aa5bf6a0e2f895 | refs/heads/master | 2020-06-15T04:01:11.208669 | 2016-12-06T20:05:30 | 2016-12-06T20:05:30 | 75,331,697 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 850 | h | //
// Created by andrey on 01.12.16.
//
#ifndef DATA_TRANSMISSION_SHEDULE_JOB_H
#define DATA_TRANSMISSION_SHEDULE_JOB_H
#include <cstdlib>
#include <functional>
#include "Types.h"
class Job {
public:
Job(const unsigned int id, const unsigned int duration, const unsigned int begin, const unsigned int end,
const unsigned int period);
unsigned int getId() const;
Time getDuration() const;
Time getBegin() const;
Time getEnd() const;
bool operator==(const Job &j) const;
bool operator!=(const Job &j) const;
Time getPeriod() const;
private:
unsigned id;
unsigned duration;
unsigned begin;
unsigned end;
unsigned period;
};
namespace std {
template <> struct hash<Job>
{
size_t operator()(const Job & j) const
{
return std::hash<int>()(j.getId());
}
};
}
#endif //DATA_TRANSMISSION_SHEDULE_JOB_H
| [
"romanov6416@yandex.ru"
] | romanov6416@yandex.ru |
a9a72eec3102a44ab71d2c283b2e08d109d5b614 | 0bea01e492d73d76387620aadfb5a9d026a47f88 | /source/sspUtility/src/sspTime.h | 61b2d2125e023c2168043dad8888b1e99038e350 | [] | no_license | ssaue/soundspace | 904a3ab803b1baeebb7ddd58443e38136be0652f | dd00efe9b16977bfd828e4dc029675e5b8c47c58 | refs/heads/master | 2021-01-10T03:44:01.111939 | 2019-01-02T10:04:55 | 2019-01-02T10:04:55 | 50,424,978 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,603 | h | ///////////////////////////////
// sspTime.h : header file
///////////////////////////////
#ifndef SSPTIME_H
#define SSPTIME_H
#include <time.h>
// These macroes cause trouble
#undef min
#undef max
//
// Basic time units
//
typedef long long sspTimeType; // absolute: the number of microseconds since epoch
typedef unsigned int sspTimerType; // relative: a length in milliseconds
class sspTimeConvert
{
public:
enum {SEC2MSEC = 1000, MSEC2USEC=1000, USEC2NSEC=1000, SEC2USEC = 1000000, MSEC2NSEC=1000000, SEC2NSEC=1000000000};
enum {HOUR2SEC = 3600, DAY2HOUR=24};
private:
static const double s_us2s;
static const double s_us2ms;
public:
static double time2secs(sspTimeType time) {return time * s_us2s;}
static double time2msecs(sspTimeType time) {return time * s_us2ms;}
static sspTimeType days2time(double days) {return (sspTimeType) hours2time(days * DAY2HOUR);}
static sspTimeType hours2time(double hours) {return (sspTimeType) secs2time(hours * HOUR2SEC);}
static sspTimeType secs2time(double secs) {return (sspTimeType) (secs * SEC2USEC);}
static sspTimeType msecs2time(double msecs) {return (sspTimeType) (msecs * MSEC2USEC);}
static sspTimerType secs2timer(double secs) {return (sspTimerType) (secs * SEC2MSEC);}
static sspTimerType msecs2timer(double msecs) {return (sspTimerType) (msecs + 0.5);}
#if !defined(WIN32)
static void time2timeval(sspTimeType usecs, struct timeval& time)
{
time.tv_sec = (long) (usecs / SEC2USEC);
time.tv_usec = (long) (usecs % SEC2USEC);
}
static sspTimeType timeval2time(struct timeval& time)
{
return (sspTimeType) (tv.tv_sec * SEC2USEC + tv.tv_usec);
}
static void timer2timespec(sspTimerType msecs, timespec_t& time)
{
time.tv_sec = (time_t) (msecs / SEC2MSEC);
time.tv_nsec = (long) ((msecs % SEC2MSEC) * MSEC2NSEC);
}
static sspTimerType timespec2timer(timespec_t& time)
{
return (sspTimerType) (tv.tv_sec * SEC2MSEC + tv.tv_nsec / MSEC2NSEC);
}
#endif
};
class sspTime
{
public:
sspTime();
sspTime(sspTimeType time) : m_time(time) {}
sspTime(const sspTime& time) : m_time(time.m_time) {}
sspTime& operator= (const sspTime& time) {m_time = time.m_time; return *this;}
virtual ~sspTime() {}
sspTimeType getCurrentTime();
sspTimeType getTime() const { return m_time; };
// Operations involving two sspTime objects
sspTimeType operator- (const sspTime& time) const
{
return m_time - time.getTime();
};
bool operator> (const sspTime& time) const
{
return m_time > time.getTime();
};
bool operator< (const sspTime& time) const
{
return m_time < time.getTime();
};
// Operations involving a sspTimeType value
sspTime& operator-= (const sspTimeType& time)
{
m_time -= time;
return *this;
};
sspTime& operator+= (const sspTimeType& time)
{
m_time += time;
return *this;
};
sspTime operator- (const sspTimeType& time) const
{
return sspTime(m_time-time);
};
sspTime operator+ (const sspTimeType& time) const
{
return sspTime(m_time+time);
};
protected:
void update();
sspTimeType m_time;
private:
#ifdef WIN32
static sspTimeType s_baseTime, s_baseCounter;
static double s_dFreqFac;
static bool s_bInitialized;
#endif
};
// The sspTimeUpdate is a utility class that handles time updates
class sspTimeUpdate
{
private:
sspTime m_next;
sspTimeType m_nInterval;
public:
sspTimeUpdate() : m_nInterval(0) {}
sspTimeUpdate(sspTimeType nInterval) : m_nInterval(nInterval) {}
void setInterval(sspTimeType nInterval) {m_nInterval = nInterval;}
void initialize(bool bIncrement = true)
{
m_next.getCurrentTime();
if (bIncrement) m_next += m_nInterval;
}
bool update()
{
bool bUpdate = (sspTime() > m_next);
if (bUpdate) m_next += m_nInterval;
return bUpdate;
}
};
// The sspDate class is only concerned with days and months within a year
class sspDate
{
protected:
static int m_nMonths[];
int m_nDay;
int m_nMon;
public:
sspDate() : m_nDay(1), m_nMon(1) {}
sspDate(int nDay, int nMonth) : m_nDay(nDay), m_nMon(nMonth) {}
sspDate(const sspDate& date) : m_nDay(date.m_nDay), m_nMon(date.m_nMon) {}
sspDate& operator= (const sspDate& date);
virtual ~sspDate() {}
void setDay(int nDay) {m_nDay = nDay;}
void setMonth(int nMonth) {m_nMon = nMonth;}
int day() const {return m_nDay;}
int month() const {return m_nMon;}
int daysInYear() const
{
int nDay = m_nDay;
for (int i=0; i<m_nMon-1; ++i)
nDay += m_nMonths[i];
return nDay;
}
int operator- (const sspDate& date) const
{
return daysInYear() - date.daysInYear();
}
bool operator> (const sspDate& date) const
{
return daysInYear() > date.daysInYear();
}
bool operator< (const sspDate& date) const
{
return daysInYear() < date.daysInYear();
}
bool operator>= (const sspDate& date) const
{
return daysInYear() >= date.daysInYear();
}
bool operator<= (const sspDate& date) const
{
return daysInYear() <= date.daysInYear();
}
bool operator== (const sspDate& date) const
{
return m_nDay == date.m_nDay && m_nMon == date.m_nMon;
}
bool isValid() const
{
return m_nMon >= 1 && m_nMon <= 12 && m_nDay >= 1 && m_nDay <= m_nMonths[m_nMon-1];
}
const char* dateAsString(char *buffer, int nMaxSize) const;
const wchar_t* dateAsString(wchar_t *buffer, int nMaxSize) const;
};
class sspClock
{
protected:
int m_nSec;
int m_nMin;
int m_nHour;
public:
sspClock() : m_nHour(0), m_nMin(0), m_nSec(0) {}
sspClock(int nHour, int nMin, int nSec) : m_nHour(nHour), m_nMin(nMin), m_nSec(nSec) {}
sspClock(const sspClock& clock) : m_nHour(clock.m_nHour), m_nMin(clock.m_nMin), m_nSec(clock.m_nSec) {}
sspClock& operator= (const sspClock& clock);
virtual ~sspClock() {}
void setHour(int nHour) {m_nHour = nHour;}
void setMinute(int nMin) {m_nMin = nMin;}
void setSecond(int nSec) {m_nSec = nSec;}
int sec() const {return m_nSec; };
int min() const {return m_nMin; };
int hour() const {return m_nHour;};
int secondsInDay() const
{
return m_nSec + 60 * (m_nMin + 60 * m_nHour);
}
int operator- (const sspClock& clock) const
{
return secondsInDay() - clock.secondsInDay();
}
bool operator> (const sspClock& clock) const
{
return secondsInDay() > clock.secondsInDay();
}
bool operator< (const sspClock& clock) const
{
return secondsInDay() < clock.secondsInDay();
}
bool operator>= (const sspClock& clock) const
{
return secondsInDay() >= clock.secondsInDay();
}
bool operator<= (const sspClock& clock) const
{
return secondsInDay() <= clock.secondsInDay();
}
bool operator== (const sspClock& clock) const
{
return m_nHour == clock.m_nHour && m_nMin == clock.m_nMin && m_nSec == clock.m_nSec;
}
bool isValid() const
{
return m_nHour < 24 && m_nMin < 60 && m_nSec < 60;
}
const char* clockAsString(char *buffer, int nMaxSize) const;
const wchar_t* clockAsString(wchar_t *buffer, int nMaxSize) const;
};
class sspLocalTime : public sspTime, public sspDate, public sspClock
{
public:
enum {SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, WEEKDAYS};
static const char s_dayNames[WEEKDAYS][10];
sspLocalTime();
virtual ~sspLocalTime() {}
sspTime& getCurrentTime();
int year() const { return m_nYear; };
int dayOfWeek() const {return m_nDayOfWeek;}
int dayOfYear() const {return m_nDayOfYear;}
protected:
void localTime();
private:
int m_nYear;
int m_nDayOfWeek;
int m_nDayOfYear;
};
#endif
| [
"sigurd.saue@gmail.com"
] | sigurd.saue@gmail.com |
340ea6f630afddb3bc676783ab7de3251f04d0b3 | 5715eef01e82ea825e5b2e090fbba7cdd4f3bb81 | /test/type_traits.hpp | 519a00ab31db298c224acc3480128854c1881dd2 | [] | no_license | Gregory-Meyer/locking | d408e940ffa89e87c5f128632b408dd0aabc75d0 | cf5583082435b1b84ec1573835ec40d9d6d14a0e | refs/heads/master | 2020-03-27T08:02:18.058685 | 2018-08-26T20:37:13 | 2018-08-26T20:37:13 | 146,214,684 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,537 | hpp | // BSD 3-Clause License
//
// Copyright (c) 2018, Gregory Meyer
// 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 reproducne the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include <locking/adaptive_mutex.hpp>
#include <locking/spinlock.hpp>
#include <locking/type_traits.hpp>
#include <chrono>
#include <mutex>
#include <shared_mutex>
using namespace locking;
struct BasicLock {
void lock() { };
void unlock() { };
};
struct Lock {
void lock() { };
bool try_lock() { return true; };
void unlock() { };
};
struct Mutex {
Mutex() = default;
Mutex(const Mutex &other) = delete;
Mutex(Mutex &&other) = delete;
Mutex& operator=(const Mutex &other) = delete;
Mutex& operator=(Mutex &&other) = delete;
void lock() { };
bool try_lock() { return true; };
void unlock() { };
};
// IsBasicLockable
static_assert(IS_BASIC_LOCKABLE<BasicLock>, "BasicLock must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<Lock>, "Lock must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<Mutex>, "Mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<Spinlock>, "Spinlock must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<AdaptiveMutex<>>,
"AdaptiveMutex<> must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::mutex>,
"std::mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::timed_mutex>,
"std::timed_mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::recursive_mutex>,
"std::recursive_mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::recursive_timed_mutex>,
"std::recursive_timed_mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::shared_mutex>,
"std::shared_mutex must be BasicLockable");
static_assert(IS_BASIC_LOCKABLE<std::shared_timed_mutex>,
"std::shared_timed_mutex must be BasicLockable");
static_assert(!IS_BASIC_LOCKABLE<void>, "void must not be BasicLockable");
static_assert(!IS_BASIC_LOCKABLE<int>, "int must not be BasicLockable");
static_assert(!IS_BASIC_LOCKABLE<double>, "double must not be BasicLockable");
// IsLockable
static_assert(IS_LOCKABLE<Lock>, "Lock must be Lockable");
static_assert(IS_LOCKABLE<Mutex>, "Mutex must be Lockable");
static_assert(IS_LOCKABLE<Spinlock>, "Spinlock must be Lockable");
static_assert(IS_LOCKABLE<AdaptiveMutex<>>, "AdaptiveMutex<> must be Lockable");
static_assert(IS_LOCKABLE<std::mutex>,
"std::mutex must be Lockable");
static_assert(IS_LOCKABLE<std::timed_mutex>,
"std::timed_mutex must be Lockable");
static_assert(IS_LOCKABLE<std::recursive_mutex>,
"std::recursive_mutex must be Lockable");
static_assert(IS_LOCKABLE<std::recursive_timed_mutex>,
"std::recursive_timed_mutex must be Lockable");
static_assert(IS_LOCKABLE<std::shared_mutex>,
"std::shared_mutex must be Lockable");
static_assert(IS_LOCKABLE<std::shared_timed_mutex>,
"std::shared_timed_mutex must be Lockable");
static_assert(!IS_LOCKABLE<BasicLock>, "BasicLock must not be Lockable");
static_assert(!IS_LOCKABLE<void>, "void must not be Lockable");
static_assert(!IS_LOCKABLE<int>, "int must not be Lockable");
static_assert(!IS_LOCKABLE<double>, "double must not be Lockable");
// IsMutex
static_assert(IS_MUTEX<Mutex>, "Mutex must be a Mutex");
static_assert(IS_MUTEX<Spinlock>, "Spinlock must be a Mutex");
static_assert(IS_MUTEX<AdaptiveMutex<>>, "AdaptiveMutex<> must be a Mutex");
static_assert(IS_MUTEX<std::mutex>,
"std::mutex must be a Mutex");
static_assert(IS_MUTEX<std::timed_mutex>,
"std::timed_mutex must be a Mutex");
static_assert(IS_MUTEX<std::recursive_mutex>,
"std::recursive_mutex must be a Mutex");
static_assert(IS_MUTEX<std::recursive_timed_mutex>,
"std::recursive_timed_mutex must be a Mutex");
static_assert(IS_MUTEX<std::shared_mutex>,
"std::shared_mutex must be a Mutex");
static_assert(IS_MUTEX<std::shared_timed_mutex>,
"std::shared_timed_mutex must be a Mutex");
static_assert(!IS_MUTEX<BasicLock>, "BasicLock must not be a Mutex");
static_assert(!IS_MUTEX<Lock>, "Lock must not be a Mutex");
static_assert(!IS_MUTEX<void>, "void must not be a Mutex");
static_assert(!IS_MUTEX<int>, "int must not be a Mutex");
static_assert(!IS_MUTEX<double>, "double must not be a Mutex");
// IsArithmetic
static_assert(IS_ARITHMETIC<char>, "char must be Arithmetic");
static_assert(IS_ARITHMETIC<short>, "short must be Arithmetic");
static_assert(IS_ARITHMETIC<int>, "int must be Arithmetic");
static_assert(IS_ARITHMETIC<long>, "long must be Arithmetic");
static_assert(IS_ARITHMETIC<long long>, "long long must be Arithmetic");
static_assert(IS_ARITHMETIC<unsigned char>, "unsigned char must be Arithmetic");
static_assert(IS_ARITHMETIC<unsigned short>,
"unsigned short must be Arithmetic");
static_assert(IS_ARITHMETIC<unsigned int>, "unsigned int must be Arithmetic");
static_assert(IS_ARITHMETIC<unsigned long>, "unsigned long must be Arithmetic");
static_assert(IS_ARITHMETIC<unsigned long long>,
"unsigned long long must be Arithmetic");
static_assert(IS_ARITHMETIC<signed char>, "signed char must be Arithmetic");
static_assert(IS_ARITHMETIC<signed short>, "signed short must be Arithmetic");
static_assert(IS_ARITHMETIC<signed int>, "signed int must be Arithmetic");
static_assert(IS_ARITHMETIC<signed long>, "signed long must be Arithmetic");
static_assert(IS_ARITHMETIC<signed long long>,
"signed long long must be Arithmetic");
static_assert(IS_ARITHMETIC<float>, "float must be Arithmetic");
static_assert(IS_ARITHMETIC<double>, "double must be Arithmetic");
static_assert(IS_ARITHMETIC<long double>, "long double must be Arithmetic");
static_assert(!IS_ARITHMETIC<void*>, "void* must not be Arithmetic");
static_assert(!IS_ARITHMETIC<int*>, "int* must not be Arithmetic");
static_assert(!IS_ARITHMETIC<double*>, "double* must not be Arithmetic");
// IsRatio
static_assert(IS_RATIO<std::ratio<1, 1>>, "std::ratio<1, 1> must be Ratio");
static_assert(IS_RATIO<std::ratio<42, 42>>, "std::ratio<42, 42> must be Ratio");
static_assert(IS_RATIO<std::ratio<1, 42>>, "std::ratio<1, 42> must be Ratio");
static_assert(IS_RATIO<std::ratio<42, 1>>, "std::ratio<42, 1> must be Ratio");
static_assert(!IS_RATIO<void>, "void must not be Ratio");
static_assert(!IS_RATIO<int>, "int must not be Ratio");
static_assert(!IS_RATIO<double>, "double must not be Ratio");
// IsClock
static_assert(IS_CLOCK<std::chrono::high_resolution_clock>,
"std::chrono::high_resolution_clock must be Clock");
static_assert(IS_CLOCK<std::chrono::system_clock>,
"std::chrono::system_clock must be Clock");
static_assert(IS_CLOCK<std::chrono::steady_clock>,
"std::chrono::steady_clock must be Clock");
static_assert(!IS_CLOCK<void>, "void must not be Clock");
static_assert(!IS_CLOCK<int>, "int must not be Clock");
static_assert(!IS_CLOCK<double>, "double must not be Clock");
| [
"gregjm@umich.edu"
] | gregjm@umich.edu |
5d49f09a6003f13ccb93993707e9d71a7dfc77fe | 94e5a9e157d3520374d95c43fe6fec97f1fc3c9b | /vjudge/ridwan vai aust 5.1/A.cpp | 17c04a60217f8c54239336dc470f2cfa34d41a95 | [
"MIT"
] | permissive | dipta007/Competitive-Programming | 0127c550ad523884a84eb3ea333d08de8b4ba528 | 998d47f08984703c5b415b98365ddbc84ad289c4 | refs/heads/master | 2021-01-21T14:06:40.082553 | 2020-07-06T17:40:46 | 2020-07-06T17:40:46 | 54,851,014 | 8 | 4 | null | 2020-05-02T13:14:41 | 2016-03-27T22:30:02 | C++ | UTF-8 | C++ | false | false | 5,284 | cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
// #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define PB(x) push_back(x)
#define FOR(i, L, R) for (int i = (int)(L); i <= (int)(R); i++)
#define ROF(i, L, R) for (int i = (int)(L); i >= (int)(R); i--)
#define ALL(p) p.begin(), p.end()
#define ALLR(p) p.rbegin(), p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define getI(a) scanf("%d", &a)
#define getII(a, b) scanf("%d%d", &a, &b)
#define getIII(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld", &a)
#define getLL(a, b) scanf("%lld%lld", &a, &b)
#define getLLL(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define getF(n) scanf("%lf", &n)
#define bitCheck(N, in) ((bool)(N & (1 << (in))))
#define bitOn(N, in) (N | (1 << (in)))
#define bitOff(N, in) (N & (~(1 << (in))))
#define bitFlip(a, k) (a ^ (1 << (k)))
#define bitCount(a) __builtin_popcount(a)
#define bitCountLL(a) __builtin_popcountll(a)
#define bitLeftMost(a) (63 - __builtin_clzll((a)))
#define bitRightMost(a) (__builtin_ctzll(a))
#define ranL(a, b) ((((rand() << 15) ^ rand()) % ((b) - (a) + 1)) + (a))
#define ranI(a, b) ((((ll)rand() * rand()) % ((b) - (a) + 1)) + (a))
#define ranF(a, b) (((double)rand() / RAND_MAX) * ((b) - (a)) + (a))
#define UNIQUE(V) (V).erase(unique((V).begin(), (V).end()), (V).end())
#define SETI(ar) memset(ar, 126, sizeof ar)
#define printbits(x, n) cout << #x << " = " << x << " = " << bitset<n>(x) << endl /// Least significant n bits of x, n must be constant
#define tobinary(x) string(bitset<64>(x).to_string<char, string::traits_type, string::allocator_type>()).substr(min(63, __builtin_clzll(x)), 64)
#define lastbits(x, n) cout << string(bitset<64>(x).to_string<char, string::traits_type, string::allocator_type>()).substr(64 - n, 64) << endl
#define firstbits(x, n) cout << string(bitset<64>(x).to_string<char, string::traits_type, string::allocator_type>()).substr(min(63, __builtin_clzll(x)), 64).substr(0, n) << endl;
#define ff first
#define ss second
#define sf scanf
#define pf printf
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
#define FMT(...) (sprintf(CRTBUFF, __VA_ARGS__) ? CRTBUFF : 0)
char CRTBUFF[30000];
#ifdef dipta007
#define debug(args...) \
{ \
cerr << __LINE__ << " D: "; \
dbg, args; \
cerr << endl; \
}
#define trace(...) \
{ \
cerr << "Line " << __LINE__ << ": "; \
__f(#__VA_ARGS__, __VA_ARGS__); \
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
const char *comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << " : " << arg1 << " | ";
__f(comma + 1, args...);
}
#else
#define debug(args...) /// Just strip off all debug tokens
#define trace(...) ///yeeeee
#endif
struct debugger
{
template <typename T>
debugger &operator,(const T &v)
{
cerr << v << " ";
return *this;
}
} dbg;
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 2.0 * acos(0.0);
ll MIN() { return INF; }
template <typename T, typename... Args>
inline T MIN(T a, Args... args) { return min(a, (T)MIN(args...)); }
ll MAX() { return -INF; }
template <typename T, typename... Args>
inline T MAX(T a, Args... args) { return max(a, (T)MAX(args...)); }
// g++ -g -O2 -std=gnu++11 A.cpp
// ./a.out
///****************** template ends here ****************
int main()
{
#ifdef dipta007
//READ("in.txt");
//WRITE("out.txt");
#endif // dipta007
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
while (cin >> n)
{
int cnt[34];
CLR(cnt);
FOR(i, 0, n - 1)
{
int x;
cin >> x;
int in = 0;
while (x)
{
cnt[in] += x % 2;
x /= 2;
in++;
}
}
ll c = 1;
ull res = 0;
FOR(i, 0, 31)
{
ll n = cnt[i] - 1;
if (n > 0)
{
ll nth = n * c + (n - 1) * (-c);
ll sum = (n * (n * c + nth)) / 2;
// cout << n << " " << sum << " " << nth << endl;
res += sum;
}
c = c * 2LL;
}
cout << res << endl;
}
return 0;
}
| [
"iamdipta@gmail.com"
] | iamdipta@gmail.com |
49d06b42a773b1cc869082c2d11fd543cb215ad0 | 4d12cf2cff2160f13f739b8026cfc346ed91b921 | /ch4/code/disparity.cpp | d19f9ce8f36bbd4cb8498005c557d476189565a2 | [] | no_license | eglrp/VSLAM_Homework | cc71928c65e0f64d683103e9646dbea4618a02c0 | 8d85851469e25c2dd4c5acae923379d38d5874ae | refs/heads/master | 2020-07-16T02:45:30.245754 | 2019-09-01T13:40:17 | 2019-09-01T13:40:17 | 205,702,127 | 15 | 7 | null | 2019-09-01T16:20:07 | 2019-09-01T16:20:06 | null | UTF-8 | C++ | false | false | 3,025 | cpp | //
// Created by xuzhi.
//
#include <opencv2/opencv.hpp>
#include <string>
#include <Eigen/Core>
#include <pangolin/pangolin.h>
#include <unistd.h>
using namespace std;
using namespace Eigen;
// 文件路径,如果不对,请调整
string left_file = "../left.png";
string right_file = "../right.png";
string disparity_file = "../disparity.png";
// 在panglin中画图,已写好,无需调整
void showPointCloud(const vector<Vector4d, Eigen::aligned_allocator<Vector4d>> &pointcloud);
int main(int argc, char **argv) {
// 内参
double fx = 718.856, fy = 718.856, cx = 607.1928, cy = 185.2157;
// 间距:baseline
double d = 0.573;
// 归一化坐标中的x, y
double x_normal, y_normal;
// 读取图像
cv::Mat left = cv::imread(left_file, 0);
cv::Mat right = cv::imread(right_file, 0);
cv::Mat disparity = cv::imread(disparity_file, 0); // disparty 为CV_8U,单位为像素
// 生成点云
vector<Vector4d, Eigen::aligned_allocator<Vector4d>> pointcloud;
// TODO 根据双目模型计算点云
// 根据d,求出z
for (int v = 0; v < left.rows; v++)
for (int u = 0; u < left.cols; u++) {
Vector4d point(0, 0, 0, left.at<uchar>(v, u) / 255.0); // 前三维为xyz,第四维为颜色
// start your code here (~6 lines)
// 根据双目模型计算 point 的位置 z = f*b/d
auto z = fx*d/(disparity.at<uchar>(v,u));
x_normal = (u-cx)/fx;
y_normal = (v-cy)/fy;
point[0] = x_normal * z;
point[1] = y_normal * z;
point[2] = z;
pointcloud.push_back(point);
// end your code here
}
// 画出点云
showPointCloud(pointcloud);
return 0;
}
void showPointCloud(const vector<Vector4d, Eigen::aligned_allocator<Vector4d>> &pointcloud) {
if (pointcloud.empty()) {
cerr << "Point cloud is empty!" << endl;
return;
}
pangolin::CreateWindowAndBind("Point Cloud Viewer", 1024, 768);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
pangolin::OpenGlRenderState s_cam(
pangolin::ProjectionMatrix(1024, 768, 500, 500, 512, 389, 0.1, 1000),
pangolin::ModelViewLookAt(0, -0.1, -1.8, 0, 0, 0, 0.0, -1.0, 0.0)
);
pangolin::View &d_cam = pangolin::CreateDisplay()
.SetBounds(0.0, 1.0, pangolin::Attach::Pix(175), 1.0, -1024.0f / 768.0f)
.SetHandler(new pangolin::Handler3D(s_cam));
while (pangolin::ShouldQuit() == false) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
d_cam.Activate(s_cam);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glPointSize(2);
glBegin(GL_POINTS);
for (auto &p: pointcloud) {
glColor3f(p[3], p[3], p[3]);
glVertex3d(p[0], p[1], p[2]);
}
glEnd();
pangolin::FinishFrame();
usleep(5000); // sleep 5 ms
}
return;
}
| [
"332999245@qq.com"
] | 332999245@qq.com |
8a1cf7e1fce32319e4e126eb90825ac24169a326 | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/cpp-qt5-qhttpengine-server/generated/server/src/models/OAIComDayCqDamCoreImplReportsReportExportServiceProperties.h | ebb22e147bc8818f4fef36248a5d62e5ef0ff1ae | [
"Apache-2.0",
"MIT"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | C++ | false | false | 1,620 | h | /**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* OAIComDayCqDamCoreImplReportsReportExportServiceProperties.h
*
*
*/
#ifndef OAIComDayCqDamCoreImplReportsReportExportServiceProperties_H
#define OAIComDayCqDamCoreImplReportsReportExportServiceProperties_H
#include <QJsonObject>
#include "OAIConfigNodePropertyInteger.h"
#include "OAIObject.h"
namespace OpenAPI {
class OAIComDayCqDamCoreImplReportsReportExportServiceProperties: public OAIObject {
public:
OAIComDayCqDamCoreImplReportsReportExportServiceProperties();
OAIComDayCqDamCoreImplReportsReportExportServiceProperties(QString json);
~OAIComDayCqDamCoreImplReportsReportExportServiceProperties() override;
void init();
QString asJson () const override;
QJsonObject asJsonObject() const override;
void fromJsonObject(QJsonObject json) override;
void fromJson(QString jsonString) override;
OAIConfigNodePropertyInteger getQueryBatchSize() const;
void setQueryBatchSize(const OAIConfigNodePropertyInteger &query_batch_size);
virtual bool isSet() const override;
private:
OAIConfigNodePropertyInteger query_batch_size;
bool m_query_batch_size_isSet;
};
}
#endif // OAIComDayCqDamCoreImplReportsReportExportServiceProperties_H
| [
"cliffano@gmail.com"
] | cliffano@gmail.com |
e064021e3df832710b7bdb08e8add2e6ece7a65a | 279b3911a6ec6ad1ff7658a0057704c8c8b405ed | /src/wallet/rpcwallet.cpp | e82ac43fb3645067ce6d2084b3f8fea849f575b9 | [
"MIT"
] | permissive | Aryacoin/OmniAYA | 81cfd5b93fe4ce8503f68017187a09ba8b21fff4 | 1e9c50356b9359132aa147a1e54fbb448b17ed58 | refs/heads/master | 2023-06-01T07:25:34.046780 | 2021-06-19T23:58:04 | 2021-06-19T23:58:04 | 378,238,606 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 201,120 | cpp | // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 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 <amount.h>
#include <chain.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <httpserver.h>
#include <init.h>
#include <interfaces/chain.h>
#include <validation.h>
#include <key_io.h>
#include <net.h>
#include <node/transaction.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <policy/fees.h>
#include <policy/policy.h>
#include <policy/rbf.h>
#include <rpc/mining.h>
#include <rpc/rawtransaction.h>
#include <rpc/server.h>
#include <rpc/util.h>
#include <script/descriptor.h>
#include <script/sign.h>
#include <shutdown.h>
#include <timedata.h>
#include <util/bip32.h>
#include <util/system.h>
#include <util/moneystr.h>
#include <wallet/coincontrol.h>
#include <wallet/feebumper.h>
#include <wallet/psbtwallet.h>
#include <wallet/rpcwallet.h>
#include <wallet/wallet.h>
#include <wallet/walletdb.h>
#include <wallet/walletutil.h>
#include <stdint.h>
#include <univalue.h>
#include <functional>
static const std::string WALLET_ENDPOINT_BASE = "/wallet/";
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest& request, std::string& wallet_name)
{
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
// wallet endpoint was used
wallet_name = urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size()));
return true;
}
return false;
}
std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request)
{
std::string wallet_name;
if (GetWalletNameFromJSONRPCRequest(request, wallet_name)) {
std::shared_ptr<CWallet> pwallet = GetWallet(wallet_name);
if (!pwallet) throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Requested wallet does not exist or is not loaded");
return pwallet;
}
std::vector<std::shared_ptr<CWallet>> wallets = GetWallets();
return wallets.size() == 1 || (request.fHelp && wallets.size() > 0) ? wallets[0] : nullptr;
}
std::string HelpRequiringPassphrase(CWallet * const pwallet)
{
return pwallet && pwallet->IsCrypted()
? "\nRequires wallet passphrase to be set with walletpassphrase call."
: "";
}
bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException)
{
if (pwallet) return true;
if (avoidException) return false;
if (!HasWallets()) {
throw JSONRPCError(
RPC_METHOD_NOT_FOUND, "Method not found (wallet method is disabled because no wallet is loaded)");
}
throw JSONRPCError(RPC_WALLET_NOT_SPECIFIED,
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
}
void EnsureWalletIsUnlocked(CWallet * const pwallet)
{
if (pwallet->IsLocked()) {
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
}
}
int32_t komodo_blockheight(uint256 hash)
{
BlockMap::const_iterator it; CBlockIndex *pindex = 0;
if ( (it = mapBlockIndex.find(hash)) != mapBlockIndex.end() )
{
if ( (pindex= it->second) != 0 )
return(pindex->nHeight);
}
return(0);
}
static void WalletTxToJSON(interfaces::Chain& chain, interfaces::Chain::Lock& locked_chain, const CWalletTx& wtx, UniValue& entry)
{
int confirms = wtx.GetDepthInMainChain(locked_chain);
entry.pushKV("rawconfirmations", confirms);
if (wtx.IsCoinBase())
entry.pushKV("generated", true);
if (confirms > 0)
{
entry.pushKV("confirmations", komodo_dpowconfs((int32_t)komodo_blockheight(wtx.hashBlock),confirms));
entry.pushKV("blockhash", wtx.hashBlock.GetHex());
entry.pushKV("blockindex", wtx.nIndex);
int64_t block_time;
bool found_block = chain.findBlock(wtx.hashBlock, nullptr /* block */, &block_time);
assert(found_block);
entry.pushKV("blocktime", block_time);
} else {
entry.pushKV("confirmations", confirms);
entry.pushKV("trusted", wtx.IsTrusted(locked_chain));
}
uint256 hash = wtx.GetHash();
entry.pushKV("txid", hash.GetHex());
UniValue conflicts(UniValue::VARR);
for (const uint256& conflict : wtx.GetConflicts())
conflicts.push_back(conflict.GetHex());
entry.pushKV("walletconflicts", conflicts);
entry.pushKV("time", wtx.GetTxTime());
entry.pushKV("timereceived", (int64_t)wtx.nTimeReceived);
// Add opt-in RBF status
std::string rbfStatus = "no";
if (confirms <= 0) {
LOCK(mempool.cs);
RBFTransactionState rbfState = IsRBFOptIn(*wtx.tx, mempool);
if (rbfState == RBFTransactionState::UNKNOWN)
rbfStatus = "unknown";
else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125)
rbfStatus = "yes";
}
entry.pushKV("bip125-replaceable", rbfStatus);
for (const std::pair<const std::string, std::string>& item : wtx.mapValue)
entry.pushKV(item.first, item.second);
}
static std::string LabelFromValue(const UniValue& value)
{
std::string label = value.get_str();
if (label == "*")
throw JSONRPCError(RPC_WALLET_INVALID_LABEL_NAME, "Invalid label name");
return label;
}
static UniValue getnewaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"getnewaddress",
"\nReturns a new Aryacoin address for receiving payments.\n"
"If 'label' is specified, it is added to the address book \n"
"so payments received with the address will be associated with 'label'.\n",
{
{"label", RPCArg::Type::STR, /* default */ "\"\"", "The label name for the address to be linked to. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name."},
{"address_type", RPCArg::Type::STR, /* default */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
},
RPCResult{
"\"address\" (string) The new aryacoin address\n"
},
RPCExamples{
HelpExampleCli("getnewaddress", "")
+ HelpExampleRpc("getnewaddress", "")
},
}.ToString());
LOCK(pwallet->cs_wallet);
if (!pwallet->CanGetAddresses()) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: This wallet has no available keys");
}
// Parse the label first so we don't generate a key if there's an error
std::string label;
if (!request.params[0].isNull())
label = LabelFromValue(request.params[0]);
OutputType output_type = pwallet->m_default_address_type;
if (!request.params[1].isNull()) {
if (!ParseOutputType(request.params[1].get_str(), output_type)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[1].get_str()));
}
}
if (!pwallet->IsLocked()) {
pwallet->TopUpKeyPool();
}
// Generate a new key that is added to wallet
CPubKey newKey;
if (!pwallet->GetKeyFromPool(newKey)) {
throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first");
}
pwallet->LearnRelatedScripts(newKey, output_type);
CTxDestination dest = GetDestinationForKey(newKey, output_type);
pwallet->SetAddressBook(dest, label, "receive");
return EncodeDestination(dest);
}
static UniValue getrawchangeaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
RPCHelpMan{"getrawchangeaddress",
"\nReturns a new Aryacoin address, for receiving change.\n"
"This is for use with raw transactions, NOT normal use.\n",
{
{"address_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
},
RPCResult{
"\"address\" (string) The address\n"
},
RPCExamples{
HelpExampleCli("getrawchangeaddress", "")
+ HelpExampleRpc("getrawchangeaddress", "")
},
}.ToString());
LOCK(pwallet->cs_wallet);
if (!pwallet->CanGetAddresses(true)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: This wallet has no available keys");
}
if (!pwallet->IsLocked()) {
pwallet->TopUpKeyPool();
}
OutputType output_type = pwallet->m_default_change_type != OutputType::CHANGE_AUTO ? pwallet->m_default_change_type : pwallet->m_default_address_type;
if (!request.params[0].isNull()) {
if (!ParseOutputType(request.params[0].get_str(), output_type)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[0].get_str()));
}
}
CReserveKey reservekey(pwallet);
CPubKey vchPubKey;
if (!reservekey.GetReservedKey(vchPubKey, true))
throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first");
reservekey.KeepKey();
pwallet->LearnRelatedScripts(vchPubKey, output_type);
CTxDestination dest = GetDestinationForKey(vchPubKey, output_type);
return EncodeDestination(dest);
}
static UniValue setlabel(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
RPCHelpMan{"setlabel",
"\nSets the label associated with the given address.\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The aryacoin address to be associated with a label."},
{"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label to assign to the address."},
},
RPCResults{},
RPCExamples{
HelpExampleCli("setlabel", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" \"tabby\"")
+ HelpExampleRpc("setlabel", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\", \"tabby\"")
},
}.ToString());
LOCK(pwallet->cs_wallet);
CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Aryacoin address");
}
std::string label = LabelFromValue(request.params[1]);
if (IsMine(*pwallet, dest)) {
pwallet->SetAddressBook(dest, label, "receive");
} else {
pwallet->SetAddressBook(dest, label, "send");
}
return NullUniValue;
}
static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, const CCoinControl& coin_control, mapValue_t mapValue)
{
CAmount curBalance = pwallet->GetBalance();
// Check amount
if (nValue <= 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
if (nValue > curBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
if (pwallet->GetBroadcastTransactions() && !g_connman) {
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
}
// Parse Bitcoin address
CScript scriptPubKey = GetScriptForDestination(address);
// Create and send the transaction
CReserveKey reservekey(pwallet);
CAmount nFeeRequired;
std::string strError;
std::vector<CRecipient> vecSend;
int nChangePosRet = -1;
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
vecSend.push_back(recipient);
CTransactionRef tx;
if (!pwallet->CreateTransaction(locked_chain, vecSend, tx, reservekey, nFeeRequired, nChangePosRet, strError, coin_control)) {
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
throw JSONRPCError(RPC_WALLET_ERROR, strError);
}
CValidationState state;
if (!pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, reservekey, g_connman.get(), state)) {
strError = strprintf("Error: The transaction was rejected! Reason given: %s", FormatStateMessage(state));
throw JSONRPCError(RPC_WALLET_ERROR, strError);
}
return tx;
}
static UniValue sendtoaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
throw std::runtime_error(
RPCHelpMan{"sendtoaddress",
"\nSend an amount to a given address." +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The aryacoin address to send to."},
{"amounttosend", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount in " + CURRENCY_UNIT + " to send. eg 0.1"},
{"comment", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment used to store what the transaction is for.\n"
" This is not part of the transaction, just kept in your wallet."},
{"comment_to", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment to store the name of the person or organization\n"
" to which you're sending the transaction. This is not part of the \n"
" transaction, just kept in your wallet."},
{"subtractfeefromamount", RPCArg::Type::BOOL, /* default */ "false", "The fee will be deducted from the amount being sent.\n"
" The recipient will receive less aryacoins than you enter in the amount field."},
{"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"},
{"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
RPCResult{
"\"txid\" (string) The transaction id.\n"
},
RPCExamples{
HelpExampleCli("sendtoaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 0.1")
+ HelpExampleCli("sendtoaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 0.1 \"donation\" \"seans outpost\"")
+ HelpExampleCli("sendtoaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 0.1 \"\" \"\" true")
+ HelpExampleRpc("sendtoaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\", 0.1, \"donation\", \"seans outpost\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
}
// Amount
CAmount nAmount = AmountFromValue(request.params[1]);
if (nAmount <= 0)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send");
// Wallet comments
mapValue_t mapValue;
if (!request.params[2].isNull() && !request.params[2].get_str().empty())
mapValue["comment"] = request.params[2].get_str();
if (!request.params[3].isNull() && !request.params[3].get_str().empty())
mapValue["to"] = request.params[3].get_str();
bool fSubtractFeeFromAmount = false;
if (!request.params[4].isNull()) {
fSubtractFeeFromAmount = request.params[4].get_bool();
}
CCoinControl coin_control;
if (!request.params[5].isNull()) {
coin_control.m_signal_bip125_rbf = request.params[5].get_bool();
}
if (!request.params[6].isNull()) {
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
}
if (!request.params[7].isNull()) {
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
EnsureWalletIsUnlocked(pwallet);
CTransactionRef tx = SendMoney(*locked_chain, pwallet, dest, nAmount, fSubtractFeeFromAmount, coin_control, std::move(mapValue));
return tx->GetHash().GetHex();
}
static UniValue listaddressgroupings(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
RPCHelpMan{"listaddressgroupings",
"\nLists groups of addresses which have had their common ownership\n"
"made public by common use as inputs or as the resulting change\n"
"in past transactions\n",
{},
RPCResult{
"[\n"
" [\n"
" [\n"
" \"address\", (string) The aryacoin address\n"
" amount, (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"label\" (string, optional) The label\n"
" ]\n"
" ,...\n"
" ]\n"
" ,...\n"
"]\n"
},
RPCExamples{
HelpExampleCli("listaddressgroupings", "")
+ HelpExampleRpc("listaddressgroupings", "")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
UniValue jsonGroupings(UniValue::VARR);
std::map<CTxDestination, CAmount> balances = pwallet->GetAddressBalances(*locked_chain);
for (const std::set<CTxDestination>& grouping : pwallet->GetAddressGroupings()) {
UniValue jsonGrouping(UniValue::VARR);
for (const CTxDestination& address : grouping)
{
UniValue addressInfo(UniValue::VARR);
addressInfo.push_back(EncodeDestination(address));
addressInfo.push_back(ValueFromAmount(balances[address]));
{
if (pwallet->mapAddressBook.find(address) != pwallet->mapAddressBook.end()) {
addressInfo.push_back(pwallet->mapAddressBook.find(address)->second.name);
}
}
jsonGrouping.push_back(addressInfo);
}
jsonGroupings.push_back(jsonGrouping);
}
return jsonGroupings;
}
static UniValue signmessage(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 2)
throw std::runtime_error(
RPCHelpMan{"signmessage",
"\nSign a message with the private key of an address" +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The aryacoin address to use for the private key."},
{"message", RPCArg::Type::STR, RPCArg::Optional::NO, "The message to create a signature of."},
},
RPCResult{
"\"signature\" (string) The signature of the message encoded in base 64\n"
},
RPCExamples{
"\nUnlock the wallet for 30 seconds\n"
+ HelpExampleCli("walletpassphrase", "\"mypassphrase\" 30") +
"\nCreate the signature\n"
+ HelpExampleCli("signmessage", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" \"my message\"") +
"\nVerify the signature\n"
+ HelpExampleCli("verifymessage", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" \"signature\" \"my message\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("signmessage", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\", \"my message\"")
},
}.ToString());
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
EnsureWalletIsUnlocked(pwallet);
std::string strAddress = request.params[0].get_str();
std::string strMessage = request.params[1].get_str();
CTxDestination dest = DecodeDestination(strAddress);
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address");
}
const CKeyID *keyID = boost::get<CKeyID>(&dest);
if (!keyID) {
throw JSONRPCError(RPC_TYPE_ERROR, "Address does not refer to key");
}
CKey key;
if (!pwallet->GetKey(*keyID, key)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Private key not available");
}
CHashWriter ss(SER_GETHASH, 0);
ss << strMessageMagic;
ss << strMessage;
std::vector<unsigned char> vchSig;
if (!key.SignCompact(ss.GetHash(), vchSig))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Sign failed");
return EncodeBase64(vchSig.data(), vchSig.size());
}
static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"getreceivedbyaddress",
"\nReturns the total amount received by the given address in transactions with at least minconf confirmations.\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The aryacoin address for transactions."},
{"minconf", RPCArg::Type::NUM, /* default */ "1", "Only include transactions confirmed at least this many times."},
},
RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received at this address.\n"
},
RPCExamples{
"\nThe amount from transactions with at least 1 confirmation\n"
+ HelpExampleCli("getreceivedbyaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\"") +
"\nThe amount including unconfirmed transactions, zero confirmations\n"
+ HelpExampleCli("getreceivedbyaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 0") +
"\nThe amount with at least 6 confirmations\n"
+ HelpExampleCli("getreceivedbyaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 6") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("getreceivedbyaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\", 6")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
LockAnnotation lock(::cs_main); // Temporary, for CheckFinalTx below. Removed in upcoming commit.
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
// Bitcoin address
CTxDestination dest = DecodeDestination(request.params[0].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Aryacoin address");
}
CScript scriptPubKey = GetScriptForDestination(dest);
if (!IsMine(*pwallet, scriptPubKey)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Address not found in wallet");
}
// Minimum confirmations
int nMinDepth = 1;
if (!request.params[1].isNull())
nMinDepth = request.params[1].get_int();
// Tally
CAmount nAmount = 0;
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
const CWalletTx& wtx = pairWtx.second;
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
continue;
for (const CTxOut& txout : wtx.tx->vout)
if (txout.scriptPubKey == scriptPubKey)
if (wtx.GetDepthInMainChain(*locked_chain) >= nMinDepth)
nAmount += txout.nValue;
}
return ValueFromAmount(nAmount);
}
static UniValue getreceivedbylabel(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"getreceivedbylabel",
"\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n",
{
{"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The selected label, may be the default label using \"\"."},
{"minconf", RPCArg::Type::NUM, /* default */ "1", "Only include transactions confirmed at least this many times."},
},
RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this label.\n"
},
RPCExamples{
"\nAmount received by the default label with at least 1 confirmation\n"
+ HelpExampleCli("getreceivedbylabel", "\"\"") +
"\nAmount received at the tabby label including unconfirmed amounts with zero confirmations\n"
+ HelpExampleCli("getreceivedbylabel", "\"tabby\" 0") +
"\nThe amount with at least 6 confirmations\n"
+ HelpExampleCli("getreceivedbylabel", "\"tabby\" 6") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("getreceivedbylabel", "\"tabby\", 6")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
LockAnnotation lock(::cs_main); // Temporary, for CheckFinalTx below. Removed in upcoming commit.
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
// Minimum confirmations
int nMinDepth = 1;
if (!request.params[1].isNull())
nMinDepth = request.params[1].get_int();
// Get the set of pub keys assigned to label
std::string label = LabelFromValue(request.params[0]);
std::set<CTxDestination> setAddress = pwallet->GetLabelAddresses(label);
// Tally
CAmount nAmount = 0;
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
const CWalletTx& wtx = pairWtx.second;
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
continue;
for (const CTxOut& txout : wtx.tx->vout)
{
CTxDestination address;
if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*pwallet, address) && setAddress.count(address)) {
if (wtx.GetDepthInMainChain(*locked_chain) >= nMinDepth)
nAmount += txout.nValue;
}
}
}
return ValueFromAmount(nAmount);
}
static UniValue getbalance(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || (request.params.size() > 3 ))
throw std::runtime_error(
RPCHelpMan{"getbalance",
"\nReturns the total available balance.\n"
"The available balance is what the wallet considers currently spendable, and is\n"
"thus affected by options which limit spendability such as -spendzeroconfchange.\n",
{
{"dummy", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Remains for backward compatibility. Must be excluded or set to \"*\"."},
{"minconf", RPCArg::Type::NUM, /* default */ "0", "Only include transactions confirmed at least this many times."},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Also include balance in watch-only addresses (see 'importaddress')"},
},
RPCResult{
"amount (numeric) The total amount in " + CURRENCY_UNIT + " received for this wallet.\n"
},
RPCExamples{
"\nThe total amount in the wallet with 1 or more confirmations\n"
+ HelpExampleCli("getbalance", "") +
"\nThe total amount in the wallet at least 6 blocks confirmed\n"
+ HelpExampleCli("getbalance", "\"*\" 6") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("getbalance", "\"*\", 6")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
const UniValue& dummy_value = request.params[0];
if (!dummy_value.isNull() && dummy_value.get_str() != "*") {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "dummy first argument must be excluded or set to \"*\".");
}
int min_depth = 0;
if (!request.params[1].isNull()) {
min_depth = request.params[1].get_int();
}
isminefilter filter = ISMINE_SPENDABLE;
if (!request.params[2].isNull() && request.params[2].get_bool()) {
filter = filter | ISMINE_WATCH_ONLY;
}
return ValueFromAmount(pwallet->GetBalance(filter, min_depth));
}
static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
RPCHelpMan{"getunconfirmedbalance",
"Returns the server's total unconfirmed balance\n",
{},
RPCResults{},
RPCExamples{""},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
return ValueFromAmount(pwallet->GetUnconfirmedBalance());
}
static UniValue sendmany(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 2 || request.params.size() > 8)
throw std::runtime_error(
RPCHelpMan{"sendmany",
"\nSend multiple times. Amounts are double-precision floating point numbers." +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"dummy", RPCArg::Type::STR, RPCArg::Optional::NO, "Must be set to \"\" for backwards compatibility.", "\"\""},
{"amounts", RPCArg::Type::OBJ, RPCArg::Optional::NO, "A json object with addresses and amounts",
{
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The aryacoin address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value"},
},
},
{"minconf", RPCArg::Type::NUM, /* default */ "1", "Only use the balance confirmed at least this many times."},
{"comment", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A comment"},
{"subtractfeefrom", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array with addresses.\n"
" The fee will be equally deducted from the amount of each selected address.\n"
" Those recipients will receive less aryacoins than you enter in their corresponding amount field.\n"
" If no addresses are specified here, the sender pays the fee.",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "Subtract fee from this address"},
},
},
{"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Allow this transaction to be replaced by a transaction with higher fees via BIP 125"},
{"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
RPCResult{
"\"txid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
" the number of addresses.\n"
},
RPCExamples{
"\nSend two amounts to two different addresses:\n"
+ HelpExampleCli("sendmany", "\"\" \"{\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\":0.01,\\\"LbhhnrHHVFP1eUjP1tdNIYeEVsNHfN9FCw\\\":0.02}\"") +
"\nSend two amounts to two different addresses setting the confirmation and comment:\n"
+ HelpExampleCli("sendmany", "\"\" \"{\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\":0.01,\\\"LbhhnrHHVFP1eUjP1tdNIYeEVsNHfN9FCw\\\":0.02}\" 6 \"testing\"") +
"\nSend two amounts to two different addresses, subtract fee from amount:\n"
+ HelpExampleCli("sendmany", "\"\" \"{\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\":0.01,\\\"LbhhnrHHVFP1eUjP1tdNIYeEVsNHfN9FCw\\\":0.02}\" 1 \"\" \"[\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\",\\\"LbhhnrHHVFP1eUjP1tdNIYeEVsNHfN9FCw\\\"]\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("sendmany", "\"\", {\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\":0.01,\"LbhhnrHHVFP1eUjP1tdNIYeEVsNHfN9FCw\":0.02}, 6, \"testing\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (pwallet->GetBroadcastTransactions() && !g_connman) {
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
}
if (!request.params[0].isNull() && !request.params[0].get_str().empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Dummy value must be set to \"\"");
}
UniValue sendTo = request.params[1].get_obj();
int nMinDepth = 1;
if (!request.params[2].isNull())
nMinDepth = request.params[2].get_int();
mapValue_t mapValue;
if (!request.params[3].isNull() && !request.params[3].get_str().empty())
mapValue["comment"] = request.params[3].get_str();
UniValue subtractFeeFromAmount(UniValue::VARR);
if (!request.params[4].isNull())
subtractFeeFromAmount = request.params[4].get_array();
CCoinControl coin_control;
if (!request.params[5].isNull()) {
coin_control.m_signal_bip125_rbf = request.params[5].get_bool();
}
if (!request.params[6].isNull()) {
coin_control.m_confirm_target = ParseConfirmTarget(request.params[6]);
}
if (!request.params[7].isNull()) {
if (!FeeModeFromString(request.params[7].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
std::set<CTxDestination> destinations;
std::vector<CRecipient> vecSend;
CAmount totalAmount = 0;
std::vector<std::string> keys = sendTo.getKeys();
for (const std::string& name_ : keys) {
CTxDestination dest = DecodeDestination(name_);
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Aryacoin address: ") + name_);
}
if (destinations.count(dest)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ") + name_);
}
destinations.insert(dest);
CScript scriptPubKey = GetScriptForDestination(dest);
CAmount nAmount = AmountFromValue(sendTo[name_]);
if (nAmount <= 0)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount for send");
totalAmount += nAmount;
bool fSubtractFeeFromAmount = false;
for (unsigned int idx = 0; idx < subtractFeeFromAmount.size(); idx++) {
const UniValue& addr = subtractFeeFromAmount[idx];
if (addr.get_str() == name_)
fSubtractFeeFromAmount = true;
}
CRecipient recipient = {scriptPubKey, nAmount, fSubtractFeeFromAmount};
vecSend.push_back(recipient);
}
EnsureWalletIsUnlocked(pwallet);
// Check funds
if (totalAmount > pwallet->GetLegacyBalance(ISMINE_SPENDABLE, nMinDepth)) {
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Wallet has insufficient funds");
}
// Shuffle recipient list
std::shuffle(vecSend.begin(), vecSend.end(), FastRandomContext());
// Send
CReserveKey keyChange(pwallet);
CAmount nFeeRequired = 0;
int nChangePosRet = -1;
std::string strFailReason;
CTransactionRef tx;
bool fCreated = pwallet->CreateTransaction(*locked_chain, vecSend, tx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control);
if (!fCreated)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
CValidationState state;
if (!pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, keyChange, g_connman.get(), state)) {
strFailReason = strprintf("Transaction commit failed:: %s", FormatStateMessage(state));
throw JSONRPCError(RPC_WALLET_ERROR, strFailReason);
}
return tx->GetHash().GetHex();
}
static UniValue addmultisigaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 2 || request.params.size() > 4) {
std::string msg =
RPCHelpMan{"addmultisigaddress",
"\nAdd a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
"Each key is a Aryacoin address or hex-encoded public key.\n"
"This functionality is only intended for use with non-watchonly addresses.\n"
"See `importaddress` for watchonly p2sh address support.\n"
"If 'label' is specified, assign address to that label.\n",
{
{"nrequired", RPCArg::Type::NUM, RPCArg::Optional::NO, "The number of required signatures out of the n keys or addresses."},
{"keys", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of aryacoin addresses or hex-encoded public keys",
{
{"key", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "aryacoin address or hex-encoded public key"},
},
},
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "A label to assign the addresses to."},
{"address_type", RPCArg::Type::STR, /* default */ "set by -addresstype", "The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
},
RPCResult{
"{\n"
" \"address\":\"multisigaddress\", (string) The value of the new multisig address.\n"
" \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
"}\n"
},
RPCExamples{
"\nAdd a multisig address from 2 addresses\n"
+ HelpExampleCli("addmultisigaddress", "2 \"[\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\",\\\"LYKr1oaPSqShthukmLDhdZsqUJgzVnQiAQ\\\"]\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("addmultisigaddress", "2, \"[\\\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\\\",\\\"LYKr1oaPSqShthukmLDhdZsqUJgzVnQiAQ\\\"]\"")
},
}.ToString();
throw std::runtime_error(msg);
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
std::string label;
if (!request.params[2].isNull())
label = LabelFromValue(request.params[2]);
int required = request.params[0].get_int();
// Get the public keys
const UniValue& keys_or_addrs = request.params[1].get_array();
std::vector<CPubKey> pubkeys;
for (unsigned int i = 0; i < keys_or_addrs.size(); ++i) {
if (IsHex(keys_or_addrs[i].get_str()) && (keys_or_addrs[i].get_str().length() == 66 || keys_or_addrs[i].get_str().length() == 130)) {
pubkeys.push_back(HexToPubKey(keys_or_addrs[i].get_str()));
} else {
pubkeys.push_back(AddrToPubKey(pwallet, keys_or_addrs[i].get_str()));
}
}
OutputType output_type = pwallet->m_default_address_type;
if (!request.params[3].isNull()) {
if (!ParseOutputType(request.params[3].get_str(), output_type)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown address type '%s'", request.params[3].get_str()));
}
}
// Construct using pay-to-script-hash:
CScript inner;
CTxDestination dest = AddAndGetMultisigDestination(required, pubkeys, output_type, *pwallet, inner);
pwallet->SetAddressBook(dest, label, "send");
UniValue result(UniValue::VOBJ);
result.pushKV("address", EncodeDestination(dest));
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));
return result;
}
struct tallyitem
{
CAmount nAmount{0};
int nConf{std::numeric_limits<int>::max()};
std::vector<uint256> txids;
bool fIsWatchonly{false};
tallyitem()
{
}
};
static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * const pwallet, const UniValue& params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
{
LockAnnotation lock(::cs_main); // Temporary, for CheckFinalTx below. Removed in upcoming commit.
// Minimum confirmations
int nMinDepth = 1;
if (!params[0].isNull())
nMinDepth = params[0].get_int();
// Whether to include empty labels
bool fIncludeEmpty = false;
if (!params[1].isNull())
fIncludeEmpty = params[1].get_bool();
isminefilter filter = ISMINE_SPENDABLE;
if(!params[2].isNull())
if(params[2].get_bool())
filter = filter | ISMINE_WATCH_ONLY;
bool has_filtered_address = false;
CTxDestination filtered_address = CNoDestination();
if (!by_label && params.size() > 3) {
if (!IsValidDestinationString(params[3].get_str())) {
throw JSONRPCError(RPC_WALLET_ERROR, "address_filter parameter was invalid");
}
filtered_address = DecodeDestination(params[3].get_str());
has_filtered_address = true;
}
// Tally
std::map<CTxDestination, tallyitem> mapTally;
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
const CWalletTx& wtx = pairWtx.second;
if (wtx.IsCoinBase() || !CheckFinalTx(*wtx.tx))
continue;
int nDepth = wtx.GetDepthInMainChain(locked_chain);
if (nDepth < nMinDepth)
continue;
for (const CTxOut& txout : wtx.tx->vout)
{
CTxDestination address;
if (!ExtractDestination(txout.scriptPubKey, address))
continue;
if (has_filtered_address && !(filtered_address == address)) {
continue;
}
isminefilter mine = IsMine(*pwallet, address);
if(!(mine & filter))
continue;
tallyitem& item = mapTally[address];
item.nAmount += txout.nValue;
item.nConf = std::min(item.nConf, nDepth);
item.txids.push_back(wtx.GetHash());
if (mine & ISMINE_WATCH_ONLY)
item.fIsWatchonly = true;
}
}
// Reply
UniValue ret(UniValue::VARR);
std::map<std::string, tallyitem> label_tally;
// Create mapAddressBook iterator
// If we aren't filtering, go from begin() to end()
auto start = pwallet->mapAddressBook.begin();
auto end = pwallet->mapAddressBook.end();
// If we are filtering, find() the applicable entry
if (has_filtered_address) {
start = pwallet->mapAddressBook.find(filtered_address);
if (start != end) {
end = std::next(start);
}
}
for (auto item_it = start; item_it != end; ++item_it)
{
const CTxDestination& address = item_it->first;
const std::string& label = item_it->second.name;
auto it = mapTally.find(address);
if (it == mapTally.end() && !fIncludeEmpty)
continue;
CAmount nAmount = 0;
int nConf = std::numeric_limits<int>::max();
bool fIsWatchonly = false;
if (it != mapTally.end())
{
nAmount = (*it).second.nAmount;
nConf = (*it).second.nConf;
fIsWatchonly = (*it).second.fIsWatchonly;
}
if (by_label)
{
tallyitem& _item = label_tally[label];
_item.nAmount += nAmount;
_item.nConf = std::min(_item.nConf, nConf);
_item.fIsWatchonly = fIsWatchonly;
}
else
{
UniValue obj(UniValue::VOBJ);
if(fIsWatchonly)
obj.pushKV("involvesWatchonly", true);
obj.pushKV("address", EncodeDestination(address));
obj.pushKV("amount", ValueFromAmount(nAmount));
obj.pushKV("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf));
obj.pushKV("label", label);
UniValue transactions(UniValue::VARR);
if (it != mapTally.end())
{
for (const uint256& _item : (*it).second.txids)
{
transactions.push_back(_item.GetHex());
}
}
obj.pushKV("txids", transactions);
ret.push_back(obj);
}
}
if (by_label)
{
for (const auto& entry : label_tally)
{
CAmount nAmount = entry.second.nAmount;
int nConf = entry.second.nConf;
UniValue obj(UniValue::VOBJ);
if (entry.second.fIsWatchonly)
obj.pushKV("involvesWatchonly", true);
obj.pushKV("amount", ValueFromAmount(nAmount));
obj.pushKV("confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf));
obj.pushKV("label", entry.first);
ret.push_back(obj);
}
}
return ret;
}
static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
RPCHelpMan{"listreceivedbyaddress",
"\nList balances by receiving address.\n",
{
{"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum number of confirmations before payments are included."},
{"include_empty", RPCArg::Type::BOOL, /* default */ "false", "Whether to include addresses that haven't received any payments."},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses (see 'importaddress')."},
{"address_filter", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If present, only return information on this address."},
},
RPCResult{
"[\n"
" {\n"
" \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n"
" \"address\" : \"receivingaddress\", (string) The receiving address\n"
" \"amount\" : x.xxx, (numeric) The total amount in " + CURRENCY_UNIT + " received by the address\n"
" \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n"
" \"label\" : \"label\", (string) The label of the receiving address. The default label is \"\".\n"
" \"txids\": [\n"
" \"txid\", (string) The ids of transactions received with the address \n"
" ...\n"
" ]\n"
" }\n"
" ,...\n"
"]\n"
},
RPCExamples{
HelpExampleCli("listreceivedbyaddress", "")
+ HelpExampleCli("listreceivedbyaddress", "6 true")
+ HelpExampleRpc("listreceivedbyaddress", "6, true, true")
+ HelpExampleRpc("listreceivedbyaddress", "6, true, true, \"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
return ListReceived(*locked_chain, pwallet, request.params, false);
}
static UniValue listreceivedbylabel(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 3)
throw std::runtime_error(
RPCHelpMan{"listreceivedbylabel",
"\nList received transactions by label.\n",
{
{"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum number of confirmations before payments are included."},
{"include_empty", RPCArg::Type::BOOL, /* default */ "false", "Whether to include labels that haven't received any payments."},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses (see 'importaddress')."},
},
RPCResult{
"[\n"
" {\n"
" \"involvesWatchonly\" : true, (bool) Only returned if imported addresses were involved in transaction\n"
" \"amount\" : x.xxx, (numeric) The total amount received by addresses with this label\n"
" \"confirmations\" : n, (numeric) The number of confirmations of the most recent transaction included\n"
" \"label\" : \"label\" (string) The label of the receiving address. The default label is \"\".\n"
" }\n"
" ,...\n"
"]\n"
},
RPCExamples{
HelpExampleCli("listreceivedbylabel", "")
+ HelpExampleCli("listreceivedbylabel", "6 true")
+ HelpExampleRpc("listreceivedbylabel", "6, true, true")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
return ListReceived(*locked_chain, pwallet, request.params, true);
}
static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
{
if (IsValidDestination(dest)) {
entry.pushKV("address", EncodeDestination(dest));
}
}
/**
* List transactions based on the given criteria.
*
* @param pwallet The wallet.
* @param wtx The wallet transaction.
* @param nMinDepth The minimum confirmation depth.
* @param fLong Whether to include the JSON version of the transaction.
* @param ret The UniValue into which the result is stored.
* @param filter_ismine The "is mine" filter flags.
* @param filter_label Optional label string to filter incoming transactions.
*/
static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* const pwallet, const CWalletTx& wtx, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter_ismine, const std::string* filter_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
{
CAmount nFee;
std::list<COutputEntry> listReceived;
std::list<COutputEntry> listSent;
wtx.GetAmounts(listReceived, listSent, nFee, filter_ismine);
bool involvesWatchonly = wtx.IsFromMe(ISMINE_WATCH_ONLY);
// Sent
if (!filter_label)
{
for (const COutputEntry& s : listSent)
{
UniValue entry(UniValue::VOBJ);
if (involvesWatchonly || (::IsMine(*pwallet, s.destination) & ISMINE_WATCH_ONLY)) {
entry.pushKV("involvesWatchonly", true);
}
MaybePushAddress(entry, s.destination);
entry.pushKV("category", "send");
entry.pushKV("amount", ValueFromAmount(-s.amount));
if (pwallet->mapAddressBook.count(s.destination)) {
entry.pushKV("label", pwallet->mapAddressBook[s.destination].name);
}
entry.pushKV("vout", s.vout);
entry.pushKV("fee", ValueFromAmount(-nFee));
if (fLong)
WalletTxToJSON(pwallet->chain(), locked_chain, wtx, entry);
entry.pushKV("abandoned", wtx.isAbandoned());
ret.push_back(entry);
}
}
// Received
if (listReceived.size() > 0 && wtx.GetDepthInMainChain(locked_chain) >= nMinDepth)
{
for (const COutputEntry& r : listReceived)
{
std::string label;
if (pwallet->mapAddressBook.count(r.destination)) {
label = pwallet->mapAddressBook[r.destination].name;
}
if (filter_label && label != *filter_label) {
continue;
}
UniValue entry(UniValue::VOBJ);
if (involvesWatchonly || (::IsMine(*pwallet, r.destination) & ISMINE_WATCH_ONLY)) {
entry.pushKV("involvesWatchonly", true);
}
MaybePushAddress(entry, r.destination);
if (wtx.IsCoinBase())
{
if (wtx.GetDepthInMainChain(locked_chain) < 1)
entry.pushKV("category", "orphan");
else if (wtx.IsImmatureCoinBase(locked_chain))
entry.pushKV("category", "immature");
else
entry.pushKV("category", "generate");
}
else
{
entry.pushKV("category", "receive");
}
entry.pushKV("amount", ValueFromAmount(r.amount));
if (pwallet->mapAddressBook.count(r.destination)) {
entry.pushKV("label", label);
}
entry.pushKV("vout", r.vout);
if (fLong)
WalletTxToJSON(pwallet->chain(), locked_chain, wtx, entry);
ret.push_back(entry);
}
}
}
UniValue listtransactions(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
RPCHelpMan{"listtransactions",
"\nIf a label name is provided, this will return only incoming transactions paying to addresses with the specified label.\n"
"\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n",
{
{"label", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, should be a valid label name to return only incoming transactions\n"
" with the specified label, or \"*\" to disable filtering and return all transactions."},
{"count", RPCArg::Type::NUM, /* default */ "10", "The number of transactions to return"},
{"skip", RPCArg::Type::NUM, /* default */ "0", "The number of transactions to skip"},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Include transactions to watch-only addresses (see 'importaddress')"},
},
RPCResult{
"[\n"
" {\n"
" \"address\":\"address\", (string) The aryacoin address of the transaction.\n"
" \"category\": (string) The transaction category.\n"
" \"send\" Transactions sent.\n"
" \"receive\" Non-coinbase transactions received.\n"
" \"generate\" Coinbase transactions received with more than 100 confirmations.\n"
" \"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
" \"orphan\" Orphaned coinbase transactions received.\n"
" \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n"
" for all other categories\n"
" \"label\": \"label\", (string) A comment for the address/transaction, if any\n"
" \"vout\": n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"confirmations\": n, (numeric) The number of confirmations for the transaction. Negative confirmations indicate the\n"
" transaction conflicts with the block chain\n"
" \"trusted\": xxx, (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
" \"txid\": \"transactionid\", (string) The transaction id.\n"
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT).\n"
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
" may be unknown for unconfirmed transactions not in the mempool\n"
" \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
" 'send' category of transactions.\n"
" }\n"
"]\n"
},
RPCExamples{
"\nList the most recent 10 transactions in the systems\n"
+ HelpExampleCli("listtransactions", "") +
"\nList transactions 100 to 120\n"
+ HelpExampleCli("listtransactions", "\"*\" 20 100") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("listtransactions", "\"*\", 20, 100")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
const std::string* filter_label = nullptr;
if (!request.params[0].isNull() && request.params[0].get_str() != "*") {
filter_label = &request.params[0].get_str();
if (filter_label->empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Label argument must be a valid label name or \"*\".");
}
}
int nCount = 10;
if (!request.params[1].isNull())
nCount = request.params[1].get_int();
int nFrom = 0;
if (!request.params[2].isNull())
nFrom = request.params[2].get_int();
isminefilter filter = ISMINE_SPENDABLE;
if(!request.params[3].isNull())
if(request.params[3].get_bool())
filter = filter | ISMINE_WATCH_ONLY;
if (nCount < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative count");
if (nFrom < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Negative from");
UniValue ret(UniValue::VARR);
{
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
const CWallet::TxItems & txOrdered = pwallet->wtxOrdered;
// iterate backwards until we have nCount items to return:
for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
{
CWalletTx *const pwtx = (*it).second;
ListTransactions(*locked_chain, pwallet, *pwtx, 0, true, ret, filter, filter_label);
if ((int)ret.size() >= (nCount+nFrom)) break;
}
}
// ret is newest to oldest
if (nFrom > (int)ret.size())
nFrom = ret.size();
if ((nFrom + nCount) > (int)ret.size())
nCount = ret.size() - nFrom;
std::vector<UniValue> arrTmp = ret.getValues();
std::vector<UniValue>::iterator first = arrTmp.begin();
std::advance(first, nFrom);
std::vector<UniValue>::iterator last = arrTmp.begin();
std::advance(last, nFrom+nCount);
if (last != arrTmp.end()) arrTmp.erase(last, arrTmp.end());
if (first != arrTmp.begin()) arrTmp.erase(arrTmp.begin(), first);
std::reverse(arrTmp.begin(), arrTmp.end()); // Return oldest to newest
ret.clear();
ret.setArray();
ret.push_backV(arrTmp);
return ret;
}
static UniValue listsinceblock(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 4)
throw std::runtime_error(
RPCHelpMan{"listsinceblock",
"\nGet all transactions in blocks since block [blockhash], or all transactions if omitted.\n"
"If \"blockhash\" is no longer a part of the main chain, transactions from the fork point onward are included.\n"
"Additionally, if include_removed is set, transactions affecting the wallet which were removed are returned in the \"removed\" array.\n",
{
{"blockhash", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "If set, the block hash to list transactions since, otherwise list all transactions."},
{"target_confirmations", RPCArg::Type::NUM, /* default */ "1", "Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value"},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Include transactions to watch-only addresses (see 'importaddress')"},
{"include_removed", RPCArg::Type::BOOL, /* default */ "true", "Show transactions that were removed due to a reorg in the \"removed\" array\n"
" (not guaranteed to work on pruned nodes)"},
},
RPCResult{
"{\n"
" \"transactions\": [\n"
" \"address\":\"address\", (string) The aryacoin address of the transaction.\n"
" \"category\": (string) The transaction category.\n"
" \"send\" Transactions sent.\n"
" \"receive\" Non-coinbase transactions received.\n"
" \"generate\" Coinbase transactions received with more than 100 confirmations.\n"
" \"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
" \"orphan\" Orphaned coinbase transactions received.\n"
" \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and is positive\n"
" for all other categories\n"
" \"vout\" : n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the 'send' category of transactions.\n"
" \"confirmations\": n, (numeric) The number of confirmations for the transaction.\n"
" When it's < 0, it means the transaction conflicted that many blocks ago.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction.\n"
" \"blockindex\": n, (numeric) The index of the transaction in the block that includes it.\n"
" \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
" \"txid\": \"transactionid\", (string) The transaction id.\n"
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT).\n"
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
" may be unknown for unconfirmed transactions not in the mempool\n"
" \"abandoned\": xxx, (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 'send' category of transactions.\n"
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
" \"label\" : \"label\" (string) A comment for the address/transaction, if any\n"
" \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
" ],\n"
" \"removed\": [\n"
" <structure is the same as \"transactions\" above, only present if include_removed=true>\n"
" Note: transactions that were re-added in the active chain will appear as-is in this array, and may thus have a positive confirmation count.\n"
" ],\n"
" \"lastblock\": \"lastblockhash\" (string) The hash of the block (target_confirmations-1) from the best block on the main chain. This is typically used to feed back into listsinceblock the next time you call it. So you would generally use a target_confirmations of say 6, so you will be continually re-notified of transactions until they've reached 6 confirmations plus any new ones\n"
"}\n"
},
RPCExamples{
HelpExampleCli("listsinceblock", "")
+ HelpExampleCli("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6")
+ HelpExampleRpc("listsinceblock", "\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
// The way the 'height' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0.
Optional<int> height = MakeOptional(false, int()); // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
Optional<int> altheight; // Height of the specified block, even if it's in a deactivated chain.
int target_confirms = 1;
isminefilter filter = ISMINE_SPENDABLE;
uint256 blockId;
if (!request.params[0].isNull() && !request.params[0].get_str().empty()) {
blockId = ParseHashV(request.params[0], "blockhash");
height = locked_chain->findFork(blockId, &altheight);
if (!height) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
}
}
if (!request.params[1].isNull()) {
target_confirms = request.params[1].get_int();
if (target_confirms < 1) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
}
}
if (!request.params[2].isNull() && request.params[2].get_bool()) {
filter = filter | ISMINE_WATCH_ONLY;
}
bool include_removed = (request.params[3].isNull() || request.params[3].get_bool());
const Optional<int> tip_height = locked_chain->getHeight();
int depth = tip_height && height ? (1 + *tip_height - *height) : -1;
UniValue transactions(UniValue::VARR);
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
CWalletTx tx = pairWtx.second;
if (depth == -1 || tx.GetDepthInMainChain(*locked_chain) < depth) {
ListTransactions(*locked_chain, pwallet, tx, 0, true, transactions, filter, nullptr /* filter_label */);
}
}
// when a reorg'd block is requested, we also list any relevant transactions
// in the blocks of the chain that was detached
UniValue removed(UniValue::VARR);
while (include_removed && altheight && *altheight > *height) {
CBlock block;
if (!pwallet->chain().findBlock(blockId, &block) || block.IsNull()) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
}
for (const CTransactionRef& tx : block.vtx) {
auto it = pwallet->mapWallet.find(tx->GetHash());
if (it != pwallet->mapWallet.end()) {
// We want all transactions regardless of confirmation count to appear here,
// even negative confirmation ones, hence the big negative.
ListTransactions(*locked_chain, pwallet, it->second, -100000000, true, removed, filter, nullptr /* filter_label */);
}
}
blockId = block.hashPrevBlock;
--*altheight;
}
int last_height = tip_height ? *tip_height + 1 - target_confirms : -1;
uint256 lastblock = last_height >= 0 ? locked_chain->getBlockHash(last_height) : uint256();
UniValue ret(UniValue::VOBJ);
ret.pushKV("transactions", transactions);
if (include_removed) ret.pushKV("removed", removed);
ret.pushKV("lastblock", lastblock.GetHex());
return ret;
}
static UniValue gettransaction(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"gettransaction",
"\nGet detailed information about in-wallet transaction <txid>\n",
{
{"txid", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction id"},
{"include_watchonly", RPCArg::Type::BOOL, /* default */ "false", "Whether to include watch-only addresses in balance calculation and details[]"},
},
RPCResult{
"{\n"
" \"amount\" : x.xxx, (numeric) The transaction amount in " + CURRENCY_UNIT + "\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"blockhash\" : \"hash\", (string) The block hash\n"
" \"blockindex\" : xx, (numeric) The index of the transaction in the block that includes it\n"
" \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
" \"txid\" : \"transactionid\", (string) The transaction id.\n"
" \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
" \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
" \"bip125-replaceable\": \"yes|no|unknown\", (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);\n"
" may be unknown for unconfirmed transactions not in the mempool\n"
" \"details\" : [\n"
" {\n"
" \"address\" : \"address\", (string) The aryacoin address involved in the transaction\n"
" \"category\" : (string) The transaction category.\n"
" \"send\" Transactions sent.\n"
" \"receive\" Non-coinbase transactions received.\n"
" \"generate\" Coinbase transactions received with more than 100 confirmations.\n"
" \"immature\" Coinbase transactions received with 100 or fewer confirmations.\n"
" \"orphan\" Orphaned coinbase transactions received.\n"
" \"amount\" : x.xxx, (numeric) The amount in " + CURRENCY_UNIT + "\n"
" \"label\" : \"label\", (string) A comment for the address/transaction, if any\n"
" \"vout\" : n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"abandoned\": xxx (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the \n"
" 'send' category of transactions.\n"
" }\n"
" ,...\n"
" ],\n"
" \"hex\" : \"data\" (string) Raw data for transaction\n"
"}\n"
},
RPCExamples{
HelpExampleCli("gettransaction", "\"dec0f22c36ea48b9de08d5d95ee21d40d228d931d07f2496d5189ac2d33fdbf3\"")
+ HelpExampleCli("gettransaction", "\"dec0f22c36ea48b9de08d5d95ee21d40d228d931d07f2496d5189ac2d33fdbf3\" true")
+ HelpExampleRpc("gettransaction", "\"dec0f22c36ea48b9de08d5d95ee21d40d228d931d07f2496d5189ac2d33fdbf3\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
uint256 hash(ParseHashV(request.params[0], "txid"));
isminefilter filter = ISMINE_SPENDABLE;
if(!request.params[1].isNull())
if(request.params[1].get_bool())
filter = filter | ISMINE_WATCH_ONLY;
UniValue entry(UniValue::VOBJ);
auto it = pwallet->mapWallet.find(hash);
if (it == pwallet->mapWallet.end()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id");
}
const CWalletTx& wtx = it->second;
CAmount nCredit = wtx.GetCredit(*locked_chain, filter);
CAmount nDebit = wtx.GetDebit(filter);
CAmount nNet = nCredit - nDebit;
CAmount nFee = (wtx.IsFromMe(filter) ? wtx.tx->GetValueOut() - nDebit : 0);
entry.pushKV("amount", ValueFromAmount(nNet - nFee));
if (wtx.IsFromMe(filter))
entry.pushKV("fee", ValueFromAmount(nFee));
WalletTxToJSON(pwallet->chain(), *locked_chain, wtx, entry);
UniValue details(UniValue::VARR);
ListTransactions(*locked_chain, pwallet, wtx, 0, false, details, filter, nullptr /* filter_label */);
entry.pushKV("details", details);
std::string strHex = EncodeHexTx(*wtx.tx, RPCSerializationFlags());
entry.pushKV("hex", strHex);
return entry;
}
static UniValue abandontransaction(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
RPCHelpMan{"abandontransaction",
"\nMark in-wallet transaction <txid> as abandoned\n"
"This will mark this transaction and all its in-wallet descendants as abandoned which will allow\n"
"for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions.\n"
"It only works on transactions which are not included in a block and are not currently in the mempool.\n"
"It has no effect on transactions which are already abandoned.\n",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
},
RPCResults{},
RPCExamples{
HelpExampleCli("abandontransaction", "\"dec0f22c36ea48b9de08d5d95ee21d40d228d931d07f2496d5189ac2d33fdbf3\"")
+ HelpExampleRpc("abandontransaction", "\"dec0f22c36ea48b9de08d5d95ee21d40d228d931d07f2496d5189ac2d33fdbf3\"")
},
}.ToString());
}
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
uint256 hash(ParseHashV(request.params[0], "txid"));
if (!pwallet->mapWallet.count(hash)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid or non-wallet transaction id");
}
if (!pwallet->AbandonTransaction(*locked_chain, hash)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not eligible for abandonment");
}
return NullUniValue;
}
static UniValue backupwallet(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
RPCHelpMan{"backupwallet",
"\nSafely copies current wallet file to destination, which can be a directory or a path with filename.\n",
{
{"destination", RPCArg::Type::STR, RPCArg::Optional::NO, "The destination directory or file"},
},
RPCResults{},
RPCExamples{
HelpExampleCli("backupwallet", "\"backup.dat\"")
+ HelpExampleRpc("backupwallet", "\"backup.dat\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
std::string strDest = request.params[0].get_str();
if (!pwallet->BackupWallet(strDest)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet backup failed!");
}
return NullUniValue;
}
static UniValue keypoolrefill(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
RPCHelpMan{"keypoolrefill",
"\nFills the keypool."+
HelpRequiringPassphrase(pwallet) + "\n",
{
{"newsize", RPCArg::Type::NUM, /* default */ "100", "The new keypool size"},
},
RPCResults{},
RPCExamples{
HelpExampleCli("keypoolrefill", "")
+ HelpExampleRpc("keypoolrefill", "")
},
}.ToString());
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Private keys are disabled for this wallet");
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
// 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
unsigned int kpSize = 0;
if (!request.params[0].isNull()) {
if (request.params[0].get_int() < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size.");
kpSize = (unsigned int)request.params[0].get_int();
}
EnsureWalletIsUnlocked(pwallet);
pwallet->TopUpKeyPool(kpSize);
if (pwallet->GetKeyPoolSize() < kpSize) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool.");
}
return NullUniValue;
}
static UniValue walletpassphrase(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 2) {
throw std::runtime_error(
RPCHelpMan{"walletpassphrase",
"\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
"This is needed prior to performing transactions related to private keys such as sending aryacoins\n"
"\nNote:\n"
"Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
"time that overrides the old one.\n",
{
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet passphrase"},
{"timeout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The time to keep the decryption key in seconds; capped at 100000000 (~3 years)."},
},
RPCResults{},
RPCExamples{
"\nUnlock the wallet for 60 seconds\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 60") +
"\nLock the wallet again (before 60 seconds)\n"
+ HelpExampleCli("walletlock", "") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("walletpassphrase", "\"my pass phrase\", 60")
},
}.ToString());
}
int64_t nSleepTime;
{
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrase was called.");
}
// Note that the walletpassphrase is stored in request.params[0] which is not mlock()ed
SecureString strWalletPass;
strWalletPass.reserve(100);
// TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)
// Alternately, find a way to make request.params[0] mlock()'d to begin with.
strWalletPass = request.params[0].get_str().c_str();
// Get the timeout
nSleepTime = request.params[1].get_int64();
// Timeout cannot be negative, otherwise it will relock immediately
if (nSleepTime < 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative.");
}
// Clamp timeout
constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug?
if (nSleepTime > MAX_SLEEP_TIME) {
nSleepTime = MAX_SLEEP_TIME;
}
if (strWalletPass.empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "passphrase can not be empty");
}
if (!pwallet->Unlock(strWalletPass)) {
throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
}
pwallet->TopUpKeyPool();
pwallet->nRelockTime = GetTime() + nSleepTime;
}
// rpcRunLater must be called without cs_wallet held otherwise a deadlock
// can occur. The deadlock would happen when RPCRunLater removes the
// previous timer (and waits for the callback to finish if already running)
// and the callback locks cs_wallet.
AssertLockNotHeld(wallet->cs_wallet);
// Keep a weak pointer to the wallet so that it is possible to unload the
// wallet before the following callback is called. If a valid shared pointer
// is acquired in the callback then the wallet is still loaded.
std::weak_ptr<CWallet> weak_wallet = wallet;
RPCRunLater(strprintf("lockwallet(%s)", pwallet->GetName()), [weak_wallet] {
if (auto shared_wallet = weak_wallet.lock()) {
LOCK(shared_wallet->cs_wallet);
shared_wallet->Lock();
shared_wallet->nRelockTime = 0;
}
}, nSleepTime);
return NullUniValue;
}
static UniValue walletpassphrasechange(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 2) {
throw std::runtime_error(
RPCHelpMan{"walletpassphrasechange",
"\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n",
{
{"oldpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The current passphrase"},
{"newpassphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The new passphrase"},
},
RPCResults{},
RPCExamples{
HelpExampleCli("walletpassphrasechange", "\"old one\" \"new one\"")
+ HelpExampleRpc("walletpassphrasechange", "\"old one\", \"new one\"")
},
}.ToString());
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletpassphrasechange was called.");
}
// TODO: get rid of these .c_str() calls by implementing SecureString::operator=(std::string)
// Alternately, find a way to make request.params[0] mlock()'d to begin with.
SecureString strOldWalletPass;
strOldWalletPass.reserve(100);
strOldWalletPass = request.params[0].get_str().c_str();
SecureString strNewWalletPass;
strNewWalletPass.reserve(100);
strNewWalletPass = request.params[1].get_str().c_str();
if (strOldWalletPass.empty() || strNewWalletPass.empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "passphrase can not be empty");
}
if (!pwallet->ChangeWalletPassphrase(strOldWalletPass, strNewWalletPass)) {
throw JSONRPCError(RPC_WALLET_PASSPHRASE_INCORRECT, "Error: The wallet passphrase entered was incorrect.");
}
return NullUniValue;
}
static UniValue walletlock(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
RPCHelpMan{"walletlock",
"\nRemoves the wallet encryption key from memory, locking the wallet.\n"
"After calling this method, you will need to call walletpassphrase again\n"
"before being able to call any methods which require the wallet to be unlocked.\n",
{},
RPCResults{},
RPCExamples{
"\nSet the passphrase for 2 minutes to perform a transaction\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\" 120") +
"\nPerform a send (requires passphrase set)\n"
+ HelpExampleCli("sendtoaddress", "\"AUzhDkVUrLyj44f1r6ahxxZh1iaDRgybxz\" 1.0") +
"\nClear the passphrase since we are done before 2 minutes is up\n"
+ HelpExampleCli("walletlock", "") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("walletlock", "")
},
}.ToString());
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (!pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an unencrypted wallet, but walletlock was called.");
}
pwallet->Lock();
pwallet->nRelockTime = 0;
return NullUniValue;
}
static UniValue encryptwallet(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
RPCHelpMan{"encryptwallet",
"\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
"After this, any calls that interact with private keys such as sending or signing \n"
"will require the passphrase to be set prior the making these calls.\n"
"Use the walletpassphrase call for this, and then walletlock call.\n"
"If the wallet is already encrypted, use the walletpassphrasechange call.\n",
{
{"passphrase", RPCArg::Type::STR, RPCArg::Optional::NO, "The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long."},
},
RPCResults{},
RPCExamples{
"\nEncrypt your wallet\n"
+ HelpExampleCli("encryptwallet", "\"my pass phrase\"") +
"\nNow set the passphrase to use the wallet, such as for signing or sending aryacoin\n"
+ HelpExampleCli("walletpassphrase", "\"my pass phrase\"") +
"\nNow we can do something like sign\n"
+ HelpExampleCli("signmessage", "\"address\" \"test message\"") +
"\nNow lock the wallet again by removing the passphrase\n"
+ HelpExampleCli("walletlock", "") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("encryptwallet", "\"my pass phrase\"")
},
}.ToString());
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (pwallet->IsCrypted()) {
throw JSONRPCError(RPC_WALLET_WRONG_ENC_STATE, "Error: running with an encrypted wallet, but encryptwallet was called.");
}
// TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)
// Alternately, find a way to make request.params[0] mlock()'d to begin with.
SecureString strWalletPass;
strWalletPass.reserve(100);
strWalletPass = request.params[0].get_str().c_str();
if (strWalletPass.empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "passphrase can not be empty");
}
if (!pwallet->EncryptWallet(strWalletPass)) {
throw JSONRPCError(RPC_WALLET_ENCRYPTION_FAILED, "Error: Failed to encrypt the wallet.");
}
return "wallet encrypted; The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.";
}
static UniValue lockunspent(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
throw std::runtime_error(
RPCHelpMan{"lockunspent",
"\nUpdates list of temporarily unspendable outputs.\n"
"Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs.\n"
"If no transaction outputs are specified when unlocking then all current locked transaction outputs are unlocked.\n"
"A locked transaction output will not be chosen by automatic coin selection, when spending aryacoins.\n"
"Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
"is always cleared (by virtue of process exit) when a node stops or fails.\n"
"Also see the listunspent call\n",
{
{"unlock", RPCArg::Type::BOOL, RPCArg::Optional::NO, "Whether to unlock (true) or lock (false) the specified transactions"},
{"transactions", RPCArg::Type::ARR, /* default */ "empty array", "A json array of objects. Each object the txid (string) vout (numeric).",
{
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
},
},
},
},
},
RPCResult{
"true|false (boolean) Whether the command was successful or not\n"
},
RPCExamples{
"\nList the unspent transactions\n"
+ HelpExampleCli("listunspent", "") +
"\nLock an unspent transaction\n"
+ HelpExampleCli("lockunspent", "false \"[{\\\"txid\\\":\\\"daaf44ec1e64e66ffda4a7e195ea60d5c8c8b602fc6bf22928582d3ff2530462\\\",\\\"vout\\\":1}]\"") +
"\nList the locked transactions\n"
+ HelpExampleCli("listlockunspent", "") +
"\nUnlock the transaction again\n"
+ HelpExampleCli("lockunspent", "true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("lockunspent", "false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
RPCTypeCheckArgument(request.params[0], UniValue::VBOOL);
bool fUnlock = request.params[0].get_bool();
if (request.params[1].isNull()) {
if (fUnlock)
pwallet->UnlockAllCoins();
return true;
}
RPCTypeCheckArgument(request.params[1], UniValue::VARR);
const UniValue& output_params = request.params[1];
// Create and validate the COutPoints first.
std::vector<COutPoint> outputs;
outputs.reserve(output_params.size());
for (unsigned int idx = 0; idx < output_params.size(); idx++) {
const UniValue& o = output_params[idx].get_obj();
RPCTypeCheckObj(o,
{
{"txid", UniValueType(UniValue::VSTR)},
{"vout", UniValueType(UniValue::VNUM)},
});
const uint256 txid(ParseHashO(o, "txid"));
const int nOutput = find_value(o, "vout").get_int();
if (nOutput < 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive");
}
const COutPoint outpt(txid, nOutput);
const auto it = pwallet->mapWallet.find(outpt.hash);
if (it == pwallet->mapWallet.end()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, unknown transaction");
}
const CWalletTx& trans = it->second;
if (outpt.n >= trans.tx->vout.size()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout index out of bounds");
}
if (pwallet->IsSpent(*locked_chain, outpt.hash, outpt.n)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected unspent output");
}
const bool is_locked = pwallet->IsLockedCoin(outpt.hash, outpt.n);
if (fUnlock && !is_locked) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected locked output");
}
if (!fUnlock && is_locked) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, output already locked");
}
outputs.push_back(outpt);
}
// Atomically set (un)locked status for the outputs.
for (const COutPoint& outpt : outputs) {
if (fUnlock) pwallet->UnlockCoin(outpt);
else pwallet->LockCoin(outpt);
}
return true;
}
static UniValue listlockunspent(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 0)
throw std::runtime_error(
RPCHelpMan{"listlockunspent",
"\nReturns list of temporarily unspendable outputs.\n"
"See the lockunspent call to lock and unlock transactions for spending.\n",
{},
RPCResult{
"[\n"
" {\n"
" \"txid\" : \"transactionid\", (string) The transaction id locked\n"
" \"vout\" : n (numeric) The vout value\n"
" }\n"
" ,...\n"
"]\n"
},
RPCExamples{
"\nList the unspent transactions\n"
+ HelpExampleCli("listunspent", "") +
"\nLock an unspent transaction\n"
+ HelpExampleCli("lockunspent", "false \"[{\\\"txid\\\":\\\"daaf44ec1e64e66ffda4a7e195ea60d5c8c8b602fc6bf22928582d3ff2530462\\\",\\\"vout\\\":1}]\"") +
"\nList the locked transactions\n"
+ HelpExampleCli("listlockunspent", "") +
"\nUnlock the transaction again\n"
+ HelpExampleCli("lockunspent", "true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("listlockunspent", "")
},
}.ToString());
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
std::vector<COutPoint> vOutpts;
pwallet->ListLockedCoins(vOutpts);
UniValue ret(UniValue::VARR);
for (const COutPoint& outpt : vOutpts) {
UniValue o(UniValue::VOBJ);
o.pushKV("txid", outpt.hash.GetHex());
o.pushKV("vout", (int)outpt.n);
ret.push_back(o);
}
return ret;
}
static UniValue settxfee(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 1) {
throw std::runtime_error(
RPCHelpMan{"settxfee",
"\nSet the transaction fee per kB for this wallet. Overrides the global -paytxfee command line parameter.\n",
{
{"feeamount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The transaction fee in " + CURRENCY_UNIT + "/kB"},
},
RPCResult{
"true|false (boolean) Returns true if successful\n"
},
RPCExamples{
HelpExampleCli("settxfee", "0.00001")
+ HelpExampleRpc("settxfee", "0.00001")
},
}.ToString());
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
CAmount nAmount = AmountFromValue(request.params[0]);
CFeeRate tx_fee_rate(nAmount, 1000);
if (tx_fee_rate == 0) {
// automatic selection
} else if (tx_fee_rate < ::minRelayTxFee) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("txfee cannot be less than min relay tx fee (%s)", ::minRelayTxFee.ToString()));
}
pwallet->m_pay_tx_fee = tx_fee_rate;
return true;
}
static UniValue getwalletinfo(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
RPCHelpMan{"getwalletinfo",
"Returns an object containing various wallet state info.\n",
{},
RPCResult{
"{\n"
" \"walletname\": xxxxx, (string) the wallet name\n"
" \"walletversion\": xxxxx, (numeric) the wallet version\n"
" \"balance\": xxxxxxx, (numeric) the total confirmed balance of the wallet in " + CURRENCY_UNIT + "\n"
" \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in " + CURRENCY_UNIT + "\n"
" \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in " + CURRENCY_UNIT + "\n"
" \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
" \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool\n"
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated (only counts external keys)\n"
" \"keypoolsize_hd_internal\": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)\n"
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
" \"paytxfee\": x.xxxx, (numeric) the transaction fee configuration, set in " + CURRENCY_UNIT + "/kB\n"
" \"hdseedid\": \"<hash160>\" (string, optional) the Hash160 of the HD seed (only present when HD is enabled)\n"
" \"private_keys_enabled\": true|false (boolean) false if privatekeys are disabled for this wallet (enforced watch-only wallet)\n"
"}\n"
},
RPCExamples{
HelpExampleCli("getwalletinfo", "")
+ HelpExampleRpc("getwalletinfo", "")
},
}.ToString());
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
UniValue obj(UniValue::VOBJ);
size_t kpExternalSize = pwallet->KeypoolCountExternalKeys();
obj.pushKV("walletname", pwallet->GetName());
obj.pushKV("walletversion", pwallet->GetVersion());
obj.pushKV("balance", ValueFromAmount(pwallet->GetBalance()));
obj.pushKV("unconfirmed_balance", ValueFromAmount(pwallet->GetUnconfirmedBalance()));
obj.pushKV("immature_balance", ValueFromAmount(pwallet->GetImmatureBalance()));
obj.pushKV("txcount", (int)pwallet->mapWallet.size());
obj.pushKV("keypoololdest", pwallet->GetOldestKeyPoolTime());
obj.pushKV("keypoolsize", (int64_t)kpExternalSize);
CKeyID seed_id = pwallet->GetHDChain().seed_id;
if (pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) {
obj.pushKV("keypoolsize_hd_internal", (int64_t)(pwallet->GetKeyPoolSize() - kpExternalSize));
}
if (pwallet->IsCrypted()) {
obj.pushKV("unlocked_until", pwallet->nRelockTime);
}
obj.pushKV("paytxfee", ValueFromAmount(pwallet->m_pay_tx_fee.GetFeePerK()));
if (!seed_id.IsNull()) {
obj.pushKV("hdseedid", seed_id.GetHex());
}
obj.pushKV("private_keys_enabled", !pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS));
return obj;
}
static UniValue listwalletdir(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0) {
throw std::runtime_error(
RPCHelpMan{"listwalletdir",
"Returns a list of wallets in the wallet directory.\n",
{},
RPCResult{
"{\n"
" \"wallets\" : [ (json array of objects)\n"
" {\n"
" \"name\" : \"name\" (string) The wallet name\n"
" }\n"
" ,...\n"
" ]\n"
"}\n"
},
RPCExamples{
HelpExampleCli("listwalletdir", "")
+ HelpExampleRpc("listwalletdir", "")
},
}.ToString());
}
UniValue wallets(UniValue::VARR);
for (const auto& path : ListWalletDir()) {
UniValue wallet(UniValue::VOBJ);
wallet.pushKV("name", path.string());
wallets.push_back(wallet);
}
UniValue result(UniValue::VOBJ);
result.pushKV("wallets", wallets);
return result;
}
static UniValue listwallets(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
RPCHelpMan{"listwallets",
"Returns a list of currently loaded wallets.\n"
"For full information on the wallet, use \"getwalletinfo\"\n",
{},
RPCResult{
"[ (json array of strings)\n"
" \"walletname\" (string) the wallet name\n"
" ...\n"
"]\n"
},
RPCExamples{
HelpExampleCli("listwallets", "")
+ HelpExampleRpc("listwallets", "")
},
}.ToString());
UniValue obj(UniValue::VARR);
for (const std::shared_ptr<CWallet>& wallet : GetWallets()) {
if (!EnsureWalletIsAvailable(wallet.get(), request.fHelp)) {
return NullUniValue;
}
LOCK(wallet->cs_wallet);
obj.push_back(wallet->GetName());
}
return obj;
}
static UniValue loadwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
RPCHelpMan{"loadwallet",
"\nLoads a wallet from a wallet file or directory."
"\nNote that all wallet command-line options used when starting aryacoind will be"
"\napplied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n",
{
{"filename", RPCArg::Type::STR, RPCArg::Optional::NO, "The wallet directory or .dat file."},
},
RPCResult{
"{\n"
" \"name\" : <wallet_name>, (string) The wallet name if loaded successfully.\n"
" \"warning\" : <warning>, (string) Warning message if wallet was not loaded cleanly.\n"
"}\n"
},
RPCExamples{
HelpExampleCli("loadwallet", "\"test.dat\"")
+ HelpExampleRpc("loadwallet", "\"test.dat\"")
},
}.ToString());
WalletLocation location(request.params[0].get_str());
if (!location.Exists()) {
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + location.GetName() + " not found.");
} else if (fs::is_directory(location.GetPath())) {
// The given filename is a directory. Check that there's a wallet.dat file.
fs::path wallet_dat_file = location.GetPath() / "wallet.dat";
if (fs::symlink_status(wallet_dat_file).type() == fs::file_not_found) {
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Directory " + location.GetName() + " does not contain a wallet.dat file.");
}
}
std::string error, warning;
std::shared_ptr<CWallet> const wallet = LoadWallet(*g_rpc_interfaces->chain, location, error, warning);
if (!wallet) throw JSONRPCError(RPC_WALLET_ERROR, error);
UniValue obj(UniValue::VOBJ);
obj.pushKV("name", wallet->GetName());
obj.pushKV("warning", warning);
return obj;
}
static UniValue createwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3) {
throw std::runtime_error(
RPCHelpMan{"createwallet",
"\nCreates and loads a new wallet.\n",
{
{"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name for the new wallet. If this is a path, the wallet will be created at the path location."},
{"disable_private_keys", RPCArg::Type::BOOL, /* default */ "false", "Disable the possibility of private keys (only watchonlys are possible in this mode)."},
{"blank", RPCArg::Type::BOOL, /* default */ "false", "Create a blank wallet. A blank wallet has no keys or HD seed. One can be set using sethdseed."},
},
RPCResult{
"{\n"
" \"name\" : <wallet_name>, (string) The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path.\n"
" \"warning\" : <warning>, (string) Warning message if wallet was not loaded cleanly.\n"
"}\n"
},
RPCExamples{
HelpExampleCli("createwallet", "\"testwallet\"")
+ HelpExampleRpc("createwallet", "\"testwallet\"")
},
}.ToString());
}
std::string error;
std::string warning;
uint64_t flags = 0;
if (!request.params[1].isNull() && request.params[1].get_bool()) {
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
}
if (!request.params[2].isNull() && request.params[2].get_bool()) {
flags |= WALLET_FLAG_BLANK_WALLET;
}
WalletLocation location(request.params[0].get_str());
if (location.Exists()) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet " + location.GetName() + " already exists.");
}
// Wallet::Verify will check if we're trying to create a wallet with a duplication name.
if (!CWallet::Verify(*g_rpc_interfaces->chain, location, false, error, warning)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error);
}
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(*g_rpc_interfaces->chain, location, flags);
if (!wallet) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet creation failed.");
}
AddWallet(wallet);
wallet->postInitProcess();
UniValue obj(UniValue::VOBJ);
obj.pushKV("name", wallet->GetName());
obj.pushKV("warning", warning);
return obj;
}
static UniValue unloadwallet(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() > 1) {
throw std::runtime_error(
RPCHelpMan{"unloadwallet",
"Unloads the wallet referenced by the request endpoint otherwise unloads the wallet specified in the argument.\n"
"Specifying the wallet name on a wallet endpoint is invalid.",
{
{"wallet_name", RPCArg::Type::STR, /* default */ "the wallet name from the RPC request", "The name of the wallet to unload."},
},
RPCResults{},
RPCExamples{
HelpExampleCli("unloadwallet", "wallet_name")
+ HelpExampleRpc("unloadwallet", "wallet_name")
},
}.ToString());
}
std::string wallet_name;
if (GetWalletNameFromJSONRPCRequest(request, wallet_name)) {
if (!request.params[0].isNull()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot unload the requested wallet");
}
} else {
wallet_name = request.params[0].get_str();
}
std::shared_ptr<CWallet> wallet = GetWallet(wallet_name);
if (!wallet) {
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Requested wallet does not exist or is not loaded");
}
// Release the "main" shared pointer and prevent further notifications.
// Note that any attempt to load the same wallet would fail until the wallet
// is destroyed (see CheckUniqueFileid).
if (!RemoveWallet(wallet)) {
throw JSONRPCError(RPC_MISC_ERROR, "Requested wallet already unloaded");
}
UnloadWallet(std::move(wallet));
return NullUniValue;
}
static UniValue resendwallettransactions(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 0)
throw std::runtime_error(
RPCHelpMan{"resendwallettransactions",
"Immediately re-broadcast unconfirmed wallet transactions to all peers.\n"
"Intended only for testing; the wallet code periodically re-broadcasts\n"
"automatically.\n",
{},
RPCResult{
"Returns an RPC error if -walletbroadcast is set to false.\n"
"Returns array of transaction ids that were re-broadcast.\n"
},
RPCExamples{""},
}.ToString()
);
if (!g_connman)
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
if (!pwallet->GetBroadcastTransactions()) {
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast");
}
std::vector<uint256> txids = pwallet->ResendWalletTransactionsBefore(*locked_chain, GetTime(), g_connman.get());
UniValue result(UniValue::VARR);
for (const uint256& txid : txids)
{
result.push_back(txid.ToString());
}
return result;
}
static UniValue listunspent(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 5)
throw std::runtime_error(
RPCHelpMan{"listunspent",
"\nReturns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filter to only include txouts paid to specified addresses.\n",
{
{"minconf", RPCArg::Type::NUM, /* default */ "1", "The minimum confirmations to filter"},
{"maxconf", RPCArg::Type::NUM, /* default */ "9999999", "The maximum confirmations to filter"},
{"addresses", RPCArg::Type::ARR, /* default */ "empty array", "A json array of aryacoin addresses to filter",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "aryacoin address"},
},
},
{"include_unsafe", RPCArg::Type::BOOL, /* default */ "true", "Include outputs that are not safe to spend\n"
" See description of \"safe\" attribute below."},
{"query_options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "JSON with query options",
{
{"minimumAmount", RPCArg::Type::AMOUNT, /* default */ "0", "Minimum value of each UTXO in " + CURRENCY_UNIT + ""},
{"maximumAmount", RPCArg::Type::AMOUNT, /* default */ "unlimited", "Maximum value of each UTXO in " + CURRENCY_UNIT + ""},
{"maximumCount", RPCArg::Type::NUM, /* default */ "unlimited", "Maximum number of UTXOs"},
{"minimumSumAmount", RPCArg::Type::AMOUNT, /* default */ "unlimited", "Minimum sum value of all UTXOs in " + CURRENCY_UNIT + ""},
},
"query_options"},
},
RPCResult{
"[ (array of json object)\n"
" {\n"
" \"txid\" : \"txid\", (string) the transaction id \n"
" \"vout\" : n, (numeric) the vout value\n"
" \"address\" : \"address\", (string) the aryacoin address\n"
" \"label\" : \"label\", (string) The associated label, or \"\" for the default label\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
" \"amount\" : x.xxx, (numeric) the transaction output amount in " + CURRENCY_UNIT + "\n"
" \"confirmations\" : n, (numeric) The number of confirmations\n"
" \"redeemScript\" : \"script\" (string) The redeemScript if scriptPubKey is P2SH\n"
" \"witnessScript\" : \"script\" (string) witnessScript if the scriptPubKey is P2WSH or P2SH-P2WSH\n"
" \"spendable\" : xxx, (bool) Whether we have the private keys to spend this output\n"
" \"solvable\" : xxx, (bool) Whether we know how to spend this output, ignoring the lack of keys\n"
" \"desc\" : xxx, (string, only when solvable) A descriptor for spending this output\n"
" \"safe\" : xxx (bool) Whether this output is considered safe to spend. Unconfirmed transactions\n"
" from outside keys and unconfirmed replacement transactions are considered unsafe\n"
" and are not eligible for spending by fundrawtransaction and sendtoaddress.\n"
" }\n"
" ,...\n"
"]\n"
},
RPCExamples{
HelpExampleCli("listunspent", "")
+ HelpExampleCli("listunspent", "6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
+ HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
+ HelpExampleCli("listunspent", "6 9999999 '[]' true '{ \"minimumAmount\": 0.005 }'")
+ HelpExampleRpc("listunspent", "6, 9999999, [] , true, { \"minimumAmount\": 0.005 } ")
},
}.ToString());
int nMinDepth = 1;
if (!request.params[0].isNull()) {
RPCTypeCheckArgument(request.params[0], UniValue::VNUM);
nMinDepth = request.params[0].get_int();
}
int nMaxDepth = 9999999;
if (!request.params[1].isNull()) {
RPCTypeCheckArgument(request.params[1], UniValue::VNUM);
nMaxDepth = request.params[1].get_int();
}
std::set<CTxDestination> destinations;
if (!request.params[2].isNull()) {
RPCTypeCheckArgument(request.params[2], UniValue::VARR);
UniValue inputs = request.params[2].get_array();
for (unsigned int idx = 0; idx < inputs.size(); idx++) {
const UniValue& input = inputs[idx];
CTxDestination dest = DecodeDestination(input.get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Aryacoin address: ") + input.get_str());
}
if (!destinations.insert(dest).second) {
throw JSONRPCError(RPC_INVALID_PARAMETER, std::string("Invalid parameter, duplicated address: ") + input.get_str());
}
}
}
bool include_unsafe = true;
if (!request.params[3].isNull()) {
RPCTypeCheckArgument(request.params[3], UniValue::VBOOL);
include_unsafe = request.params[3].get_bool();
}
CAmount nMinimumAmount = 0;
CAmount nMaximumAmount = MAX_MONEY;
CAmount nMinimumSumAmount = MAX_MONEY;
uint64_t nMaximumCount = 0;
if (!request.params[4].isNull()) {
const UniValue& options = request.params[4].get_obj();
if (options.exists("minimumAmount"))
nMinimumAmount = AmountFromValue(options["minimumAmount"]);
if (options.exists("maximumAmount"))
nMaximumAmount = AmountFromValue(options["maximumAmount"]);
if (options.exists("minimumSumAmount"))
nMinimumSumAmount = AmountFromValue(options["minimumSumAmount"]);
if (options.exists("maximumCount"))
nMaximumCount = options["maximumCount"].get_int64();
}
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
UniValue results(UniValue::VARR);
std::vector<COutput> vecOutputs;
{
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
pwallet->AvailableCoins(*locked_chain, vecOutputs, !include_unsafe, nullptr, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount, nMinDepth, nMaxDepth);
}
LOCK(pwallet->cs_wallet);
for (const COutput& out : vecOutputs) {
CTxDestination address;
const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey;
bool fValidAddress = ExtractDestination(scriptPubKey, address);
if (destinations.size() && (!fValidAddress || !destinations.count(address)))
continue;
UniValue entry(UniValue::VOBJ);
entry.pushKV("txid", out.tx->GetHash().GetHex());
entry.pushKV("vout", out.i);
if (fValidAddress) {
entry.pushKV("address", EncodeDestination(address));
auto i = pwallet->mapAddressBook.find(address);
if (i != pwallet->mapAddressBook.end()) {
entry.pushKV("label", i->second.name);
}
if (scriptPubKey.IsPayToScriptHash()) {
const CScriptID& hash = boost::get<CScriptID>(address);
CScript redeemScript;
if (pwallet->GetCScript(hash, redeemScript)) {
entry.pushKV("redeemScript", HexStr(redeemScript.begin(), redeemScript.end()));
// Now check if the redeemScript is actually a P2WSH script
CTxDestination witness_destination;
if (redeemScript.IsPayToWitnessScriptHash()) {
bool extracted = ExtractDestination(redeemScript, witness_destination);
assert(extracted);
// Also return the witness script
const WitnessV0ScriptHash& whash = boost::get<WitnessV0ScriptHash>(witness_destination);
CScriptID id;
CRIPEMD160().Write(whash.begin(), whash.size()).Finalize(id.begin());
CScript witnessScript;
if (pwallet->GetCScript(id, witnessScript)) {
entry.pushKV("witnessScript", HexStr(witnessScript.begin(), witnessScript.end()));
}
}
}
} else if (scriptPubKey.IsPayToWitnessScriptHash()) {
const WitnessV0ScriptHash& whash = boost::get<WitnessV0ScriptHash>(address);
CScriptID id;
CRIPEMD160().Write(whash.begin(), whash.size()).Finalize(id.begin());
CScript witnessScript;
if (pwallet->GetCScript(id, witnessScript)) {
entry.pushKV("witnessScript", HexStr(witnessScript.begin(), witnessScript.end()));
}
}
}
entry.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue));
entry.pushKV("rawconfirmations",out.nDepth);
entry.pushKV("confirmations", komodo_dpowconfs((int32_t)komodo_blockheight(out.tx->hashBlock),out.nDepth));
entry.pushKV("spendable", out.fSpendable);
entry.pushKV("solvable", out.fSolvable);
if (out.fSolvable) {
auto descriptor = InferDescriptor(scriptPubKey, *pwallet);
entry.pushKV("desc", descriptor->ToString());
}
entry.pushKV("safe", out.fSafe);
results.push_back(entry);
}
return results;
}
void FundTransaction(CWallet* const pwallet, CMutableTransaction& tx, CAmount& fee_out, int& change_position, UniValue options)
{
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
CCoinControl coinControl;
change_position = -1;
bool lockUnspents = false;
UniValue subtractFeeFromOutputs;
std::set<int> setSubtractFeeFromOutputs;
if (!options.isNull()) {
if (options.type() == UniValue::VBOOL) {
// backward compatibility bool only fallback
coinControl.fAllowWatchOnly = options.get_bool();
}
else {
RPCTypeCheckArgument(options, UniValue::VOBJ);
RPCTypeCheckObj(options,
{
{"changeAddress", UniValueType(UniValue::VSTR)},
{"changePosition", UniValueType(UniValue::VNUM)},
{"change_type", UniValueType(UniValue::VSTR)},
{"includeWatching", UniValueType(UniValue::VBOOL)},
{"lockUnspents", UniValueType(UniValue::VBOOL)},
{"feeRate", UniValueType()}, // will be checked below
{"subtractFeeFromOutputs", UniValueType(UniValue::VARR)},
{"replaceable", UniValueType(UniValue::VBOOL)},
{"conf_target", UniValueType(UniValue::VNUM)},
{"estimate_mode", UniValueType(UniValue::VSTR)},
},
true, true);
if (options.exists("changeAddress")) {
CTxDestination dest = DecodeDestination(options["changeAddress"].get_str());
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "changeAddress must be a valid aryacoin address");
}
coinControl.destChange = dest;
}
if (options.exists("changePosition"))
change_position = options["changePosition"].get_int();
if (options.exists("change_type")) {
if (options.exists("changeAddress")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both changeAddress and address_type options");
}
coinControl.m_change_type = pwallet->m_default_change_type;
if (!ParseOutputType(options["change_type"].get_str(), *coinControl.m_change_type)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Unknown change type '%s'", options["change_type"].get_str()));
}
}
if (options.exists("includeWatching"))
coinControl.fAllowWatchOnly = options["includeWatching"].get_bool();
if (options.exists("lockUnspents"))
lockUnspents = options["lockUnspents"].get_bool();
if (options.exists("feeRate"))
{
coinControl.m_feerate = CFeeRate(AmountFromValue(options["feeRate"]));
coinControl.fOverrideFeeRate = true;
}
if (options.exists("subtractFeeFromOutputs"))
subtractFeeFromOutputs = options["subtractFeeFromOutputs"].get_array();
if (options.exists("replaceable")) {
coinControl.m_signal_bip125_rbf = options["replaceable"].get_bool();
}
if (options.exists("conf_target")) {
if (options.exists("feeRate")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both conf_target and feeRate");
}
coinControl.m_confirm_target = ParseConfirmTarget(options["conf_target"]);
}
if (options.exists("estimate_mode")) {
if (options.exists("feeRate")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and feeRate");
}
if (!FeeModeFromString(options["estimate_mode"].get_str(), coinControl.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
}
}
if (tx.vout.size() == 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output");
if (change_position != -1 && (change_position < 0 || (unsigned int)change_position > tx.vout.size()))
throw JSONRPCError(RPC_INVALID_PARAMETER, "changePosition out of bounds");
for (unsigned int idx = 0; idx < subtractFeeFromOutputs.size(); idx++) {
int pos = subtractFeeFromOutputs[idx].get_int();
if (setSubtractFeeFromOutputs.count(pos))
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, duplicated position: %d", pos));
if (pos < 0)
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, negative position: %d", pos));
if (pos >= int(tx.vout.size()))
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, position too large: %d", pos));
setSubtractFeeFromOutputs.insert(pos);
}
std::string strFailReason;
if (!pwallet->FundTransaction(tx, fee_out, change_position, strFailReason, lockUnspents, setSubtractFeeFromOutputs, coinControl)) {
throw JSONRPCError(RPC_WALLET_ERROR, strFailReason);
}
}
static UniValue fundrawtransaction(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
const RPCHelpMan help{"fundrawtransaction",
"\nAdd inputs to a transaction until it has enough in value to meet its out value.\n"
"This will not modify existing inputs, and will add at most one change output to the outputs.\n"
"No existing outputs will be modified unless \"subtractFeeFromOutputs\" is specified.\n"
"Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n"
"The inputs added will not be signed, use signrawtransactionwithkey\n"
" or signrawtransactionwithwallet for that.\n"
"Note that all existing inputs must have their previous output transaction be in the wallet.\n"
"Note that all inputs selected must be of standard form and P2SH scripts must be\n"
"in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
"You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
"Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n",
{
{"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex string of the raw transaction"},
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "for backward compatibility: passing in a true instead of an object will result in {\"includeWatching\":true}",
{
{"changeAddress", RPCArg::Type::STR, /* default */ "pool address", "The aryacoin address to receive the change"},
{"changePosition", RPCArg::Type::NUM, /* default */ "random", "The index of the change output"},
{"change_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
{"includeWatching", RPCArg::Type::BOOL, /* default */ "false", "Also select inputs which are watch only"},
{"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", "Lock selected unspent outputs"},
{"feeRate", RPCArg::Type::AMOUNT, /* default */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"},
{"subtractFeeFromOutputs", RPCArg::Type::ARR, /* default */ "empty array", "A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n"
" Those recipients will receive less aryacoins than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.",
{
{"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
},
},
{"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees"},
{"conf_target", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
"options"},
{"iswitness", RPCArg::Type::BOOL, /* default */ "depends on heuristic tests", "Whether the transaction hex is a serialized witness transaction.\n"
"If iswitness is not present, heuristic tests will be used in decoding.\n"
"If true, only witness deserialization will be tried.\n"
"If false, only non-witness deserialization will be tried.\n"
"This boolean should reflect whether the transaction has inputs\n"
"(e.g. fully valid, or on-chain transactions), if known by the caller."
},
},
RPCResult{
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
" \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
},
RPCExamples{
"\nCreate a transaction with no inputs\n"
+ HelpExampleCli("createrawtransaction", "\"[]\" \"{\\\"myaddress\\\":0.01}\"") +
"\nAdd sufficient unsigned inputs to meet the output value\n"
+ HelpExampleCli("fundrawtransaction", "\"rawtransactionhex\"") +
"\nSign the transaction\n"
+ HelpExampleCli("signrawtransactionwithwallet", "\"fundedtransactionhex\"") +
"\nSend the transaction\n"
+ HelpExampleCli("sendrawtransaction", "\"signedtransactionhex\"")
},
};
if (request.fHelp || !help.IsValidNumArgs(request.params.size())) {
throw std::runtime_error(help.ToString());
}
RPCTypeCheck(request.params, {UniValue::VSTR, UniValueType(), UniValue::VBOOL});
// parse hex string from parameter
CMutableTransaction tx;
bool try_witness = request.params[2].isNull() ? true : request.params[2].get_bool();
bool try_no_witness = request.params[2].isNull() ? true : !request.params[2].get_bool();
if (!DecodeHexTx(tx, request.params[0].get_str(), try_no_witness, try_witness)) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
CAmount fee;
int change_position;
FundTransaction(pwallet, tx, fee, change_position, request.params[1]);
UniValue result(UniValue::VOBJ);
result.pushKV("hex", EncodeHexTx(CTransaction(tx)));
result.pushKV("fee", ValueFromAmount(fee));
result.pushKV("changepos", change_position);
return result;
}
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 3)
throw std::runtime_error(
RPCHelpMan{"signrawtransactionwithwallet",
"\nSign inputs for raw transaction (serialized, hex-encoded).\n"
"The second optional argument (may be null) is an array of previous transaction outputs that\n"
"this transaction depends on but may not yet be in the block chain." +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
{"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, "A json array of previous dependent transaction outputs",
{
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"scriptPubKey", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "script key"},
{"redeemScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2SH) redeem script"},
{"witnessScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "(required for P2WSH or P2SH-P2WSH) witness script"},
{"amount", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The amount spent"},
},
},
},
},
{"sighashtype", RPCArg::Type::STR, /* default */ "ALL", "The signature hash type. Must be one of\n"
" \"ALL\"\n"
" \"NONE\"\n"
" \"SINGLE\"\n"
" \"ALL|ANYONECANPAY\"\n"
" \"NONE|ANYONECANPAY\"\n"
" \"SINGLE|ANYONECANPAY\""},
},
RPCResult{
"{\n"
" \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
" \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n"
" {\n"
" \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n"
" \"vout\" : n, (numeric) The index of the output to spent and used as input\n"
" \"scriptSig\" : \"hex\", (string) The hex-encoded signature script\n"
" \"sequence\" : n, (numeric) Script sequence number\n"
" \"error\" : \"text\" (string) Verification or signing error related to the input\n"
" }\n"
" ,...\n"
" ]\n"
"}\n"
},
RPCExamples{
HelpExampleCli("signrawtransactionwithwallet", "\"myhex\"")
+ HelpExampleRpc("signrawtransactionwithwallet", "\"myhex\"")
},
}.ToString());
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VARR, UniValue::VSTR}, true);
CMutableTransaction mtx;
if (!DecodeHexTx(mtx, request.params[0].get_str(), true)) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
}
// Sign the transaction
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
EnsureWalletIsUnlocked(pwallet);
return SignTransaction(pwallet->chain(), mtx, request.params[1], pwallet, false, request.params[2]);
}
static UniValue bumpfee(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
return NullUniValue;
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
RPCHelpMan{"bumpfee",
"\nBumps the fee of an opt-in-RBF transaction T, replacing it with a new transaction B.\n"
"An opt-in RBF transaction with the given txid must be in the wallet.\n"
"The command will pay the additional fee by decreasing (or perhaps removing) its change output.\n"
"If the change output is not big enough to cover the increased fee, the command will currently fail\n"
"instead of adding new inputs to compensate. (A future implementation could improve this.)\n"
"The command will fail if the wallet or mempool contains a transaction that spends one of T's outputs.\n"
"By default, the new fee will be calculated automatically using estimatesmartfee.\n"
"The user can specify a confirmation target for estimatesmartfee.\n"
"Alternatively, the user can specify totalFee, or use RPC settxfee to set a higher fee rate.\n"
"At a minimum, the new fee rate must be high enough to pay an additional new relay fee (incrementalfee\n"
"returned by getnetworkinfo) to enter the node's mempool.\n",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid to be bumped"},
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
{
{"confTarget", RPCArg::Type::NUM, /* default */ "wallet default", "Confirmation target (in blocks)"},
{"totalFee", RPCArg::Type::NUM, /* default */ "fallback to 'confTarget'", "Total fee (NOT feerate) to pay, in satoshis.\n"
" In rare cases, the actual fee paid might be slightly higher than the specified\n"
" totalFee if the tx change output has to be removed because it is too close to\n"
" the dust threshold."},
{"replaceable", RPCArg::Type::BOOL, /* default */ "true", "Whether the new transaction should still be\n"
" marked bip-125 replaceable. If true, the sequence numbers in the transaction will\n"
" be left unchanged from the original. If false, any input sequence numbers in the\n"
" original transaction that were less than 0xfffffffe will be increased to 0xfffffffe\n"
" so the new transaction will not be explicitly bip-125 replaceable (though it may\n"
" still be replaceable in practice, for example if it has unconfirmed ancestors which\n"
" are replaceable)."},
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
"options"},
},
RPCResult{
"{\n"
" \"txid\": \"value\", (string) The id of the new transaction\n"
" \"origfee\": n, (numeric) Fee of the replaced transaction\n"
" \"fee\": n, (numeric) Fee of the new transaction\n"
" \"errors\": [ str... ] (json array of strings) Errors encountered during processing (may be empty)\n"
"}\n"
},
RPCExamples{
"\nBump the fee, get the new transaction\'s txid\n" +
HelpExampleCli("bumpfee", "<txid>")
},
}.ToString());
}
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VOBJ});
uint256 hash(ParseHashV(request.params[0], "txid"));
// optional parameters
CAmount totalFee = 0;
CCoinControl coin_control;
coin_control.m_signal_bip125_rbf = true;
if (!request.params[1].isNull()) {
UniValue options = request.params[1];
RPCTypeCheckObj(options,
{
{"confTarget", UniValueType(UniValue::VNUM)},
{"totalFee", UniValueType(UniValue::VNUM)},
{"replaceable", UniValueType(UniValue::VBOOL)},
{"estimate_mode", UniValueType(UniValue::VSTR)},
},
true, true);
if (options.exists("confTarget") && options.exists("totalFee")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "confTarget and totalFee options should not both be set. Please provide either a confirmation target for fee estimation or an explicit total fee for the transaction.");
} else if (options.exists("confTarget")) { // TODO: alias this to conf_target
coin_control.m_confirm_target = ParseConfirmTarget(options["confTarget"]);
} else if (options.exists("totalFee")) {
totalFee = options["totalFee"].get_int64();
if (totalFee <= 0) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid totalFee %s (must be greater than 0)", FormatMoney(totalFee)));
}
}
if (options.exists("replaceable")) {
coin_control.m_signal_bip125_rbf = options["replaceable"].get_bool();
}
if (options.exists("estimate_mode")) {
if (!FeeModeFromString(options["estimate_mode"].get_str(), coin_control.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
}
}
}
// Make sure the results are valid at least up to the most recent block
// the user could have gotten from another RPC command prior to now
pwallet->BlockUntilSyncedToCurrentChain();
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
EnsureWalletIsUnlocked(pwallet);
std::vector<std::string> errors;
CAmount old_fee;
CAmount new_fee;
CMutableTransaction mtx;
feebumper::Result res = feebumper::CreateTransaction(pwallet, hash, coin_control, totalFee, errors, old_fee, new_fee, mtx);
if (res != feebumper::Result::OK) {
switch(res) {
case feebumper::Result::INVALID_ADDRESS_OR_KEY:
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, errors[0]);
break;
case feebumper::Result::INVALID_REQUEST:
throw JSONRPCError(RPC_INVALID_REQUEST, errors[0]);
break;
case feebumper::Result::INVALID_PARAMETER:
throw JSONRPCError(RPC_INVALID_PARAMETER, errors[0]);
break;
case feebumper::Result::WALLET_ERROR:
throw JSONRPCError(RPC_WALLET_ERROR, errors[0]);
break;
default:
throw JSONRPCError(RPC_MISC_ERROR, errors[0]);
break;
}
}
// sign bumped transaction
if (!feebumper::SignTransaction(pwallet, mtx)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction.");
}
// commit the bumped transaction
uint256 txid;
if (feebumper::CommitTransaction(pwallet, hash, std::move(mtx), errors, txid) != feebumper::Result::OK) {
throw JSONRPCError(RPC_WALLET_ERROR, errors[0]);
}
UniValue result(UniValue::VOBJ);
result.pushKV("txid", txid.GetHex());
result.pushKV("origfee", ValueFromAmount(old_fee));
result.pushKV("fee", ValueFromAmount(new_fee));
UniValue result_errors(UniValue::VARR);
for (const std::string& error : errors) {
result_errors.push_back(error);
}
result.pushKV("errors", result_errors);
return result;
}
UniValue generate(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
throw std::runtime_error(
RPCHelpMan{"generate",
"\nMine up to nblocks blocks immediately (before the RPC call returns) to an address in the wallet.\n",
{
{"nblocks", RPCArg::Type::NUM, RPCArg::Optional::NO, "How many blocks are generated immediately."},
{"maxtries", RPCArg::Type::NUM, /* default */ "1000000", "How many iterations to try."},
},
RPCResult{
"[ blockhashes ] (array) hashes of blocks generated\n"
},
RPCExamples{
"\nGenerate 11 blocks\n"
+ HelpExampleCli("generate", "11")
},
}.ToString());
}
if (!IsDeprecatedRPCEnabled("generate")) {
throw JSONRPCError(RPC_METHOD_DEPRECATED, "The wallet generate rpc method is deprecated and will be fully removed in v0.19. "
"To use generate in v0.18, restart aryacoind with -deprecatedrpc=generate.\n"
"Clients should transition to using the node rpc method generatetoaddress\n");
}
int num_generate = request.params[0].get_int();
uint64_t max_tries = 1000000;
if (!request.params[1].isNull()) {
max_tries = request.params[1].get_int();
}
std::shared_ptr<CReserveScript> coinbase_script;
pwallet->GetScriptForMining(coinbase_script);
// If the keypool is exhausted, no script is returned at all. Catch this.
if (!coinbase_script) {
throw JSONRPCError(RPC_WALLET_KEYPOOL_RAN_OUT, "Error: Keypool ran out, please call keypoolrefill first");
}
//throw an error if no script was provided
if (coinbase_script->reserveScript.empty()) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "No coinbase script available");
}
return generateBlocks(coinbase_script, num_generate, max_tries, true);
}
UniValue rescanblockchain(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error(
RPCHelpMan{"rescanblockchain",
"\nRescan the local blockchain for wallet related transactions.\n",
{
{"start_height", RPCArg::Type::NUM, /* default */ "0", "block height where the rescan should start"},
{"stop_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG, "the last block height that should be scanned. If none is provided it will rescan up to the tip at return time of this call."},
},
RPCResult{
"{\n"
" \"start_height\" (numeric) The block height where the rescan started (the requested height or 0)\n"
" \"stop_height\" (numeric) The height of the last rescanned block. May be null in rare cases if there was a reorg and the call didn't scan any blocks because they were already scanned in the background.\n"
"}\n"
},
RPCExamples{
HelpExampleCli("rescanblockchain", "100000 120000")
+ HelpExampleRpc("rescanblockchain", "100000, 120000")
},
}.ToString());
}
WalletRescanReserver reserver(pwallet);
if (!reserver.reserve()) {
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
}
int start_height = 0;
uint256 start_block, stop_block;
{
auto locked_chain = pwallet->chain().lock();
Optional<int> tip_height = locked_chain->getHeight();
if (!request.params[0].isNull()) {
start_height = request.params[0].get_int();
if (start_height < 0 || !tip_height || start_height > *tip_height) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid start_height");
}
}
Optional<int> stop_height;
if (!request.params[1].isNull()) {
stop_height = request.params[1].get_int();
if (*stop_height < 0 || !tip_height || *stop_height > *tip_height) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid stop_height");
}
else if (*stop_height < start_height) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "stop_height must be greater than start_height");
}
}
// We can't rescan beyond non-pruned blocks, stop and throw an error
if (locked_chain->findPruned(start_height, stop_height)) {
throw JSONRPCError(RPC_MISC_ERROR, "Can't rescan beyond pruned data. Use RPC call getblockchaininfo to determine your pruned height.");
}
if (tip_height) {
start_block = locked_chain->getBlockHash(start_height);
// If called with a stop_height, set the stop_height here to
// trigger a rescan to that height.
// If called without a stop height, leave stop_height as null here
// so rescan continues to the tip (even if the tip advances during
// rescan).
if (stop_height) {
stop_block = locked_chain->getBlockHash(*stop_height);
}
}
}
CWallet::ScanResult result =
pwallet->ScanForWalletTransactions(start_block, stop_block, reserver, true /* fUpdate */);
switch (result.status) {
case CWallet::ScanResult::SUCCESS:
break;
case CWallet::ScanResult::FAILURE:
throw JSONRPCError(RPC_MISC_ERROR, "Rescan failed. Potentially corrupted data files.");
case CWallet::ScanResult::USER_ABORT:
throw JSONRPCError(RPC_MISC_ERROR, "Rescan aborted.");
// no default case, so the compiler can warn about missing cases
}
UniValue response(UniValue::VOBJ);
response.pushKV("start_height", start_height);
response.pushKV("stop_height", result.last_scanned_height ? *result.last_scanned_height : UniValue());
return response;
}
class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue>
{
public:
CWallet * const pwallet;
void ProcessSubScript(const CScript& subscript, UniValue& obj) const
{
// Always present: script type and redeemscript
std::vector<std::vector<unsigned char>> solutions_data;
txnouttype which_type = Solver(subscript, solutions_data);
obj.pushKV("script", GetTxnOutputType(which_type));
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
CTxDestination embedded;
if (ExtractDestination(subscript, embedded)) {
// Only when the script corresponds to an address.
UniValue subobj(UniValue::VOBJ);
UniValue detail = DescribeAddress(embedded);
subobj.pushKVs(detail);
UniValue wallet_detail = boost::apply_visitor(*this, embedded);
subobj.pushKVs(wallet_detail);
subobj.pushKV("address", EncodeDestination(embedded));
subobj.pushKV("scriptPubKey", HexStr(subscript.begin(), subscript.end()));
// Always report the pubkey at the top level, so that `getnewaddress()['pubkey']` always works.
if (subobj.exists("pubkey")) obj.pushKV("pubkey", subobj["pubkey"]);
obj.pushKV("embedded", std::move(subobj));
} else if (which_type == TX_MULTISIG) {
// Also report some information on multisig scripts (which do not have a corresponding address).
// TODO: abstract out the common functionality between this logic and ExtractDestinations.
obj.pushKV("sigsrequired", solutions_data[0][0]);
UniValue pubkeys(UniValue::VARR);
for (size_t i = 1; i < solutions_data.size() - 1; ++i) {
CPubKey key(solutions_data[i].begin(), solutions_data[i].end());
pubkeys.push_back(HexStr(key.begin(), key.end()));
}
obj.pushKV("pubkeys", std::move(pubkeys));
}
}
explicit DescribeWalletAddressVisitor(CWallet* _pwallet) : pwallet(_pwallet) {}
UniValue operator()(const CNoDestination& dest) const { return UniValue(UniValue::VOBJ); }
UniValue operator()(const CKeyID& keyID) const
{
UniValue obj(UniValue::VOBJ);
CPubKey vchPubKey;
if (pwallet && pwallet->GetPubKey(keyID, vchPubKey)) {
obj.pushKV("pubkey", HexStr(vchPubKey));
obj.pushKV("iscompressed", vchPubKey.IsCompressed());
}
return obj;
}
UniValue operator()(const CScriptID& scriptID) const
{
UniValue obj(UniValue::VOBJ);
CScript subscript;
if (pwallet && pwallet->GetCScript(scriptID, subscript)) {
ProcessSubScript(subscript, obj);
}
return obj;
}
UniValue operator()(const WitnessV0KeyHash& id) const
{
UniValue obj(UniValue::VOBJ);
CPubKey pubkey;
if (pwallet && pwallet->GetPubKey(CKeyID(id), pubkey)) {
obj.pushKV("pubkey", HexStr(pubkey));
}
return obj;
}
UniValue operator()(const WitnessV0ScriptHash& id) const
{
UniValue obj(UniValue::VOBJ);
CScript subscript;
CRIPEMD160 hasher;
uint160 hash;
hasher.Write(id.begin(), 32).Finalize(hash.begin());
if (pwallet && pwallet->GetCScript(CScriptID(hash), subscript)) {
ProcessSubScript(subscript, obj);
}
return obj;
}
UniValue operator()(const WitnessUnknown& id) const { return UniValue(UniValue::VOBJ); }
};
static UniValue DescribeWalletAddress(CWallet* pwallet, const CTxDestination& dest)
{
UniValue ret(UniValue::VOBJ);
UniValue detail = DescribeAddress(dest);
ret.pushKVs(detail);
ret.pushKVs(boost::apply_visitor(DescribeWalletAddressVisitor(pwallet), dest));
return ret;
}
/** Convert CAddressBookData to JSON record. */
static UniValue AddressBookDataToJSON(const CAddressBookData& data, const bool verbose)
{
UniValue ret(UniValue::VOBJ);
if (verbose) {
ret.pushKV("name", data.name);
}
ret.pushKV("purpose", data.purpose);
return ret;
}
UniValue getaddressinfo(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 1) {
throw std::runtime_error(
RPCHelpMan{"getaddressinfo",
"\nReturn information about the given aryacoin address. Some information requires the address\n"
"to be in the wallet.\n",
{
{"address", RPCArg::Type::STR, RPCArg::Optional::NO, "The aryacoin address to get the information of."},
},
RPCResult{
"{\n"
" \"address\" : \"address\", (string) The aryacoin address validated\n"
" \"scriptPubKey\" : \"hex\", (string) The hex-encoded scriptPubKey generated by the address\n"
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
" \"iswatchonly\" : true|false, (boolean) If the address is watchonly\n"
" \"solvable\" : true|false, (boolean) Whether we know how to spend coins sent to this address, ignoring the possible lack of private keys\n"
" \"desc\" : \"desc\", (string, optional) A descriptor for spending coins sent to this address (only when solvable)\n"
" \"isscript\" : true|false, (boolean) If the key is a script\n"
" \"ischange\" : true|false, (boolean) If the address was used for change output\n"
" \"iswitness\" : true|false, (boolean) If the address is a witness address\n"
" \"witness_version\" : version (numeric, optional) The version number of the witness program\n"
" \"witness_program\" : \"hex\" (string, optional) The hex value of the witness program\n"
" \"script\" : \"type\" (string, optional) The output script type. Only if \"isscript\" is true and the redeemscript is known. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_keyhash, witness_v0_scripthash, witness_unknown\n"
" \"hex\" : \"hex\", (string, optional) The redeemscript for the p2sh address\n"
" \"pubkeys\" (string, optional) Array of pubkeys associated with the known redeemscript (only if \"script\" is \"multisig\")\n"
" [\n"
" \"pubkey\"\n"
" ,...\n"
" ]\n"
" \"sigsrequired\" : xxxxx (numeric, optional) Number of signatures required to spend multisig output (only if \"script\" is \"multisig\")\n"
" \"pubkey\" : \"publickeyhex\", (string, optional) The hex value of the raw public key, for single-key addresses (possibly embedded in P2SH or P2WSH)\n"
" \"embedded\" : {...}, (object, optional) Information about the address embedded in P2SH or P2WSH, if relevant and known. It includes all getaddressinfo output fields for the embedded address, excluding metadata (\"timestamp\", \"hdkeypath\", \"hdseedid\") and relation to the wallet (\"ismine\", \"iswatchonly\").\n"
" \"iscompressed\" : true|false, (boolean, optional) If the pubkey is compressed\n"
" \"label\" : \"label\" (string) The label associated with the address, \"\" is the default label\n"
" \"timestamp\" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)\n"
" \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n"
" \"hdseedid\" : \"<hash160>\" (string, optional) The Hash160 of the HD seed\n"
" \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) The fingperint of the master key.\n"
" \"labels\" (object) Array of labels associated with the address.\n"
" [\n"
" { (json object of label data)\n"
" \"name\": \"labelname\" (string) The label\n"
" \"purpose\": \"string\" (string) Purpose of address (\"send\" for sending address, \"receive\" for receiving address)\n"
" },...\n"
" ]\n"
"}\n"
},
RPCExamples{
HelpExampleCli("getaddressinfo", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
+ HelpExampleRpc("getaddressinfo", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
},
}.ToString());
}
LOCK(pwallet->cs_wallet);
UniValue ret(UniValue::VOBJ);
CTxDestination dest = DecodeDestination(request.params[0].get_str());
// Make sure the destination is valid
if (!IsValidDestination(dest)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
}
std::string currentAddress = EncodeDestination(dest);
ret.pushKV("address", currentAddress);
CScript scriptPubKey = GetScriptForDestination(dest);
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
isminetype mine = IsMine(*pwallet, dest);
ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE));
bool solvable = IsSolvable(*pwallet, scriptPubKey);
ret.pushKV("solvable", solvable);
if (solvable) {
ret.pushKV("desc", InferDescriptor(scriptPubKey, *pwallet)->ToString());
}
ret.pushKV("iswatchonly", bool(mine & ISMINE_WATCH_ONLY));
UniValue detail = DescribeWalletAddress(pwallet, dest);
ret.pushKVs(detail);
if (pwallet->mapAddressBook.count(dest)) {
ret.pushKV("label", pwallet->mapAddressBook[dest].name);
}
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
const CKeyMetadata* meta = nullptr;
CKeyID key_id = GetKeyForDestination(*pwallet, dest);
if (!key_id.IsNull()) {
auto it = pwallet->mapKeyMetadata.find(key_id);
if (it != pwallet->mapKeyMetadata.end()) {
meta = &it->second;
}
}
if (!meta) {
auto it = pwallet->m_script_metadata.find(CScriptID(scriptPubKey));
if (it != pwallet->m_script_metadata.end()) {
meta = &it->second;
}
}
if (meta) {
ret.pushKV("timestamp", meta->nCreateTime);
if (meta->has_key_origin) {
ret.pushKV("hdkeypath", WriteHDKeypath(meta->key_origin.path));
ret.pushKV("hdseedid", meta->hd_seed_id.GetHex());
ret.pushKV("hdmasterfingerprint", HexStr(meta->key_origin.fingerprint, meta->key_origin.fingerprint + 4));
}
}
// Currently only one label can be associated with an address, return an array
// so the API remains stable if we allow multiple labels to be associated with
// an address.
UniValue labels(UniValue::VARR);
std::map<CTxDestination, CAddressBookData>::iterator mi = pwallet->mapAddressBook.find(dest);
if (mi != pwallet->mapAddressBook.end()) {
labels.push_back(AddressBookDataToJSON(mi->second, true));
}
ret.pushKV("labels", std::move(labels));
return ret;
}
static UniValue getaddressesbylabel(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() != 1)
throw std::runtime_error(
RPCHelpMan{"getaddressesbylabel",
"\nReturns the list of addresses assigned the specified label.\n",
{
{"label", RPCArg::Type::STR, RPCArg::Optional::NO, "The label."},
},
RPCResult{
"{ (json object with addresses as keys)\n"
" \"address\": { (json object with information about address)\n"
" \"purpose\": \"string\" (string) Purpose of address (\"send\" for sending address, \"receive\" for receiving address)\n"
" },...\n"
"}\n"
},
RPCExamples{
HelpExampleCli("getaddressesbylabel", "\"tabby\"")
+ HelpExampleRpc("getaddressesbylabel", "\"tabby\"")
},
}.ToString());
LOCK(pwallet->cs_wallet);
std::string label = LabelFromValue(request.params[0]);
// Find all addresses that have the given label
UniValue ret(UniValue::VOBJ);
for (const std::pair<const CTxDestination, CAddressBookData>& item : pwallet->mapAddressBook) {
if (item.second.name == label) {
ret.pushKV(EncodeDestination(item.first), AddressBookDataToJSON(item.second, false));
}
}
if (ret.empty()) {
throw JSONRPCError(RPC_WALLET_INVALID_LABEL_NAME, std::string("No addresses with label " + label));
}
return ret;
}
static UniValue listlabels(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
RPCHelpMan{"listlabels",
"\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n",
{
{"purpose", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Address purpose to list labels for ('send','receive'). An empty string is the same as not providing this argument."},
},
RPCResult{
"[ (json array of string)\n"
" \"label\", (string) Label name\n"
" ...\n"
"]\n"
},
RPCExamples{
"\nList all labels\n"
+ HelpExampleCli("listlabels", "") +
"\nList labels that have receiving addresses\n"
+ HelpExampleCli("listlabels", "receive") +
"\nList labels that have sending addresses\n"
+ HelpExampleCli("listlabels", "send") +
"\nAs a JSON-RPC call\n"
+ HelpExampleRpc("listlabels", "receive")
},
}.ToString());
LOCK(pwallet->cs_wallet);
std::string purpose;
if (!request.params[0].isNull()) {
purpose = request.params[0].get_str();
}
// Add to a set to sort by label name, then insert into Univalue array
std::set<std::string> label_set;
for (const std::pair<const CTxDestination, CAddressBookData>& entry : pwallet->mapAddressBook) {
if (purpose.empty() || entry.second.purpose == purpose) {
label_set.insert(entry.second.name);
}
}
UniValue ret(UniValue::VARR);
for (const std::string& name : label_set) {
ret.push_back(name);
}
return ret;
}
UniValue sethdseed(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() > 2) {
throw std::runtime_error(
RPCHelpMan{"sethdseed",
"\nSet or generate a new HD wallet seed. Non-HD wallets will not be upgraded to being a HD wallet. Wallets that are already\n"
"HD will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.\n"
"\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed." +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"newkeypool", RPCArg::Type::BOOL, /* default */ "true", "Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n"
" If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed.\n"
" If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing\n"
" keypool will be used until it has been depleted."},
{"seed", RPCArg::Type::STR, /* default */ "random seed", "The WIF private key to use as the new HD seed.\n"
" The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"},
},
RPCResults{},
RPCExamples{
HelpExampleCli("sethdseed", "")
+ HelpExampleCli("sethdseed", "false")
+ HelpExampleCli("sethdseed", "true \"wifkey\"")
+ HelpExampleRpc("sethdseed", "true, \"wifkey\"")
},
}.ToString());
}
if (IsInitialBlockDownload()) {
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Cannot set a new HD seed while still in Initial Block Download");
}
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot set a HD seed to a wallet with private keys disabled");
}
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
// Do not do anything to non-HD wallets
if (!pwallet->CanSupportFeature(FEATURE_HD)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot set a HD seed on a non-HD wallet. Start with -upgradewallet in order to upgrade a non-HD wallet to HD");
}
EnsureWalletIsUnlocked(pwallet);
bool flush_key_pool = true;
if (!request.params[0].isNull()) {
flush_key_pool = request.params[0].get_bool();
}
CPubKey master_pub_key;
if (request.params[1].isNull()) {
master_pub_key = pwallet->GenerateNewSeed();
} else {
CKey key = DecodeSecret(request.params[1].get_str());
if (!key.IsValid()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid private key");
}
if (HaveKey(*pwallet, key)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Already have this key (either as an HD seed or as a loose private key)");
}
master_pub_key = pwallet->DeriveNewSeed(key);
}
pwallet->SetHDSeed(master_pub_key);
if (flush_key_pool) pwallet->NewKeyPool();
return NullUniValue;
}
void AddKeypathToMap(const CWallet* pwallet, const CKeyID& keyID, std::map<CPubKey, KeyOriginInfo>& hd_keypaths)
{
CPubKey vchPubKey;
if (!pwallet->GetPubKey(keyID, vchPubKey)) {
return;
}
KeyOriginInfo info;
if (!pwallet->GetKeyOrigin(keyID, info)) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Internal keypath is broken");
}
hd_keypaths.emplace(vchPubKey, std::move(info));
}
UniValue walletprocesspsbt(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 1 || request.params.size() > 4)
throw std::runtime_error(
RPCHelpMan{"walletprocesspsbt",
"\nUpdate a PSBT with input information from our wallet and then sign inputs\n"
"that we can sign for." +
HelpRequiringPassphrase(pwallet) + "\n",
{
{"psbt", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction base64 string"},
{"sign", RPCArg::Type::BOOL, /* default */ "true", "Also sign the transaction when updating"},
{"sighashtype", RPCArg::Type::STR, /* default */ "ALL", "The signature hash type to sign with if not specified by the PSBT. Must be one of\n"
" \"ALL\"\n"
" \"NONE\"\n"
" \"SINGLE\"\n"
" \"ALL|ANYONECANPAY\"\n"
" \"NONE|ANYONECANPAY\"\n"
" \"SINGLE|ANYONECANPAY\""},
{"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"},
},
RPCResult{
"{\n"
" \"psbt\" : \"value\", (string) The base64-encoded partially signed transaction\n"
" \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
" ]\n"
"}\n"
},
RPCExamples{
HelpExampleCli("walletprocesspsbt", "\"psbt\"")
},
}.ToString());
RPCTypeCheck(request.params, {UniValue::VSTR, UniValue::VBOOL, UniValue::VSTR});
// Unserialize the transaction
PartiallySignedTransaction psbtx;
std::string error;
if (!DecodeBase64PSBT(psbtx, request.params[0].get_str(), error)) {
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed %s", error));
}
// Get the sighash type
int nHashType = ParseSighashString(request.params[2]);
// Fill transaction with our data and also sign
bool sign = request.params[1].isNull() ? true : request.params[1].get_bool();
bool bip32derivs = request.params[3].isNull() ? false : request.params[3].get_bool();
bool complete = true;
const TransactionError err = FillPSBT(pwallet, psbtx, complete, nHashType, sign, bip32derivs);
if (err != TransactionError::OK) {
throw JSONRPCTransactionError(err);
}
UniValue result(UniValue::VOBJ);
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;
result.pushKV("psbt", EncodeBase64(ssTx.str()));
result.pushKV("complete", complete);
return result;
}
UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
{
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
CWallet* const pwallet = wallet.get();
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
return NullUniValue;
}
if (request.fHelp || request.params.size() < 2 || request.params.size() > 5)
throw std::runtime_error(
RPCHelpMan{"walletcreatefundedpsbt",
"\nCreates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough\n"
"Implements the Creator and Updater roles.\n",
{
{"inputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "A json array of json objects",
{
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{
{"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"vout", RPCArg::Type::NUM, RPCArg::Optional::NO, "The output number"},
{"sequence", RPCArg::Type::NUM, RPCArg::Optional::NO, "The sequence number"},
},
},
},
},
{"outputs", RPCArg::Type::ARR, RPCArg::Optional::NO, "a json array with outputs (key-value pairs), where none of the keys are duplicated.\n"
"That is, each address can only appear once and there can only be one 'data' object.\n"
"For compatibility reasons, a dictionary, which holds the key-value pairs directly, is also\n"
" accepted as second parameter.",
{
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{
{"address", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "A key-value pair. The key (string) is the aryacoin address, the value (float or string) is the amount in " + CURRENCY_UNIT + ""},
},
},
{"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "",
{
{"data", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "A key-value pair. The key must be \"data\", the value is hex-encoded data"},
},
},
},
},
{"locktime", RPCArg::Type::NUM, /* default */ "0", "Raw locktime. Non-0 value also locktime-activates inputs"},
{"options", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED_NAMED_ARG, "",
{
{"changeAddress", RPCArg::Type::STR_HEX, /* default */ "pool address", "The aryacoin address to receive the change"},
{"changePosition", RPCArg::Type::NUM, /* default */ "random", "The index of the change output"},
{"change_type", RPCArg::Type::STR, /* default */ "set by -changetype", "The output type to use. Only valid if changeAddress is not specified. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\"."},
{"includeWatching", RPCArg::Type::BOOL, /* default */ "false", "Also select inputs which are watch only"},
{"lockUnspents", RPCArg::Type::BOOL, /* default */ "false", "Lock selected unspent outputs"},
{"feeRate", RPCArg::Type::AMOUNT, /* default */ "not set: makes wallet determine the fee", "Set a specific fee rate in " + CURRENCY_UNIT + "/kB"},
{"subtractFeeFromOutputs", RPCArg::Type::ARR, /* default */ "empty array", "A json array of integers.\n"
" The fee will be equally deducted from the amount of each specified output.\n"
" Those recipients will receive less aryacoins than you enter in their corresponding amount field.\n"
" If no outputs are specified here, the sender pays the fee.",
{
{"vout_index", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "The zero-based output index, before a change output is added."},
},
},
{"replaceable", RPCArg::Type::BOOL, /* default */ "wallet default", "Marks this transaction as BIP125 replaceable.\n"
" Allows this transaction to be replaced by a transaction with higher fees"},
{"conf_target", RPCArg::Type::NUM, /* default */ "Fallback to wallet's confirmation target", "Confirmation target (in blocks)"},
{"estimate_mode", RPCArg::Type::STR, /* default */ "UNSET", "The fee estimate mode, must be one of:\n"
" \"UNSET\"\n"
" \"ECONOMICAL\"\n"
" \"CONSERVATIVE\""},
},
"options"},
{"bip32derivs", RPCArg::Type::BOOL, /* default */ "false", "If true, includes the BIP 32 derivation paths for public keys if we know them"},
},
RPCResult{
"{\n"
" \"psbt\": \"value\", (string) The resulting raw transaction (base64-encoded string)\n"
" \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
},
RPCExamples{
"\nCreate a transaction with no inputs\n"
+ HelpExampleCli("walletcreatefundedpsbt", "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")
},
}.ToString());
RPCTypeCheck(request.params, {
UniValue::VARR,
UniValueType(), // ARR or OBJ, checked later
UniValue::VNUM,
UniValue::VOBJ,
UniValue::VBOOL
}, true
);
CAmount fee;
int change_position;
bool rbf = pwallet->m_signal_rbf;
const UniValue &replaceable_arg = request.params[3]["replaceable"];
if (!replaceable_arg.isNull()) {
RPCTypeCheckArgument(replaceable_arg, UniValue::VBOOL);
rbf = replaceable_arg.isTrue();
}
CMutableTransaction rawTx = ConstructTransaction(request.params[0], request.params[1], request.params[2], rbf);
FundTransaction(pwallet, rawTx, fee, change_position, request.params[3]);
// Make a blank psbt
PartiallySignedTransaction psbtx(rawTx);
// Fill transaction with out data but don't sign
bool bip32derivs = request.params[4].isNull() ? false : request.params[4].get_bool();
bool complete = true;
const TransactionError err = FillPSBT(pwallet, psbtx, complete, 1, false, bip32derivs);
if (err != TransactionError::OK) {
throw JSONRPCTransactionError(err);
}
// Serialize the PSBT
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;
UniValue result(UniValue::VOBJ);
result.pushKV("psbt", EncodeBase64(ssTx.str()));
result.pushKV("fee", ValueFromAmount(fee));
result.pushKV("changepos", change_position);
return result;
}
UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp
UniValue dumpprivkey(const JSONRPCRequest& request); // in rpcdump.cpp
UniValue importprivkey(const JSONRPCRequest& request);
UniValue importaddress(const JSONRPCRequest& request);
UniValue importpubkey(const JSONRPCRequest& request);
UniValue dumpwallet(const JSONRPCRequest& request);
UniValue importwallet(const JSONRPCRequest& request);
UniValue importprunedfunds(const JSONRPCRequest& request);
UniValue removeprunedfunds(const JSONRPCRequest& request);
UniValue importmulti(const JSONRPCRequest& request);
// clang-format off
static const CRPCCommand commands[] =
{ // category name actor (function) argNames
// --------------------- ------------------------ ----------------------- ----------
{ "generating", "generate", &generate, {"nblocks","maxtries"} },
{ "hidden", "resendwallettransactions", &resendwallettransactions, {} },
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, {"hexstring","options","iswitness"} },
{ "wallet", "abandontransaction", &abandontransaction, {"txid"} },
{ "wallet", "abortrescan", &abortrescan, {} },
{ "wallet", "addmultisigaddress", &addmultisigaddress, {"nrequired","keys","label","address_type"} },
{ "wallet", "backupwallet", &backupwallet, {"destination"} },
{ "wallet", "bumpfee", &bumpfee, {"txid", "options"} },
{ "wallet", "createwallet", &createwallet, {"wallet_name", "disable_private_keys", "blank"} },
{ "wallet", "dumpprivkey", &dumpprivkey, {"address"} },
{ "wallet", "dumpwallet", &dumpwallet, {"filename"} },
{ "wallet", "encryptwallet", &encryptwallet, {"passphrase"} },
{ "wallet", "getaddressesbylabel", &getaddressesbylabel, {"label"} },
{ "wallet", "getaddressinfo", &getaddressinfo, {"address"} },
{ "wallet", "getbalance", &getbalance, {"dummy","minconf","include_watchonly"} },
{ "wallet", "getnewaddress", &getnewaddress, {"label","address_type"} },
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, {"address_type"} },
{ "wallet", "getreceivedbyaddress", &getreceivedbyaddress, {"address","minconf"} },
{ "wallet", "getreceivedbylabel", &getreceivedbylabel, {"label","minconf"} },
{ "wallet", "gettransaction", &gettransaction, {"txid","include_watchonly"} },
{ "wallet", "getunconfirmedbalance", &getunconfirmedbalance, {} },
{ "wallet", "getwalletinfo", &getwalletinfo, {} },
{ "wallet", "importaddress", &importaddress, {"address","label","rescan","p2sh"} },
{ "wallet", "importmulti", &importmulti, {"requests","options"} },
{ "wallet", "importprivkey", &importprivkey, {"privkey","label","rescan"} },
{ "wallet", "importprunedfunds", &importprunedfunds, {"rawtransaction","txoutproof"} },
{ "wallet", "importpubkey", &importpubkey, {"pubkey","label","rescan"} },
{ "wallet", "importwallet", &importwallet, {"filename"} },
{ "wallet", "keypoolrefill", &keypoolrefill, {"newsize"} },
{ "wallet", "listaddressgroupings", &listaddressgroupings, {} },
{ "wallet", "listlabels", &listlabels, {"purpose"} },
{ "wallet", "listlockunspent", &listlockunspent, {} },
{ "wallet", "listreceivedbyaddress", &listreceivedbyaddress, {"minconf","include_empty","include_watchonly","address_filter"} },
{ "wallet", "listreceivedbylabel", &listreceivedbylabel, {"minconf","include_empty","include_watchonly"} },
{ "wallet", "listsinceblock", &listsinceblock, {"blockhash","target_confirmations","include_watchonly","include_removed"} },
{ "wallet", "listtransactions", &listtransactions, {"label|dummy","count","skip","include_watchonly"} },
{ "wallet", "listunspent", &listunspent, {"minconf","maxconf","addresses","include_unsafe","query_options"} },
{ "wallet", "listwalletdir", &listwalletdir, {} },
{ "wallet", "listwallets", &listwallets, {} },
{ "wallet", "loadwallet", &loadwallet, {"filename"} },
{ "wallet", "lockunspent", &lockunspent, {"unlock","transactions"} },
{ "wallet", "removeprunedfunds", &removeprunedfunds, {"txid"} },
{ "wallet", "rescanblockchain", &rescanblockchain, {"start_height", "stop_height"} },
{ "wallet", "sendmany", &sendmany, {"dummy","amounts","minconf","comment","subtractfeefrom","replaceable","conf_target","estimate_mode"} },
{ "wallet", "sendtoaddress", &sendtoaddress, {"address","amounttosend","comment","comment_to","subtractfeefromamount","replaceable","conf_target","estimate_mode"} },
{ "wallet", "sethdseed", &sethdseed, {"newkeypool","seed"} },
{ "wallet", "setlabel", &setlabel, {"address","label"} },
{ "wallet", "settxfee", &settxfee, {"feeamount"} },
{ "wallet", "signmessage", &signmessage, {"address","message"} },
{ "wallet", "signrawtransactionwithwallet", &signrawtransactionwithwallet, {"hexstring","prevtxs","sighashtype"} },
{ "wallet", "unloadwallet", &unloadwallet, {"wallet_name"} },
{ "wallet", "walletcreatefundedpsbt", &walletcreatefundedpsbt, {"inputs","outputs","locktime","options","bip32derivs"} },
{ "wallet", "walletlock", &walletlock, {} },
{ "wallet", "walletpassphrase", &walletpassphrase, {"passphrase","timeout"} },
{ "wallet", "walletpassphrasechange", &walletpassphrasechange, {"oldpassphrase","newpassphrase"} },
{ "wallet", "walletprocesspsbt", &walletprocesspsbt, {"psbt","sign","sighashtype","bip32derivs"} },
};
// clang-format on
void RegisterWalletRPCCommands(CRPCTable &t)
{
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
| [
"34451068+sillyghost@users.noreply.github.com"
] | 34451068+sillyghost@users.noreply.github.com |
4fb55e4af993c5196a5a9143de7803c965e926fd | 9010799ce37d5e7225375c81166480cda0f83b82 | /src/Resources/ResourceKey.hpp | 4ac350bf8a82e05c70b9921d3abecd9d40a12253 | [
"WTFPL"
] | permissive | Iteem/SCCT | b324619ccdd260e5c373d91f9b46e5f4897f26fe | 48178fa138f1a717053f290d657833ed86db2e4c | refs/heads/master | 2021-03-12T23:41:38.573117 | 2013-05-09T09:42:00 | 2013-05-09T09:42:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 777 | hpp | //Copyright (c) 2013 Patrick Winkler (iteem7777@gmail.com)
//This work is free. You can redistribute it and/or modify it under the
//terms of the Do What The Fuck You Want To Public License, Version 2,
//as published by Sam Hocevar. See the COPYING file for more details.
#ifndef RESOURCEKEY_HPP_INCLUDED
#define RESOURCEKEY_HPP_INCLUDED
#include <functional>
#include <memory>
#include <string>
namespace scct
{
template <typename T>
class ResourceKey
{
public:
typedef std::function< std::shared_ptr<T>() > Loader;
ResourceKey( Loader loader, std::string id );
std::shared_ptr<T> load() const;
std::string getId() const;
private:
Loader m_loader;
std::string m_id;
};
} // namespace scct
#include "ResourceKey.inl"
#endif // RESOURCEKEY_HPP_INCLUDED
| [
"patrick.winkler@intergga.ch"
] | patrick.winkler@intergga.ch |
f2e1c401a55cd6c123e6d548edd9c6acfd4d8f8c | 98b1e51f55fe389379b0db00365402359309186a | /homework_6/problem_2/100x100/0.532/phi | 46c25f0a28274420db1077ff7f3d7475190fe6d5 | [] | no_license | taddyb/597-009 | f14c0e75a03ae2fd741905c4c0bc92440d10adda | 5f67e7d3910e3ec115fb3f3dc89a21dcc9a1b927 | refs/heads/main | 2023-01-23T08:14:47.028429 | 2020-12-03T13:24:27 | 2020-12-03T13:24:27 | 311,713,551 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 142,976 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class surfaceScalarField;
location "0.532";
object phi;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField nonuniform List<scalar>
19800
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
boundaryField
{
left
{
type calculated;
value nonuniform List<scalar>
100
(
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
)
;
}
right
{
type calculated;
value nonuniform List<scalar>
100
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
}
up
{
type calculated;
value nonuniform List<scalar>
100
(
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
0.0002
)
;
}
down
{
type calculated;
value nonuniform List<scalar>
100
(
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
-0.0002
)
;
}
frontAndBack
{
type empty;
value nonuniform List<scalar> 0();
}
}
// ************************************************************************* //
| [
"tbindas@pop-os.localdomain"
] | tbindas@pop-os.localdomain | |
134880e2d31815d131f39f808a865f9069d2f18b | a6993ebbb0d58312c50316065c6f86c4fd72e878 | /src/UI_op/fsm.h | 71e7afe143fb397558a6286fb7e5466beddc9a73 | [] | no_license | SZSilence06/curve-design | dbc194c8da411e2d506334757f6b7ecea412b5c7 | 396caebf9fdfa9fb3aaa6b507b16f9e82b5ae986 | refs/heads/master | 2021-01-11T09:42:36.951541 | 2017-05-02T10:19:27 | 2017-05-02T10:19:27 | 77,582,631 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,227 | h | #ifndef HJ_FSM_H_
#define HJ_FSM_H_
#include <utility>
#include <string>
#include "finite_state_machine.h"
#include <osgGA/GUIEventHandler>
#include "event_interface.h"
class fsm_glwnd_interface : public event_interface
{
public:
virtual void init(data_interface &di) {
di_ = &di;
}
static bool no_transition(const state_key &k) {
return k.empty();
}
virtual state_key key(void) const = 0;
protected:
data_interface *di_;
};
class fsm : public hj::fsm::finite_state_machine<fsm_glwnd_interface, state_key, boost::any>
{
public:
fsm(const std::string & name);
virtual void init(data_interface &di);
virtual void enter(state_key &next_state, boost::any ¶m);
virtual event_return on_gui_event(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa);
virtual event_return on_button_click(const std::string &button_name);
virtual event_return on_cevent(const std::string &event_name, const boost::any ¶m);
virtual state_key key(void) const;
protected:
virtual bool transition(event_return &er);
void add_state(hj::fsm::state<fsm_glwnd_interface, state_key, boost::any> *s);
private:
const std::string name_;
};
#endif
| [
"342631359@@qq.com"
] | 342631359@@qq.com |
8e3d04b6dceb68b612982dbd49d733ed461e877b | 63b77f777387dca4c3f229f5a43e66dda0901ffe | /src/room/RackDevs.h | a36deeb0cc7fd6dcc4120b2488f4ef8ee27f6a03 | [] | no_license | Robertomdcg/devs-slide | 1372eddd429c9126dbe3d62f398cd3c4cbaad81a | 73a9075c64e23a889d9371fe01bf41c3c170f2b2 | refs/heads/master | 2020-06-13T20:05:04.059377 | 2017-03-15T16:55:57 | 2017-03-15T16:55:57 | 75,558,497 | 0 | 1 | null | 2016-12-04T19:17:58 | 2016-12-04T19:17:58 | null | UTF-8 | C++ | false | false | 252 | h | /*
* RackDevs.h
*
* Created on: 03/12/2016
* Author: roberto
*/
#ifndef SRC_XDEVS_RACKDEVS_H_
#define SRC_XDEVS_RACKDEVS_H_
class RackDevs: public Coupled {
public:
RackDevs();
virtual ~RackDevs();
};
#endif /* SRC_XDEVS_RACKDEVS_H_ */
| [
"robertomcdg@gmail.com"
] | robertomcdg@gmail.com |
159f4d2a65520355ce925b9e19bfca8291e96c2b | 5cb7861cf5787dec2ff4bb0d5f2f96803e4b7ede | /tensorflow/core/tfrt/saved_model/tests/saved_model_test.cc | 1c532843ff41cff7f9f83315ca43dd5bbafdbeb1 | [
"Apache-2.0",
"MIT",
"BSD-2-Clause"
] | permissive | VeriSilicon/tensorflow | c94887193d562c9d320b5c56d476629682c4ce58 | 2a1fa53a7c3a06eedec16b8aa751fb7deba8f4c5 | refs/heads/xla_npu_v270 | 2022-06-02T16:53:51.549104 | 2022-04-18T10:19:46 | 2022-04-18T10:19:46 | 93,762,772 | 4 | 29 | Apache-2.0 | 2022-04-18T10:19:47 | 2017-06-08T15:05:39 | C++ | UTF-8 | C++ | false | false | 34,906 | cc | /* Copyright 2021 The TensorFlow 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 <memory>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "tensorflow/cc/saved_model/loader.h"
#include "tensorflow/cc/saved_model/reader.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/platform/resource_loader.h"
#include "tensorflow/core/tfrt/run_handler_thread_pool/run_handler_concurrent_work_queue.h"
#include "tensorflow/core/tfrt/saved_model/saved_model_testutil.h"
namespace tfrt {
namespace saved_model_test {
namespace {
struct TestParams {
bool enable_native_ops = false;
bool enable_grappler = false;
bool enable_lazy_loading = false;
};
class SavedModelTest : public testing::TestWithParam<TestParams> {};
TEST_P(SavedModelTest, BasicV1) {
// SavedModel toy contains a graph of a single 'tf.AddV2' op. It is generated
// using the following python code:
// x = tf.placeholder(tf.int32, shape=(3))
// y = tf.compat.v1.get_variable(name='y', initializer=[1, 2, 3])
// r = tf.matmul(x, y)
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.enable_lazy_loading = GetParam().enable_lazy_loading;
options.compile_options.enable_native_ops = GetParam().enable_native_ops;
options.compile_options.enable_grappler = GetParam().enable_grappler;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1}));
tfrt::SavedModel::RunOptions run_options;
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run(run_options, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
}
// Tests all the value combinations of `TestParams`. For readability, use
// integers instead of booleans.
INSTANTIATE_TEST_SUITE_P(
SavedModelLiteTest, SavedModelTest,
testing::Values(
// The values below are for:
// enable_native_ops, enable_grappler, enable_lazy_loading
TestParams{0, 0, 0}, TestParams{0, 0, 1}, TestParams{0, 1, 0},
TestParams{0, 1, 1}, TestParams{1, 0, 0}, TestParams{1, 0, 1},
TestParams{1, 1, 0}, TestParams{1, 1, 1}));
TEST(SavedModelTest, BasicV2) {
// SavedModel toy contains a graph of a single 'tf.AddV2' op. It is generated
// using the following python code:
// self.w = tf.Variable(tf.ones((3)), name='w')
// r = tf.matmul(x, self.w)
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v2");
TFRTSavedModelTest test(saved_model_dir);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.emplace_back(tensorflow::DT_INT32,
/*shape=*/tensorflow::TensorShape{1, 3});
auto flat = inputs.back().flat<int32_t>();
flat(0) = 1;
flat(1) = 1;
flat(2) = 1;
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(
test.GetSavedModel()->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
auto& output = outputs[0];
ASSERT_EQ(output.NumElements(), 1);
EXPECT_EQ(output.flat<int32_t>()(0), 6);
}
std::vector<tensorflow::Tensor> CreateExpectedOutputs(
const FunctionMetadata& function_metadata,
const std::vector<std::pair<std::string, tensorflow::Tensor>>&
named_outputs) {
std::vector<tensorflow::Tensor> outputs;
absl::flat_hash_map<std::string, tensorflow::Tensor> name_to_outputs;
for (const auto& name_and_output : named_outputs) {
name_to_outputs[name_and_output.first] = name_and_output.second;
}
for (const auto& name : function_metadata.GetOutputNames()) {
outputs.push_back(name_to_outputs.at(name));
}
return outputs;
}
TEST(SavedModelTest, LoadSavedModelWithMetaGraphDef) {
// SavedModel toy contains a graph of a single 'tf.AddV2' op. It is generated
// using the following python code:
// x = tf.placeholder(tf.int32, shape=(3))
// y = tf.compat.v1.get_variable(name='y', initializer=[1, 2, 3])
// r = tf.matmul(x, y)
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
tensorflow::MetaGraphDef meta_graph_def;
TF_CHECK_OK(tensorflow::ReadMetaGraphDefFromSavedModel(
saved_model_dir, /*tags=*/{"serve"}, &meta_graph_def));
tensorflow::Status status;
auto saved_model = SavedModelImpl::LoadSavedModel(
options, saved_model_dir, std::move(meta_graph_def), &status);
TF_CHECK_OK(status);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1}));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run({}, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
}
TEST(SavedModelTest, RunMultipleSignatures) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
std::vector<tensorflow::Tensor> toy_inputs;
toy_inputs.push_back(CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{1, 1, 1}));
std::vector<tensorflow::Tensor> another_toy_inputs;
another_toy_inputs.push_back(CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{2, 2, 2}));
std::vector<tensorflow::Tensor> yet_another_toy_inputs;
yet_another_toy_inputs.push_back(CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{3, 3, 3}));
// TODO(b/183220175): Construct `inputs` in place once `TenserHandle` is
// copyable.
std::vector<std::vector<tensorflow::Tensor>> inputs;
inputs.push_back(std::move(toy_inputs));
inputs.push_back(std::move(another_toy_inputs));
inputs.push_back(std::move(yet_another_toy_inputs));
std::vector<std::vector<tensorflow::Tensor>> outputs;
std::vector<std::string> names = {"toy", "another_toy", "yet_another_toy"};
TF_ASSERT_OK(saved_model->RunMultipleSignatures(/*run_options=*/{}, names,
inputs, &outputs));
ASSERT_EQ(outputs.size(), 3);
{
auto toy_metadata = saved_model->GetFunctionMetadata("toy");
ASSERT_TRUE(toy_metadata.has_value());
std::vector<std::pair<std::string, tensorflow::Tensor>>
expected_toy_named_outputs;
expected_toy_named_outputs.push_back(
{"r1", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{6})});
std::vector<tensorflow::Tensor> expected_toy_outputs =
CreateExpectedOutputs(*toy_metadata, expected_toy_named_outputs);
ASSERT_EQ(outputs[0].size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0][0]),
testing::ElementsAreArray(
GetTfTensorData<int32_t>(expected_toy_outputs[0])));
}
{
auto another_toy_metadata = saved_model->GetFunctionMetadata("another_toy");
ASSERT_TRUE(another_toy_metadata.has_value());
std::vector<std::pair<std::string, tensorflow::Tensor>>
expected_another_toy_named_outputs;
expected_another_toy_named_outputs.push_back(
{"r21", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{12})});
expected_another_toy_named_outputs.push_back(
{"r22", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{18})});
std::vector<tensorflow::Tensor> expected_another_toy_outputs =
CreateExpectedOutputs(*another_toy_metadata,
expected_another_toy_named_outputs);
ASSERT_EQ(outputs[1].size(), 2);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1][0]),
testing::ElementsAreArray(
GetTfTensorData<int32_t>(expected_another_toy_outputs[0])));
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1][1]),
testing::ElementsAreArray(
GetTfTensorData<int32_t>(expected_another_toy_outputs[1])));
}
{
auto yet_another_toy_metadata =
saved_model->GetFunctionMetadata("yet_another_toy");
ASSERT_TRUE(yet_another_toy_metadata.has_value());
std::vector<std::pair<std::string, tensorflow::Tensor>>
expected_yet_another_toy_named_outputs;
expected_yet_another_toy_named_outputs.push_back(
{"r31", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{18})});
expected_yet_another_toy_named_outputs.push_back(
{"r32", CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{21, 21, 21})});
expected_yet_another_toy_named_outputs.push_back(
{"r33", CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{24, 24, 24})});
std::vector<tensorflow::Tensor> expected_yet_another_toy_outputs =
CreateExpectedOutputs(*yet_another_toy_metadata,
expected_yet_another_toy_named_outputs);
ASSERT_EQ(outputs[2].size(), 3);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2][0]),
testing::ElementsAreArray(GetTfTensorData<int32_t>(
expected_yet_another_toy_outputs[0])));
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2][1]),
testing::ElementsAreArray(GetTfTensorData<int32_t>(
expected_yet_another_toy_outputs[1])));
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2][2]),
testing::ElementsAreArray(GetTfTensorData<int32_t>(
expected_yet_another_toy_outputs[2])));
}
}
TEST(SavedModelTest, RunMultipleSignatures_OverlappingNodes) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
std::vector<std::vector<tensorflow::Tensor>> inputs = {
{CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{1, 1, 1})},
{CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{1, 1, 1})},
{CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{1, 1, 1})}};
std::vector<std::vector<tensorflow::Tensor>> outputs;
std::vector<std::string> names = {"toy", "another_toy", "toy"};
TF_ASSERT_OK(saved_model->RunMultipleSignatures(/*run_options=*/{}, names,
inputs, &outputs));
ASSERT_EQ(outputs.size(), 3);
ASSERT_EQ(outputs[0].size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0][0]),
testing::ElementsAreArray({6}));
{
auto another_toy_metadata = saved_model->GetFunctionMetadata("another_toy");
ASSERT_TRUE(another_toy_metadata.has_value());
std::vector<std::pair<std::string, tensorflow::Tensor>>
expected_another_toy_named_outputs;
expected_another_toy_named_outputs.push_back(
{"r21", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{6})});
expected_another_toy_named_outputs.push_back(
{"r22", CreateTfTensor<int32_t>(/*shape=*/{1}, /*data=*/{12})});
std::vector<tensorflow::Tensor> expected_another_toy_outputs =
CreateExpectedOutputs(*another_toy_metadata,
expected_another_toy_named_outputs);
ASSERT_EQ(outputs[1].size(), 2);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1][0]),
testing::ElementsAreArray(
GetTfTensorData<int32_t>(expected_another_toy_outputs[0])));
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1][1]),
testing::ElementsAreArray(
GetTfTensorData<int32_t>(expected_another_toy_outputs[1])));
}
ASSERT_EQ(outputs[2].size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2][0]),
testing::ElementsAreArray({6}));
}
class SavedModelRunByTensorNamesTest : public ::testing::Test {
protected:
void SetUp() override {
auto saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
runtime_ = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime_.get());
tensorflow::Status status;
saved_model_.reset(static_cast<SavedModelImpl*>(
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status)
.release()));
TF_CHECK_OK(status);
inputs_.push_back(
std::make_pair("input1", CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{1, 1, 1})));
inputs_.push_back(
std::make_pair("input2", CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{2, 2, 2})));
inputs_.push_back(
std::make_pair("input3", CreateTfTensor<int32_t>(/*shape=*/{1, 3},
/*data=*/{3, 3, 3})));
}
std::unique_ptr<tensorflow::tfrt_stub::Runtime> runtime_;
std::unique_ptr<SavedModelImpl> saved_model_;
std::vector<std::pair<std::string, tensorflow::Tensor>> inputs_;
std::vector<std::string> output_tensor_names_{"result1", "result21",
"result31"};
std::vector<std::string> target_node_names_{"result22", "result32"};
};
TEST_F(SavedModelRunByTensorNamesTest, Basic) {
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model_->RunByTensorNames(/*run_options=*/{}, inputs_,
output_tensor_names_,
target_node_names_, &outputs));
ASSERT_EQ(outputs.size(), 3);
// Check output "r1".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]), testing::ElementsAre(6));
// Check output "r21".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1]), testing::ElementsAre(12));
// Check output "r31".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2]), testing::ElementsAre(18));
}
TEST_F(SavedModelRunByTensorNamesTest, NoTargetNodes) {
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model_->RunByTensorNames(
/*run_options=*/{}, inputs_, output_tensor_names_,
/*target_node_names=*/{}, &outputs));
ASSERT_EQ(outputs.size(), 3);
// Check output "r1".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]), testing::ElementsAre(6));
// Check output "r21".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1]), testing::ElementsAre(12));
// Check output "r31".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2]), testing::ElementsAre(18));
}
TEST_F(SavedModelRunByTensorNamesTest, NoOutputNodes) {
std::vector<tensorflow::Tensor> outputs;
outputs.emplace_back(); // Test outputs is first cleared.
TF_ASSERT_OK(saved_model_->RunByTensorNames(
/*run_options=*/{}, inputs_, /*output_tensor_names=*/{},
target_node_names_, &outputs));
ASSERT_EQ(outputs.size(), 0);
}
TEST_F(SavedModelRunByTensorNamesTest, ShuffleInputsAndOutputs) {
std::vector<std::pair<std::string, tensorflow::Tensor>> inputs = {
{"input2", CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{4, 4, 4})},
{"input1", CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1})},
{"input3", CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{3, 3, 3})},
};
std::vector<std::string> output_tensor_names{"result22", "result1",
"result31"};
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model_->RunByTensorNames(
/*run_options=*/{}, inputs, output_tensor_names, {}, &outputs));
ASSERT_EQ(outputs.size(), 3);
// Check output "r22".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]), testing::ElementsAre(30));
// Check output "r1".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[1]), testing::ElementsAre(6));
// Check output "r31".
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[2]), testing::ElementsAre(18));
}
TEST(SavedModelTest, CustomWorkQueue) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
tfrt::tf::RunHandlerThreadWorkQueue::Options queue_options;
queue_options.num_complementary_threads = 1;
queue_options.num_main_threads = 1;
queue_options.init_timeout_ms = 100;
auto runtime = tensorflow::tfrt_stub::Runtime::Create(
std::make_unique<tfrt::tf::RunHandlerThreadWorkQueue>(queue_options));
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_native_ops = false;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1}));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run({}, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
// Run one more time to check per-request state is correct set up.
outputs.clear();
TF_ASSERT_OK(saved_model->Run({}, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
}
// Verifies the savedmodel runs correctly with work queues specified in
// RunOptions.
TEST(SavedModelTest, RunOptionsWorkQueue) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = tensorflow::tfrt_stub::Runtime::Create();
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_native_ops = false;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1}));
std::vector<tensorflow::Tensor> outputs;
tfrt::tf::RunHandlerThreadWorkQueue::Options queue_options;
queue_options.num_complementary_threads = 1;
queue_options.num_main_threads = 1;
queue_options.init_timeout_ms = 100;
tfrt::tf::RunHandlerThreadWorkQueue run_handler_queue(queue_options);
tfrt::SavedModel::RunOptions run_options;
run_options.work_queue = &run_handler_queue;
TF_ASSERT_OK(saved_model->Run(run_options, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
// Run one more time to check per-request state is correct set up.
outputs.clear();
TF_ASSERT_OK(saved_model->Run(run_options, "toy", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray({6}));
}
TEST(SavedModelTest, FunctionMetadata) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
TFRTSavedModelTest test(saved_model_dir);
auto* saved_model = test.GetSavedModel();
auto function_metadata = saved_model->GetFunctionMetadata("toy");
ASSERT_TRUE(function_metadata.has_value());
EXPECT_THAT(function_metadata->GetInputNames(),
testing::ElementsAreArray({"x1"}));
EXPECT_THAT(
function_metadata->GetInputSpecs(),
testing::ElementsAreArray({TensorSpec(tensorflow::DT_INT32, {1, 3})}));
EXPECT_THAT(function_metadata->GetOutputNames(),
testing::ElementsAreArray({"r1"}));
EXPECT_THAT(function_metadata->GetOutputSpecs(),
// Shape inference disabled, thus we only match dtype.
testing::ElementsAreArray(
{testing::Field(&TensorSpec::dtype, tensorflow::DT_INT32)}));
}
TEST(SavedModelTest, WrongShape) {
// SavedModel toy contains a graph of a single 'tf.AddV2' op. It is generated
// using the following python code:
// self.w = tf.Variable(tf.ones((3)), name='w')
// r = tf.matmul(x, self.w)
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v2");
TFRTSavedModelTest test(saved_model_dir);
// Set input 'x' to a wrong shape [[1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(CreateTfTensor<int32_t>(/*shape=*/{1, 2}, /*data=*/{1, 1}));
std::vector<tensorflow::Tensor> outputs;
tfrt::SavedModel::RunOptions run_options;
run_options.validate_input_specs = true;
auto status = test.GetSavedModel()->Run(run_options, "serving_default",
inputs, &outputs);
ASSERT_FALSE(status.ok());
EXPECT_THAT(status.error_message(),
testing::HasSubstr("input shape is wrong"));
}
TEST(SavedModelTest, RefTypeTensorInput) {
// This test checks the loading does not fail for signatures with ref type
// input/output.
//
// TODO(b/188580685): This is a short term workaround to skip signatures with
// ref type input. We need to add correctness testing here for ref type inputs
// once it is supported.
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/ref_type_tensor_input");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_grappler = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_ASSERT_OK(status);
EXPECT_THAT(
saved_model->GetFunctionNames(),
testing::UnorderedElementsAre(
"non_ref", "__tf_saved_model_session_initializer_save/restore_all"));
}
TEST(SavedModelTest, HashTableAssetV1) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/"
"hash_table_asset_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_native_ops = false;
options.compile_options.enable_grappler = true;
options.compile_options.hoist_invariant_ops = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(CreateTfStringTensor(/*shape=*/{}, /*data=*/{"cat"}));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int64_t>(outputs[0]),
testing::ElementsAreArray({0}));
}
TEST(ControlFlowTest, CtrlFlow) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/if_v1");
TFRTSavedModelTest test(saved_model_dir);
std::vector<int32_t> x_data = {-1};
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(CreateTfTensor<int32_t>(
/*shape=*/{}, absl::MakeConstSpan(x_data)));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(
test.GetSavedModel()->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
auto function_metadata =
test.GetSavedModel()->GetFunctionMetadata("serving_default");
ASSERT_TRUE(function_metadata.has_value());
tensorflow::Tensor x(tensorflow::DT_INT32, tensorflow::TensorShape({}));
std::copy(std::begin(x_data), std::end(x_data), x.flat<int32_t>().data());
std::vector<tensorflow::Tensor> tf_inputs = {x};
std::vector<tensorflow::Tensor> tf_outputs;
ComputeCurrentTFResult(saved_model_dir, /*signature_name=*/"serving_default",
function_metadata->GetInputNames(), tf_inputs,
function_metadata->GetOutputNames(), &tf_outputs);
ASSERT_EQ(tf_outputs.size(), 1);
EXPECT_THAT(
GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray(std::vector<int32_t>(
tf_outputs[0].flat<int32_t>().data(),
tf_outputs[0].flat<int32_t>().data() + tf_outputs[0].NumElements())));
}
TEST(SavedModelTest, ResourceGather) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/resource_gather_v1");
TFRTSavedModelTest test(saved_model_dir);
std::vector<int32_t> x_data = {1};
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(CreateTfTensor<int32_t>(
/*shape=*/{}, absl::MakeConstSpan(x_data)));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(
test.GetSavedModel()->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
auto function_metadata =
test.GetSavedModel()->GetFunctionMetadata("serving_default");
ASSERT_TRUE(function_metadata.has_value());
tensorflow::Tensor x(tensorflow::DT_INT32, tensorflow::TensorShape({}));
std::copy(std::begin(x_data), std::end(x_data), x.flat<int32_t>().data());
std::vector<tensorflow::Tensor> tf_inputs = {x};
std::vector<tensorflow::Tensor> tf_outputs;
ComputeCurrentTFResult(saved_model_dir, /*signature_name=*/"serving_default",
function_metadata->GetInputNames(), tf_inputs,
function_metadata->GetOutputNames(), &tf_outputs);
ASSERT_EQ(tf_outputs.size(), 1);
EXPECT_THAT(
GetTfTensorData<int32_t>(outputs[0]),
testing::ElementsAreArray(std::vector<int32_t>(
tf_outputs[0].flat<int32_t>().data(),
tf_outputs[0].flat<int32_t>().data() + tf_outputs[0].NumElements())));
}
TEST(SavedModelTest, DTypeCoverage) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/dtype_coverage_v1");
TFRTSavedModelTest test(saved_model_dir);
std::vector<tensorflow::Tensor> inputs;
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(
test.GetSavedModel()->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 16);
auto function_metadata =
test.GetSavedModel()->GetFunctionMetadata("serving_default");
ASSERT_TRUE(function_metadata.has_value());
std::vector<tensorflow::Tensor> tf_inputs;
std::vector<tensorflow::Tensor> tf_outputs;
ComputeCurrentTFResult(saved_model_dir, /*signature_name=*/"serving_default",
function_metadata->GetInputNames(), tf_inputs,
function_metadata->GetOutputNames(), &tf_outputs);
ASSERT_EQ(tf_outputs.size(), 16);
for (int i = 0; i < 16; ++i) {
ExpectTensorEqual(outputs[i], tf_outputs[i]);
}
}
TEST(SavedModelTest, Error) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/error_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_ASSERT_OK(status);
std::vector<tensorflow::Tensor> outputs;
status = saved_model->Run({}, "serving_default", {}, &outputs);
ASSERT_FALSE(status.ok());
EXPECT_EQ(status.code(), tensorflow::error::INVALID_ARGUMENT);
EXPECT_TRUE(absl::StrContains(
status.error_message(), "You must feed a value for placeholder tensor"));
}
class SavedModelPowTest : public testing::TestWithParam<std::string> {};
TEST_P(SavedModelPowTest, Pow) {
std::string saved_model_dir =
tensorflow::GetDataDependencyFilepath(GetParam());
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_grappler = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
std::vector<int32_t> data = {2};
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{}, absl::MakeConstSpan(data)));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]), testing::ElementsAre(8));
}
INSTANTIATE_TEST_SUITE_P(
SavedModelPowTest, SavedModelPowTest,
testing::Values("tensorflow/core/tfrt/saved_model/tests/pow",
"tensorflow/core/tfrt/saved_model/tests/pow_v2"));
TEST(SavedModelTest, ControlFlowV1) {
// This test checks that loading a savedmodel with V1 control flows works
// properly. The current workflow requires functionalization on V1 control
// flows and may insert extra functions. This test is to guard on errors due
// to handling V1 control flows (eg. adding different functions with name
// conflicts).
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/control_flow_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_grappler = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_ASSERT_OK(status);
}
TEST(SavedModelTest, WhileLoopV1) {
// This test checks that loading a savedmodel with V1 while works properly.
// The current workflow applies functionalization which may change nodes in
// the original graph. We insert additional nodes to prevent it from changing
// fetch nodes.
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/while_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_grappler = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_ASSERT_OK(status);
std::vector<int32_t> data = {0};
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{}, absl::MakeConstSpan(data)));
std::vector<tensorflow::Tensor> outputs;
TF_ASSERT_OK(saved_model->Run({}, "serving_default", inputs, &outputs));
ASSERT_EQ(outputs.size(), 1);
EXPECT_THAT(GetTfTensorData<int32_t>(outputs[0]), testing::ElementsAre(10));
}
TEST(SavedModelTest, SparseTensorInput) {
// This test checks the loading does not fail for signatures with sparse
// input/output.
//
// TODO(b/184675681): This is a short term workaround to skip signatures with
// sparse input. We need to add correctness testing here for sparse inputs
// once it is supported.
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/sparse_tensor_input");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
options.compile_options.enable_grappler = true;
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_ASSERT_OK(status);
EXPECT_THAT(saved_model->GetFunctionNames(), testing::ElementsAre("dense"));
}
TEST(SavedModelTest, DeadlineExceeded) {
std::string saved_model_dir = tensorflow::GetDataDependencyFilepath(
"tensorflow/core/tfrt/saved_model/tests/toy_v1");
auto runtime = DefaultTfrtRuntime(/*num_threads=*/1);
auto options = DefaultSavedModelOptions(runtime.get());
tensorflow::Status status;
auto saved_model =
SavedModelImpl::LoadSavedModel(options, saved_model_dir,
/*tags=*/{"serve"}, &status);
TF_CHECK_OK(status);
// Set input 'x' to [[1, 1, 1]]
std::vector<tensorflow::Tensor> inputs;
inputs.push_back(
CreateTfTensor<int32_t>(/*shape=*/{1, 3}, /*data=*/{1, 1, 1}));
std::vector<tensorflow::Tensor> outputs;
tfrt::SavedModel::RunOptions run_options;
run_options.deadline = absl::ToChronoTime(absl::Now());
status = saved_model->Run(run_options, "toy", inputs, &outputs);
ASSERT_FALSE(status.ok());
EXPECT_THAT(status.error_message(), testing::HasSubstr("Deadline exceeded"));
}
} // namespace
} // namespace saved_model_test
} // namespace tfrt
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
86af5eb9aad588ad7a6f0064f1bcd892214ec3be | fe91ffa11707887e4cdddde8f386a8c8e724aa58 | /chrome/browser/chromeos/crostini/crostini_features.h | 9716250739441763377883e779b28a767a53181f | [
"BSD-3-Clause"
] | permissive | akshaymarch7/chromium | 78baac2b45526031846ccbaeca96c639d1d60ace | d273c844a313b1e527dec0d59ce70c95fd2bd458 | refs/heads/master | 2023-02-26T23:48:03.686055 | 2020-04-15T01:20:07 | 2020-04-15T01:20:07 | 255,778,651 | 2 | 1 | BSD-3-Clause | 2020-04-15T02:04:56 | 2020-04-15T02:04:55 | null | UTF-8 | C++ | false | false | 2,427 | h | // Copyright 2019 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 CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_
#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_
#include "base/macros.h"
class Profile;
namespace crostini {
// CrostiniFeatures provides an interface for querying which parts of crostini
// are enabled or allowed.
class CrostiniFeatures {
public:
static CrostiniFeatures* Get();
// Returns true if crostini is allowed to run for |profile|.
// Otherwise, returns false, e.g. if crostini is not available on the device,
// or it is in the flow to set up managed account creation.
virtual bool IsAllowed(Profile* profile);
// When |check_policy| is true, returns true if fully interactive crostini UI
// may be shown. Implies crostini is allowed to run.
// When check_policy is false, returns true if crostini UI is not forbidden by
// hardware, flags, etc, even if it is forbidden by the enterprise policy. The
// UI uses this to indicate that crostini is available but disabled by policy.
virtual bool IsUIAllowed(Profile*, bool check_policy = true);
// Returns whether if Crostini has been enabled, i.e. the user has launched it
// at least once and not deleted it.
virtual bool IsEnabled(Profile* profile);
// Returns true if policy allows export import UI.
virtual bool IsExportImportUIAllowed(Profile*);
// Returns whether user is allowed root access to Crostini. Always returns
// true when advanced access controls feature flag is disabled.
virtual bool IsRootAccessAllowed(Profile*);
// Returns true if container upgrade ui is allowed by flag.
virtual bool IsContainerUpgradeUIAllowed(Profile*);
// Returns whether the user is allowed to enable and disable ADB sideloading
// based on whether the user is the owner, whether the user and the device
// are managed, and feature flag and policies for managed case.
virtual bool CanChangeAdbSideloading(Profile* profile);
// TODO(crbug.com/1004708): Move other functions from crostini_util to here.
protected:
static void SetForTesting(CrostiniFeatures* features);
CrostiniFeatures();
virtual ~CrostiniFeatures();
DISALLOW_COPY_AND_ASSIGN(CrostiniFeatures);
};
} // namespace crostini
#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_FEATURES_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
06469059b2af7fff03e20e32f915d49e450769ed | 069e3bed22068cddef60a8e4b94f663c21b2b012 | /ir.cpp | 4840b1153bb3b86c9f9b4413ec8a0c40e13814d0 | [] | no_license | cezarsa/blinky | 1b24967e50aca905053c22df41051b755a1fa820 | a3009b227ccb269f9a986295b8b4816820c54635 | refs/heads/master | 2020-09-22T03:23:48.029854 | 2016-11-26T17:20:24 | 2016-11-26T17:20:24 | 66,173,729 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,055 | cpp | #include "common.hpp"
const int RECV_PIN = D4;
IRrecv irrecv(RECV_PIN);
void initIR() { irrecv.enableIRIn(); }
String irEncoding(int type) {
switch (type) {
default:
case UNKNOWN:
return "UNKNOWN";
case NEC:
return "NEC";
case SONY:
return "SONY";
case RC5:
return "RC5";
case RC6:
return "RC6";
case DISH:
return "DISH";
case SHARP:
return "SHARP";
case JVC:
return "JVC";
case SANYO:
return "SANYO";
case MITSUBISHI:
return "MITSUBISHI";
case SAMSUNG:
return "SAMSUNG";
case LG:
return "LG";
case WHYNTER:
return "WHYNTER";
case PANASONIC:
return "PANASONIC";
}
return "";
}
#define N_IR_VALUES 10
int irTypes[N_IR_VALUES];
unsigned long irValues[N_IR_VALUES];
int irCurrent = 0;
String irJSON() {
String rsp("\"ir\":{\"current\":");
rsp += irCurrent;
rsp += ",\"entries\":[";
for (int i = 0; i < N_IR_VALUES; i++) {
rsp += String("{\"encoding\":\"") + irEncoding(irTypes[i]) + String("\",");
rsp += String("\"value\":\"") + String(irValues[i], HEX) + String("\"}");
if (i < (N_IR_VALUES - 1)) {
rsp += String(",");
}
}
rsp += "]}";
return rsp;
}
typedef void (*irCmd)();
struct cmd {
unsigned long value;
irCmd fn;
};
void on() {
bool on = true;
toggleLights(&on);
}
void off() {
bool off = false;
toggleLights(&off);
}
void toggle() { toggleLights(NULL); }
cmd cmdList[] = {{value : 0xce1972fd, fn : on},
{value : 0xd4dd0381, fn : off},
{value : 0x20df10ef, fn : toggle}};
void loopIR() {
decode_results results;
if (irrecv.decode(&results)) {
if (results.value != 0xffffffff) {
irTypes[irCurrent] = results.decode_type;
irValues[irCurrent] = results.value;
irCurrent = (irCurrent + 1) % N_IR_VALUES;
int cmdsLen = sizeof(cmdList) / sizeof(cmd);
for (int i = 0; i < cmdsLen; i++) {
if (cmdList[i].value == results.value) {
cmdList[i].fn();
break;
}
}
}
irrecv.resume();
}
}
| [
"cezarsa@gmail.com"
] | cezarsa@gmail.com |
54435001017914229d60ed4350326fc3d7b9a7c7 | 0646c22827e0941ec5040701337782fc9e728b94 | /SOCS/SOCS Online 10_/atikotak.cpp | a24891ee5691597bd24ca8d1ce0f5a0089b5593a | [] | no_license | JustinChris/programminportfolio | 89381037e4fce9d25b6c91e1d7673e49423d9fc3 | e98b720ef09735024dca734b2088cc63d9fee330 | refs/heads/main | 2023-04-01T23:47:00.491407 | 2021-04-13T08:36:26 | 2021-04-13T08:36:26 | 318,080,890 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 123 | cpp | #include <stdio.h>
int main() {
int d[100] = {0};
for (int i = 0; i < 100; i++){
printf("%d",d[i]);
}
return 0;
}
| [
"justin.christian001@binus.ac.id"
] | justin.christian001@binus.ac.id |
3b3d9acb04ed2243d0d37330894920b43d5ce250 | 9afe8785df3afb1b5f061dfb59399f4ad3de870d | /00_OpenGL_Demos/01_Vertexa/SourceCode/Animation.cpp | e7b4e95dec8645ebd57000ab94e5ef3c20196541 | [] | no_license | a-shinde/RTR | 66dee8cfe1bd2de0b4aa60dc34c91ea091543d97 | 27402dbd519dfb479c1a6c0f7cc831408ecb3f6a | refs/heads/master | 2022-04-30T08:12:57.938299 | 2022-03-03T12:44:50 | 2022-03-03T12:44:50 | 93,935,213 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,837 | cpp | #include <fstream>
#include "Animation.h"
#include "Shaders.h"
extern std::ofstream g_log_file;
extern GLuint winWidth, winHeight;
extern GLfloat xRot, yRot, zRot;
extern GLfloat xTrans, yTrans, zTrans;
Animation::Animation()
{
}
Animation::~Animation()
{
glDeleteProgram(shader.shaderProgramObject);
}
void Animation::init()
{
// shader for animated model
shader.MakeProgramObject("shaders/VertexShader.vert", "shaders/FragmentShader.frag");
//Load Animation Data from Assimp
model_trinity_animation.initShaders(shader.shaderProgramObject);
model_trinity_animation.loadModel("models//model//model.dae");
model_trinity_animation.loadVisemes("models//model//animations//viseme.dae");
////model_trinity_animation.loadSecondModel("models//model//dressCode//model.dae");
vector<string> animationNames;
animationNames.push_back("models//model//animations//Expression.dae");
animationNames.push_back("models//model//animations//OpeningScene.dae");
animationNames.push_back("models//model//animations//idle.dae");
animationNames.push_back("models//model//animations//walk.dae");
animationNames.push_back("models//model//animations//Aeroplane.dae");
animationNames.push_back("models//model//animations//IndianDance.dae");
animationNames.push_back("models//model//animations//Moonwalk.dae");
animationNames.push_back("models//model//animations//Hello.dae");
model_trinity_animation.loadAnimations(animationNames);
model_dressCode.initShaders(shader.shaderProgramObject);
model_dressCode.loadModel("models//model//dressCode//model.dae");
model_dressCode.loadVisemes("models//model//animations//viseme.dae");
model_dressCode.loadAnimations(animationNames);
//Load Model From our Parser
/*model_trinity_geometries.loadModel("models/model/model.dae");
model_trinity_geometries.initShaders(shader.shaderProgramObject);
model_trinity_geometries.setBoneInfo(model_trinity_animation.getBoneMapping());
model_trinity_geometries.getGeometryData();*/
//Initialize CubeMap
initializeCubeMap();
//Lighting
for (uint index = 0; index < animationSettings.lighting.maxLight; index++)
{
string name = "Lights[" + to_string(index) + "].isEnabled";
animationSettings.lighting.lights[index].u_isLightEnabled = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].position";
animationSettings.lighting.lights[index].u_position = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].ambient";
animationSettings.lighting.lights[index].u_ambient = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].diffuse";
animationSettings.lighting.lights[index].u_diffuse = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].specular";
animationSettings.lighting.lights[index].u_specular = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].constant";
animationSettings.lighting.lights[index].u_constant_attenuation = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].linear";
animationSettings.lighting.lights[index].u_linear_attenuation = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
name = "Lights[" + to_string(index) + "].quadratic";
animationSettings.lighting.lights[index].u_quadratic_attenuation = glGetUniformLocation(shader.shaderProgramObject, name.c_str());
}
animationSettings.lighting.initialize_sequence1();
model_matrix_uniform = glGetUniformLocation(shader.shaderProgramObject, "u_model_matrix");
view_matrix_uniform = glGetUniformLocation(shader.shaderProgramObject, "u_view_matrix");
projection_uniform = glGetUniformLocation(shader.shaderProgramObject, "u_projection_matrix");
modelMatrix = glm::mat4();
}
void Animation::update()
{
current_time = (GLfloat)GetTickCount();
delta_time = (current_time - last_time);
last_time = current_time;
viewMatrix = camera.getViewMatrix();
if (animationSettings.modelIndex == 1)
model_dressCode.update();
else
model_trinity_animation.update();
modelMatrix = glm::mat4();
modelMatrix = glm::translate(modelMatrix, glm::vec3(xTrans, yTrans, zTrans));
modelMatrix = glm::rotate(modelMatrix, glm::radians(yRot), glm::vec3(0.0f, 1.0f, 0.0f));
modelMatrix = glm::rotate(modelMatrix, glm::radians(xRot), glm::vec3(1.0f, 0.0f, 0.0f));
modelMatrix = glm::rotate(modelMatrix, glm::radians(zRot), glm::vec3(0.0f, 0.0f, 1.0f));
//Custom correction for Animations
switch (animationSettings.action.actionSequence)
{
case ACTION_MOONWALK:
modelMatrix = glm::rotate(modelMatrix, glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 1.0f));
break;
case ACTION_AEROPLANE:
modelMatrix = glm::rotate(modelMatrix, glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 1.0f));
break;
case ACTION_INDIAN_DANCE:
modelMatrix = glm::rotate(modelMatrix, glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f));
break;
default:
break;
}
camera.update();
}
void Animation::render()
{
glUseProgram(shader.shaderProgramObject);
glUniformMatrix4fv(model_matrix_uniform, 1, GL_FALSE, glm::value_ptr(modelMatrix));
glUniformMatrix4fv(view_matrix_uniform, 1, GL_FALSE, glm::value_ptr(viewMatrix));
glUniformMatrix4fv(projection_uniform, 1, GL_FALSE, glm::value_ptr(perspectiveProjectionMatrix));
if (animationSettings.modelIndex == 1)
model_dressCode.applyModelBoneTransform(animationSettings);
else
model_trinity_animation.applyModelBoneTransform(animationSettings);
//glUniformMatrix4fv(model_trinity_geometries.morphMatrixUniform, 1, GL_FALSE, glm::value_ptr(animationSettings.lipSync.getVisemeMatrix()));
setLigting();
if (camera.currentScene != 0)
{
if (animationSettings.modelIndex == 1)
model_dressCode.display(shader.shaderProgramObject);
else
model_trinity_animation.display(shader.shaderProgramObject);
}
//model_trinity_geometries.Modeldisplay(shader.shaderProgramObject);
glUseProgram(0);
displayCubeMap(viewMatrix, perspectiveProjectionMatrix, animationSettings.environment.cubeMapIndex);
}
void Animation::playSound()
{
}
void Animation::setLigting()
{
for (uint index = 0; index < animationSettings.lighting.maxLight; index++)
{
glUniform1i(animationSettings.lighting.lights[index].u_isLightEnabled, animationSettings.lighting.lights[index].isLightEnabled);
glUniform3fv(animationSettings.lighting.lights[index].u_position, 1, animationSettings.lighting.lights[index].position);
glUniform3fv(animationSettings.lighting.lights[index].u_ambient, 1, animationSettings.lighting.lights[index].ambient);
glUniform3fv(animationSettings.lighting.lights[index].u_diffuse, 1, animationSettings.lighting.lights[index].diffuse);
glUniform3fv(animationSettings.lighting.lights[index].u_specular, 1, animationSettings.lighting.lights[index].specular);
glUniform1f(animationSettings.lighting.lights[index].u_constant_attenuation, animationSettings.lighting.lights[index].constant_attenuation);
glUniform1f(animationSettings.lighting.lights[index].u_linear_attenuation, animationSettings.lighting.lights[index].linear_attenuation);
glUniform1f(animationSettings.lighting.lights[index].u_quadratic_attenuation, animationSettings.lighting.lights[index].quadratic_attenuation);
}
}
GLuint Animation::LoadGLTexturesPNG(GLuint *texture, const char *filePath)
{
int iStatus = FALSE;
FIBITMAP* imagen = NULL;
FREE_IMAGE_FORMAT formato = FreeImage_GetFileType(filePath,0);
imagen = FreeImage_Load(formato, filePath);
/*
size_t length = strlen(filePath) + 1;
wchar_t wtext[200];
mbstowcs(wtext, filePath, length);
LPWSTR p_fileParh = wtext;
hBitmap = (HBITMAP)LoadImage(GetModuleHandle(NULL), p_fileParh, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
*/
if (imagen)
{
FIBITMAP* temp = imagen;
imagen = FreeImage_ConvertTo32Bits(imagen);
FreeImage_Unload(temp);
int w = FreeImage_GetWidth(imagen);
int h = FreeImage_GetHeight(imagen);
char* pixels = (char*)FreeImage_GetBits(imagen);
// In case if Image is invered.
/* for (int i = 0; i < h; i++)
{
for (int j = 0; j < w; j++)
{
invPixels[((((h - 1) - i)*w) + j) * 4 + 0] = pixeles[((i*w) + j) * 4 + 0];
invPixels[((((h - 1) - i)*w) + j) * 4 + 1] = pixeles[((i*w) + j) * 4 + 1];
invPixels[((((h - 1) - i)*w) + j) * 4 + 2] = pixeles[((i*w) + j) * 4 + 2];
invPixels[((((h - 1) - i)*w) + j) * 4 + 3] = pixeles[((i*w) + j) * 4 + 3];
}
}
*/
iStatus = TRUE;
glGenTextures(1, texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);//rgba
glBindTexture(GL_TEXTURE_2D, *texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA,
w,
h,
0,
GL_BGRA,
GL_UNSIGNED_BYTE,
pixels);
glGenerateMipmap(GL_TEXTURE_2D);
}
else
{
g_log_file << "failed to load texture" << std::endl;
}
return iStatus;
} | [
"ashinde@nvidia.com"
] | ashinde@nvidia.com |
cad2260f6326686b2e59fe475b044a9a0108c8df | 1708ae0065594deb61ce54e74e08782caa1e5352 | /GameFileServer1/main/main.cpp | a699dac6d67e30a7f242ec9a0c0bdf7ac5bdfb7b | [] | no_license | stareven/Dlut-Game-Platform | e9933214bb3984416414b19bf220390c7322182b | 0bbe52420ec337c1c77bda70d4d84cc865915cbb | refs/heads/master | 2021-01-18T04:53:10.054947 | 2011-08-28T23:23:28 | 2011-08-28T23:23:28 | 2,854,323 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 874 | cpp | #include <QtCore/QCoreApplication>
#include <QDebug>
#include "network/jgfsserver.h"
#include "service/jsubserverstartup.h"
#include "global/elogin.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
JGfsServer server;
quint16 port=server.run(50123);
qDebug()<<"GameFileServer1 startup :"<<port;
JSubServerStartup sssu;
sssu.m_host.m_address=QHostAddress("127.0.0.1");
sssu.m_host.m_port=37373;
sssu.m_loginname="sampleserverrunner";
sssu.m_passwd="123";
sssu.m_role=ROLE_GAMESERVERRUNNER;
sssu.m_gameinfo.m_gameId=109;
sssu.m_gameinfo.m_version=JVersion(1);
sssu.m_serverinfo.m_serverId=53380;
sssu.m_serverinfo.m_name="game_file_server_1";
sssu.m_serverinfo.m_address=QHostAddress::LocalHost;
sssu.m_serverinfo.m_port=port;
sssu.m_serverinfo.m_type=SubServer::SSubServer::ET_GameFileServer;
sssu.startup();
return a.exec();
}
| [
"lexdene@sohu.com"
] | lexdene@sohu.com |
79d0642c2ee1c87312b234e5a0beb79af42ca982 | 72530b12990dc28da37e3aad3d32bf8768af630b | /CPP/cpp_pool/day05/ex02/PresidentialPardonForm.cpp | 5130d053aa938a61a7f1d30e3bcb2877c22b6566 | [] | no_license | lacretelle/42_cursus | baa805415819a74535d94a9a2f2ca058080d70c0 | 3333da966109c1e378545137b5530148ecd7d972 | refs/heads/master | 2023-03-17T16:19:31.627724 | 2021-03-05T15:25:57 | 2021-03-05T15:25:57 | 317,812,905 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,138 | cpp | #include "PresidentialPardonForm.hpp"
PresidentialPardonForm::PresidentialPardonForm() : AForm() {}
PresidentialPardonForm::PresidentialPardonForm(std::string target) : AForm("PresidentialPardonForm", 25, 5), _target(target){}
PresidentialPardonForm::PresidentialPardonForm(PresidentialPardonForm const &src) : AForm(src)
{
*this = src;
}
PresidentialPardonForm &PresidentialPardonForm::operator=(PresidentialPardonForm const &src)
{
if (this != &src)
{
AForm::operator=(src);
this->_target = src.getTarget();
}
return *this;
}
PresidentialPardonForm::~PresidentialPardonForm() {}
std::string PresidentialPardonForm::getTarget() const
{
return this->_target;
}
void PresidentialPardonForm::action()
{
std::cout << this->getTarget() << " has been forgiven by Zafod Beeblebrox !" << std::endl;
}
std::ostream &operator<<(std::ostream &o, PresidentialPardonForm src)
{
o << "PresidentialPardonForm " << src.getName() << ", signed:" << src.getIsSigned() << ", which grade is " << src.getGradeSigned() << " to signed it and grade is " << src.getGradeEx() << " to excute it.";
return o;
}
| [
"marie@MacBook-Air-de-Marie.local"
] | marie@MacBook-Air-de-Marie.local |
c7f58301e3046e7f513284722fd7255473dcd422 | 7002f9baf2a838a4d148b1df221b2fb2dbcbcaaf | /Simulator/srSimulator/Systems/NAO/Ball.cpp | c879820d4061831bd9e7e2413a9beceea231a0bf | [] | no_license | jainajinkya/Sejong_Dynamic_Control_Toolkit | 7edfd69696408a19fe95f4a5594e2767d25cc97e | 811d4ff64b89a06f6a8e1cc9dcf851163c8f06e1 | refs/heads/master | 2021-08-14T23:02:50.910091 | 2017-11-16T23:42:21 | 2017-11-16T23:42:21 | 111,034,351 | 0 | 0 | null | 2017-11-16T23:35:41 | 2017-11-16T23:35:41 | null | UTF-8 | C++ | false | false | 863 | cpp | #include "Ball.h"
Ball::Ball(double x, double y, double z, double d, double mass, double rest){
for( int i(0); i<NUM_BALL; ++i){
ball_.GetGeomInfo().SetShape(srGeometryInfo::SPHERE);
ball_.GetGeomInfo().SetColor(0.324f, 0.12f, 0.12f);
ball_.GetGeomInfo().SetDimension(d, 0.0, 0.0);
ball_.SetFriction(0.1);
ball_.SetDamping(0.001);
ball_.SetRestitution(rest);
}
ball_.m_Inertia.SetMass(mass);
ball_.SetFrame(EulerZYX(Vec3(0.0, 0.0, 0.0), Vec3(x, y, z) ) );
// Collision
for (int i(0); i<NUM_BALL; ++i){
collision_.GetGeomInfo().SetShape(ball_.GetGeomInfo().GetShape());
collision_.GetGeomInfo().SetDimension(ball_.GetGeomInfo().GetDimension());
ball_.AddCollision(& collision_);
}
this->SetBaseLink(&ball_);
this->SetBaseLinkType(srSystem::DYNAMIC);
}
| [
"dk6587@utexas.edu"
] | dk6587@utexas.edu |
e2e15ca8627308286c8d64b12ceddc88fa85d655 | 5b80db0924330e5d76618662421d0bcac07af132 | /src/optimization/LocalCompression.cpp | 1e48be499d833af0d45101a28670990b785427b1 | [
"MIT"
] | permissive | Mookel/VC4C | 25129e2260c3ae5cdbdc92e8dc0f392fc3118a30 | d72978253820e4175fa591206dedda6c586068b3 | refs/heads/master | 2023-06-07T10:43:58.594891 | 2021-06-21T15:20:13 | 2021-06-21T15:20:24 | 357,043,822 | 0 | 0 | MIT | 2021-04-12T03:20:39 | 2021-04-12T03:20:39 | null | UTF-8 | C++ | false | false | 5,083 | cpp | /*
* Author: doe300
*
* See the file "LICENSE" for the full license governing this code.
*/
#include "LocalCompression.h"
#include "../InstructionWalker.h"
#include "../Method.h"
#include "../intermediate/VectorHelper.h"
#include "../intermediate/operators.h"
#include "CompilationError.h"
#include "log.h"
#include <string>
#include <vector>
using namespace vc4c;
using namespace vc4c::optimizations;
using namespace vc4c::operators;
static const std::vector<BuiltinLocal::Type> workGroupLocalNames = {BuiltinLocal::Type::LOCAL_IDS,
BuiltinLocal::Type::LOCAL_SIZES, BuiltinLocal::Type::GROUP_ID_X, BuiltinLocal::Type::GROUP_ID_Y,
BuiltinLocal::Type::GROUP_ID_Z, BuiltinLocal::Type::NUM_GROUPS_X, BuiltinLocal::Type::NUM_GROUPS_Y,
BuiltinLocal::Type::NUM_GROUPS_Z, BuiltinLocal::Type::GLOBAL_OFFSET_X, BuiltinLocal::Type::GLOBAL_OFFSET_Y,
BuiltinLocal::Type::GLOBAL_OFFSET_Z, BuiltinLocal::Type::WORK_DIMENSIONS, BuiltinLocal::Type::GLOBAL_DATA_ADDRESS};
static NODISCARD InstructionWalker compressLocalWrite(
Method& method, InstructionWalker it, const BuiltinLocal& local, const Local& container, unsigned char index)
{
CPPLOG_LAZY(logging::Level::DEBUG,
log << "Compressing write of local '" << local.name << "' into container '" << container.name
<< "' at position " << index << " at: " << it->to_string() << logging::endl);
if(auto source = it->getMoveSource())
{
// directly use the source of the assignment and insert it into vector
it = intermediate::insertVectorInsertion(
it, method, container.createReference(), Value(SmallImmediate(index), TYPE_INT8), *source);
it.erase();
return it;
}
if(auto op = it.get<intermediate::Operation>())
{
if(op->writesLocal(&local) && op->readsLocal(&local) && op->readsLiteral() && !op->hasSideEffects() &&
!op->hasConditionalExecution())
{
// replace local with index in container and make calculation only applicable for this index, e.g. for
// work-group loop group-id increment
auto cond = assignNop(it) = selectSIMDElement(index);
op->replaceLocal(&local, &container, LocalUse::Type::BOTH);
op->setCondition(cond);
it.nextInBlock();
return it;
}
}
const Value tmp = method.addNewLocal(local.type);
it->replaceLocal(&local, tmp.local(), LocalUse::Type::WRITER);
it.nextInBlock();
return intermediate::insertVectorInsertion(
it, method, container.createReference(), Value(SmallImmediate(index), TYPE_INT8), tmp);
}
static NODISCARD InstructionWalker compressLocalRead(
Method& method, InstructionWalker it, const BuiltinLocal& local, const Local& container, unsigned char index)
{
CPPLOG_LAZY(logging::Level::DEBUG,
log << "Compressing read of local '" << local.name << "' from container '" << container.name << "' at position "
<< index << " at: " << it->to_string() << logging::endl);
const Value tmp = method.addNewLocal(local.type);
it = intermediate::insertVectorExtraction(
it, method, container.createReference(), Value(SmallImmediate(index), TYPE_INT8), tmp);
it->replaceLocal(&local, tmp.local(), LocalUse::Type::READER);
return it;
}
static void compressLocalIntoRegister(
Method& method, const BuiltinLocal& local, const Local& container, unsigned char index)
{
if(index > 15)
throw CompilationError(CompilationStep::OPTIMIZER, "Container index out of bounds", std::to_string(index));
if(local.type.getVectorWidth() != 1)
throw CompilationError(CompilationStep::OPTIMIZER, "Can't compress local of vector-type: ", local.to_string());
// TODO most efficient way of finding iterator for instruction?
for(BasicBlock& bb : method)
{
auto it = bb.walk();
while(!it.isEndOfBlock())
{
if(it.get() && it->writesLocal(&local))
// replace all writes with write to container at given position
it = compressLocalWrite(method, it, local, container, index);
else if(it.get() && it->readsLocal(&local))
// replace all reads with reads of container at given position
it = compressLocalRead(method, it, local, container, index);
else
it.nextInBlock();
}
}
}
bool optimizations::compressWorkGroupLocals(const Module& module, Method& method, const Configuration& config)
{
if(method.empty() || method.begin()->empty())
return false;
unsigned char index = 0;
const Value container = method.addNewLocal(TYPE_INT32.toVectorType(16), "%work_group_info");
method.begin()->walk().nextInBlock().emplace(new intermediate::MoveOperation(container, INT_ZERO));
for(auto type : workGroupLocalNames)
{
if(auto local = method.findBuiltin(type))
{
compressLocalIntoRegister(method, *local, *container.local(), index);
++index;
}
}
return false;
}
| [
"stadeldani@web.de"
] | stadeldani@web.de |
cdb6506ecf41aed7d09398f7c84f88424da8920c | 2a440aea43b5b880fd433f58098ac3bbc66fcfec | /drds/include/alibabacloud/drds/model/CreateIndexRequest.h | 9461c0912ee41ea76b4841a0c0bb94f13547c8c7 | [
"Apache-2.0"
] | permissive | longkai1028/aliyun-openapi-cpp-sdk | 30d6553e508c6a38d190557487972553a6ae64d5 | 97286a49ca7ae8754984f6b8abce1a8e6f48117c | refs/heads/master | 2023-04-04T00:13:25.713899 | 2021-04-13T02:28:45 | 2021-04-13T02:28:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,664 | h | /*
* Copyright 2009-2017 Alibaba Cloud 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.
*/
#ifndef ALIBABACLOUD_DRDS_MODEL_CREATEINDEXREQUEST_H_
#define ALIBABACLOUD_DRDS_MODEL_CREATEINDEXREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/drds/DrdsExport.h>
namespace AlibabaCloud
{
namespace Drds
{
namespace Model
{
class ALIBABACLOUD_DRDS_EXPORT CreateIndexRequest : public RpcServiceRequest
{
public:
CreateIndexRequest();
~CreateIndexRequest();
std::string getDrdsInstanceId()const;
void setDrdsInstanceId(const std::string& drdsInstanceId);
std::string getAccessKeyId()const;
void setAccessKeyId(const std::string& accessKeyId);
std::string getDbName()const;
void setDbName(const std::string& dbName);
std::string getDdlSql()const;
void setDdlSql(const std::string& ddlSql);
private:
std::string drdsInstanceId_;
std::string accessKeyId_;
std::string dbName_;
std::string ddlSql_;
};
}
}
}
#endif // !ALIBABACLOUD_DRDS_MODEL_CREATEINDEXREQUEST_H_ | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
4fa30350b8cf3589d120d385776c0bb3a6918aee | 736d389dde3020f1e06b034b2224bed2b6dfae9c | /engine/console/compiler.cc | dc5ae61683e90024961b2153c4f1d7958ba0c83e | [
"MIT"
] | permissive | jamesu/korkscript | 08396ed9999c01d6ece6ef77186b4856dbb4fd27 | 14ac1acc9d766173495816d181d26fd3bd530e94 | refs/heads/master | 2022-12-20T19:43:04.670210 | 2020-09-03T15:41:39 | 2020-09-03T15:41:39 | 292,612,109 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 11,072 | cc | //-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "platform/platform.h"
#include "console/console.h"
#include "console/telnetDebugger.h"
#include "console/ast.h"
#include "core/tAlgorithm.h"
#include "core/findMatch.h"
#include "console/consoleInternal.h"
#include "core/fileStream.h"
#include "console/compiler.h"
#include "console/simBase.h"
namespace Compiler
{
F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line)
{
F64 val = dAtof(str);
if(val != 0)
return val;
else if(!dStricmp(str, "true"))
return 1;
else if(!dStricmp(str, "false"))
return 0;
else if(file)
{
Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line);
return 0;
}
return 0;
}
//------------------------------------------------------------
CompilerStringTable *gCurrentStringTable, gGlobalStringTable, gFunctionStringTable;
CompilerFloatTable *gCurrentFloatTable, gGlobalFloatTable, gFunctionFloatTable;
DataChunker gConsoleAllocator;
CompilerIdentTable gIdentTable;
//------------------------------------------------------------
void evalSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr)
{
#ifdef TORQUE_64
*(U64*)(ptr) = (U64)ste;
#else
*ptr = (U32)ste;
#endif
}
void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr)
{
if(ste)
getIdentTable().add(ste, ip);
*ptr = 0;
*(ptr+1) = 0;
}
void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode;
//------------------------------------------------------------
bool gSyntaxError = false;
//------------------------------------------------------------
CompilerStringTable *getCurrentStringTable() { return gCurrentStringTable; }
CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; }
CompilerStringTable &getFunctionStringTable() { return gFunctionStringTable; }
void setCurrentStringTable (CompilerStringTable* cst) { gCurrentStringTable = cst; }
CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; }
CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; }
CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; }
void setCurrentFloatTable (CompilerFloatTable* cst) { gCurrentFloatTable = cst; }
CompilerIdentTable &getIdentTable() { return gIdentTable; }
void precompileIdent(StringTableEntry ident)
{
if(ident)
gGlobalStringTable.add(ident);
}
void resetTables()
{
setCurrentStringTable(&gGlobalStringTable);
setCurrentFloatTable(&gGlobalFloatTable);
getGlobalFloatTable().reset();
getGlobalStringTable().reset();
getFunctionFloatTable().reset();
getFunctionStringTable().reset();
getIdentTable().reset();
}
void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); }
void consoleAllocReset() { gConsoleAllocator.freeBlocks(); }
}
//-------------------------------------------------------------------------
using namespace Compiler;
//-------------------------------------------------------------------------
U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag)
{
// Is it already in?
Entry **walk;
for(walk = &list; *walk; walk = &((*walk)->next))
{
if((*walk)->tag != tag)
continue;
if(caseSens)
{
if(!dStrcmp((*walk)->string, str))
return (*walk)->start;
}
else
{
if(!dStricmp((*walk)->string, str))
return (*walk)->start;
}
}
// Write it out.
Entry *newStr = (Entry *) consoleAlloc(sizeof(Entry));
*walk = newStr;
newStr->next = NULL;
newStr->start = totalLen;
U32 len = dStrlen(str) + 1;
if(tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul
len = 7;
totalLen += len;
newStr->string = (char *) consoleAlloc(len);
newStr->len = len;
newStr->tag = tag;
dStrcpy(newStr->string, str);
return newStr->start;
}
U32 CompilerStringTable::addIntString(U32 value)
{
dSprintf(buf, sizeof(buf), "%d", value);
return add(buf);
}
U32 CompilerStringTable::addFloatString(F64 value)
{
dSprintf(buf, sizeof(buf), "%g", value);
return add(buf);
}
void CompilerStringTable::reset()
{
list = NULL;
totalLen = 0;
}
char *CompilerStringTable::build()
{
char *ret = new char[totalLen];
for(Entry *walk = list; walk; walk = walk->next)
dStrcpy(ret + walk->start, walk->string);
return ret;
}
void CompilerStringTable::write(Stream &st)
{
st.write(totalLen);
for(Entry *walk = list; walk; walk = walk->next)
st.write(walk->len, walk->string);
}
//------------------------------------------------------------
U32 CompilerFloatTable::add(F64 value)
{
Entry **walk;
U32 i = 0;
for(walk = &list; *walk; walk = &((*walk)->next), i++)
if(value == (*walk)->val)
return i;
Entry *newFloat = (Entry *) consoleAlloc(sizeof(Entry));
newFloat->val = value;
newFloat->next = NULL;
count++;
*walk = newFloat;
return count-1;
}
void CompilerFloatTable::reset()
{
list = NULL;
count = 0;
}
F64 *CompilerFloatTable::build()
{
F64 *ret = new F64[count];
U32 i = 0;
for(Entry *walk = list; walk; walk = walk->next, i++)
ret[i] = walk->val;
return ret;
}
void CompilerFloatTable::write(Stream &st)
{
st.write(count);
for(Entry *walk = list; walk; walk = walk->next)
st.write(walk->val);
}
//------------------------------------------------------------
void CompilerIdentTable::reset()
{
list = NULL;
}
void CompilerIdentTable::add(StringTableEntry ste, U32 ip)
{
U32 index = gGlobalStringTable.add(ste, false);
Entry *newEntry = (Entry *) consoleAlloc(sizeof(Entry));
newEntry->offset = index;
newEntry->ip = ip;
for(Entry *walk = list; walk; walk = walk->next)
{
if(walk->offset == index)
{
newEntry->nextIdent = walk->nextIdent;
walk->nextIdent = newEntry;
return;
}
}
newEntry->next = list;
list = newEntry;
newEntry->nextIdent = NULL;
}
void CompilerIdentTable::write(Stream &st)
{
U32 count = 0;
Entry * walk;
for(walk = list; walk; walk = walk->next)
count++;
st.write(count);
for(walk = list; walk; walk = walk->next)
{
U32 ec = 0;
Entry * el;
for(el = walk; el; el = el->nextIdent)
ec++;
st.write(walk->offset);
st.write(ec);
for(el = walk; el; el = el->nextIdent)
st.write(el->ip);
}
}
//-------------------------------------------------------------------------
U8 *CodeStream::allocCode(U32 sz)
{
U8 *ptr = NULL;
if (mCodeHead)
{
const U32 bytesLeft = BlockSize - mCodeHead->size;
if (bytesLeft > sz)
{
ptr = mCodeHead->data + mCodeHead->size;
mCodeHead->size += sz;
return ptr;
}
}
CodeData *data = new CodeData;
data->data = (U8*)dMalloc(BlockSize);
data->size = sz;
data->next = NULL;
if (mCodeHead)
mCodeHead->next = data;
mCodeHead = data;
if (mCode == NULL)
mCode = data;
return data->data;
}
//-------------------------------------------------------------------------
void CodeStream::fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint)
{
AssertFatal(mFixStack.size() > 0, "Fix stack mismatch");
U32 fixStart = mFixStack[mFixStack.size()-1];
for (U32 i=fixStart; i<mFixList.size(); i += 2)
{
FixType type = (FixType)mFixList[i+1];
U32 fixedIp = 0;
bool valid = true;
switch (type)
{
case FIXTYPE_LOOPBLOCKSTART:
fixedIp = loopBlockStart;
break;
case FIXTYPE_BREAK:
fixedIp = breakPoint;
break;
case FIXTYPE_CONTINUE:
fixedIp = continuePoint;
break;
default:
//Con::warnf("Address %u fixed as %u", mFixList[i], mFixList[i+1]);
valid = false;
break;
}
if (valid)
{
patch(mFixList[i], fixedIp);
}
}
}
//-------------------------------------------------------------------------
void CodeStream::emitCodeStream(U32 *size, U32 **stream, U32 **lineBreaks)
{
// Alloc stream
U32 numLineBreaks = getNumLineBreaks();
*stream = new U32[mCodePos + (numLineBreaks * 2)];
dMemset(*stream, '\0', mCodePos + (numLineBreaks * 2));
*size = mCodePos;
// Dump chunks & line breaks
U32 outBytes = mCodePos * sizeof(U32);
U8 *outPtr = *((U8**)stream);
for (CodeData *itr = mCode; itr != NULL; itr = itr->next)
{
U32 bytesToCopy = itr->size > outBytes ? outBytes : itr->size;
dMemcpy(outPtr, itr->data, bytesToCopy);
outPtr += bytesToCopy;
outBytes -= bytesToCopy;
}
*lineBreaks = *stream + mCodePos;
dMemcpy(*lineBreaks, mBreakLines.address(), sizeof(U32) * mBreakLines.size());
// Apply patches on top
for (U32 i=0; i<mPatchList.size(); i++)
{
PatchEntry &e = mPatchList[i];
(*stream)[e.addr] = e.value;
}
}
//-------------------------------------------------------------------------
void CodeStream::reset()
{
mCodePos = 0;
mFixStack.clear();
mFixLoopStack.clear();
mFixList.clear();
mBreakLines.clear();
// Pop down to one code block
CodeData *itr = mCode ? mCode->next : NULL;
while (itr != NULL)
{
CodeData *next = itr->next;
dFree(itr->data);
delete(itr);
itr = next;
}
if (mCode)
{
mCode->size = 0;
mCode->next = NULL;
mCodeHead = mCode;
}
}
| [
"jamesu@gmail.com"
] | jamesu@gmail.com |
46927eca55c611b623381ae689653f629aecf300 | 1b1114a96b826f8d1de0eafca1e38db57d4ff7c7 | /src/algorithm/deimosV1.cpp | 3bf4c7d7fe67b06079e7e53f7647a2b48c8e0de9 | [
"MIT"
] | permissive | TheSonOfDeimos/network-routing-optimization | beb0d19c7020ca106a02e23406daf28c97bc1406 | 7030b5cf333f19ab68952b6841463f4cfd664895 | refs/heads/main | 2023-05-08T01:02:08.619010 | 2021-06-05T20:47:44 | 2021-06-05T20:47:44 | 341,121,037 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,101 | cpp | #include "deimosV1.hpp"
#include "types.hpp"
DeimosV1::DeimosV1(int maxPathLength, double reqSpeed, double reqPacketloss, double reqPing)
: m_maxPathLength(maxPathLength),
m_reqSpeed(reqSpeed),
m_reqPacketloss(reqPacketloss),
m_reqPing(reqPing)
{
}
status_t DeimosV1::adoptStartMatrix(ConnectMatrix_t &startMatrix)
{
status_t status = ERROR_OK;
for (auto &line : startMatrix)
{
for (auto &element : line.second)
{
EXIT_IF(element.second.cost != -1, ERROR_LOGIC);
element.second.cost = 0;
}
}
exit:
return status;
}
status_t DeimosV1::isPathPossible(hostAddress_t startLineAddr, const std::pair<hostAddress_t, Cell> &startElement, hostAddress_t prevLineAddr, const std::pair<hostAddress_t, Cell> &prevElement)
{
status_t status = ERROR_RESULT_TRUE;
EXIT_IF(prevLineAddr == prevElement.first, ERROR_RESULT_FALSE);
EXIT_IF(prevLineAddr == startElement.first && prevElement.first == startLineAddr, ERROR_RESULT_FALSE);
EXIT_IF(prevElement.second.path.back() != startElement.second.path.front(), ERROR_LOGIC);
// Check req
EXIT_IF(prevElement.second.path.size() >= static_cast<std::size_t>(m_maxPathLength), ERROR_RESULT_FALSE);
{
double expSpeed = std::min(startElement.second.speed, prevElement.second.speed);
double expPacketLoss = (1 - ((100 - startElement.second.packetLoss) / 100) * ((100 - prevElement.second.packetLoss) / 100)) * 100;
double expPing = startElement.second.ping + prevElement.second.ping;
EXIT_IF(expSpeed < m_reqSpeed, ERROR_RESULT_FALSE);
EXIT_IF(expPacketLoss > m_reqPacketloss, ERROR_RESULT_FALSE);
EXIT_IF(expPing > m_reqPing, ERROR_RESULT_FALSE);
}
// Find cycles
{
std::vector<hostAddress_t> se = startElement.second.path;
std::vector<hostAddress_t> pe = prevElement.second.path;
std::sort(se.begin(), se.end());
std::sort(pe.begin(), pe.end());
std::vector<hostAddress_t> intersect;
std::set_intersection(se.begin(), se.end(),
pe.begin(), pe.end(),
std::back_inserter(intersect));
EXIT_IF(intersect.size() > 1, ERROR_RESULT_FALSE);
}
exit:
return status;
}
status_t DeimosV1::appentToNextMatrix(hostAddress_t startLineAddr, const std::pair<hostAddress_t, Cell> &startElement, hostAddress_t prevLineAddr, const std::pair<hostAddress_t, Cell> &prevElement, ConnectMatrix_t &nextMatrix)
{
status_t status = ERROR_OK;
Cell newCell = prevElement.second;
newCell.path.push_back(startElement.first);
newCell.speed = std::min(startElement.second.speed, prevElement.second.speed);
newCell.packetLoss = (1 - ((100 - startElement.second.packetLoss) / 100) * ((100 - prevElement.second.packetLoss) / 100)) * 100;
newCell.ping = startElement.second.ping + prevElement.second.ping;
std::vector<double> weightVector = {};
weightVector.push_back((1 / newCell.speed) / (1 / m_reqSpeed));
weightVector.push_back(newCell.packetLoss / m_reqPacketloss);
weightVector.push_back(newCell.ping / m_reqPing);
std::sort(weightVector.begin(), weightVector.end(), std::greater<double>());
newCell.cost = prevElement.second.cost + weightVector.front();
nextMatrix[prevLineAddr][startElement.first] = newCell;
exit:
return status;
}
RouteTable_t DeimosV1::mergeMatrixToRouteTable(const std::vector<ConnectMatrix_t> &matrixVec)
{
RouteTable_t table;
for (auto& matrix : matrixVec)
{
for (auto& line : matrix)
{
for (auto& elem : line.second)
{
table.push_back({});
table.back().cost = elem.second.cost;
table.back().source = line.first;
table.back().destination = elem.first;
table.back().path = elem.second.path;
}
}
}
std::sort(table.begin(), table.end(), [](Route& cell_1, Route& cell_2)
{
return cell_1.cost < cell_2.cost;
});
return table;
}
| [
"l.kargalov@yandex.ru"
] | l.kargalov@yandex.ru |
2335c4db417e44903e6fd265f9361eb2258c67e2 | d87b74caa36c207a10e4340ca91bc93a6a0e3384 | /src/Popo/BaseItem.h | 351949a2171cb592ccf5e910e387870691ae58cb | [
"Unlicense"
] | permissive | yangzhiming/popo | aeb82a1cad13ccb40358fbcaa8847a33c77516f7 | 598b93befa2f00214b6d236050048d7da231443f | refs/heads/master | 2020-05-31T16:47:27.514938 | 2013-09-26T09:33:32 | 2013-09-26T09:33:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 272 | h | #ifndef _BASE_ITEM_H_
#define _BASE_ITEM_H_
class BaseItem
{
public:
BaseItem(void) {}
virtual ~BaseItem(void) {}
virtual void Draw(Graphics* pGraph) = 0;
virtual BaseItem* Clone() = 0;
virtual void Update(float fDelta) = 0;
};
#endif //_BASE_ITEM_H_ | [
"yzmforever@163.com"
] | yzmforever@163.com |
54ce8be4afdad84dea439ab92ac49f26c014dc19 | 41ee2d69b6af0a3200178d7930e74e58cc43b742 | /src/iterator/tstl_iterator_base.h | b9cf728f3f699a58bf960a48b0680f2002d9bca3 | [] | no_license | jylc/TSTL | a54efe5db6bf4b8f816c09a7512319f69540c80f | a3445bc4976d9b5fc0b5947e1e092cf2077149d2 | refs/heads/master | 2022-12-11T16:20:11.925921 | 2020-08-31T02:49:43 | 2020-08-31T02:49:43 | 288,062,242 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 12,315 | h | #pragma once
#ifndef _TSTL_ITERATOR_BASE_H_
#define _TSTL_ITERATOR_BASE_H_
namespace TSTL
{
//有五种迭代器类别
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag :public input_iterator_tag {};
struct bidirectional_iterator_tag :public forward_iterator_tag {};
struct random_access_iterator_tag :public bidirectional_iterator_tag {};
/*
*iterators必须有能力回答algorithm的提问
*提问在标准库中有五种,但其中两种reference和pointer
*从未被使用
*/
template<typename _Tp, typename _Distance>
class input_iterator
{
public:
typedef input_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template<typename _Tp, typename _Distance>
class output_iterator
{
public:
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
};
template<typename _Tp, typename _Distance>
class forward_iterator
{
public:
typedef forward_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template<typename _Tp, typename _Distance>
class bidirectional_iterator
{
public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template<typename _Tp, typename _Distance>
class random_access_iterator
{
public:
typedef random_access_iterator_tag iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
//用户自己写的迭代器最好继承于此
#ifdef __STL_USE_NAMESPACES
template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
typedef _Pointer = _Tp*, typedef _Reference = _Tp&>
class iterator
{
public:
typedef _Category iterator_category;
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Pointer pointer;
typedef _Reference reference;
};
#endif // __STL_USE_NAMESPACES
/*
* 问:为什么需要萃取器(traits)?
* 答:当iterator是class类型时,可以回答算法的提问,
* 但当iterator是native pointer(它被视为一种退化的iterator)时,就无法回答。
* 于是使用萃取机将其特性萃取出来(相当于添加了一个中间层)。
*/
#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
// traits 获取各个迭代器的特性(相应类型)-----类型特性类
template<typename _Iterator>
class iterator_traits
{
public:
typedef _Iterator::iterator_category iterator_category; //迭代器的类型
typedef _Iterator::value_type value_type; //迭代器解除引用后的值的类型
typedef _Iterator::difference_type difference_type; //两个迭代器之间的距离
typedef _Iterator::pointer pointer; //指向被迭代类型的指针
typedef _Iterator::reference reference; //被迭代类型的引用
};
// 针对原生指针(native pointer)而设计的 traits 偏特化版
template<typename _Tp>
class iterator_traits<_Tp*>
{
public:
typedef random_access_iterator_tag iterator_category;
typedef ptrdiff_t difference_type;
typedef _Tp value_type;
typedef _Tp* pointer;
typedef _Tp& reference;
};
template<typename _Tp>
class iterator_traits<const _Tp*>
{
public:
typedef random_access_iterator_tag iterator_category;
typedef ptrdiff_t difference_type;
typedef _Tp value_type;
typedef const _Tp* pointer;
typedef const _Tp& reference;
};
template<typename _Iter>
inline typename iterator_traits<_Iter>::iterator_category
__iterator_category(const _Iter&)
{
typedef typename iterator_traits<_Iter>::iterator_category _Category;
return _Category();
}
template<typename _Iter>
inline typename iterator_traits<_Iter>::difference_type*
__difference_type(const _Iter&)
{
return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
}
template<typename _Iter>
inline typename iterator_traits<_Iter>::value_type*
__value_type(const _Iter&)
{
return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
}
//封装
template<typename _Iter>
inline typename iterator_traits<_Iter>::iterator_category
iterator_category(const _Iter& __i)
{
return __iterator_category(__i);
}
template<typename _Iter>
inline typename iterator_traits<_Iter>::difference_type*
difference_type(const _Iter& __i)
{
return __difference_type(__i);
}
template<typename _Iter>
inline typename iterator_traits<_Iter>::value_type*
value_type(const _Iter& __i)
{
return __value_type(__i);
}
#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
#define __DISTANCE_TYPE(__i) __distance_type(__i)
#define __VALUE_TYPE(__i) __value_type(__i)
#else
template<typename _Tp,typename _Distance>
inline input_iterator_tag
iterator_category(const input_iterator<_Tp, _Distance>&)
{
return input_iterator_tag();
}
template<typename _Tp,typename _Distance>
inline output_iterator_tag
iterator_category(const output_iterator<_Tp, _Distance>&)
{
return output_iterator_tag();
}
template<typename _Tp, typename _Distance>
inline forward_iterator_tag
iterator_category(const forward_iterator<_Tp, _Distance>&)
{
return forward_iterator_tag();
}
template<typename _Tp, typename _Distance>
inline bidirectional_iterator_tag
iterator_category(const bidirectional_iterator<_Tp, _Distance>&)
{
return bidirectional_iterator_tag
}
template<typename _Tp, typename _Distance>
inline random_access_iterator_tag
iterator_category(const random_access_iterator<_Tp, _Distance>&)
{
return random_access_iterator_tag
}
template<typename _Tp>
inline random_access_iterator_tag
iterator_category(const _Tp*)
{
return random_access_iterator_tag();
}
//value_type
template<typename _Tp,typename _Distance>
inline _Tp* value_type(const input_iterator<_Tp, _Distance>&)
{
return (_Tp*)(0);
}
template<typename _Tp,typename _Distance>
inline _Tp* value_type(const forward_iterator<_Tp, _Distance>&)
{
return (_Tp*)(0);
}
template<typename _Tp, typename _Distance>
inline _Tp* value_type(const bidirectional_iterator<_Tp, _Distance>&)
{
return (_Tp*)(0);
}
template<typename _Tp, typename _Distance>
inline _Tp* value_type(const random_access_iterator<_Tp, _Distance>&)
{
return (_Tp*)(0);
}
template<typename _Tp>
inline _Tp* value_type(const _Tp*) {
return (_Tp*)(0);
}
//distance_type
template<typename _T,typename _Distance>
inline _Distance* distance_type(const input_iterator<_T,_Distance>&)
{
return (_Distance*)(0);
}
template<typename _T, typename _Distance>
inline _Distance* distance_type(const output_iterator<_T, _Distance>&)
{
return (_Distance*)(0);
}
template<typename _T, typename _Distance>
inline _Distance* distance_type(const forward_iterator<_T, _Distance>&)
{
return (_Distance*)(0);
}
template<typename _T, typename _Distance>
inline _Distance* distance_type(const bidirectional_iterator<_T, _Distance>&)
{
return (_Distance*)(0);
}
template<typename _T, typename _Distance>
inline _Distance* distance_type(const random_access_iterator<_T, _Distance>&)
{
return (_Distance*)(0);
}
template<typename _Tp>
inline ptrdiff_t* distance_type(const _Tp*)
{
return (ptrdiff_t*)(0);
}
//distance
////////////////////////////////////////////////////////////////////////////////
// template <class InputIterator, class Distance>
// inline void distance(InputIterator first, InputIterator last, Distance& n)
////////////////////////////////////////////////////////////////////////////////
// distance
// |
// |---------------- 判断迭代器类型
// Input Iterator ↓ Random Access Iterator
// -------------------------------------------
// | |
// | |
// ↓ |
// __distance(..., input_iterator_tag) |
// while (first != last) { ++first; ++n; } |
// ↓
// __distance(..., random_access_iterator_tag)
// n += last - first;
////////////////////////////////////////////////////////////////////////////////
template<class InputIterator,typename Distance>
inline void __distance(InputIterator __first, InputIterator __last, Distance& n,input_iterator_tag)
{
while (__first!=__last)
{
__first++;
n++;
}
}
template<class RandomAccessIterator,typename Distance>
inline void __distance(RandomAccessIterator __first, RandomAccessIterator __last, Distance& n, random_access_iterator_tag)
{
n += __last - __first;
}
template<typename InputIterator,typename Distance>
inline void distance(InputIterator __first, InputIterator __last, Distance& n)
{
__distance(__first, __last, n,iterator_category(__first));
}
////////////////////////////////////////////////////////////////////////////////
// advance()实现部分
////////////////////////////////////////////////////////////////////////////////
// advance
// |
// |---------------- 判断迭代器类型
// Input Iterator ↓
// ---------------------------------------------------------------------
// | Random Access Iterator | Bidirectional Iterator |
// | | |
// ↓ | |
// __advance(..., input_iterator_tag) | |
// while (n--) ++i; | |
// | |
// ↓ |
// __advance(..., random_access_iterator_tag) |
// i += n; |
// |
// ↓
// __advance(..., bidirectional_iterator_tag)
// if (n >= 0)
// while (n--) ++i;
// else
// while (n++) --i;
////////////////////////////////////////////////////////////////////////////////
template<typename InputIterator,typename Distance>
inline void __advance(InputIterator& i, Distance n, input_iterator_tag)
{
while (n--)
{
i++;
}
}
template<typename BidirectionalIterator,typename Distance>
inline void __advance(BidirectionalIterator& i, Distance n, bidirectional_iterator_tag)
{
if (n >= 0)
{
while (n--)
{
i++;
}
}
else
{
while (n++)
{
i--;
}
}
}
template<typename RandomAccessIterator,typename Distance>
inline void __advance(RandomAccessIterator& i, Distance n, random_access_iterator_tag)
{
i += n;
}
template<typename InputIterator,typename Distance>
inline void advance(InputIterator& i, Distance n)
{
__advance(i, n, iterator_category(i));
}
#endif // __STL_CLASS_PARTIAL_SPECIALIZATION
}
#endif // !_TSTL_ITERATOR_BASE_H_
| [
"wxb1737450829@126.com"
] | wxb1737450829@126.com |
bb228a5737fb90d9c0de7d99b534fa4259bad502 | 6b0ee0657d427e3c51fa190c6a3b3468cdde5194 | /SMM_1.1/Classes/Native/Il2CppCompilerCalculateTypeValues_18Table.cpp | d898a026c693753cf5503c1e712f4abd4322ba61 | [] | no_license | Ryan-Bilodeau/TreadWater-iOS | 67b59dff954a56b9f121cafab3027b334ffc17c5 | da9f02f689ffb3c379c0478ab097e1164911795a | refs/heads/master | 2020-04-08T18:00:33.218977 | 2018-11-29T02:07:00 | 2018-11-29T02:07:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 49,930 | cpp | #include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "UnityEngine_UI_UnityEngine_UI_Scrollbar_Axis2427050347.h"
#include "UnityEngine_UI_UnityEngine_UI_Scrollbar_U3CClickRe4156771994.h"
#include "UnityEngine_UI_UnityEngine_UI_ScrollRect1199013257.h"
#include "UnityEngine_UI_UnityEngine_UI_ScrollRect_MovementTy905360158.h"
#include "UnityEngine_UI_UnityEngine_UI_ScrollRect_Scrollbar3834843475.h"
#include "UnityEngine_UI_UnityEngine_UI_ScrollRect_ScrollRec3529018992.h"
#include "UnityEngine_UI_UnityEngine_UI_Selectable1490392188.h"
#include "UnityEngine_UI_UnityEngine_UI_Selectable_Transition605142169.h"
#include "UnityEngine_UI_UnityEngine_UI_Selectable_Selection3187567897.h"
#include "UnityEngine_UI_UnityEngine_UI_SetPropertyUtility4019374597.h"
#include "UnityEngine_UI_UnityEngine_UI_Slider297367283.h"
#include "UnityEngine_UI_UnityEngine_UI_Slider_Direction1525323322.h"
#include "UnityEngine_UI_UnityEngine_UI_Slider_SliderEvent2111116400.h"
#include "UnityEngine_UI_UnityEngine_UI_Slider_Axis375128448.h"
#include "UnityEngine_UI_UnityEngine_UI_SpriteState1353336012.h"
#include "UnityEngine_UI_UnityEngine_UI_StencilMaterial1630303189.h"
#include "UnityEngine_UI_UnityEngine_UI_StencilMaterial_MatE3157325053.h"
#include "UnityEngine_UI_UnityEngine_UI_Text356221433.h"
#include "UnityEngine_UI_UnityEngine_UI_Toggle3976754468.h"
#include "UnityEngine_UI_UnityEngine_UI_Toggle_ToggleTransit1114673831.h"
#include "UnityEngine_UI_UnityEngine_UI_Toggle_ToggleEvent1896830814.h"
#include "UnityEngine_UI_UnityEngine_UI_ToggleGroup1030026315.h"
#include "UnityEngine_UI_UnityEngine_UI_ClipperRegistry1349564894.h"
#include "UnityEngine_UI_UnityEngine_UI_Clipping223789604.h"
#include "UnityEngine_UI_UnityEngine_UI_RectangularVertexCli3349113845.h"
#include "UnityEngine_UI_UnityEngine_UI_AspectRatioFitter3114550109.h"
#include "UnityEngine_UI_UnityEngine_UI_AspectRatioFitter_As1166448724.h"
#include "UnityEngine_UI_UnityEngine_UI_CanvasScaler2574720772.h"
#include "UnityEngine_UI_UnityEngine_UI_CanvasScaler_ScaleMod987318053.h"
#include "UnityEngine_UI_UnityEngine_UI_CanvasScaler_ScreenM1916789528.h"
#include "UnityEngine_UI_UnityEngine_UI_CanvasScaler_Unit3220761768.h"
#include "UnityEngine_UI_UnityEngine_UI_ContentSizeFitter1325211874.h"
#include "UnityEngine_UI_UnityEngine_UI_ContentSizeFitter_Fi4030874534.h"
#include "UnityEngine_UI_UnityEngine_UI_GridLayoutGroup1515633077.h"
#include "UnityEngine_UI_UnityEngine_UI_GridLayoutGroup_Corn1077473318.h"
#include "UnityEngine_UI_UnityEngine_UI_GridLayoutGroup_Axis1431825778.h"
#include "UnityEngine_UI_UnityEngine_UI_GridLayoutGroup_Cons3558160636.h"
#include "UnityEngine_UI_UnityEngine_UI_HorizontalLayoutGrou2875670365.h"
#include "UnityEngine_UI_UnityEngine_UI_HorizontalOrVertical1968298610.h"
#include "UnityEngine_UI_UnityEngine_UI_LayoutElement2808691390.h"
#include "UnityEngine_UI_UnityEngine_UI_LayoutGroup3962498969.h"
#include "UnityEngine_UI_UnityEngine_UI_LayoutGroup_U3CDelay3228926346.h"
#include "UnityEngine_UI_UnityEngine_UI_LayoutRebuilder2155218138.h"
#include "UnityEngine_UI_UnityEngine_UI_LayoutUtility4076838048.h"
#include "UnityEngine_UI_UnityEngine_UI_VerticalLayoutGroup2468316403.h"
#include "UnityEngine_UI_UnityEngine_UI_ReflectionMethodsCac3343836395.h"
#include "UnityEngine_UI_UnityEngine_UI_ReflectionMethodsCac3928470916.h"
#include "UnityEngine_UI_UnityEngine_UI_ReflectionMethodsCac2260664863.h"
#include "UnityEngine_UI_UnityEngine_UI_ReflectionMethodsCac3435657708.h"
#include "UnityEngine_UI_UnityEngine_UI_ReflectionMethodsCac2213949596.h"
#include "UnityEngine_UI_UnityEngine_UI_VertexHelper385374196.h"
#include "UnityEngine_UI_UnityEngine_UI_BaseVertexEffect2504093552.h"
#include "UnityEngine_UI_UnityEngine_UI_BaseMeshEffect1728560551.h"
#include "UnityEngine_UI_UnityEngine_UI_Outline1417504278.h"
#include "UnityEngine_UI_UnityEngine_UI_PositionAsUV11102546563.h"
#include "UnityEngine_UI_UnityEngine_UI_Shadow4269599528.h"
#include "UnityEngine_UI_U3CPrivateImplementationDetailsU3E1486305137.h"
#include "UnityEngine_UI_U3CPrivateImplementationDetailsU3E_1568637717.h"
#include "UnityEngine_Analytics_U3CModuleU3E3783534214.h"
#include "UnityEngine_Analytics_UnityEngine_Analytics_Analyt2191537572.h"
#include "UnityEngine_Analytics_UnityEngine_Analytics_Analyt1068911718.h"
#include "UnityEngine_Analytics_UnityEngine_Analytics_Tracka1304606600.h"
#include "UnityEngine_Analytics_UnityEngine_Analytics_Tracka2256174789.h"
#include "AssemblyU2DCSharp_U3CModuleU3E3783534214.h"
#include "AssemblyU2DCSharp_AudioManager4222704959.h"
#include "AssemblyU2DCSharp_ButtonManager868394943.h"
#include "AssemblyU2DCSharp_CanvasManager475273629.h"
#include "AssemblyU2DCSharp_CloudManager3172292548.h"
#include "AssemblyU2DCSharp_CloudManager_U3CSpawnManagerU3Ec2296720958.h"
#include "AssemblyU2DCSharp_DayNightManager707488325.h"
#include "AssemblyU2DCSharp_DayNightManager_U3CIncreaseDayAn3780777759.h"
#include "AssemblyU2DCSharp_DayNightManager_U3CFirstWinAnimat216805772.h"
#include "AssemblyU2DCSharp_DayNightManager_U3CFirstWinSprit2960083517.h"
#include "AssemblyU2DCSharp_GameStateManager1063875770.h"
#include "AssemblyU2DCSharp_GameStateManager_U3CResetMeowsPos635611634.h"
#include "AssemblyU2DCSharp_GameStateManager_U3CResumeOnButto551396632.h"
#include "AssemblyU2DCSharp_GameStateManager_U3CPauseAtStart1323805765.h"
#include "AssemblyU2DCSharp_GameStateManager_U3CCheckIfPlaye3775106045.h"
#include "AssemblyU2DCSharp_CloudStateManager891150987.h"
#include "AssemblyU2DCSharp_CloudStateManager_U3CManageStateU440724577.h"
#include "AssemblyU2DCSharp_PPKeys1122428640.h"
#include "AssemblyU2DCSharp_OceanManager4124689315.h"
#include "AssemblyU2DCSharp_OceanManager_U3CBgTilingU3Ec__It1547012651.h"
#include "AssemblyU2DCSharp_OceanManager_U3CFgTilingU3Ec__It3897932328.h"
#include "AssemblyU2DCSharp_PlayerManager1596653588.h"
#include "AssemblyU2DCSharp_PlayerManager_U3CPlaySwimAnimati3636478526.h"
#include "AssemblyU2DCSharp_Scene0MenuObjects1763648433.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1800 = { sizeof (Axis_t2427050347)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1800[3] =
{
Axis_t2427050347::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1801 = { sizeof (U3CClickRepeatU3Ec__Iterator0_t4156771994), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1801[5] =
{
U3CClickRepeatU3Ec__Iterator0_t4156771994::get_offset_of_eventData_0(),
U3CClickRepeatU3Ec__Iterator0_t4156771994::get_offset_of_U24this_1(),
U3CClickRepeatU3Ec__Iterator0_t4156771994::get_offset_of_U24current_2(),
U3CClickRepeatU3Ec__Iterator0_t4156771994::get_offset_of_U24disposing_3(),
U3CClickRepeatU3Ec__Iterator0_t4156771994::get_offset_of_U24PC_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1802 = { sizeof (ScrollRect_t1199013257), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1802[36] =
{
ScrollRect_t1199013257::get_offset_of_m_Content_2(),
ScrollRect_t1199013257::get_offset_of_m_Horizontal_3(),
ScrollRect_t1199013257::get_offset_of_m_Vertical_4(),
ScrollRect_t1199013257::get_offset_of_m_MovementType_5(),
ScrollRect_t1199013257::get_offset_of_m_Elasticity_6(),
ScrollRect_t1199013257::get_offset_of_m_Inertia_7(),
ScrollRect_t1199013257::get_offset_of_m_DecelerationRate_8(),
ScrollRect_t1199013257::get_offset_of_m_ScrollSensitivity_9(),
ScrollRect_t1199013257::get_offset_of_m_Viewport_10(),
ScrollRect_t1199013257::get_offset_of_m_HorizontalScrollbar_11(),
ScrollRect_t1199013257::get_offset_of_m_VerticalScrollbar_12(),
ScrollRect_t1199013257::get_offset_of_m_HorizontalScrollbarVisibility_13(),
ScrollRect_t1199013257::get_offset_of_m_VerticalScrollbarVisibility_14(),
ScrollRect_t1199013257::get_offset_of_m_HorizontalScrollbarSpacing_15(),
ScrollRect_t1199013257::get_offset_of_m_VerticalScrollbarSpacing_16(),
ScrollRect_t1199013257::get_offset_of_m_OnValueChanged_17(),
ScrollRect_t1199013257::get_offset_of_m_PointerStartLocalCursor_18(),
ScrollRect_t1199013257::get_offset_of_m_ContentStartPosition_19(),
ScrollRect_t1199013257::get_offset_of_m_ViewRect_20(),
ScrollRect_t1199013257::get_offset_of_m_ContentBounds_21(),
ScrollRect_t1199013257::get_offset_of_m_ViewBounds_22(),
ScrollRect_t1199013257::get_offset_of_m_Velocity_23(),
ScrollRect_t1199013257::get_offset_of_m_Dragging_24(),
ScrollRect_t1199013257::get_offset_of_m_PrevPosition_25(),
ScrollRect_t1199013257::get_offset_of_m_PrevContentBounds_26(),
ScrollRect_t1199013257::get_offset_of_m_PrevViewBounds_27(),
ScrollRect_t1199013257::get_offset_of_m_HasRebuiltLayout_28(),
ScrollRect_t1199013257::get_offset_of_m_HSliderExpand_29(),
ScrollRect_t1199013257::get_offset_of_m_VSliderExpand_30(),
ScrollRect_t1199013257::get_offset_of_m_HSliderHeight_31(),
ScrollRect_t1199013257::get_offset_of_m_VSliderWidth_32(),
ScrollRect_t1199013257::get_offset_of_m_Rect_33(),
ScrollRect_t1199013257::get_offset_of_m_HorizontalScrollbarRect_34(),
ScrollRect_t1199013257::get_offset_of_m_VerticalScrollbarRect_35(),
ScrollRect_t1199013257::get_offset_of_m_Tracker_36(),
ScrollRect_t1199013257::get_offset_of_m_Corners_37(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1803 = { sizeof (MovementType_t905360158)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1803[4] =
{
MovementType_t905360158::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1804 = { sizeof (ScrollbarVisibility_t3834843475)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1804[4] =
{
ScrollbarVisibility_t3834843475::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1805 = { sizeof (ScrollRectEvent_t3529018992), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1806 = { sizeof (Selectable_t1490392188), -1, sizeof(Selectable_t1490392188_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1806[14] =
{
Selectable_t1490392188_StaticFields::get_offset_of_s_List_2(),
Selectable_t1490392188::get_offset_of_m_Navigation_3(),
Selectable_t1490392188::get_offset_of_m_Transition_4(),
Selectable_t1490392188::get_offset_of_m_Colors_5(),
Selectable_t1490392188::get_offset_of_m_SpriteState_6(),
Selectable_t1490392188::get_offset_of_m_AnimationTriggers_7(),
Selectable_t1490392188::get_offset_of_m_Interactable_8(),
Selectable_t1490392188::get_offset_of_m_TargetGraphic_9(),
Selectable_t1490392188::get_offset_of_m_GroupsAllowInteraction_10(),
Selectable_t1490392188::get_offset_of_m_CurrentSelectionState_11(),
Selectable_t1490392188::get_offset_of_U3CisPointerInsideU3Ek__BackingField_12(),
Selectable_t1490392188::get_offset_of_U3CisPointerDownU3Ek__BackingField_13(),
Selectable_t1490392188::get_offset_of_U3ChasSelectionU3Ek__BackingField_14(),
Selectable_t1490392188::get_offset_of_m_CanvasGroupCache_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1807 = { sizeof (Transition_t605142169)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1807[5] =
{
Transition_t605142169::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1808 = { sizeof (SelectionState_t3187567897)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1808[5] =
{
SelectionState_t3187567897::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1809 = { sizeof (SetPropertyUtility_t4019374597), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1810 = { sizeof (Slider_t297367283), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1810[15] =
{
Slider_t297367283::get_offset_of_m_FillRect_16(),
Slider_t297367283::get_offset_of_m_HandleRect_17(),
Slider_t297367283::get_offset_of_m_Direction_18(),
Slider_t297367283::get_offset_of_m_MinValue_19(),
Slider_t297367283::get_offset_of_m_MaxValue_20(),
Slider_t297367283::get_offset_of_m_WholeNumbers_21(),
Slider_t297367283::get_offset_of_m_Value_22(),
Slider_t297367283::get_offset_of_m_OnValueChanged_23(),
Slider_t297367283::get_offset_of_m_FillImage_24(),
Slider_t297367283::get_offset_of_m_FillTransform_25(),
Slider_t297367283::get_offset_of_m_FillContainerRect_26(),
Slider_t297367283::get_offset_of_m_HandleTransform_27(),
Slider_t297367283::get_offset_of_m_HandleContainerRect_28(),
Slider_t297367283::get_offset_of_m_Offset_29(),
Slider_t297367283::get_offset_of_m_Tracker_30(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1811 = { sizeof (Direction_t1525323322)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1811[5] =
{
Direction_t1525323322::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1812 = { sizeof (SliderEvent_t2111116400), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1813 = { sizeof (Axis_t375128448)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1813[3] =
{
Axis_t375128448::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1814 = { sizeof (SpriteState_t1353336012)+ sizeof (Il2CppObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1814[3] =
{
SpriteState_t1353336012::get_offset_of_m_HighlightedSprite_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
SpriteState_t1353336012::get_offset_of_m_PressedSprite_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
SpriteState_t1353336012::get_offset_of_m_DisabledSprite_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1815 = { sizeof (StencilMaterial_t1630303189), -1, sizeof(StencilMaterial_t1630303189_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1815[1] =
{
StencilMaterial_t1630303189_StaticFields::get_offset_of_m_List_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1816 = { sizeof (MatEntry_t3157325053), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1816[10] =
{
MatEntry_t3157325053::get_offset_of_baseMat_0(),
MatEntry_t3157325053::get_offset_of_customMat_1(),
MatEntry_t3157325053::get_offset_of_count_2(),
MatEntry_t3157325053::get_offset_of_stencilId_3(),
MatEntry_t3157325053::get_offset_of_operation_4(),
MatEntry_t3157325053::get_offset_of_compareFunction_5(),
MatEntry_t3157325053::get_offset_of_readMask_6(),
MatEntry_t3157325053::get_offset_of_writeMask_7(),
MatEntry_t3157325053::get_offset_of_useAlphaClip_8(),
MatEntry_t3157325053::get_offset_of_colorMask_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1817 = { sizeof (Text_t356221433), -1, sizeof(Text_t356221433_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1817[7] =
{
Text_t356221433::get_offset_of_m_FontData_28(),
Text_t356221433::get_offset_of_m_Text_29(),
Text_t356221433::get_offset_of_m_TextCache_30(),
Text_t356221433::get_offset_of_m_TextCacheForLayout_31(),
Text_t356221433_StaticFields::get_offset_of_s_DefaultText_32(),
Text_t356221433::get_offset_of_m_DisableFontTextureRebuiltCallback_33(),
Text_t356221433::get_offset_of_m_TempVerts_34(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1818 = { sizeof (Toggle_t3976754468), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1818[5] =
{
Toggle_t3976754468::get_offset_of_toggleTransition_16(),
Toggle_t3976754468::get_offset_of_graphic_17(),
Toggle_t3976754468::get_offset_of_m_Group_18(),
Toggle_t3976754468::get_offset_of_onValueChanged_19(),
Toggle_t3976754468::get_offset_of_m_IsOn_20(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1819 = { sizeof (ToggleTransition_t1114673831)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1819[3] =
{
ToggleTransition_t1114673831::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1820 = { sizeof (ToggleEvent_t1896830814), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1821 = { sizeof (ToggleGroup_t1030026315), -1, sizeof(ToggleGroup_t1030026315_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1821[4] =
{
ToggleGroup_t1030026315::get_offset_of_m_AllowSwitchOff_2(),
ToggleGroup_t1030026315::get_offset_of_m_Toggles_3(),
ToggleGroup_t1030026315_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_4(),
ToggleGroup_t1030026315_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1822 = { sizeof (ClipperRegistry_t1349564894), -1, sizeof(ClipperRegistry_t1349564894_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1822[2] =
{
ClipperRegistry_t1349564894_StaticFields::get_offset_of_s_Instance_0(),
ClipperRegistry_t1349564894::get_offset_of_m_Clippers_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1823 = { sizeof (Clipping_t223789604), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1824 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1825 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1826 = { sizeof (RectangularVertexClipper_t3349113845), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1826[2] =
{
RectangularVertexClipper_t3349113845::get_offset_of_m_WorldCorners_0(),
RectangularVertexClipper_t3349113845::get_offset_of_m_CanvasCorners_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1827 = { sizeof (AspectRatioFitter_t3114550109), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1827[4] =
{
AspectRatioFitter_t3114550109::get_offset_of_m_AspectMode_2(),
AspectRatioFitter_t3114550109::get_offset_of_m_AspectRatio_3(),
AspectRatioFitter_t3114550109::get_offset_of_m_Rect_4(),
AspectRatioFitter_t3114550109::get_offset_of_m_Tracker_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1828 = { sizeof (AspectMode_t1166448724)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1828[6] =
{
AspectMode_t1166448724::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1829 = { sizeof (CanvasScaler_t2574720772), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1829[14] =
{
CanvasScaler_t2574720772::get_offset_of_m_UiScaleMode_2(),
CanvasScaler_t2574720772::get_offset_of_m_ReferencePixelsPerUnit_3(),
CanvasScaler_t2574720772::get_offset_of_m_ScaleFactor_4(),
CanvasScaler_t2574720772::get_offset_of_m_ReferenceResolution_5(),
CanvasScaler_t2574720772::get_offset_of_m_ScreenMatchMode_6(),
CanvasScaler_t2574720772::get_offset_of_m_MatchWidthOrHeight_7(),
0,
CanvasScaler_t2574720772::get_offset_of_m_PhysicalUnit_9(),
CanvasScaler_t2574720772::get_offset_of_m_FallbackScreenDPI_10(),
CanvasScaler_t2574720772::get_offset_of_m_DefaultSpriteDPI_11(),
CanvasScaler_t2574720772::get_offset_of_m_DynamicPixelsPerUnit_12(),
CanvasScaler_t2574720772::get_offset_of_m_Canvas_13(),
CanvasScaler_t2574720772::get_offset_of_m_PrevScaleFactor_14(),
CanvasScaler_t2574720772::get_offset_of_m_PrevReferencePixelsPerUnit_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1830 = { sizeof (ScaleMode_t987318053)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1830[4] =
{
ScaleMode_t987318053::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1831 = { sizeof (ScreenMatchMode_t1916789528)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1831[4] =
{
ScreenMatchMode_t1916789528::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1832 = { sizeof (Unit_t3220761768)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1832[6] =
{
Unit_t3220761768::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1833 = { sizeof (ContentSizeFitter_t1325211874), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1833[4] =
{
ContentSizeFitter_t1325211874::get_offset_of_m_HorizontalFit_2(),
ContentSizeFitter_t1325211874::get_offset_of_m_VerticalFit_3(),
ContentSizeFitter_t1325211874::get_offset_of_m_Rect_4(),
ContentSizeFitter_t1325211874::get_offset_of_m_Tracker_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1834 = { sizeof (FitMode_t4030874534)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1834[4] =
{
FitMode_t4030874534::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1835 = { sizeof (GridLayoutGroup_t1515633077), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1835[6] =
{
GridLayoutGroup_t1515633077::get_offset_of_m_StartCorner_10(),
GridLayoutGroup_t1515633077::get_offset_of_m_StartAxis_11(),
GridLayoutGroup_t1515633077::get_offset_of_m_CellSize_12(),
GridLayoutGroup_t1515633077::get_offset_of_m_Spacing_13(),
GridLayoutGroup_t1515633077::get_offset_of_m_Constraint_14(),
GridLayoutGroup_t1515633077::get_offset_of_m_ConstraintCount_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1836 = { sizeof (Corner_t1077473318)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1836[5] =
{
Corner_t1077473318::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1837 = { sizeof (Axis_t1431825778)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1837[3] =
{
Axis_t1431825778::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1838 = { sizeof (Constraint_t3558160636)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1838[4] =
{
Constraint_t3558160636::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1839 = { sizeof (HorizontalLayoutGroup_t2875670365), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1840 = { sizeof (HorizontalOrVerticalLayoutGroup_t1968298610), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1840[5] =
{
HorizontalOrVerticalLayoutGroup_t1968298610::get_offset_of_m_Spacing_10(),
HorizontalOrVerticalLayoutGroup_t1968298610::get_offset_of_m_ChildForceExpandWidth_11(),
HorizontalOrVerticalLayoutGroup_t1968298610::get_offset_of_m_ChildForceExpandHeight_12(),
HorizontalOrVerticalLayoutGroup_t1968298610::get_offset_of_m_ChildControlWidth_13(),
HorizontalOrVerticalLayoutGroup_t1968298610::get_offset_of_m_ChildControlHeight_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1841 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1842 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1843 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1844 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1845 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1846 = { sizeof (LayoutElement_t2808691390), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1846[7] =
{
LayoutElement_t2808691390::get_offset_of_m_IgnoreLayout_2(),
LayoutElement_t2808691390::get_offset_of_m_MinWidth_3(),
LayoutElement_t2808691390::get_offset_of_m_MinHeight_4(),
LayoutElement_t2808691390::get_offset_of_m_PreferredWidth_5(),
LayoutElement_t2808691390::get_offset_of_m_PreferredHeight_6(),
LayoutElement_t2808691390::get_offset_of_m_FlexibleWidth_7(),
LayoutElement_t2808691390::get_offset_of_m_FlexibleHeight_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1847 = { sizeof (LayoutGroup_t3962498969), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1847[8] =
{
LayoutGroup_t3962498969::get_offset_of_m_Padding_2(),
LayoutGroup_t3962498969::get_offset_of_m_ChildAlignment_3(),
LayoutGroup_t3962498969::get_offset_of_m_Rect_4(),
LayoutGroup_t3962498969::get_offset_of_m_Tracker_5(),
LayoutGroup_t3962498969::get_offset_of_m_TotalMinSize_6(),
LayoutGroup_t3962498969::get_offset_of_m_TotalPreferredSize_7(),
LayoutGroup_t3962498969::get_offset_of_m_TotalFlexibleSize_8(),
LayoutGroup_t3962498969::get_offset_of_m_RectChildren_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1848 = { sizeof (U3CDelayedSetDirtyU3Ec__Iterator0_t3228926346), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1848[4] =
{
U3CDelayedSetDirtyU3Ec__Iterator0_t3228926346::get_offset_of_rectTransform_0(),
U3CDelayedSetDirtyU3Ec__Iterator0_t3228926346::get_offset_of_U24current_1(),
U3CDelayedSetDirtyU3Ec__Iterator0_t3228926346::get_offset_of_U24disposing_2(),
U3CDelayedSetDirtyU3Ec__Iterator0_t3228926346::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1849 = { sizeof (LayoutRebuilder_t2155218138), -1, sizeof(LayoutRebuilder_t2155218138_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1849[9] =
{
LayoutRebuilder_t2155218138::get_offset_of_m_ToRebuild_0(),
LayoutRebuilder_t2155218138::get_offset_of_m_CachedHashFromTransform_1(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_s_Rebuilders_2(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__mgU24cache0_3(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_4(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_5(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__amU24cache2_6(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__amU24cache3_7(),
LayoutRebuilder_t2155218138_StaticFields::get_offset_of_U3CU3Ef__amU24cache4_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1850 = { sizeof (LayoutUtility_t4076838048), -1, sizeof(LayoutUtility_t4076838048_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1850[8] =
{
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_0(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_1(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache2_2(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache3_3(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache4_4(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache5_5(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache6_6(),
LayoutUtility_t4076838048_StaticFields::get_offset_of_U3CU3Ef__amU24cache7_7(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1851 = { sizeof (VerticalLayoutGroup_t2468316403), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1852 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1853 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1853[2] =
{
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1854 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1854[1] =
{
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1855 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1855[4] =
{
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1856 = { sizeof (ReflectionMethodsCache_t3343836395), -1, sizeof(ReflectionMethodsCache_t3343836395_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1856[5] =
{
ReflectionMethodsCache_t3343836395::get_offset_of_raycast3D_0(),
ReflectionMethodsCache_t3343836395::get_offset_of_raycast3DAll_1(),
ReflectionMethodsCache_t3343836395::get_offset_of_raycast2D_2(),
ReflectionMethodsCache_t3343836395::get_offset_of_getRayIntersectionAll_3(),
ReflectionMethodsCache_t3343836395_StaticFields::get_offset_of_s_ReflectionMethodsCache_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1857 = { sizeof (Raycast3DCallback_t3928470916), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1858 = { sizeof (Raycast2DCallback_t2260664863), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1859 = { sizeof (RaycastAllCallback_t3435657708), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1860 = { sizeof (GetRayIntersectionAllCallback_t2213949596), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1861 = { sizeof (VertexHelper_t385374196), -1, sizeof(VertexHelper_t385374196_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1861[11] =
{
VertexHelper_t385374196::get_offset_of_m_Positions_0(),
VertexHelper_t385374196::get_offset_of_m_Colors_1(),
VertexHelper_t385374196::get_offset_of_m_Uv0S_2(),
VertexHelper_t385374196::get_offset_of_m_Uv1S_3(),
VertexHelper_t385374196::get_offset_of_m_Uv2S_4(),
VertexHelper_t385374196::get_offset_of_m_Uv3S_5(),
VertexHelper_t385374196::get_offset_of_m_Normals_6(),
VertexHelper_t385374196::get_offset_of_m_Tangents_7(),
VertexHelper_t385374196::get_offset_of_m_Indices_8(),
VertexHelper_t385374196_StaticFields::get_offset_of_s_DefaultTangent_9(),
VertexHelper_t385374196_StaticFields::get_offset_of_s_DefaultNormal_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1862 = { sizeof (BaseVertexEffect_t2504093552), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1863 = { sizeof (BaseMeshEffect_t1728560551), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1863[1] =
{
BaseMeshEffect_t1728560551::get_offset_of_m_Graphic_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1864 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1865 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1866 = { sizeof (Outline_t1417504278), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1867 = { sizeof (PositionAsUV1_t1102546563), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1868 = { sizeof (Shadow_t4269599528), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1868[4] =
{
Shadow_t4269599528::get_offset_of_m_EffectColor_3(),
Shadow_t4269599528::get_offset_of_m_EffectDistance_4(),
Shadow_t4269599528::get_offset_of_m_UseGraphicAlpha_5(),
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1869 = { sizeof (U3CPrivateImplementationDetailsU3E_t1486305141), -1, sizeof(U3CPrivateImplementationDetailsU3E_t1486305141_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1869[1] =
{
U3CPrivateImplementationDetailsU3E_t1486305141_StaticFields::get_offset_of_U24fieldU2D7BBE37982E6C057ED87163CAFC7FD6E5E42EEA46_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1870 = { sizeof (U24ArrayTypeU3D12_t1568637717)+ sizeof (Il2CppObject), sizeof(U24ArrayTypeU3D12_t1568637717 ), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1871 = { sizeof (U3CModuleU3E_t3783534221), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1872 = { sizeof (AnalyticsTracker_t2191537572), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1872[5] =
{
AnalyticsTracker_t2191537572::get_offset_of_m_EventName_2(),
AnalyticsTracker_t2191537572::get_offset_of_m_Dict_3(),
AnalyticsTracker_t2191537572::get_offset_of_m_PrevDictHash_4(),
AnalyticsTracker_t2191537572::get_offset_of_m_TrackableProperty_5(),
AnalyticsTracker_t2191537572::get_offset_of_m_Trigger_6(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1873 = { sizeof (Trigger_t1068911718)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1873[8] =
{
Trigger_t1068911718::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1874 = { sizeof (TrackableProperty_t1304606600), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1874[2] =
{
0,
TrackableProperty_t1304606600::get_offset_of_m_Fields_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1875 = { sizeof (FieldWithTarget_t2256174789), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1875[6] =
{
FieldWithTarget_t2256174789::get_offset_of_m_ParamName_0(),
FieldWithTarget_t2256174789::get_offset_of_m_Target_1(),
FieldWithTarget_t2256174789::get_offset_of_m_FieldPath_2(),
FieldWithTarget_t2256174789::get_offset_of_m_TypeString_3(),
FieldWithTarget_t2256174789::get_offset_of_m_DoStatic_4(),
FieldWithTarget_t2256174789::get_offset_of_m_StaticString_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1876 = { sizeof (U3CModuleU3E_t3783534222), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1877 = { sizeof (AudioManager_t4222704959), -1, sizeof(AudioManager_t4222704959_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1877[13] =
{
AudioManager_t4222704959_StaticFields::get_offset_of_Instance_2(),
AudioManager_t4222704959::get_offset_of_JumpClip_3(),
AudioManager_t4222704959::get_offset_of_WaterHitClip_4(),
AudioManager_t4222704959::get_offset_of_DayIncreaseClip_5(),
AudioManager_t4222704959::get_offset_of_ButtonClickClip_6(),
AudioManager_t4222704959::get_offset_of_DeathClip_7(),
AudioManager_t4222704959::get_offset_of_WinningClip_8(),
AudioManager_t4222704959::get_offset_of_JumpSource_9(),
AudioManager_t4222704959::get_offset_of_WaterHitSource_10(),
AudioManager_t4222704959::get_offset_of_DayIncreaseSource_11(),
AudioManager_t4222704959::get_offset_of_ButtonClickSource_12(),
AudioManager_t4222704959::get_offset_of_DeathSource_13(),
AudioManager_t4222704959::get_offset_of_WinningSource_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1878 = { sizeof (ButtonManager_t868394943), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1879 = { sizeof (CanvasManager_t475273629), -1, sizeof(CanvasManager_t475273629_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1879[2] =
{
CanvasManager_t475273629::get_offset_of_TempText_2(),
CanvasManager_t475273629_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1880 = { sizeof (CloudManager_t3172292548), -1, sizeof(CloudManager_t3172292548_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1880[11] =
{
CloudManager_t3172292548_StaticFields::get_offset_of_DisabledClouds_2(),
CloudManager_t3172292548::get_offset_of_DisableDist_3(),
CloudManager_t3172292548::get_offset_of_MovementSpeed_4(),
CloudManager_t3172292548::get_offset_of_MinSpawnInterval_5(),
CloudManager_t3172292548::get_offset_of_MaxSpawnInterval_6(),
CloudManager_t3172292548::get_offset_of_MAX_Y_SPAWN_DIST_7(),
CloudManager_t3172292548::get_offset_of_MIN_Y_SPAWN_DIST_8(),
CloudManager_t3172292548::get_offset_of_MAX_X_SPAWN_DIST_9(),
CloudManager_t3172292548::get_offset_of_MIN_X_SPAWN_DIST_10(),
CloudManager_t3172292548::get_offset_of_TempPos_11(),
CloudManager_t3172292548::get_offset_of_Index_12(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1881 = { sizeof (U3CSpawnManagerU3Ec__Iterator0_t2296720958), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1881[4] =
{
U3CSpawnManagerU3Ec__Iterator0_t2296720958::get_offset_of_U24this_0(),
U3CSpawnManagerU3Ec__Iterator0_t2296720958::get_offset_of_U24current_1(),
U3CSpawnManagerU3Ec__Iterator0_t2296720958::get_offset_of_U24disposing_2(),
U3CSpawnManagerU3Ec__Iterator0_t2296720958::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1882 = { sizeof (DayNightManager_t707488325), -1, sizeof(DayNightManager_t707488325_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1882[14] =
{
DayNightManager_t707488325_StaticFields::get_offset_of_Day_2(),
DayNightManager_t707488325::get_offset_of_RotationSpeed_3(),
DayNightManager_t707488325::get_offset_of_Angle_4(),
DayNightManager_t707488325::get_offset_of_NewRot_5(),
DayNightManager_t707488325::get_offset_of_DirLightRot_6(),
DayNightManager_t707488325::get_offset_of_FramerateModifier_7(),
DayNightManager_t707488325::get_offset_of_StartingDaySize_8(),
DayNightManager_t707488325::get_offset_of_DaySize_9(),
DayNightManager_t707488325::get_offset_of_DayAngle_10(),
DayNightManager_t707488325::get_offset_of_LastAngle_11(),
DayNightManager_t707488325::get_offset_of_CanIncremenetDay_12(),
DayNightManager_t707488325::get_offset_of_StopIncrementingDay_13(),
DayNightManager_t707488325::get_offset_of_Animating_14(),
DayNightManager_t707488325_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1883 = { sizeof (U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1883[6] =
{
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U3CdoneU3E__0_0(),
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U3CincreasingU3E__0_1(),
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U24this_2(),
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U24current_3(),
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U24disposing_4(),
U3CIncreaseDayAnimationU3Ec__Iterator0_t3780777759::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1884 = { sizeof (U3CFirstWinAnimationU3Ec__Iterator1_t216805772), -1, sizeof(U3CFirstWinAnimationU3Ec__Iterator1_t216805772_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1884[6] =
{
U3CFirstWinAnimationU3Ec__Iterator1_t216805772::get_offset_of_U3CtempPosU3E__0_0(),
U3CFirstWinAnimationU3Ec__Iterator1_t216805772::get_offset_of_U24this_1(),
U3CFirstWinAnimationU3Ec__Iterator1_t216805772::get_offset_of_U24current_2(),
U3CFirstWinAnimationU3Ec__Iterator1_t216805772::get_offset_of_U24disposing_3(),
U3CFirstWinAnimationU3Ec__Iterator1_t216805772::get_offset_of_U24PC_4(),
U3CFirstWinAnimationU3Ec__Iterator1_t216805772_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1885 = { sizeof (U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1885[6] =
{
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U3CtimerU3E__0_0(),
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U3CnormalSpriteU3E__0_1(),
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U24this_2(),
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U24current_3(),
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U24disposing_4(),
U3CFirstWinSpriteSwitcherU3Ec__Iterator2_t2960083517::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1886 = { sizeof (GameStateManager_t1063875770), -1, sizeof(GameStateManager_t1063875770_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1886[20] =
{
GameStateManager_t1063875770_StaticFields::get_offset_of_Instance_2(),
GameStateManager_t1063875770::get_offset_of_PlayerSprites_3(),
GameStateManager_t1063875770::get_offset_of_GoldSprites_4(),
GameStateManager_t1063875770::get_offset_of_WaveSprites_5(),
GameStateManager_t1063875770::get_offset_of_MuteSprites_6(),
GameStateManager_t1063875770::get_offset_of_StartingTimeScale_7(),
GameStateManager_t1063875770::get_offset_of_PlayerLost_8(),
GameStateManager_t1063875770::get_offset_of_Muted_9(),
GameStateManager_t1063875770::get_offset_of_MoveButtonDown_10(),
GameStateManager_t1063875770::get_offset_of_CanBeRevived_11(),
GameStateManager_t1063875770::get_offset_of_ExtraLifeButtonPressed_12(),
GameStateManager_t1063875770::get_offset_of_AdShowing_13(),
GameStateManager_t1063875770::get_offset_of_BeatenGame_14(),
GameStateManager_t1063875770::get_offset_of_LoggedIn_15(),
GameStateManager_t1063875770::get_offset_of_WinsSet_16(),
GameStateManager_t1063875770::get_offset_of_InvokePlayerLost_17(),
GameStateManager_t1063875770::get_offset_of_tempSprites_18(),
GameStateManager_t1063875770::get_offset_of_tempWaves_19(),
GameStateManager_t1063875770::get_offset_of_tempMutes_20(),
GameStateManager_t1063875770::get_offset_of_tempGold_21(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1887 = { sizeof (U3CResetMeowsPosU3Ec__Iterator0_t635611634), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1887[4] =
{
U3CResetMeowsPosU3Ec__Iterator0_t635611634::get_offset_of_U24this_0(),
U3CResetMeowsPosU3Ec__Iterator0_t635611634::get_offset_of_U24current_1(),
U3CResetMeowsPosU3Ec__Iterator0_t635611634::get_offset_of_U24disposing_2(),
U3CResetMeowsPosU3Ec__Iterator0_t635611634::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1888 = { sizeof (U3CResumeOnButtonPressU3Ec__Iterator1_t551396632), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1888[4] =
{
U3CResumeOnButtonPressU3Ec__Iterator1_t551396632::get_offset_of_U24this_0(),
U3CResumeOnButtonPressU3Ec__Iterator1_t551396632::get_offset_of_U24current_1(),
U3CResumeOnButtonPressU3Ec__Iterator1_t551396632::get_offset_of_U24disposing_2(),
U3CResumeOnButtonPressU3Ec__Iterator1_t551396632::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1889 = { sizeof (U3CPauseAtStartU3Ec__Iterator2_t1323805765), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1889[4] =
{
U3CPauseAtStartU3Ec__Iterator2_t1323805765::get_offset_of_U24this_0(),
U3CPauseAtStartU3Ec__Iterator2_t1323805765::get_offset_of_U24current_1(),
U3CPauseAtStartU3Ec__Iterator2_t1323805765::get_offset_of_U24disposing_2(),
U3CPauseAtStartU3Ec__Iterator2_t1323805765::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1890 = { sizeof (U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045), -1, sizeof(U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1890[5] =
{
U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045::get_offset_of_U24this_0(),
U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045::get_offset_of_U24current_1(),
U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045::get_offset_of_U24disposing_2(),
U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045::get_offset_of_U24PC_3(),
U3CCheckIfPlayerLostU3Ec__Iterator3_t3775106045_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1891 = { sizeof (CloudStateManager_t891150987), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1891[4] =
{
CloudStateManager_t891150987::get_offset_of_DisableDist_2(),
CloudStateManager_t891150987::get_offset_of_MovementSpeed_3(),
CloudStateManager_t891150987::get_offset_of_TempPos_4(),
CloudStateManager_t891150987::get_offset_of_FramerateTimer_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1892 = { sizeof (U3CManageStateU3Ec__Iterator0_t440724577), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1892[4] =
{
U3CManageStateU3Ec__Iterator0_t440724577::get_offset_of_U24this_0(),
U3CManageStateU3Ec__Iterator0_t440724577::get_offset_of_U24current_1(),
U3CManageStateU3Ec__Iterator0_t440724577::get_offset_of_U24disposing_2(),
U3CManageStateU3Ec__Iterator0_t440724577::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1893 = { sizeof (PPKeys_t1122428640), -1, sizeof(PPKeys_t1122428640_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1893[3] =
{
PPKeys_t1122428640_StaticFields::get_offset_of_MuteState_2(),
PPKeys_t1122428640_StaticFields::get_offset_of_MostDaysSurvived_3(),
PPKeys_t1122428640_StaticFields::get_offset_of_Wins_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1894 = { sizeof (OceanManager_t4124689315), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1894[18] =
{
OceanManager_t4124689315::get_offset_of_BackgroundXSpeed_2(),
OceanManager_t4124689315::get_offset_of_BackgroundYSpeed_3(),
OceanManager_t4124689315::get_offset_of_BackgroundYVariance_4(),
OceanManager_t4124689315::get_offset_of_ForegroundXSpeed_5(),
OceanManager_t4124689315::get_offset_of_ForegroundYSpeed_6(),
OceanManager_t4124689315::get_offset_of_ForegroundYVariance_7(),
OceanManager_t4124689315::get_offset_of_Background_8(),
OceanManager_t4124689315::get_offset_of_Foreground_9(),
OceanManager_t4124689315::get_offset_of_BgOcean_10(),
OceanManager_t4124689315::get_offset_of_FgOcean_11(),
OceanManager_t4124689315::get_offset_of_StartingBgPos_12(),
OceanManager_t4124689315::get_offset_of_StartingFgPos_13(),
OceanManager_t4124689315::get_offset_of_SpeedModifier_14(),
OceanManager_t4124689315::get_offset_of_HeightModifer_15(),
OceanManager_t4124689315::get_offset_of_BgYIncreasing_16(),
OceanManager_t4124689315::get_offset_of_FgYIncreasing_17(),
OceanManager_t4124689315::get_offset_of_TempPos_18(),
OceanManager_t4124689315::get_offset_of_FramerateModifier_19(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1895 = { sizeof (U3CBgTilingU3Ec__Iterator0_t1547012651), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1895[6] =
{
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24locvar0_0(),
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24locvar1_1(),
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24this_2(),
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24current_3(),
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24disposing_4(),
U3CBgTilingU3Ec__Iterator0_t1547012651::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1896 = { sizeof (U3CFgTilingU3Ec__Iterator1_t3897932328), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1896[6] =
{
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24locvar0_0(),
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24locvar1_1(),
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24this_2(),
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24current_3(),
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24disposing_4(),
U3CFgTilingU3Ec__Iterator1_t3897932328::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1897 = { sizeof (PlayerManager_t1596653588), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1897[7] =
{
PlayerManager_t1596653588::get_offset_of_MoveForce_2(),
PlayerManager_t1596653588::get_offset_of_StartingAnimationSpeed_3(),
PlayerManager_t1596653588::get_offset_of_DragInWater_4(),
PlayerManager_t1596653588::get_offset_of_DoneAnimating_5(),
PlayerManager_t1596653588::get_offset_of_CanJump_6(),
PlayerManager_t1596653588::get_offset_of_CurrentAnimationSpeed_7(),
PlayerManager_t1596653588::get_offset_of_StartingDrag_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1898 = { sizeof (U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1898[6] =
{
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U3CincreasingCounterU3E__0_0(),
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U3CcounterU3E__0_1(),
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U24this_2(),
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U24current_3(),
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U24disposing_4(),
U3CPlaySwimAnimationU3Ec__Iterator0_t3636478526::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1899 = { sizeof (Scene0MenuObjects_t1763648433), -1, sizeof(Scene0MenuObjects_t1763648433_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1899[10] =
{
Scene0MenuObjects_t1763648433_StaticFields::get_offset_of_MuteButton_2(),
Scene0MenuObjects_t1763648433_StaticFields::get_offset_of_MostDaysFg_3(),
Scene0MenuObjects_t1763648433_StaticFields::get_offset_of_MostDaysBg_4(),
Scene0MenuObjects_t1763648433_StaticFields::get_offset_of_WinsFg_5(),
Scene0MenuObjects_t1763648433_StaticFields::get_offset_of_WinsBg_6(),
Scene0MenuObjects_t1763648433::get_offset_of_MuteButtonRef_7(),
Scene0MenuObjects_t1763648433::get_offset_of_MostDaysFgRef_8(),
Scene0MenuObjects_t1763648433::get_offset_of_MostDaysBgRef_9(),
Scene0MenuObjects_t1763648433::get_offset_of_WinsFgRef_10(),
Scene0MenuObjects_t1763648433::get_offset_of_WinsBgRef_11(),
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"ryanbilodeau24@gmail.com"
] | ryanbilodeau24@gmail.com |
d98072d41525c6235abec7379a48bc9bf966b0ba | 9705f36996e10209cfc25abf6207d0b7fcc21c5c | /ImageMatcher_UpdatedCode/MatchTemplate_Updated.cpp | 95f3c25f1d528580a4ec73d7c6c346d244c1438f | [] | no_license | milan322/PatternMatch_Updated | ed31046122a94fa6ca0b8271bf1054c96577f23b | 04e8c854e61cb107a95081feff0c3f8be18e7283 | refs/heads/master | 2021-01-10T20:20:13.934640 | 2014-04-16T07:42:26 | 2014-04-16T07:42:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,543 | cpp | #include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include<iostream>
#include<stdio.h>
using namespace std;
using namespace cv;
int main(int argc,char** argv)
{
// cv::Mat ref = cv::imread("reference.png");
// cv::Mat tpl = cv::imread("template.png");
cv::Mat ref=cv::imread(argv[1],1);
cv::Mat tpl=cv::imread(argv[2],1);
if (ref.empty() || tpl.empty())
return -1;
cv::Mat gref, gtpl;
cv::cvtColor(ref, gref, CV_BGR2GRAY);
cv::cvtColor(tpl, gtpl, CV_BGR2GRAY);
cv::Mat res(ref.rows-tpl.rows+1, ref.cols-tpl.cols+1, CV_32FC1);
cv::matchTemplate(gref, gtpl, res, CV_TM_CCOEFF_NORMED);
cv::threshold(res, res, 0.7, 1.0, CV_THRESH_TOZERO);
//cv:Scalar tempVal = mean( res );
// float myMAtMean = tempVal.val[0];
// cout<<"Avg:"<<myMAtMean<<endl;
cv::imshow("Source Image",ref);
while (true)
{
double minval, maxval, threshold = .7;
cv::Point minloc, maxloc,ioi;
cv::minMaxLoc(res, &minval, &maxval, &minloc, &maxloc);
if (maxval >= threshold)
{
cv::rectangle(
ref,
maxloc,
cv::Point(maxloc.x + tpl.cols, maxloc.y + tpl.rows),
CV_RGB(0,255,0), 2
);
cv::floodFill(res, maxloc, cv::Scalar(0), 0, cv::Scalar(.1), cv::Scalar(1.));
}
else
break;
}
cv::imshow("Result Image", ref);
cv::waitKey();
return 0;
}
| [
"gopinath@Vaayu.(none)"
] | gopinath@Vaayu.(none) |
f2ed2a424ec2d4c4d309ceb57ae666a4976642a6 | f94aa5bd4d8814b57ae6713c1f69fa1e11bc6526 | /TribesAscendSDK/HeaderDump/GameFramework__GameCrowdAgentBehavior.h | fe423e81b7774611502c4a92fda017574991b327 | [] | no_license | pixel5/TASDK | 71980b727b86034771ea91c67f6c02116f47c245 | 0dc5e4524efed291fe7d8cf936fa64e0e37e4e82 | refs/heads/master | 2020-05-23T15:12:55.162796 | 2013-07-13T00:27:32 | 2013-07-13T00:27:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,482 | h | #pragma once
#define ADD_VAR( x, y, z ) ( ##x ) var_##y() \
{ \
static ScriptProperty *script_property = ( ScriptProperty* )( ScriptObject::Find( #x " GameFramework.GameCrowdAgentBehavior." #y ) ); \
return ( ##x( this, script_property->offset, z ) ); \
}
#define ADD_STRUCT( x, y, z ) ( ##x ) var_##y() \
{ \
static ScriptProperty *script_property = ( ScriptProperty* )( ScriptObject::Find( "StructProperty GameFramework.GameCrowdAgentBehavior." #y ) ); \
return ( ##x( this, script_property->offset, z ) ); \
}
#define ADD_OBJECT( x, y ) ( class x* ) var_##y() \
{ \
static ScriptProperty *script_property = ( ScriptProperty* )( ScriptObject::Find( "ObjectProperty GameFramework.GameCrowdAgentBehavior." #y ) ); \
return *( x** )( this + script_property->offset ); \
}
namespace UnrealScript
{
class GameCrowdAgentBehavior : public Object
{
public:
ADD_OBJECT( Actor, ActionTarget )
ADD_VAR( ::FloatProperty, MaxPlayerDistance, 0xFFFFFFFF )
ADD_OBJECT( GameCrowdAgent, MyAgent )
ADD_VAR( ::FloatProperty, TimeToStopPropagatingViralBehavior, 0xFFFFFFFF )
ADD_VAR( ::FloatProperty, DurationOfViralBehaviorPropagation, 0xFFFFFFFF )
ADD_VAR( ::BoolProperty, bIsPanicked, 0x10 )
ADD_VAR( ::BoolProperty, bPassOnIsViralBehaviorFlag, 0x8 )
ADD_VAR( ::BoolProperty, bIsViralBehavior, 0x4 )
ADD_VAR( ::BoolProperty, bFaceActionTargetFirst, 0x2 )
ADD_VAR( ::BoolProperty, bIdleBehavior, 0x1 )
};
}
#undef ADD_VAR
#undef ADD_STRUCT
#undef ADD_OBJECT
| [
"altimormc@gmail.com"
] | altimormc@gmail.com |
3dbcb6844007d3553bb80151f4bd4a4f5a67534d | bbb8d941d0aa439ca435e0f00ddbd7330ad2db79 | /cpp/swapTemp.cpp | 57fd3b36c727b756fff02cc8f9259d96472d6243 | [] | no_license | dimritium/Code | 7ca940124074d7f7bca28559e0fe2f3cba24f846 | e6678b3dabe21fcd05e362bb8115f7812ad9abb8 | refs/heads/master | 2021-07-25T06:35:22.755474 | 2017-11-04T15:07:50 | 2017-11-04T15:07:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 319 | cpp | #include <bits/stdc++.h>
#define fl(a,b,c) for(a=b;a<c;a++)
#define MOD 1000000007
#define pb push_back
using namespace std;
template<class T>
void swap_(T &a, T &b)
{
T temp = a;
a = b;
b = temp;
};
int main()
{
int a = 5, b=8;
swap_(a, b);
cout<<a<<b;
float c=5.5, d = 5.9;
swap_(c, d);
cout<<c<<" "<<d;
} | [
"dimrishubhi@gmail.com"
] | dimrishubhi@gmail.com |
aae04d9838f4ddee82600589139070538df51c72 | c72f1ba091332e289791afb5ed723c7b619046f9 | /4 JSON Parser HTTP Cache/C++ Parser+HTTP+Cache iOS w calabash/include/Poco/Data/LOB.h | c257ea5288db9ce3fd094e33fe4f4993e5f2cfbe | [] | no_license | ravindranathakila/Sogeti-MasterThesis-CrossPlatformMobileDevelopment | 7d7823ed17c37945f6b600550625a7ebaf9edd27 | 6042d67950d18302972758038dcbe5066d585726 | refs/heads/master | 2021-01-20T23:03:47.956283 | 2013-07-07T07:59:30 | 2013-07-07T07:59:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,959 | h | //
// LOB.h
//
// $Id: //poco/Main/Data/include/Poco/Data/LOB.h#12 $
//
// Library: Data
// Package: DataCore
// Module: LOB
//
// Definition of the LOB class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Data_LOB_INCLUDED
#define Data_LOB_INCLUDED
#include "Poco/Data/Data.h"
#include "Poco/SharedPtr.h"
#include "Poco/Dynamic/VarHolder.h"
#include "Poco/Exception.h"
#include <vector>
#include <algorithm>
namespace Poco {
namespace Data {
template <typename T>
class LOB
/// Representation of a Large OBject.
///
/// A LOB can hold arbitrary data.
/// The maximum size depends on the underlying database.
///
/// The LOBInputStream and LOBOutputStream classes provide
/// a convenient way to access the data in a LOB.
{
public:
typedef typename std::vector<T>::const_iterator Iterator;
typedef T ValueType;
typedef typename std::vector<T> Container;
typedef Poco::SharedPtr<Container> ContentPtr;
LOB(): _pContent(new std::vector<T>())
/// Creates an empty LOB.
{
}
LOB(const std::vector<T>& content):
_pContent(new std::vector<T>(content))
/// Creates the LOB, content is deep-copied.
{
}
LOB(const T* const pContent, std::size_t size):
_pContent(new std::vector<T>(pContent, pContent + size))
/// Creates the LOB by deep-copying pContent.
{
}
LOB(const std::basic_string<T>& content):
_pContent(new std::vector<T>(content.begin(), content.end()))
/// Creates a LOB from a string.
{
}
LOB(const LOB& other): _pContent(other._pContent)
/// Creates a LOB by copying another one.
{
}
~LOB()
/// Destroys the LOB.
{
}
LOB& operator = (const LOB& other)
/// Assignment operator.
{
LOB tmp(other);
swap(tmp);
return *this;
}
bool operator == (const LOB& other) const
/// Compares for equality LOB by value.
{
return *_pContent == *other._pContent;
}
bool operator != (const LOB& other) const
/// Compares for inequality LOB by value.
{
return *_pContent != *other._pContent;
}
void swap(LOB& other)
/// Swaps the LOB with another one.
{
using std::swap;
swap(_pContent, other._pContent);
}
const std::vector<T>& content() const
/// Returns the content.
{
return *_pContent;
}
const T* rawContent() const
/// Returns the raw content.
///
/// If the LOB is empty, returns NULL.
{
if (_pContent->empty())
return 0;
else
return &(*_pContent)[0];
}
void assignVal(std::size_t count, const T& val)
/// Assigns raw content to internal storage.
{
ContentPtr tmp = new Container(count, val);
_pContent.swap(tmp);
}
void assignRaw(const T* ptr, std::size_t count)
/// Assigns raw content to internal storage.
{
poco_assert_dbg (ptr);
LOB tmp(ptr, count);
swap(tmp);
}
void appendRaw(const T* pChar, std::size_t count)
/// Assigns raw content to internal storage.
{
poco_assert_dbg (pChar);
_pContent->insert(_pContent->end(), pChar, pChar+count);
}
void clear(bool doCompact = false)
/// Clears the content of the blob.
/// If doCompact is true, trims the excess capacity.
{
_pContent->clear();
if (doCompact) compact();
}
void compact()
/// Trims the internal storage excess capacity.
{
std::vector<T>(*_pContent).swap(*_pContent);
}
Iterator begin() const
{
return _pContent->begin();
}
Iterator end() const
{
return _pContent->end();
}
std::size_t size() const
/// Returns the size of the LOB in bytes.
{
return static_cast<std::size_t>(_pContent->size());
}
private:
ContentPtr _pContent;
};
typedef LOB<unsigned char> BLOB;
typedef LOB<char> CLOB;
//
// inlines
//
template <typename T>
inline void swap(LOB<T>& b1, LOB<T>& b2)
{
b1.swap(b2);
}
} } // namespace Poco::Data
namespace std
{
using std::swap;
template<>
inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB& b1,
Poco::Data::BLOB& b2)
/// Full template specalization of std:::swap for BLOB
{
b1.swap(b2);
}
template<>
inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB& c1,
Poco::Data::CLOB& c2)
/// Full template specalization of std:::swap for CLOB
{
c1.swap(c2);
}
}
//
// VarHolderImpl<LOB>
//
namespace Poco {
namespace Dynamic {
template <>
class VarHolderImpl<Poco::Data::BLOB>: public VarHolder
{
public:
VarHolderImpl(const Poco::Data::BLOB& val): _val(val)
{
}
~VarHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Poco::Data::BLOB);
}
void convert(std::string& val) const
{
val.assign(_val.begin(), _val.end());
}
VarHolder* clone() const
{
return new VarHolderImpl(_val);
}
const Poco::Data::BLOB& value() const
{
return _val;
}
private:
VarHolderImpl();
Poco::Data::BLOB _val;
};
template <>
class VarHolderImpl<Poco::Data::CLOB>: public VarHolder
{
public:
VarHolderImpl(const Poco::Data::CLOB& val): _val(val)
{
}
~VarHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Poco::Data::CLOB);
}
void convert(std::string& val) const
{
val.assign(_val.begin(), _val.end());
}
VarHolder* clone() const
{
return new VarHolderImpl(_val);
}
const Poco::Data::CLOB& value() const
{
return _val;
}
private:
VarHolderImpl();
Poco::Data::CLOB _val;
};
} } // namespace Poco::Dynamic
#endif // Data_LOB_INCLUDED
| [
"dev.david.karlsson@gmail.com"
] | dev.david.karlsson@gmail.com |
0deec34884ac3ff53ca8a82b0b75ee39aad46a3b | 6db9478ab57690420b2aa98b450d346f7a9f3b7d | /z_unclassified/1026.cpp | 2a24cc0763fed2796b5b76f64b86b92460f79de4 | [] | no_license | siosio34/AlgorithmStudy | d23266e0d4576a3aab123aee7b571021ec619009 | b5626a0e4eb14f9553fe48aacacb1696a927c740 | refs/heads/master | 2020-03-19T09:15:13.167353 | 2019-05-22T13:50:41 | 2019-05-22T13:50:41 | 136,272,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 593 | cpp | #include <iostream>
using namespace std;
int main()
{
int num;
int temp;
int sum = 0;
cin >> num;
int *a = new int[num];
int *b = new int[num];
for (int i = 0; i<num; i++)
{
cin >> a[i];
}
for (int i = 0; i<num; i++)
{
cin >> b[i];
}
for (int i = 1; i<num; i++)
{
for (int j = 0; j<num - 1; j++)
{
if (a[i] < a[j])
{
temp = a[j];
a[j] = a[i];
a[i] = temp;
}
if (b[i] < b[j])
{
temp = b[j];
b[j] = b[i];
b[i] = temp;
}
}
}
for (int i = 0; i<num; i++)
{
sum += (a[i] * b[num - 1 - i]);
}
cout << sum;
return 0;
} | [
"siosio34@nate.com"
] | siosio34@nate.com |
224a56c5c94659b4c323b15bb492a510cd75831f | 9713a817b2cf288e29813d6b8c77aa073cf95053 | /complain.hpp | 154695cd5497d1d49cfac7391737767ea3f3c4ab | [
"MIT"
] | permissive | CzechBlueBear/ElectricPlush | ac8b2a15f5bd67df13d3acd4e0e2f4e02545df0f | ad9ab9005d680b3d1b9e3c38659e9492369640a5 | refs/heads/master | 2021-01-23T03:07:58.830441 | 2013-11-10T13:41:29 | 2013-11-10T13:41:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 342 | hpp | #ifndef COMPLAIN_HPP
#define COMPLAIN_HPP
#include <string>
#define COMPLAIN(msg) do { doComplain(__PRETTY_FUNCTION__, msg); } while(0)
void doComplain(const char *where, const std::string &msg);
#define ON_GL_ERROR_COMPLAIN() do { doOnGLErrorComplain(__PRETTY_FUNCTION__); } while(0)
void doOnGLErrorComplain(const char *where);
#endif | [
"jiri.bluebear.dluhos@gmail.com"
] | jiri.bluebear.dluhos@gmail.com |
17a5367da91a7af5e932cd69933c810b244539ec | e4a386ecc62121a124a68fc530483c582a9f2c29 | /PlayFabServerSDK/PlayFabLocalizationAPI.h | ef0a8c0e0cdd60f2dddd8640c75b950b7ad0a15b | [
"Apache-2.0",
"MIT"
] | permissive | PlayFab/Cocos2d-xSDK | f3d08059bb25018970dc312d58de51702fba4664 | b0ba5c90ff0731b9ffb6fb56fcdaaafaa6dca6b9 | refs/heads/master | 2021-01-23T16:20:56.759161 | 2020-12-01T00:19:33 | 2020-12-01T00:19:33 | 23,086,480 | 7 | 8 | NOASSERTION | 2020-12-01T00:19:34 | 2014-08-18T21:06:50 | C++ | UTF-8 | C++ | false | false | 942 | h | #ifndef PLAYFAB_LOCALIZATIONAPI_H_
#define PLAYFAB_LOCALIZATIONAPI_H_
#include "IHttpRequester.h"
#include "PlayFabError.h"
#include "PlayFabLocalizationDataModels.h"
#include <string>
namespace PlayFab
{
class PlayFabLocalizationAPI
{
public:
template<typename ResType> using ProcessApiCallback = std::function<void(const ResType& result, void* userData)>;
// ------------ Generated API calls
static void GetLanguageList(LocalizationModels::GetLanguageListRequest& request, ProcessApiCallback<LocalizationModels::GetLanguageListResponse> callback, ErrorCallback errorCallback = nullptr, void* userData = nullptr);
private:
// ------------ Private constructor, to enforce all-static class
PlayFabLocalizationAPI();
// ------------ Generated result handlers
static void OnGetLanguageListResult(int httpStatus, HttpRequest* request, void* userData);
};
};
#endif
| [
"jenkins-bot@playfab.com"
] | jenkins-bot@playfab.com |
366251a53bd473d15b3305aa878b3d6d51bee819 | 6ac96a57f2d6e1f1fca264209b76811909df8681 | /cf/526/b.cpp | 4cd92e724e73e505179d672e0709fb8ef001c62e | [] | no_license | SBidaibek/acm | ac85ca9b5ae158113e95c3d851c76c61ccd04c6f | b358a79f8753d2c3f9888ab8a5b22b0ec25d15db | refs/heads/master | 2020-04-22T17:19:43.625322 | 2019-02-15T06:22:14 | 2019-02-15T06:22:14 | 170,537,539 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,299 | cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef double ld;
typedef vector <int> vi;
const int N = 3e5 + 10;
const ll INF = 1e18;
const int B = 1e9 + 7;
int main() {
#ifdef black
freopen("in", "r", stdin);
#endif // black
ios_base :: sync_with_stdio(0);
cin.tie(0);
ll n, k;
cin >> n >> k;
string a, b;
cin >> a >> b;
if (a == b || k == 1) {
cout << n << "\n";
return 0;
}
ll ans = 0;
ll cur = 0;
ll free = 0;
int i = 0;
while (a[i] == b[i]) ++i;
ans = i + 2, k -= 2, cur = 2;
forn(j, i + 1, n - 1) {
if (k == 0) {
ans += ((n - 1) - j + 1) * cur;
break;
}
ans += cur;
ll sides = (a[j] != 'b') + (b[j] != 'a');
//ll new_free = free * 2 + sides;
ll add = min(k, free + sides);
ans += add;
cur += add;
k -= add;
free += free + sides;
}
cout << ans << "\n";
return 0;
}
| [
"sanzhar.bidaibek@gmail.com"
] | sanzhar.bidaibek@gmail.com |
ff91b99f8604bfd42c435ff1dad0b19007c256ce | 2b7607fa78bf83b2515b9de2f9b40d15c81c2ab2 | /Examples/include/CheckTopology.h | 4f4412b548660a949e73a9d88f29b28a01474336 | [
"Apache-2.0"
] | permissive | ANTsX/ANTs | 3176341b8de664939eafde3e1ebf8c449809a9dd | dfd9e6664f2fc5f0dbd05c6c23d5e4895e82abee | refs/heads/master | 2023-08-24T20:43:33.986495 | 2023-08-08T18:23:45 | 2023-08-08T18:23:45 | 7,777,650 | 899 | 286 | Apache-2.0 | 2023-09-10T18:38:59 | 2013-01-23T15:43:41 | C++ | UTF-8 | C++ | false | false | 304 | h |
#ifndef CHECKTOPOLOGY_H
#define CHECKTOPOLOGY_H
namespace ants
{
extern int
CheckTopology(std::vector<std::string>, // equivalent to argv of command line parameters to main()
std::ostream * out_stream // [optional] output stream to write
);
} // namespace ants
#endif // CHECKTOPOLOGY_H
| [
"hans-johnson@uiowa.edu"
] | hans-johnson@uiowa.edu |
3441aa064543fae7331516d6b5fc8157c04f374e | 1aa372fe482daf2bd122aae1a29b5823dfcaad27 | /packages/git-travel/node_modules/nodegit/src/tag.cc | 29726c64e60e1d627c141ee4b072ad005a513d96 | [
"MIT"
] | permissive | maartenvw/atom-settings | 74ea62fe376d5508b52427955be11c58f5d7308f | 9b0963c013db7d84bd281f7e31d572dd9eb1dcaa | refs/heads/master | 2020-12-24T07:04:11.496569 | 2016-11-10T12:58:57 | 2016-11-10T12:58:57 | 73,382,020 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,300 | cc | // This is a generated file, modify: generate/templates/class_content.cc.
#include <nan.h>
#include <string.h>
extern "C" {
#include <git2.h>
}
#include "../include/functions/copy.h"
#include "../include/tag.h"
#include "../include/functions/sleep_for_ms.h"
#include "../include/oid.h"
#include "../include/repository.h"
#include "../include/object.h"
#include "../include/signature.h"
#include "../include/strarray.h"
#include <iostream>
using namespace std;
using namespace v8;
using namespace node;
GitTag::GitTag(git_tag *raw, bool selfFreeing) {
this->raw = raw;
this->selfFreeing = selfFreeing;
}
GitTag::~GitTag() {
if (this->selfFreeing) {
git_tag_free(this->raw);
this->raw = NULL;
}
// this will cause an error if you have a non-self-freeing object that also needs
// to save values. Since the object that will eventually free the object has no
// way of knowing to free these values.
}
void GitTag::InitializeComponent(Local<v8::Object> target) {
Nan::HandleScope scope;
Local<FunctionTemplate> tpl = Nan::New<FunctionTemplate>(JSNewFunction);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(Nan::New("Tag").ToLocalChecked());
Nan::SetMethod(tpl, "annotationCreate", AnnotationCreate);
Nan::SetMethod(tpl, "create", Create);
Nan::SetMethod(tpl, "createLightweight", CreateLightweight);
Nan::SetMethod(tpl, "delete", Delete);
Nan::SetPrototypeMethod(tpl, "free", Free);
Nan::SetPrototypeMethod(tpl, "id", Id);
Nan::SetMethod(tpl, "list", List);
Nan::SetMethod(tpl, "listMatch", ListMatch);
Nan::SetMethod(tpl, "lookup", Lookup);
Nan::SetMethod(tpl, "lookupPrefix", LookupPrefix);
Nan::SetPrototypeMethod(tpl, "message", Message);
Nan::SetPrototypeMethod(tpl, "name", Name);
Nan::SetPrototypeMethod(tpl, "owner", Owner);
Nan::SetPrototypeMethod(tpl, "peel", Peel);
Nan::SetPrototypeMethod(tpl, "tagger", Tagger);
Nan::SetPrototypeMethod(tpl, "target", Target);
Nan::SetPrototypeMethod(tpl, "targetId", TargetId);
Nan::SetPrototypeMethod(tpl, "targetType", TargetType);
Local<Function> _constructor_template = Nan::GetFunction(tpl).ToLocalChecked();
constructor_template.Reset(_constructor_template);
Nan::Set(target, Nan::New("Tag").ToLocalChecked(), _constructor_template);
}
NAN_METHOD(GitTag::JSNewFunction) {
if (info.Length() == 0 || !info[0]->IsExternal()) {
return Nan::ThrowError("A new GitTag cannot be instantiated.");
}
GitTag* object = new GitTag(static_cast<git_tag *>(Local<External>::Cast(info[0])->Value()), Nan::To<bool>(info[1]).FromJust());
object->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
Local<v8::Value> GitTag::New(void *raw, bool selfFreeing) {
Nan::EscapableHandleScope scope;
Local<v8::Value> argv[2] = { Nan::New<External>((void *)raw), Nan::New(selfFreeing) };
return scope.Escape(Nan::NewInstance(Nan::New(GitTag::constructor_template), 2, argv).ToLocalChecked());
}
git_tag *GitTag::GetValue() {
return this->raw;
}
git_tag **GitTag::GetRefValue() {
return this->raw == NULL ? NULL : &this->raw;
}
void GitTag::ClearValue() {
this->raw = NULL;
}
/*
* @param Repository repo
* @param String tag_name
* @param Object target
* @param Signature tagger
* @param String message
* @param Oid callback
*/
NAN_METHOD(GitTag::AnnotationCreate) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1 || !info[1]->IsString()) {
return Nan::ThrowError("String tag_name is required.");
}
if (info.Length() == 2 || !info[2]->IsObject()) {
return Nan::ThrowError("Object target is required.");
}
if (info.Length() == 3 || !info[3]->IsObject()) {
return Nan::ThrowError("Signature tagger is required.");
}
if (info.Length() == 4 || !info[4]->IsString()) {
return Nan::ThrowError("String message is required.");
}
if (info.Length() == 5 || !info[5]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
AnnotationCreateBaton* baton = new AnnotationCreateBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
baton->oid = (git_oid *)malloc(sizeof(git_oid ));
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const char * from_tag_name;
String::Utf8Value tag_name(info[1]->ToString());
from_tag_name = (const char *) strdup(*tag_name);
// end convert_from_v8 block
baton->tag_name = from_tag_name;
// start convert_from_v8 block
const git_object * from_target;
from_target = Nan::ObjectWrap::Unwrap<GitObject>(info[2]->ToObject())->GetValue();
// end convert_from_v8 block
baton->target = from_target;
// start convert_from_v8 block
const git_signature * from_tagger;
from_tagger = Nan::ObjectWrap::Unwrap<GitSignature>(info[3]->ToObject())->GetValue();
// end convert_from_v8 block
baton->tagger = from_tagger;
// start convert_from_v8 block
const char * from_message;
String::Utf8Value message(info[4]->ToString());
from_message = (const char *) strdup(*message);
// end convert_from_v8 block
baton->message = from_message;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[5]));
AnnotationCreateWorker *worker = new AnnotationCreateWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("tag_name", info[1]->ToObject());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("target", info[2]->ToObject());
if (!info[3]->IsUndefined() && !info[3]->IsNull())
worker->SaveToPersistent("tagger", info[3]->ToObject());
if (!info[4]->IsUndefined() && !info[4]->IsNull())
worker->SaveToPersistent("message", info[4]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::AnnotationCreateWorker::Execute() {
int result = git_tag_annotation_create(
baton->oid,baton->repo,baton->tag_name,baton->target,baton->tagger,baton->message );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::AnnotationCreateWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
if (baton->oid != NULL) {
// GitOid baton->oid
to = GitOid::New((void *)baton->oid, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("tag_name"));
workerArguments.push(GetFromPersistent("target"));
workerArguments.push(GetFromPersistent("tagger"));
workerArguments.push(GetFromPersistent("message"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method annotationCreate has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
free((void *)baton->tag_name);
free((void *)baton->message);
delete baton;
}
/*
* @param Repository repo
* @param String tag_name
* @param Object target
* @param Signature tagger
* @param String message
* @param Number force
* @param Oid callback
*/
NAN_METHOD(GitTag::Create) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1 || !info[1]->IsString()) {
return Nan::ThrowError("String tag_name is required.");
}
if (info.Length() == 2 || !info[2]->IsObject()) {
return Nan::ThrowError("Object target is required.");
}
if (info.Length() == 3 || !info[3]->IsObject()) {
return Nan::ThrowError("Signature tagger is required.");
}
if (info.Length() == 4 || !info[4]->IsString()) {
return Nan::ThrowError("String message is required.");
}
if (info.Length() == 5 || !info[5]->IsNumber()) {
return Nan::ThrowError("Number force is required.");
}
if (info.Length() == 6 || !info[6]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
CreateBaton* baton = new CreateBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
baton->oid = (git_oid *)malloc(sizeof(git_oid ));
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const char * from_tag_name;
String::Utf8Value tag_name(info[1]->ToString());
from_tag_name = (const char *) strdup(*tag_name);
// end convert_from_v8 block
baton->tag_name = from_tag_name;
// start convert_from_v8 block
const git_object * from_target;
from_target = Nan::ObjectWrap::Unwrap<GitObject>(info[2]->ToObject())->GetValue();
// end convert_from_v8 block
baton->target = from_target;
// start convert_from_v8 block
const git_signature * from_tagger;
from_tagger = Nan::ObjectWrap::Unwrap<GitSignature>(info[3]->ToObject())->GetValue();
// end convert_from_v8 block
baton->tagger = from_tagger;
// start convert_from_v8 block
const char * from_message;
String::Utf8Value message(info[4]->ToString());
from_message = (const char *) strdup(*message);
// end convert_from_v8 block
baton->message = from_message;
// start convert_from_v8 block
int from_force;
from_force = (int) info[5]->ToNumber()->Value();
// end convert_from_v8 block
baton->force = from_force;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[6]));
CreateWorker *worker = new CreateWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("tag_name", info[1]->ToObject());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("target", info[2]->ToObject());
if (!info[3]->IsUndefined() && !info[3]->IsNull())
worker->SaveToPersistent("tagger", info[3]->ToObject());
if (!info[4]->IsUndefined() && !info[4]->IsNull())
worker->SaveToPersistent("message", info[4]->ToObject());
if (!info[5]->IsUndefined() && !info[5]->IsNull())
worker->SaveToPersistent("force", info[5]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::CreateWorker::Execute() {
int result = git_tag_create(
baton->oid,baton->repo,baton->tag_name,baton->target,baton->tagger,baton->message,baton->force );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::CreateWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
if (baton->oid != NULL) {
// GitOid baton->oid
to = GitOid::New((void *)baton->oid, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("tag_name"));
workerArguments.push(GetFromPersistent("target"));
workerArguments.push(GetFromPersistent("tagger"));
workerArguments.push(GetFromPersistent("message"));
workerArguments.push(GetFromPersistent("force"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method create has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
free((void *)baton->tag_name);
free((void *)baton->message);
delete baton;
}
/*
* @param Repository repo
* @param String tag_name
* @param Object target
* @param Number force
* @param Oid callback
*/
NAN_METHOD(GitTag::CreateLightweight) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1 || !info[1]->IsString()) {
return Nan::ThrowError("String tag_name is required.");
}
if (info.Length() == 2 || !info[2]->IsObject()) {
return Nan::ThrowError("Object target is required.");
}
if (info.Length() == 3 || !info[3]->IsNumber()) {
return Nan::ThrowError("Number force is required.");
}
if (info.Length() == 4 || !info[4]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
CreateLightweightBaton* baton = new CreateLightweightBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
baton->oid = (git_oid *)malloc(sizeof(git_oid ));
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const char * from_tag_name;
String::Utf8Value tag_name(info[1]->ToString());
from_tag_name = (const char *) strdup(*tag_name);
// end convert_from_v8 block
baton->tag_name = from_tag_name;
// start convert_from_v8 block
const git_object * from_target;
from_target = Nan::ObjectWrap::Unwrap<GitObject>(info[2]->ToObject())->GetValue();
// end convert_from_v8 block
baton->target = from_target;
// start convert_from_v8 block
int from_force;
from_force = (int) info[3]->ToNumber()->Value();
// end convert_from_v8 block
baton->force = from_force;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[4]));
CreateLightweightWorker *worker = new CreateLightweightWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("tag_name", info[1]->ToObject());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("target", info[2]->ToObject());
if (!info[3]->IsUndefined() && !info[3]->IsNull())
worker->SaveToPersistent("force", info[3]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::CreateLightweightWorker::Execute() {
int result = git_tag_create_lightweight(
baton->oid,baton->repo,baton->tag_name,baton->target,baton->force );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::CreateLightweightWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
if (baton->oid != NULL) {
// GitOid baton->oid
to = GitOid::New((void *)baton->oid, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("tag_name"));
workerArguments.push(GetFromPersistent("target"));
workerArguments.push(GetFromPersistent("force"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method createLightweight has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
free((void *)baton->tag_name);
delete baton;
}
/*
* @param Repository repo
* @param String tag_name
*/
NAN_METHOD(GitTag::Delete) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1 || !info[1]->IsString()) {
return Nan::ThrowError("String tag_name is required.");
}
if (info.Length() == 2 || !info[2]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
DeleteBaton* baton = new DeleteBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const char * from_tag_name;
String::Utf8Value tag_name(info[1]->ToString());
from_tag_name = (const char *) strdup(*tag_name);
// end convert_from_v8 block
baton->tag_name = from_tag_name;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[2]));
DeleteWorker *worker = new DeleteWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("tag_name", info[1]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::DeleteWorker::Execute() {
int result = git_tag_delete(
baton->repo,baton->tag_name );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::DeleteWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> result = Nan::Undefined();
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("tag_name"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method delete has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
free((void *)baton->tag_name);
delete baton;
}
/*
*/
NAN_METHOD(GitTag::Free) {
Nan::EscapableHandleScope scope;
if (Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue() != NULL) {
git_tag_free(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->ClearValue();
}
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
/*
* @return Oid result */
NAN_METHOD(GitTag::Id) {
Nan::EscapableHandleScope scope;
const git_oid * result = git_tag_id(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result != NULL) {
// GitOid result
to = GitOid::New((void *)result, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @param Repository repo
* @param Array callback
*/
NAN_METHOD(GitTag::List) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1 || !info[1]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
ListBaton* baton = new ListBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
baton->tag_names = (git_strarray *)malloc(sizeof(git_strarray ));
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[1]));
ListWorker *worker = new ListWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::ListWorker::Execute() {
int result = git_tag_list(
baton->tag_names,baton->repo );
}
void GitTag::ListWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
Local<Array> tmpArray = Nan::New<Array>(baton->tag_names->count);
for (unsigned int i = 0; i < baton->tag_names->count; i++) {
Nan::Set(tmpArray, Nan::New<Number>(i), Nan::New<String>(baton->tag_names->strings[i]).ToLocalChecked());
}
to = tmpArray;
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method list has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
free((void*)baton->tag_names);
}
free((void *)baton->tag_names);
delete baton;
}
/*
* @param Strarray tag_names
* @param String pattern
* @param Repository repo
* @return Number result */
NAN_METHOD(GitTag::ListMatch) {
Nan::EscapableHandleScope scope;
if (info.Length() == 0 || !(Nan::To<bool>(info[0]).FromJust())) {
return Nan::ThrowError("Array, String Object, or string tag_names is required.");
}
if (info.Length() == 1 || !info[1]->IsString()) {
return Nan::ThrowError("String pattern is required.");
}
if (info.Length() == 2 || !info[2]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
// start convert_from_v8 block
git_strarray * from_tag_names;
from_tag_names = StrArrayConverter::Convert(info[0]);
// end convert_from_v8 block
// start convert_from_v8 block
const char * from_pattern;
String::Utf8Value pattern(info[1]->ToString());
from_pattern = (const char *) strdup(*pattern);
// end convert_from_v8 block
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[2]->ToObject())->GetValue();
// end convert_from_v8 block
int result = git_tag_list_match(
from_tag_names
,from_pattern
,from_repo
);
Local<v8::Value> to;
// start convert_to_v8 block
to = Nan::New<Number>( result);
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @param Repository repo
* @param Oid id
* @param Tag callback
*/
NAN_METHOD(GitTag::Lookup) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1
|| (!info[1]->IsObject() && !info[1]->IsString())) {
return Nan::ThrowError("Oid id is required.");
}
if (info.Length() == 2 || !info[2]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
LookupBaton* baton = new LookupBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const git_oid * from_id;
if (info[1]->IsString()) {
// Try and parse in a string to a git_oid
String::Utf8Value oidString(info[1]->ToString());
git_oid *oidOut = (git_oid *)malloc(sizeof(git_oid));
if (git_oid_fromstr(oidOut, (const char *) strdup(*oidString)) != GIT_OK) {
free(oidOut);
if (giterr_last()) {
return Nan::ThrowError(giterr_last()->message);
} else {
return Nan::ThrowError("Unknown Error");
}
}
from_id = oidOut;
}
else {
from_id = Nan::ObjectWrap::Unwrap<GitOid>(info[1]->ToObject())->GetValue();
}
// end convert_from_v8 block
baton->id = from_id;
baton->idNeedsFree = info[1]->IsString();
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[2]));
LookupWorker *worker = new LookupWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("id", info[1]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::LookupWorker::Execute() {
int result = git_tag_lookup(
&baton->out,baton->repo,baton->id );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::LookupWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
if (baton->out != NULL) {
// GitTag baton->out
to = GitTag::New((void *)baton->out, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("id"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method lookup has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
if (baton->idNeedsFree) {
baton->idNeedsFree = false;
free((void *)baton->id);
}
delete baton;
}
/*
* @param Repository repo
* @param Oid id
* @param Number len
* @param Tag callback
*/
NAN_METHOD(GitTag::LookupPrefix) {
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Repository repo is required.");
}
if (info.Length() == 1
|| (!info[1]->IsObject() && !info[1]->IsString())) {
return Nan::ThrowError("Oid id is required.");
}
if (info.Length() == 2 || !info[2]->IsNumber()) {
return Nan::ThrowError("Number len is required.");
}
if (info.Length() == 3 || !info[3]->IsFunction()) {
return Nan::ThrowError("Callback is required and must be a Function.");
}
LookupPrefixBaton* baton = new LookupPrefixBaton;
baton->error_code = GIT_OK;
baton->error = NULL;
// start convert_from_v8 block
git_repository * from_repo;
from_repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
const git_oid * from_id;
if (info[1]->IsString()) {
// Try and parse in a string to a git_oid
String::Utf8Value oidString(info[1]->ToString());
git_oid *oidOut = (git_oid *)malloc(sizeof(git_oid));
if (git_oid_fromstr(oidOut, (const char *) strdup(*oidString)) != GIT_OK) {
free(oidOut);
if (giterr_last()) {
return Nan::ThrowError(giterr_last()->message);
} else {
return Nan::ThrowError("Unknown Error");
}
}
from_id = oidOut;
}
else {
from_id = Nan::ObjectWrap::Unwrap<GitOid>(info[1]->ToObject())->GetValue();
}
// end convert_from_v8 block
baton->id = from_id;
baton->idNeedsFree = info[1]->IsString();
// start convert_from_v8 block
size_t from_len;
from_len = (size_t) info[2]->ToNumber()->Value();
// end convert_from_v8 block
baton->len = from_len;
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[3]));
LookupPrefixWorker *worker = new LookupPrefixWorker(baton, callback);
if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("id", info[1]->ToObject());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("len", info[2]->ToObject());
Nan::AsyncQueueWorker(worker);
return;
}
void GitTag::LookupPrefixWorker::Execute() {
int result = git_tag_lookup_prefix(
&baton->out,baton->repo,baton->id,baton->len );
baton->error_code = result;
if (result != GIT_OK && giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}
}
void GitTag::LookupPrefixWorker::HandleOKCallback() {
if (baton->error_code == GIT_OK) {
Local<v8::Value> to;
// start convert_to_v8 block
if (baton->out != NULL) {
// GitTag baton->out
to = GitTag::New((void *)baton->out, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
Local<v8::Value> result = to;
Local<v8::Value> argv[2] = {
Nan::Null(),
result
};
callback->Call(2, argv);
} else {
if (baton->error) {
Local<v8::Value> argv[1] = {
Nan::Error(baton->error->message)
};
callback->Call(1, argv);
if (baton->error->message)
free((void *)baton->error->message);
free((void *)baton->error);
} else if (baton->error_code < 0) {
std::queue< Local<v8::Value> > workerArguments;
workerArguments.push(GetFromPersistent("repo"));
workerArguments.push(GetFromPersistent("id"));
workerArguments.push(GetFromPersistent("len"));
bool callbackFired = false;
while(!workerArguments.empty()) {
Local<v8::Value> node = workerArguments.front();
workerArguments.pop();
if (
!node->IsObject()
|| node->IsArray()
|| node->IsBooleanObject()
|| node->IsDate()
|| node->IsFunction()
|| node->IsNumberObject()
|| node->IsRegExp()
|| node->IsStringObject()
) {
continue;
}
Local<v8::Object> nodeObj = node->ToObject();
Local<v8::Value> checkValue = nodeObj->GetHiddenValue(Nan::New("NodeGitPromiseError").ToLocalChecked());
if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) {
Local<v8::Value> argv[1] = {
checkValue->ToObject()
};
callback->Call(1, argv);
callbackFired = true;
break;
}
Local<v8::Array> properties = nodeObj->GetPropertyNames();
for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) {
Local<v8::String> propName = properties->Get(propIndex)->ToString();
Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
}
}
if (!callbackFired) {
Local<v8::Object> err = Nan::Error("Method lookupPrefix has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Local<v8::Value> argv[1] = {
err
};
callback->Call(1, argv);
}
} else {
callback->Call(0, NULL);
}
}
if (baton->idNeedsFree) {
baton->idNeedsFree = false;
free((void *)baton->id);
}
delete baton;
}
/*
* @return String result */
NAN_METHOD(GitTag::Message) {
Nan::EscapableHandleScope scope;
const char * result = git_tag_message(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result){
to = Nan::New<String>(result).ToLocalChecked();
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return String result */
NAN_METHOD(GitTag::Name) {
Nan::EscapableHandleScope scope;
const char * result = git_tag_name(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result){
to = Nan::New<String>(result).ToLocalChecked();
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return Repository result */
NAN_METHOD(GitTag::Owner) {
Nan::EscapableHandleScope scope;
git_repository * result = git_tag_owner(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result != NULL) {
// GitRepository result
to = GitRepository::New((void *)result, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @param Object tag_target_out
* @return Number result */
NAN_METHOD(GitTag::Peel) {
Nan::EscapableHandleScope scope;
if (info.Length() == 0 || !info[0]->IsObject()) {
return Nan::ThrowError("Object tag_target_out is required.");
}
// start convert_from_v8 block
git_object ** from_tag_target_out;
from_tag_target_out = Nan::ObjectWrap::Unwrap<GitObject>(info[0]->ToObject())->GetRefValue();
// end convert_from_v8 block
int result = git_tag_peel(
from_tag_target_out
,Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
Local<v8::Value> to;
// start convert_to_v8 block
to = Nan::New<Number>( result);
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return Signature result */
NAN_METHOD(GitTag::Tagger) {
Nan::EscapableHandleScope scope;
const git_signature * result = git_tag_tagger(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result != NULL) {
// GitSignature result
to = GitSignature::New((void *)result, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return Object target_out */
NAN_METHOD(GitTag::Target) {
Nan::EscapableHandleScope scope;
git_object * target_out = 0;
int result = git_tag_target(
&target_out
,Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
Local<v8::Value> to;
// start convert_to_v8 block
if (target_out != NULL) {
// GitObject target_out
to = GitObject::New((void *)target_out, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return Oid result */
NAN_METHOD(GitTag::TargetId) {
Nan::EscapableHandleScope scope;
const git_oid * result = git_tag_target_id(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
// null checks on pointers
if (!result) {
return info.GetReturnValue().Set(scope.Escape(Nan::Undefined()));
}
Local<v8::Value> to;
// start convert_to_v8 block
if (result != NULL) {
// GitOid result
to = GitOid::New((void *)result, false);
}
else {
to = Nan::Null();
}
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
/*
* @return Number result */
NAN_METHOD(GitTag::TargetType) {
Nan::EscapableHandleScope scope;
git_otype result = git_tag_target_type(
Nan::ObjectWrap::Unwrap<GitTag>(info.This())->GetValue()
);
Local<v8::Value> to;
// start convert_to_v8 block
to = Nan::New<Number>( result);
// end convert_to_v8 block
return info.GetReturnValue().Set(scope.Escape(to));
}
Nan::Persistent<Function> GitTag::constructor_template;
| [
"maarten.vanwingerden@hotmail.com"
] | maarten.vanwingerden@hotmail.com |
e15e145204331f13e2502b41b93bcabdd97745ed | 08e953330f88590b0a1ffc0a04b286c449669b55 | /src/QtHuman/Human/nFaceShapes.cpp | d4c304d3bf517198011b4ea9e8ca9d9cf15ebe84 | [
"MIT"
] | permissive | Vladimir-Lin/QtHuman | 1edd2ccb0fc2b236cb85c82b3cebf480b8a83f00 | 37e81cc3940748c2f30bdd3a6f54c3c1b0798b00 | refs/heads/main | 2023-05-27T14:10:10.060446 | 2021-06-16T09:26:10 | 2021-06-16T09:26:10 | 377,440,565 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 26,647 | cpp | #include <qthuman.h>
N::FaceShapes:: FaceShapes ( QWidget * parent , Plan * p )
: ListDock ( parent , p )
, PeopleManager ( p )
, CommandSequence ( new QTimer ( this ) )
, Commanding ( false )
, dropAction ( false )
{
WidgetClass ;
Configure ( ) ;
}
N::FaceShapes::~FaceShapes(void)
{
}
QSize N::FaceShapes::sizeHint(void) const
{
return QSize ( 172 , 192 ) ;
}
void N::FaceShapes::Configure(void)
{
setWindowTitle ( tr("Face shapes") ) ;
setViewMode ( IconMode ) ;
setIconSize ( QSize(128,128) ) ;
setGridSize ( QSize(144,192) ) ;
setMovement ( Snap ) ;
setResizeMode ( Adjust ) ;
setSelectionMode ( SingleSelection ) ;
setWordWrap ( true ) ;
setMouseTracking ( true ) ;
setWrapping ( true ) ;
setTextElideMode ( Qt::ElideNone ) ;
setHorizontalScrollBarPolicy ( Qt::ScrollBarAsNeeded ) ;
setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded ) ;
setMinimumSize ( QSize(172,144) ) ;
setDragDropMode ( DragDrop ) ;
setDropFlag ( DropPicture , true ) ;
setDropFlag ( DropPeople , true ) ;
plan -> setFont ( this ) ;
////////////////////////////////////////////////////////////////////
LimitValues [ 49 ] = 1 ;
LimitValues [ 60 ] = 10 ;
LimitValues [ 61 ] = 10 ;
LimitValues [ 37714 ] = 300 ;
////////////////////////////////////////////////////////////////////
if (plan->Booleans["Phone"]) setViewMode ( QListView::ListMode ) ;
CommandSequence -> setParent ( this ) ;
nConnect ( this , SIGNAL ( TriggerCommand ( ) ) ,
this , SLOT ( StartCommand ( ) ) ) ;
nConnect ( CommandSequence , SIGNAL ( timeout ( ) ) ,
this , SLOT ( CommandHandler ( ) ) ) ;
nConnect ( this , SIGNAL (setIcon (QImage*,QListWidgetItem*)) ,
this , SLOT (setItemIcon(QImage*,QListWidgetItem*)) ) ;
nConnect ( this , SIGNAL (listItems (ListWidgetItems&)) ,
this , SLOT (appendItems(ListWidgetItems&)) ) ;
}
bool N::FaceShapes::FocusIn(void)
{
AssignAction ( Label , windowTitle ( ) ) ;
LinkAction ( Refresh , startup ( ) ) ;
LinkAction ( Insert , New ( ) ) ;
LinkAction ( Copy , Copy ( ) ) ;
return true ;
}
QMimeData * N::FaceShapes::dragMime(void)
{
QListWidgetItem * IT = currentItem() ;
if (IsNull(IT)) return NULL ;
SUID uuid = nListUuid(IT) ;
QMimeData * mime = new QMimeData() ;
setMime ( mime , "faceshape/uuid" , uuid ) ;
if (NotNull(IT)) {
QIcon icon = IT->icon() ;
if (!icon.isNull()) {
QSize s = iconSize() ;
QImage image = icon . pixmap(s) . toImage() ;
if (!image.isNull()) {
mime -> setImageData(image) ;
} ;
} ;
mime -> setText ( IT->text() ) ;
} ;
return mime ;
}
bool N::FaceShapes::hasItem(void)
{
QListWidgetItem * item = currentItem() ;
return NotNull ( item ) ;
}
bool N::FaceShapes::startDrag(QMouseEvent * event)
{
QListWidgetItem * atItem = itemAt(event->pos()) ;
if (IsNull(atItem)) return false ;
if (!IsMask(event->buttons(),Qt::LeftButton)) return false ;
dragPoint = event->pos() ;
if (!atItem->isSelected()) return false ;
if (!PassDragDrop) return true ;
return false ;
}
bool N::FaceShapes::fetchDrag(QMouseEvent * event)
{
if (!IsMask(event->buttons(),Qt::LeftButton)) return false ;
QPoint pos = event->pos() ;
pos -= dragPoint ;
return ( pos.manhattanLength() > qApp->startDragDistance() ) ;
}
void N::FaceShapes::dragDone(Qt::DropAction dropIt,QMimeData * mime)
{
}
bool N::FaceShapes::finishDrag(QMouseEvent * event)
{
return true ;
}
bool N::FaceShapes::acceptDrop(QWidget * source,const QMimeData * mime)
{
return dropHandler ( mime ) ;
}
QString N::FaceShapes::MimeType(const QMimeData * mime)
{
return AbstractGui::MimeType (
mime ,
"picture/uuid;picture/uuids;"
"people/uuid;people/uuids"
) ;
}
UUIDs N::FaceShapes::MimeUuids(const QMimeData * mime,QString mimetype)
{
UUIDs Uuids ;
QByteArray data = mime->data(mimetype) ;
if (data.size()<=0) return Uuids ;
if (mimetype=="picture/uuid") {
Uuids << GetUuid(data) ;
} else
if (mimetype=="picture/uuids") {
Uuids = GetUuids ( data ) ;
} else
if (mimetype=="people/uuid") {
Uuids << GetUuid(data) ;
} else
if (mimetype=="people/uuids") {
Uuids = GetUuids ( data ) ;
} ;
return Uuids ;
}
bool N::FaceShapes::dropNew(QWidget * source,const QMimeData * mime,QPoint pos)
{
QString mtype ;
UUIDs Uuids ;
if (source==this) return false ;
mtype = MimeType (mime ) ;
Uuids = MimeUuids (mime,mtype) ;
if (mtype=="picture/uuid" ||
mtype=="picture/uuids" )
plan->showMessage (
tr("Assign %1 icon from %2" )
.arg(Uuids.count() )
.arg(source->windowTitle()) ) ;
if (mtype=="people/uuid" ||
mtype=="people/uuids" )
plan->showMessage (
tr("Copy %1 people from %2" )
.arg(Uuids.count() )
.arg(source->windowTitle()) ) ;
return true ;
}
bool N::FaceShapes::dropMoving(QWidget * source,const QMimeData * mime,QPoint pos)
{
if (dropAction) return false ;
if (source==this) {
QListWidgetItem * atItem = itemAt(pos) ;
if (IsNull (atItem)) return false ;
if (NotNull(atItem) && atItem->isSelected()) return false ;
} ;
return true ;
}
bool N::FaceShapes::dropAppend(QWidget * source,const QMimeData * mime,QPoint pos)
{
if (dropAction) return false ;
return dropItems ( source , mime , pos ) ;
}
void N::FaceShapes::run(int Type,ThreadData * data)
{ Q_UNUSED ( data ) ;
switch ( Type ) {
case 10001 :
FetchUUIDs ( ) ;
break ;
case 10003 :
FetchIcons ( ) ;
break ;
} ;
}
void N::FaceShapes::StartCommand(void)
{
nDropOut ( Commanding ) ;
CommandSequence -> start ( LimitValues [ 37714 ] ) ;
}
void N::FaceShapes::CommandHandler(void)
{
nDropOut ( Commanding ) ;
Commanding = true ;
while ( Sequences.count() > 0 ) {
RunCommand ( Sequences[0] ) ;
Sequences . takeAt ( 0 ) ;
} ;
CommandSequence -> stop ( ) ;
Commanding = false ;
}
bool N::FaceShapes::RunCommand(VarArgs & arguments)
{
if (arguments.count()<1) return false ;
VarArgs V = arguments ;
UUIDs U ;
int c = V [ 0 ] . toInt ( ) ;
switch ( c ) {
case 10001 :
start ( 10001 ) ;
break ;
case 10002 :
ArgsToUuids ( 1 , V , U ) ;
plan -> processEvents ( ) ;
ListIcons ( U ) ;
break ;
default :
return false ;
} ;
return true ;
}
bool N::FaceShapes::startup(void)
{
clear ( ) ;
start ( 10001 ) ;
return true ;
}
void N::FaceShapes::setItemIcon (
QImage * image ,
QListWidgetItem * item )
{
QSize IS = iconSize ( ) ;
PictureManager PM ( plan ) ;
QIcon icon = PM . Icon (image,IS) ;
item -> setIcon ( icon ) ;
delete image ;
}
void N::FaceShapes::FetchUUIDs(void)
{
UUIDs Uuids ;
EnterSQL ( SC , plan->sql ) ;
Uuids = SC . Uuids (
PlanTable(FaceShapes) ,
"uuid" ,
SC.OrderByAsc("id") ) ;
LeaveSQL ( SC , plan->sql ) ;
if (Uuids.count()>0) {
N::VarArgs V ;
V << 10002 ;
V << Uuids . count ( ) ;
toVariants ( Uuids , V ) ;
addSequence ( V ) ;
//////////////////////////////////
emit TriggerCommand ( ) ;
} ;
}
void N::FaceShapes::ListIcons(UUIDs & Uuids)
{
QIcon icon = plan -> Icon (
Types :: FaceShape ,
1 ,
0 ,
QIcon(":/images/faces.png") ) ;
SUID uuid ;
foreach (uuid,Uuids) {
NewListWidgetItem ( TWI ) ;
TWI -> setText ( " " ) ;
TWI -> setIcon ( icon ) ;
TWI -> setData ( Qt::UserRole , uuid ) ;
QListWidget::addItem ( TWI ) ;
} ;
start ( 10003 ) ;
}
void N::FaceShapes::FetchIcons(void)
{
GroupItems GI ( plan ) ;
PictureManager PM ( plan ) ;
GI . AutoMap = true ;
GI . GroupTable = GI . LookTable (
Types :: FaceShape ,
Types :: Picture ,
Groups :: Icon ) ;
EnterSQL ( SC , plan->sql ) ;
QListWidgetItem * it ;
QString name ;
SUID uuid ;
SUID puid ;
for (int i=0;i<count();i++) {
it = item ( i ) ;
uuid = nListUuid ( it ) ;
name = Name(SC,uuid,vLanguageId) ;
it -> setText ( name ) ;
it -> setToolTip ( name ) ;
puid = GI.FindSecond (
SC ,
uuid ,
Types :: FaceShape ,
Types :: Picture ,
Groups :: Icon ,
"order by position asc limit 0,1" ) ;
QImage * image = PM.Thumb (SC,puid) ;
if (NotNull(image)) {
emit setIcon ( image , it ) ;
} ;
} ;
LeaveSQL ( SC , plan->sql ) ;
Alert ( Done ) ;
}
void N::FaceShapes::List(void)
{
ListWidgetItems Items ;
GroupItems GI ( plan ) ;
PictureManager PM ( plan ) ;
EnterSQL ( SC , plan->sql ) ;
QString name ;
SUID uuid ;
UUIDs Uuids = SC.Uuids (
PlanTable(FaceShapes) ,
"uuid" ,
SC.OrderByAsc("id") ) ;
foreach (uuid,Uuids) {
NewListWidgetItem ( TWI ) ;
// QIcon icon ;
name = Name(SC,uuid,vLanguageId) ;
TWI -> setText ( name ) ;
TWI -> setToolTip ( name ) ;
TWI -> setData ( Qt::UserRole , uuid ) ;
SUID puid = GI.FindSecond (
SC ,
uuid ,
Types :: FaceShape ,
Types :: Picture ,
Groups :: Icon ,
"order by position asc limit 0,1" ) ;
QImage * image = PM.Thumb (SC,puid) ;
if (NotNull(image)) {
emit setIcon ( image , TWI ) ;
// } else {
// icon = plan->Icon(Types::FaceShape,1,0,QIcon(":/images/faces.png")) ;
} ;
Items << TWI ;
} ;
LeaveSQL ( SC , plan->sql ) ;
emit listItems ( Items ) ;
Alert ( Done ) ;
}
void N::FaceShapes::Copy(void)
{
QMimeData * mime = dragMime ( ) ;
if (IsNull(mime)) return ;
qApp->clipboard()->setMimeData ( mime ) ;
}
bool N::FaceShapes::Menu(QPoint pos)
{
nScopedMenu ( mm , this ) ;
QMdiSubWindow * mdi = Casting(QMdiSubWindow,parent()) ;
QDockWidget * dock = Casting(QDockWidget ,parent()) ;
QListWidgetItem * item = itemAt(pos) ;
QPoint global = mapToGlobal(pos) ;
QAction * a ;
mm.add(202,tr("Refresh" )) ;
mm.add(201,tr("New face shape")) ;
if (NotNull(item)) {
mm . addSeparator ( ) ;
mm.add(101,tr("People" )) ;
mm.add(102,tr("Gallery")) ;
mm.add(103,tr("Shape equation")) ;
} ;
mm . addSeparator ( ) ;
if (!plan->Booleans["Phone"]) {
if (viewMode()==QListView::IconMode) mm.add(301,tr("List view")) ;
if (viewMode()==QListView::ListMode) mm.add(302,tr("Icon view")) ;
} ;
mm . add ( 401 , tr("Translations") ) ;
mm . addSeparator ( ) ;
nIfSafe(dock) mm.add(1000001,tr("Move to window area")) ;
nIfSafe(mdi ) mm.add(1000002,tr("Move to dock area" )) ;
mm . setFont ( plan ) ;
a = mm.exec(global) ;
if (IsNull(a)) return true ;
switch (mm[a]) {
case 101 :
emit People ( nListUuid(item),Types::FaceShape,item->text() ) ;
break ;
case 102 :
emit Gallery ( item->text(),nListUuid(item),Types::FaceShape ) ;
break ;
case 103 :
emit ShapeEquation(nListUuid(item),Types::FaceShape,item->text()) ;
break ;
case 201 :
New ( ) ;
break ;
case 202 :
startup ( ) ;
break ;
case 301 :
setViewMode ( QListView::ListMode ) ;
break ;
case 302 :
setViewMode ( QListView::IconMode ) ;
break ;
case 401 :
if (count()>0) {
UUIDs u = ItemUuids() ;
emit Translations ( windowTitle() , u ) ;
} ;
break ;
case 1000001 :
emit attachMdi (this,Qt::Vertical) ;
break ;
case 1000002 :
emit attachDock (
this ,
windowTitle() ,
Qt::RightDockWidgetArea ,
Qt::TopDockWidgetArea |
Qt::BottomDockWidgetArea |
Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea ) ;
break ;
default :
break ;
} ;
return true ;
}
bool N::FaceShapes::dropPictures(QWidget * source,QPointF psf,const UUIDs & Uuids)
{
if (source==this) return true ;
QPoint pos = psf.toPoint() ;
QListWidgetItem * atItem = itemAt(pos) ;
if (IsNull(atItem)) return true ;
if (Uuids.count()<=0) return true ;
SUID face = nListUuid(atItem) ;
dropAction = true ;
GroupItems GI(plan) ;
EnterSQL(SC,plan->sql) ;
UUIDs u = Uuids ;
GI . Join (
SC ,
face ,
Types::FaceShape ,
Types::Picture ,
Groups::Subordination ,
0 ,
u ) ;
LeaveSQL(SC,plan->sql) ;
Alert ( Done ) ;
dropAction = false ;
startup() ;
return true ;
}
bool N::FaceShapes::dropPeople(QWidget * source,QPointF psf,const UUIDs & Uuids)
{
QPoint pos = psf.toPoint() ;
QListWidgetItem * atItem = itemAt(pos) ;
if (source==this) return true ;
if (IsNull(atItem)) return true ;
dropAction = true ;
SUID auid = nListUuid(atItem) ;
UUIDs AUIDs = Uuids ;
GroupItems GI(plan) ;
EnterSQL(SC,plan->sql) ;
GI.Join (
SC , auid ,
Types::FaceShape ,
Types::People ,
Groups::Subordination ,
0 , AUIDs ) ;
LeaveSQL(SC,plan->sql) ;
Alert ( Done ) ;
dropAction = false ;
return true ;
}
void N::FaceShapes::New(void)
{
NewListWidgetItem ( LWI ) ;
QIcon icon ;
icon = plan->Icon(Types::FaceShape,1,0,QIcon(":/images/faces.png")) ;
LWI->setIcon ( icon ) ;
LWI->setData ( Qt::UserRole , 0 ) ;
QListWidget :: addItem ( LWI ) ;
scrollToItem ( LWI ) ;
setCurrentItem ( LWI ) ;
ItemEditing = LWI ;
QRect R = visualItemRect(LWI) ;
QLineEdit * l = new QLineEdit(this) ;
QFont f = font() ;
QRect L ;
L . setTop ( R.bottom () ) ;
L . setLeft ( R.left () ) ;
L . setWidth ( R.width () ) ;
L . setHeight ( f.pixelSize () + 2 ) ;
setItemWidget ( ItemEditing , l ) ;
l -> setGeometry ( L ) ;
l -> setFont ( f ) ;
ItemWidget = l ;
connect(l ,SIGNAL(editingFinished()) ,
this,SLOT (editingFinished()) ) ;
l->setFocus(Qt::TabFocusReason) ;
}
void N::FaceShapes::editingFinished(void)
{
QLineEdit * l = Casting(QLineEdit,ItemWidget) ;
if (IsNull(l)) return ;
////////////////////////////////////////////////////////////
QString name = l->text() ;
removeItemWidget(ItemEditing) ;
if (name.length()<=0) {
takeItem(row(ItemEditing)) ;
ItemEditing = NULL ;
ItemWidget = NULL ;
return ;
} ;
ItemEditing->setText(name) ;
////////////////////////////////////////////////////////////
Bustle ( ) ;
SqlConnection SC(plan->sql) ;
if (SC.open("FaceShapes","editingFinished")) {
SUID u = 0 ;
u = SC.Unique ( PlanTable(MajorUuid),"uuid",3576 ) ;
if (u>0) {
SC.assureUuid(PlanTable(MajorUuid),u,Types::FaceShape) ;
SC.insertUuid(PlanTable(FaceShapes),u,"uuid") ;
SC.assureName(PlanTable(Names),u,vLanguageId,name) ;
} ;
SC . close ( ) ;
if (u>0) ItemEditing->setData ( Qt::UserRole,u ) ;
} else {
takeItem(row(ItemEditing)) ;
} ;
SC . remove ( ) ;
Vacancy ( ) ;
////////////////////////////////////////////////////////////
ItemEditing = NULL ;
ItemWidget = NULL ;
Alert ( Done ) ;
}
| [
"lin.vladimir@gmail.com"
] | lin.vladimir@gmail.com |
fac6f25ea63d73a4cbdfeebacb5c227fad16d64d | cafcf6a79e61ae811c461e9b57016bb5c77eda24 | /datacenter/RedisAgent.h | d266643423e1219522e2bf2fc56fbfb6c04f22b5 | [
"MIT"
] | permissive | jj4jj/playground | fa3f3a0da0e4f112b0e407a1cce8faf002151b4f | be0ab129d28359199008af8282e7395186a211a5 | refs/heads/master | 2021-01-22T04:40:44.470282 | 2014-11-05T16:53:01 | 2014-11-05T16:53:01 | 23,486,561 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,479 | h | #pragma once
#include "base/stdinc.h"
#include "base/Buffer.h"
#include "base/Singleton.hpp"
struct redisAsyncContext;
struct redisReply;
struct RedisAddr
{
string ip;
int port;
uint dbidx;
};
struct RedisClientContext
{
RedisAddr addr;
redisAsyncContext* ctx;
int db_selected;
///////////////////////////
RedisClientContext()
{
ctx = NULL;
db_selected = false;
}
};
class RedisCommandListener
{
public:
virtual int OnCommand(redisReply *reply,Buffer & cb,bool timeout = false) = 0;
};
typedef shared_ptr<RedisCommandListener> RedisCommandListenerPtr;
//////////////////////////////////////////////////////////////////////////////////
struct RedisAgentCallBack
{
Buffer cb;
uint32_t time;
};
class RedisAgent : public Singleton<RedisAgent>
{
private:
RedisAgent();
~RedisAgent();
DeclareSingltonSupport(RedisAgent)
public:
static void CommandCallback(redisAsyncContext *c, void *r, void *privdata);
static void ConnectCallback(const redisAsyncContext *c, int status);
static void DisConnectCallback(const redisAsyncContext *c, int status);
public:
RedisAgentCallBack * FindCallBack(uint32_t cbid);
void OnCommand(redisAsyncContext *c,redisReply *reply,uint32_t cbid);
bool AllContextReady();
int Init(const vector<RedisAddr> & addrList,RedisCommandListenerPtr lisener_);
void Stop();
int Polling(int chkPerTick);
public:
int Get(string & key,const Buffer & cb);
int Update(string & key,const Buffer & obj,const Buffer & cb);
int Remove(string & key,const Buffer & cb);
int Command(const Buffer & cb,const char * pszFormat,...);
protected:
RedisClientContext* FindContext(const redisAsyncContext *c);
void CheckTimeOut(int iChkNum = 10);
void OnSelectDB(redisAsyncContext *c,redisReply *reply,Buffer & cb);
void SelectDB(int dbidx);
private:
RedisCommandListenerPtr m_listener;
uint32_t m_dwCallBackSeq;
unordered_map<uint32_t,RedisAgentCallBack> m_mpCallBackPool;
uint32_t m_chkTimeOut;
vector<RedisClientContext> redisCtxList;
int m_iConnected;
int m_closing;
};
| [
"resc@vip.qq.com"
] | resc@vip.qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.